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

Unified Diff: chrome/browser/sync/syncable/syncable.cc

Issue 211019: Fix compiling of sync on linux. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/syncable/directory_manager.cc ('k') | chrome/browser/sync/syncable/syncable_columns.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/syncable/syncable.cc
===================================================================
--- chrome/browser/sync/syncable/syncable.cc (revision 26817)
+++ chrome/browser/sync/syncable/syncable.cc (working copy)
@@ -7,12 +7,13 @@
#include "build/build_config.h"
#include <sys/stat.h>
+#ifdef OS_LINUX
+#include <sys/time.h>
+#endif
#include <sys/types.h>
#include <time.h>
#ifdef OS_MACOSX
#include <CoreFoundation/CoreFoundation.h>
-#elif defined(OS_LINUX)
-#include <glib.h>
#elif defined(OS_WIN)
#include <shlwapi.h> // for PathMatchSpec
#endif
@@ -102,20 +103,14 @@
CHECK(0 != result) << "Error comparing strings: " << GetLastError();
return result - 2; // Convert to -1, 0, 1
#elif defined(OS_LINUX)
-// misnomer for Linux. These are already utf8 bit strings.
- gchar *case_folded_a;
- gchar *case_folded_b;
- GError *err = NULL;
- case_folded_a = g_utf8_casefold(reinterpret_cast<const gchar*>(a), a_bytes);
- CHECK(case_folded_a != NULL) << "g_utf8_casefold failed";
- case_folded_b = g_utf8_casefold(reinterpret_cast<const gchar*>(b), b_bytes);
- CHECK(case_folded_b != NULL) << "g_utf8_casefold failed";
- gint result = g_utf8_collate(case_folded_a, case_folded_b);
- g_free(case_folded_a);
- g_free(case_folded_b);
- if (result < 0) return -1;
- if (result > 0) return 1;
- return 0;
+ int result = base::strncasecmp(reinterpret_cast<const char *>(a),
+ reinterpret_cast<const char *>(b),
+ std::min(a_bytes, b_bytes));
+ if (result != 0) {
+ return result;
+ } else {
+ return a_bytes > b_bytes ? 1 : b_bytes > a_bytes ? -1 : 0;
+ }
#elif defined(OS_MACOSX)
CFStringRef a_str;
CFStringRef b_str;
@@ -210,9 +205,9 @@
last_sync_timestamp_(info.kernel_info.last_sync_timestamp),
initial_sync_ended_(info.kernel_info.initial_sync_ended),
store_birthday_(info.kernel_info.store_birthday),
- next_id(info.kernel_info.next_id),
cache_guid_(info.cache_guid),
- next_metahandle(info.max_metahandle + 1) {
+ next_metahandle(info.max_metahandle + 1),
+ next_id(info.kernel_info.next_id) {
info_status_ = Directory::KERNEL_SHARE_INFO_VALID;
CHECK(0 == pthread_mutex_init(&mutex, NULL));
CHECK(0 == pthread_key_create(&thread_node_key, &DestroyThreadNodeKey));
@@ -811,9 +806,9 @@
size_t num_erased = 0;
kernel_->flushed_metahandles_.Push(entry->ref(META_HANDLE));
num_erased = kernel_->ids_index->erase(entry);
- DCHECK_EQ(1, num_erased);
+ DCHECK(1 == num_erased);
num_erased = kernel_->metahandles_index->erase(entry);
- DCHECK_EQ(1, num_erased);
+ DCHECK(1 == num_erased);
delete entry;
}
}
« no previous file with comments | « chrome/browser/sync/syncable/directory_manager.cc ('k') | chrome/browser/sync/syncable/syncable_columns.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698