diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 18:18:33 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-22 18:18:33 +0000 |
commit | 36d4ad5008ee38a8ab0ddad065e4ec46ffff5d0a (patch) | |
tree | bf59fd4fde5f3052ff09588a42bc734bd0b89090 /chrome/browser/sync/util | |
parent | c6e01dc7a346439ae64a00f9acd204025e17a218 (diff) | |
download | chromium_src-36d4ad5008ee38a8ab0ddad065e4ec46ffff5d0a.zip chromium_src-36d4ad5008ee38a8ab0ddad065e4ec46ffff5d0a.tar.gz chromium_src-36d4ad5008ee38a8ab0ddad065e4ec46ffff5d0a.tar.bz2 |
Fix compiling of sync on linux.
Review URL: http://codereview.chromium.org/211019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26835 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/util')
-rw-r--r-- | chrome/browser/sync/util/character_set_converters.h | 4 | ||||
-rw-r--r-- | chrome/browser/sync/util/character_set_converters_linux.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/util/compat_file_posix.cc | 3 | ||||
-rw-r--r-- | chrome/browser/sync/util/compat_pthread.h | 17 | ||||
-rw-r--r-- | chrome/browser/sync/util/event_sys-inl.h | 5 | ||||
-rw-r--r-- | chrome/browser/sync/util/path_helpers.h | 1 | ||||
-rw-r--r-- | chrome/browser/sync/util/path_helpers_linux.cc | 8 | ||||
-rw-r--r-- | chrome/browser/sync/util/path_helpers_posix.cc | 14 | ||||
-rw-r--r-- | chrome/browser/sync/util/pthread_helpers.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/util/pthread_helpers.h | 2 | ||||
-rw-r--r-- | chrome/browser/sync/util/query_helpers.h | 6 | ||||
-rw-r--r-- | chrome/browser/sync/util/sync_types.h | 4 | ||||
-rw-r--r-- | chrome/browser/sync/util/user_settings.cc | 4 | ||||
-rw-r--r-- | chrome/browser/sync/util/user_settings_posix.cc | 12 |
14 files changed, 25 insertions, 59 deletions
diff --git a/chrome/browser/sync/util/character_set_converters.h b/chrome/browser/sync/util/character_set_converters.h index 3e614c3..1db32c7 100644 --- a/chrome/browser/sync/util/character_set_converters.h +++ b/chrome/browser/sync/util/character_set_converters.h @@ -24,10 +24,6 @@ // CHECK(browser_sync::Append(utf8, &bob)); // PathString fred = bob; -#ifdef OS_LINUX -#include <glib.h> -#endif - #include <string> #include "base/basictypes.h" diff --git a/chrome/browser/sync/util/character_set_converters_linux.cc b/chrome/browser/sync/util/character_set_converters_linux.cc index 96ad1b6..3cbcca8 100644 --- a/chrome/browser/sync/util/character_set_converters_linux.cc +++ b/chrome/browser/sync/util/character_set_converters_linux.cc @@ -29,7 +29,7 @@ void TrimPathStringToValidCharacter(PathString* string) { return; if (0 == (string->at(string->length() - 1) & 0x080)) return; - int partial_enc_bytes = 0; + size_t partial_enc_bytes = 0; for (partial_enc_bytes = 0 ; true ; ++partial_enc_bytes) { if (4 == partial_enc_bytes || partial_enc_bytes == string->length()) { // original string was broken, garbage in, garbage out. diff --git a/chrome/browser/sync/util/compat_file_posix.cc b/chrome/browser/sync/util/compat_file_posix.cc index aecc2bb..62ba56f 100644 --- a/chrome/browser/sync/util/compat_file_posix.cc +++ b/chrome/browser/sync/util/compat_file_posix.cc @@ -2,11 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#if ((!defined(OS_LINUX)) && (!defined(OS_MACOSX))) +#if !defined(POSIX) #error Compile this file on Mac OS X or Linux only. #endif #include "chrome/browser/sync/util/compat_file.h" const char* const kPathSeparator = "/"; - diff --git a/chrome/browser/sync/util/compat_pthread.h b/chrome/browser/sync/util/compat_pthread.h index 3ea6a83..1bcc1f0 100644 --- a/chrome/browser/sync/util/compat_pthread.h +++ b/chrome/browser/sync/util/compat_pthread.h @@ -19,21 +19,4 @@ inline ThreadId GetCurrentThreadId() { } #endif // OS_WIN -#if (!defined(OS_WIN) && !defined(OS_MACOSX)) -// TODO(timsteele): What the heck is this? -inline int sem_post_multiple(sem_t* sem, int number) { - int i; - int r = 0; - for (i = 0; i < number; i++) { - r = sem_post(sem); - if (r != 0) { - LOG_IF(ERROR, i > 0) << "sem_post() failed on iteration #" << i << - " of " << number; - return r; - } - } - return 0; -} -#endif // (!defined(OS_WIN) && !defined(OS_MACOSX)) - #endif // CHROME_BROWSER_SYNC_UTIL_COMPAT_PTHREAD_H_ diff --git a/chrome/browser/sync/util/event_sys-inl.h b/chrome/browser/sync/util/event_sys-inl.h index 3b5c944..9e45506 100644 --- a/chrome/browser/sync/util/event_sys-inl.h +++ b/chrome/browser/sync/util/event_sys-inl.h @@ -105,8 +105,9 @@ class EventChannel { public: // The shutdown event gets send in the EventChannel's destructor. explicit EventChannel(const EventType& shutdown_event) - : callback_waiters_(NULL), shutdown_event_(shutdown_event), - current_listener_callback_(NULL) { + : current_listener_callback_(NULL), + callback_waiters_(NULL), + shutdown_event_(shutdown_event) { } ~EventChannel() { diff --git a/chrome/browser/sync/util/path_helpers.h b/chrome/browser/sync/util/path_helpers.h index e6976a8..b370fbd 100644 --- a/chrome/browser/sync/util/path_helpers.h +++ b/chrome/browser/sync/util/path_helpers.h @@ -72,7 +72,6 @@ PathString LastPathSegment(const PathString& path); std::string LastPathSegment(const std::string& path); PathString AppendSlash(const PathString& path); PathString GetFullPath(const PathString& path); -PathString LowercasePath(const PathString& path); PathString ExpandTilde(const PathString& path); inline bool HasSuffixPathString(const PathString& str, diff --git a/chrome/browser/sync/util/path_helpers_linux.cc b/chrome/browser/sync/util/path_helpers_linux.cc index 2448f09..851e868 100644 --- a/chrome/browser/sync/util/path_helpers_linux.cc +++ b/chrome/browser/sync/util/path_helpers_linux.cc @@ -4,7 +4,6 @@ #include <sys/types.h> -#include <glib.h> #include <string.h> #include "base/logging.h" @@ -42,10 +41,3 @@ PathString AppendSlash(const PathString& path) { } return path; } - -PathString LowercasePath(const PathString& path) { - gchar* ret = g_utf8_strdown(path.c_str(), -1); - PathString retstr(ret); - g_free(ret); - return retstr; -} diff --git a/chrome/browser/sync/util/path_helpers_posix.cc b/chrome/browser/sync/util/path_helpers_posix.cc index e8f7fd3..5c68177 100644 --- a/chrome/browser/sync/util/path_helpers_posix.cc +++ b/chrome/browser/sync/util/path_helpers_posix.cc @@ -5,6 +5,7 @@ #include <pwd.h> #include <string.h> +#include "chrome/browser/sync/notifier/base/string.h" #include "chrome/browser/sync/util/path_helpers.h" #if ((!defined(OS_LINUX)) && (!defined(OS_MACOSX))) @@ -25,15 +26,15 @@ PathString ExpandTilde(const PathString& path) { namespace { // TODO(sync): We really should use char[]. -string cache_dir_; + std::string cache_dir_; } -void set_cache_dir(string cache_dir) { +void set_cache_dir(std::string cache_dir) { CHECK(cache_dir_.empty()); cache_dir_ = cache_dir; } -string get_cache_dir() { +std::string get_cache_dir() { CHECK(!cache_dir_.empty()); return cache_dir_; } @@ -41,7 +42,7 @@ string get_cache_dir() { // On Posix, PathStrings are UTF-8, not UTF-16 as they are on Windows. Thus, // this function is different from the Windows version. PathString TruncatePathString(const PathString& original, int length) { - if (original.size() <= length) + if (original.size() <= static_cast<size_t>(length)) return original; if (length <= 0) return original; @@ -89,8 +90,7 @@ PathString TruncatePathString(const PathString& original, int length) { PathString MakePathComponentOSLegal(const PathString& component) { if (PathString::npos == component.find("/")) return PSTR(""); - PathString new_name; - new_name.reserve(component.size()); - StringReplace(component, "/", ":", true, &new_name); + PathString new_name(component); + notifier::StringReplace(&new_name, "/", ":", true); return new_name; } diff --git a/chrome/browser/sync/util/pthread_helpers.cc b/chrome/browser/sync/util/pthread_helpers.cc index 809f5f6..ff96409 100644 --- a/chrome/browser/sync/util/pthread_helpers.cc +++ b/chrome/browser/sync/util/pthread_helpers.cc @@ -133,7 +133,7 @@ struct timespec GetPThreadAbsoluteTime(uint32 ms) { #endif // OS_WIN } -void NameCurrentThreadForDebugging(char* name) { +void NameCurrentThreadForDebugging(const char* name) { #if defined(OS_WIN) // This implementation is taken from Chromium's platform_thread framework. // The information on how to set the thread name comes from a MSDN article: diff --git a/chrome/browser/sync/util/pthread_helpers.h b/chrome/browser/sync/util/pthread_helpers.h index c231f67..3886b7f 100644 --- a/chrome/browser/sync/util/pthread_helpers.h +++ b/chrome/browser/sync/util/pthread_helpers.h @@ -255,6 +255,6 @@ struct timespec GetPThreadAbsoluteTime(uint32 ms_from_now); // Assign a descriptive label to the current thread. This is useful to see // in a GUI debugger, but may not be implementable on all platforms. -void NameCurrentThreadForDebugging(char* name); +void NameCurrentThreadForDebugging(const char* name); #endif // CHROME_BROWSER_SYNC_UTIL_PTHREAD_HELPERS_H_ diff --git a/chrome/browser/sync/util/query_helpers.h b/chrome/browser/sync/util/query_helpers.h index 0aee3ad..54cda1f 100644 --- a/chrome/browser/sync/util/query_helpers.h +++ b/chrome/browser/sync/util/query_helpers.h @@ -17,12 +17,6 @@ #include "chrome/browser/sync/util/sync_types.h" #include "third_party/sqlite/preprocessed/sqlite3.h" -// Sometimes threads contend on the DB lock itself, especially when one thread -// is calling SaveChanges. In the worst case scenario, the user can put his -// laptop to sleep during db contention, and wake up the laptop days later, so -// infinity seems like the best choice here. -const int kDirectoryBackingStoreBusyTimeoutMs = std::numeric_limits<int>::max(); - enum SqliteNullType { SQLITE_NULL_VALUE }; diff --git a/chrome/browser/sync/util/sync_types.h b/chrome/browser/sync/util/sync_types.h index 02dad41..26469cc 100644 --- a/chrome/browser/sync/util/sync_types.h +++ b/chrome/browser/sync/util/sync_types.h @@ -35,7 +35,7 @@ inline size_t PathLen(const wchar_t* s) { #else // Mac and Linux #define PATHSTRING_IS_STD_STRING 1 #define PSTR_CHAR char -typedef string PathString; +typedef std::string PathString; #define PSTR(s) s inline size_t PathLen(const char* s) { return strlen(s); @@ -71,6 +71,6 @@ inline PathString IntToPathString(int digit) { return PathString(tmp.begin(), tmp.end()); } -const int kSyncProtocolMaxNameLengthBytes = 255; +const size_t kSyncProtocolMaxNameLengthBytes = 255; #endif // CHROME_BROWSER_SYNC_UTIL_SYNC_TYPES_H_ diff --git a/chrome/browser/sync/util/user_settings.cc b/chrome/browser/sync/util/user_settings.cc index d9ff1bd..6dbde96 100644 --- a/chrome/browser/sync/util/user_settings.cc +++ b/chrome/browser/sync/util/user_settings.cc @@ -88,8 +88,8 @@ void UserSettings::MigrateOldVersionsAsNeeded(sqlite3* const handle, GetColumn(share_query.get(), 0, &share_name); GetColumn(share_query.get(), 1, &file_name); - if (!file_util::Move(file_name, - DirectoryManager::GetSyncDataDatabaseFilename())) { + if (!file_util::Move(FilePath(file_name), + FilePath(DirectoryManager::GetSyncDataDatabaseFilename()))) { LOG(WARNING) << "Unable to upgrade UserSettings from v10"; return; } diff --git a/chrome/browser/sync/util/user_settings_posix.cc b/chrome/browser/sync/util/user_settings_posix.cc index 736d2d1..f8fd3f0 100644 --- a/chrome/browser/sync/util/user_settings_posix.cc +++ b/chrome/browser/sync/util/user_settings_posix.cc @@ -12,14 +12,16 @@ void UserSettings::ClearAllServiceTokens() { service_tokens_.clear(); } -void UserSettings::SetAuthTokenForService(const string& email, - const string& service_name, const string& long_lived_service_token) { +void UserSettings::SetAuthTokenForService( + const std::string& email, + const std::string& service_name, + const std::string& long_lived_service_token) { service_tokens_[service_name] = long_lived_service_token; } -bool UserSettings::GetLastUserAndServiceToken(const string& service_name, - string* username, - string* service_token) { +bool UserSettings::GetLastUserAndServiceToken(const std::string& service_name, + std::string* username, + std::string* service_token) { ServiceTokenMap::const_iterator iter = service_tokens_.find(service_name); if (iter != service_tokens_.end()) { |