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

Unified Diff: chrome/browser/sync/util/query_helpers.cc

Issue 340055: String cleanup in sync code (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/util/query_helpers.h ('k') | chrome/browser/sync/util/query_helpers_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/util/query_helpers.cc
===================================================================
--- chrome/browser/sync/util/query_helpers.cc (revision 30948)
+++ chrome/browser/sync/util/query_helpers.cc (working copy)
@@ -13,6 +13,7 @@
#include <vector>
#include "chrome/browser/sync/util/sync_types.h"
+#include "chrome/common/sqlite_utils.h"
using std::numeric_limits;
using std::string;
@@ -55,26 +56,21 @@
return SQLITE_OK == finalize_result ? result : finalize_result;
}
-int SqliteOpen(PathString filename, sqlite3** db) {
- int result =
-#if PATHSTRING_IS_STD_STRING
- sqlite3_open
-#else
- sqlite3_open16
-#endif
- (filename.c_str(), db);
- LOG_IF(ERROR, SQLITE_OK != result) << "Error opening " << filename << ": "
+int SqliteOpen(const FilePath& filename, sqlite3** db) {
+ int result = OpenSqliteDb(filename, db);
+ LOG_IF(ERROR, SQLITE_OK != result) << "Error opening "
+ << filename.value() << ": "
<< result;
#if defined(OS_WIN)
if (SQLITE_OK == result) {
// Make sure we mark the db file as not indexed so since if any other app
// opens it, it can break our db locking.
- DWORD attrs = GetFileAttributes(filename.c_str());
+ DWORD attrs = GetFileAttributesW(filename.value().c_str());
if (FILE_ATTRIBUTE_NORMAL == attrs)
attrs = FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
else
attrs = attrs | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
- SetFileAttributes(filename.c_str(), attrs);
+ SetFileAttributesW(filename.value().c_str(), attrs);
}
#endif // defined(OS_WIN)
// Be patient as we set pragmas.
@@ -87,27 +83,6 @@
return SQLITE_OK;
}
-#if !PATHSTRING_IS_STD_STRING
-sqlite3_stmt* BindArg(sqlite3_stmt* statement, const PathString& s, int index) {
- if (NULL == statement)
- return statement;
- CHECK(SQLITE_OK == sqlite3_bind_text16(statement, index, s.data(),
- CountBytes(s), SQLITE_TRANSIENT));
- return statement;
-}
-
-sqlite3_stmt* BindArg(sqlite3_stmt* statement, const PathChar* s, int index) {
- if (NULL == statement)
- return statement;
- CHECK(SQLITE_OK == sqlite3_bind_text16(statement,
- index,
- s,
- -1, // -1 means s is zero-terminated
- SQLITE_TRANSIENT));
- return statement;
-}
-#endif // !PATHSTRING_IS_STD_STRING
-
sqlite3_stmt* BindArg(sqlite3_stmt* statement, const string& s, int index) {
if (NULL == statement)
return statement;
@@ -179,17 +154,15 @@
return statement;
}
-#if !PATHSTRING_IS_STD_STRING
-void GetColumn(sqlite3_stmt* statement, int index, PathString* value) {
+void GetColumn(sqlite3_stmt* statement, int index, string16* value) {
if (sqlite3_column_type(statement, index) == SQLITE_NULL) {
value->clear();
} else {
value->assign(
- static_cast<const PathChar*>(sqlite3_column_text16(statement, index)),
- sqlite3_column_bytes16(statement, index) / sizeof(PathChar));
+ static_cast<const char16*>(sqlite3_column_text16(statement, index)),
+ sqlite3_column_bytes16(statement, index) / sizeof(char16));
}
}
-#endif // !PATHSTRING_IS_STD_STRING
void GetColumn(sqlite3_stmt* statement, int index, string* value) {
if (sqlite3_column_type(statement, index) == SQLITE_NULL) {
« no previous file with comments | « chrome/browser/sync/util/query_helpers.h ('k') | chrome/browser/sync/util/query_helpers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698