diff options
author | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 01:17:18 +0000 |
---|---|---|
committer | mmentovai@google.com <mmentovai@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-13 01:17:18 +0000 |
commit | 703f427ed4c2e067d95890f8edbbbdc29fc62e1d (patch) | |
tree | 61ec76f580c34d5034a820faf5829b016aa244c3 /base/string_util_icu.cc | |
parent | 856ab444ba32f086519a0db875e716844c060560 (diff) | |
download | chromium_src-703f427ed4c2e067d95890f8edbbbdc29fc62e1d.zip chromium_src-703f427ed4c2e067d95890f8edbbbdc29fc62e1d.tar.gz chromium_src-703f427ed4c2e067d95890f8edbbbdc29fc62e1d.tar.bz2 |
Fix string_util and its tests for the Mac, GCC, UTF-32 wchar_t platforms, and POSIX systems generally.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@771 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util_icu.cc')
-rw-r--r-- | base/string_util_icu.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/base/string_util_icu.cc b/base/string_util_icu.cc index 2ab933a0..fca020b 100644 --- a/base/string_util_icu.cc +++ b/base/string_util_icu.cc @@ -190,7 +190,7 @@ bool WideToUTF8(const wchar_t* src, size_t src_len, std::string* output) { // character, assume the rest will be ASCII and use a buffer size the same as // the input. When it's not ASCII, assume 3-bytes per character as the // starting point. This will be resized internally later if it's too small. - if (src[0] < 0x80) + if (static_cast<uint32>(src[0]) < 0x80) output->reserve(src_len); else output->reserve(src_len * 3); @@ -217,7 +217,7 @@ bool UTF8ToWide(const char* src, size_t src_len, std::wstring* output) { // the input. When it's not ASCII, assume the UTF-8 takes 2 bytes per // character (this is more conservative than 3 which we use above when // converting the other way). - if (src[0] < 0x80) + if (static_cast<unsigned char>(src[0]) < 0x80) output->reserve(src_len); else output->reserve(src_len / 2); @@ -316,7 +316,7 @@ bool WideToCodepage(const std::wstring& wide, #elif defined(WCHAR_T_IS_UTF32) // When wchar_t is wider than UChar (16 bits), transform |wide| into a // UChar* string. Size the UChar* buffer to be large enough to hold twice - // as many UTF-16 code points as there are UCS-4 characters, in case each + // as many UTF-16 code points as there are UTF-16 characters, in case each // character translates to a UTF-16 surrogate pair, and leave room for a NUL // terminator. std::vector<UChar> wide_uchar(wide.length() * 2 + 1); |