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

Unified Diff: chrome/browser/sync_file_system/drive_backend/drive_backend_util.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/drive_backend_util.cc
diff --git a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc
index 99fb5553bdc77320a7db080fe56d6bb3a2055b62..ac9d0d0581e26af57b37e233b5c7775045c09e98 100644
--- a/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc
+++ b/chrome/browser/sync_file_system/drive_backend/drive_backend_util.cc
@@ -148,10 +148,17 @@ SyncStatusCode GDataErrorCodeToSyncStatusCode(
return SYNC_STATUS_FAILED;
}
-std::string RemovePrefix(const std::string& str, const std::string& prefix) {
- if (StartsWithASCII(str, prefix, true))
- return std::string(str.begin() + prefix.size(), str.end());
- return str;
+bool RemovePrefix(const std::string& str, const std::string& prefix,
+ std::string* out) {
+ if (!StartsWithASCII(str, prefix, true)) {
+ if (out)
+ *out = str;
+ return false;
+ }
+
+ if (out)
+ *out = str.substr(prefix.size());
+ return true;
}
} // namespace drive_backend

Powered by Google App Engine
This is Rietveld 408576698