Index: base/string_util.cc |
diff --git a/base/string_util.cc b/base/string_util.cc |
index b0ab3a6b7400026f49b24f299ea5fff5dcfc3db1..a62b905227ec58c7474629243bb9744309958074 100644 |
--- a/base/string_util.cc |
+++ b/base/string_util.cc |
@@ -1423,25 +1423,23 @@ void SplitStringAlongWhitespace(const std::string& str, |
SplitStringAlongWhitespaceT(str, result); |
} |
-template<class StringType> |
-StringType DoReplaceStringPlaceholders(const StringType& format_string, |
- const std::vector<StringType>& subst, |
- std::vector<size_t>* offsets) { |
+template<class FormatStringType, class OutStringType> |
+OutStringType DoReplaceStringPlaceholders(const FormatStringType& format_string, |
+ const std::vector<OutStringType>& subst, std::vector<size_t>* offsets) { |
int substitutions = subst.size(); |
DCHECK(substitutions < 10); |
int sub_length = 0; |
- for (typename std::vector<StringType>::const_iterator iter = subst.begin(); |
- iter != subst.end(); |
- ++iter) { |
+ for (typename std::vector<OutStringType>::const_iterator iter = subst.begin(); |
+ iter != subst.end(); ++iter) { |
sub_length += (*iter).length(); |
} |
- StringType formatted; |
+ OutStringType formatted; |
formatted.reserve(format_string.length() + sub_length); |
std::vector<ReplacementOffset> r_offsets; |
- for (typename StringType::const_iterator i = format_string.begin(); |
+ for (typename FormatStringType::const_iterator i = format_string.begin(); |
i != format_string.end(); ++i) { |
if ('$' == *i) { |
if (i + 1 != format_string.end()) { |
@@ -1482,7 +1480,7 @@ string16 ReplaceStringPlaceholders(const string16& format_string, |
return DoReplaceStringPlaceholders(format_string, subst, offsets); |
} |
-std::string ReplaceStringPlaceholders(const std::string& format_string, |
+std::string ReplaceStringPlaceholders(const base::StringPiece& format_string, |
const std::vector<std::string>& subst, |
std::vector<size_t>* offsets) { |
return DoReplaceStringPlaceholders(format_string, subst, offsets); |