diff options
author | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 11:17:00 +0000 |
---|---|---|
committer | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-20 11:17:00 +0000 |
commit | 6c82baf4022e4b964b2729e28992b79b9c5db879 (patch) | |
tree | edc29079826c2bb9735564ac0f16502f6845e1c3 /base | |
parent | b24250fc9857d219ad617e2a14e145b65724cb61 (diff) | |
download | chromium_src-6c82baf4022e4b964b2729e28992b79b9c5db879.zip chromium_src-6c82baf4022e4b964b2729e28992b79b9c5db879.tar.gz chromium_src-6c82baf4022e4b964b2729e28992b79b9c5db879.tar.bz2 |
Pass StringPieces by constant reference.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1085 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/sys_string_conversions.h | 6 | ||||
-rw-r--r-- | base/sys_string_conversions_linux.cc | 4 | ||||
-rw-r--r-- | base/sys_string_conversions_mac.cc | 4 | ||||
-rw-r--r-- | base/sys_string_conversions_win.cc | 6 |
4 files changed, 10 insertions, 10 deletions
diff --git a/base/sys_string_conversions.h b/base/sys_string_conversions.h index ed9b8fa..dfca0f7 100644 --- a/base/sys_string_conversions.h +++ b/base/sys_string_conversions.h @@ -44,13 +44,13 @@ namespace base { // Converts between wide and UTF-8 representations of a string. On error, the // result is system-dependent. std::string SysWideToUTF8(const std::wstring& wide); -std::wstring SysUTF8ToWide(StringPiece utf8); +std::wstring SysUTF8ToWide(const StringPiece& utf8); // Converts between wide and the system multi-byte representations of a string. // DANGER: This will lose information and can change (on Windows, this can // change between reboots). std::string SysWideToNativeMB(const std::wstring& wide); -std::wstring SysNativeMBToWide(StringPiece native_mb); +std::wstring SysNativeMBToWide(const StringPiece& native_mb); // Windows-specific ------------------------------------------------------------ @@ -59,7 +59,7 @@ std::wstring SysNativeMBToWide(StringPiece native_mb); // Converts between 8-bit and wide strings, using the given code page. The // code page identifier is one accepted by the Windows function // MultiByteToWideChar(). -std::wstring SysMultiByteToWide(StringPiece mb, uint32 code_page); +std::wstring SysMultiByteToWide(const StringPiece& mb, uint32 code_page); std::string SysWideToMultiByte(const std::wstring& wide, uint32 code_page); #endif // defined(OS_WIN) diff --git a/base/sys_string_conversions_linux.cc b/base/sys_string_conversions_linux.cc index 9547ef9..9ad78d4 100644 --- a/base/sys_string_conversions_linux.cc +++ b/base/sys_string_conversions_linux.cc @@ -39,7 +39,7 @@ std::string SysWideToUTF8(const std::wstring& wide) { // than our ICU, but this will do for now. return WideToUTF8(wide); } -std::wstring SysUTF8ToWide(StringPiece utf8) { +std::wstring SysUTF8ToWide(const StringPiece& utf8) { // In theory this should be using the system-provided conversion rather // than our ICU, but this will do for now. std::wstring out; @@ -52,7 +52,7 @@ std::string SysWideToNativeMB(const std::wstring& wide) { return SysWideToUTF8(wide); } -std::wstring SysNativeMBToWide(StringPiece native_mb) { +std::wstring SysNativeMBToWide(const StringPiece& native_mb) { // TODO(evanm): we can't assume Linux is UTF-8. return SysUTF8ToWide(native_mb); } diff --git a/base/sys_string_conversions_mac.cc b/base/sys_string_conversions_mac.cc index a719245..63533a4 100644 --- a/base/sys_string_conversions_mac.cc +++ b/base/sys_string_conversions_mac.cc @@ -142,7 +142,7 @@ std::string SysWideToUTF8(const std::wstring& wide) { } // Do not assert in this function since it is used by the asssertion code! -std::wstring SysUTF8ToWide(StringPiece utf8) { +std::wstring SysUTF8ToWide(const StringPiece& utf8) { return STLStringToSTLStringWithEncodingsT<StringPiece, std::wstring>( utf8, kNarrowStringEncoding, kWideStringEncoding); } @@ -151,7 +151,7 @@ std::string SysWideToNativeMB(const std::wstring& wide) { return SysWideToUTF8(wide); } -std::wstring SysNativeMBToWide(StringPiece native_mb) { +std::wstring SysNativeMBToWide(const StringPiece& native_mb) { return SysUTF8ToWide(native_mb); } diff --git a/base/sys_string_conversions_win.cc b/base/sys_string_conversions_win.cc index 48e8f01..95ab431 100644 --- a/base/sys_string_conversions_win.cc +++ b/base/sys_string_conversions_win.cc @@ -41,7 +41,7 @@ std::string SysWideToUTF8(const std::wstring& wide) { } // Do not assert in this function since it is used by the asssertion code! -std::wstring SysUTF8ToWide(StringPiece utf8) { +std::wstring SysUTF8ToWide(const StringPiece& utf8) { return SysMultiByteToWide(utf8, CP_UTF8); } @@ -49,12 +49,12 @@ std::string SysWideToNativeMB(const std::wstring& wide) { return SysWideToMultiByte(wide, CP_ACP); } -std::wstring SysNativeMBToWide(StringPiece native_mb) { +std::wstring SysNativeMBToWide(const StringPiece& native_mb) { return SysMultiByteToWide(native_mb, CP_ACP); } // Do not assert in this function since it is used by the asssertion code! -std::wstring SysMultiByteToWide(StringPiece mb, uint32 code_page) { +std::wstring SysMultiByteToWide(const StringPiece& mb, uint32 code_page) { if (mb.empty()) return std::wstring(); |