diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 16:33:29 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 16:33:29 +0000 |
commit | ced675127013f8185dba61a70007cfd26a0d1819 (patch) | |
tree | d848b5fd2f9ec67985a4b0c909b9d292e2836c07 /base | |
parent | 816721e5f44997efdf2fb5280666ccd126f4c00e (diff) | |
download | chromium_src-ced675127013f8185dba61a70007cfd26a0d1819.zip chromium_src-ced675127013f8185dba61a70007cfd26a0d1819.tar.gz chromium_src-ced675127013f8185dba61a70007cfd26a0d1819.tar.bz2 |
Clean up another string template
Review URL: http://codereview.chromium.org/42591
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12457 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/string_util.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/base/string_util.cc b/base/string_util.cc index b37b483..ebab89b 100644 --- a/base/string_util.cc +++ b/base/string_util.cc @@ -917,16 +917,14 @@ inline int vsnprintfT(wchar_t* buffer, // Templatized backend for StringPrintF/StringAppendF. This does not finalize // the va_list, the caller is expected to do that. -template <class char_type> -static void StringAppendVT( - std::basic_string<char_type, std::char_traits<char_type> >* dst, - const char_type* format, - va_list ap) { - +template <class StringType> +static void StringAppendVT(StringType* dst, + const typename StringType::value_type* format, + va_list ap) { // First try with a small fixed size buffer. // This buffer size should be kept in sync with StringUtilTest.GrowBoundary // and StringUtilTest.StringPrintfBounds. - char_type stack_buf[1024]; + typename StringType::value_type stack_buf[1024]; va_list backup_ap; base::va_copy(backup_ap, ap); @@ -973,7 +971,7 @@ static void StringAppendVT( return; } - std::vector<char_type> mem_buf(mem_length); + std::vector<typename StringType::value_type> mem_buf(mem_length); // Restore the va_list before we use it again. base::va_copy(backup_ap, ap); @@ -1100,13 +1098,11 @@ std::wstring DoubleToWString(double value) { } void StringAppendV(std::string* dst, const char* format, va_list ap) { - StringAppendVT<char>(dst, format, ap); + StringAppendVT(dst, format, ap); } -void StringAppendV(std::wstring* dst, - const wchar_t* format, - va_list ap) { - StringAppendVT<wchar_t>(dst, format, ap); +void StringAppendV(std::wstring* dst, const wchar_t* format, va_list ap) { + StringAppendVT(dst, format, ap); } std::string StringPrintf(const char* format, ...) { |