Chromium Code Reviews| Index: base/string_util.cc |
| diff --git a/base/string_util.cc b/base/string_util.cc |
| index 1ad9abe5d8396f20dcefd5170aedf4e5644391ef..0cbb25fcb8c06354af111a6af0f2096b18e2ab2c 100644 |
| --- a/base/string_util.cc |
| +++ b/base/string_util.cc |
| @@ -831,7 +831,6 @@ template<class FormatStringType, class OutStringType> |
| 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(); |
| @@ -856,7 +855,14 @@ OutStringType DoReplaceStringPlaceholders(const FormatStringType& format_string, |
| } |
| --i; |
| } else { |
| - uintptr_t index = *i - '1'; |
| + uintptr_t index = 0; |
| + while ('0' <= *i && '9' >= *i) { |
| + index *= 10; |
| + index += *i - '0'; |
| + ++i; |
|
tony
2011/04/08 16:39:53
What happens if we're at the end of a string like
|
| + } |
| + --i; |
| + index -= 1; |
| if (offsets) { |
| ReplacementOffset r_offset(index, |
| static_cast<int>(formatted.size())); |