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

Unified Diff: chrome/browser/history/text_database.cc

Issue 8921006: Standardize StringToInt{,64} interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix call syntax of StringToInt() in Chrome OS code. Created 9 years 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/history/text_database.cc
diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc
index bb70fc75f8e7e0996fcebf26b0e7069af5b51d43..c5da03cf2cad466c5d51728e5e88c3bbccde0c75 100644
--- a/chrome/browser/history/text_database.cc
+++ b/chrome/browser/history/text_database.cc
@@ -111,9 +111,14 @@ TextDatabase::DBIdent TextDatabase::FileNameToID(const FilePath& file_path) {
return 0;
}
+ // TODO: Once StringPiece supports a templated interface over the
+ // underlying string type, use it here instead of substr, since that
+ // will avoid needless string copies. StringPiece cannot be used
+ // right now because FilePath::StringType could use either 8 or 16 bit
+ // characters, depending on the OS.
int year, month;
- base::StringToInt(suffix.begin(), suffix.begin() + 4, &year);
- base::StringToInt(suffix.begin() + 5, suffix.begin() + 7, &month);
+ base::StringToInt(suffix.substr(0, 4), &year);
+ base::StringToInt(suffix.substr(5, 2), &month);
return year * 100 + month;
}
« no previous file with comments | « chrome/browser/component_updater/component_updater_service.cc ('k') | chrome/browser/profiles/profile_info_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698