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

Unified Diff: base/string_util.cc

Issue 6882108: Revert 82405 - Support more than 9 arguments for ReplaceStringPlaceholders()- support more than 9... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 8 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 | « no previous file | base/string_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/string_util.cc
===================================================================
--- base/string_util.cc (revision 82422)
+++ base/string_util.cc (working copy)
@@ -831,6 +831,7 @@
OutStringType DoReplaceStringPlaceholders(const FormatStringType& format_string,
const std::vector<OutStringType>& subst, std::vector<size_t>* offsets) {
size_t substitutions = subst.size();
+ DCHECK(substitutions < 10);
size_t sub_length = 0;
for (typename std::vector<OutStringType>::const_iterator iter = subst.begin();
@@ -855,14 +856,7 @@
}
--i;
} else {
- uintptr_t index = 0;
- while ('0' <= *i && '9' >= *i) {
- index *= 10;
- index += *i - '0';
- ++i;
- }
- --i;
- index -= 1;
+ uintptr_t index = *i - '1';
if (offsets) {
ReplacementOffset r_offset(index,
static_cast<int>(formatted.size()));
« no previous file with comments | « no previous file | base/string_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698