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

Unified Diff: chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc

Issue 374843002: [SyncFS] [Refactoring] Change RemovePrefix() to return bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
Index: chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc
index 5391c206ac4f5efc925f6586c0659aa6ad64a30a..e59b927fb51b3729555fa0546d22b8cf3dcfc2ce 100644
--- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc
+++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index.cc
@@ -85,9 +85,8 @@ void ReadDatabaseContents(leveldb::DB* db,
std::string key = itr->key().ToString();
std::string value = itr->value().ToString();
- if (StartsWithASCII(key, kFileMetadataKeyPrefix, true)) {
- std::string file_id = RemovePrefix(key, kFileMetadataKeyPrefix);
-
+ std::string file_id;
+ if (RemovePrefix(key, kFileMetadataKeyPrefix, &file_id)) {
scoped_ptr<FileMetadata> metadata(new FileMetadata);
if (!metadata->ParseFromString(itr->value().ToString())) {
util::Log(logging::LOG_WARNING, FROM_HERE,
@@ -99,10 +98,10 @@ void ReadDatabaseContents(leveldb::DB* db,
continue;
}
- if (StartsWithASCII(key, kFileTrackerKeyPrefix, true)) {
+ std::string tracker_id_str;
+ if (RemovePrefix(key, kFileTrackerKeyPrefix, &tracker_id_str)) {
int64 tracker_id = 0;
- if (!base::StringToInt64(RemovePrefix(key, kFileTrackerKeyPrefix),
- &tracker_id)) {
+ if (!base::StringToInt64(tracker_id_str, &tracker_id)) {
util::Log(logging::LOG_WARNING, FROM_HERE,
"Failed to parse TrackerID");
continue;

Powered by Google App Engine
This is Rietveld 408576698