Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: chrome/utility/importer/edge_database_reader_win.cc

Issue 1899083002: Convert //chrome from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/utility/importer/edge_database_reader_win.h" 5 #include "chrome/utility/importer/edge_database_reader_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/ptr_util.h"
14
13 namespace { 15 namespace {
14 16
15 // This is an arbitary size chosen for the database error message buffer. 17 // This is an arbitary size chosen for the database error message buffer.
16 const size_t kErrorMessageSize = 1024; 18 const size_t kErrorMessageSize = 1024;
17 // This is the page size of the Edge data. It's unlikely to change. 19 // This is the page size of the Edge data. It's unlikely to change.
18 const JET_API_PTR kEdgeDatabasePageSize = 8192; 20 const JET_API_PTR kEdgeDatabasePageSize = 8192;
19 // This is the code page value for a Unicode (UCS-2) column. 21 // This is the code page value for a Unicode (UCS-2) column.
20 const unsigned short kJetUnicodeCodePage = 1200; 22 const unsigned short kJetUnicodeCodePage = 1200;
21 23
22 template <typename T> 24 template <typename T>
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 return false; 236 return false;
235 if (!SetLastError(JetAttachDatabase2(session_id_, database_file.c_str(), 0, 237 if (!SetLastError(JetAttachDatabase2(session_id_, database_file.c_str(), 0,
236 JET_bitDbReadOnly))) 238 JET_bitDbReadOnly)))
237 return false; 239 return false;
238 if (!SetLastError(JetOpenDatabase(session_id_, database_file.c_str(), nullptr, 240 if (!SetLastError(JetOpenDatabase(session_id_, database_file.c_str(), nullptr,
239 &db_id_, JET_bitDbReadOnly))) 241 &db_id_, JET_bitDbReadOnly)))
240 return false; 242 return false;
241 return true; 243 return true;
242 } 244 }
243 245
244 scoped_ptr<EdgeDatabaseTableEnumerator> EdgeDatabaseReader::OpenTableEnumerator( 246 std::unique_ptr<EdgeDatabaseTableEnumerator>
245 const base::string16& table_name) { 247 EdgeDatabaseReader::OpenTableEnumerator(const base::string16& table_name) {
246 JET_TABLEID table_id; 248 JET_TABLEID table_id;
247 249
248 if (!IsOpen()) { 250 if (!IsOpen()) {
249 SetLastError(JET_errDatabaseNotFound); 251 SetLastError(JET_errDatabaseNotFound);
250 return nullptr; 252 return nullptr;
251 } 253 }
252 254
253 if (!SetLastError(JetOpenTable(session_id_, db_id_, table_name.c_str(), 255 if (!SetLastError(JetOpenTable(session_id_, db_id_, table_name.c_str(),
254 nullptr, 0, JET_bitTableReadOnly, &table_id))) 256 nullptr, 0, JET_bitTableReadOnly, &table_id)))
255 return nullptr; 257 return nullptr;
256 258
257 return make_scoped_ptr( 259 return base::WrapUnique(
258 new EdgeDatabaseTableEnumerator(table_name, session_id_, table_id)); 260 new EdgeDatabaseTableEnumerator(table_name, session_id_, table_id));
259 } 261 }
OLDNEW
« no previous file with comments | « chrome/utility/importer/edge_database_reader_win.h ('k') | chrome/utility/importer/edge_importer_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698