summaryrefslogtreecommitdiffstats
path: root/base/string_util_icu.cc
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-19 00:31:24 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-19 00:31:24 +0000
commitd6b0667c7b02777b0fba2335ea604e3217332511 (patch)
tree33894de5f565b85cf4b54cbd0e4c9c8f376ffb85 /base/string_util_icu.cc
parent4ec7327e664f72ade9a1aa4460c25978d72af94f (diff)
downloadchromium_src-d6b0667c7b02777b0fba2335ea604e3217332511.zip
chromium_src-d6b0667c7b02777b0fba2335ea604e3217332511.tar.gz
chromium_src-d6b0667c7b02777b0fba2335ea604e3217332511.tar.bz2
Fix some warnings found in string unittests.
(Preparation for enabling -Wall -Werror.) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1012 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util_icu.cc')
-rw-r--r--base/string_util_icu.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/base/string_util_icu.cc b/base/string_util_icu.cc
index 5774677..c35ca71 100644
--- a/base/string_util_icu.cc
+++ b/base/string_util_icu.cc
@@ -51,15 +51,20 @@ namespace {
//
// Returns true on success. On false, |*code_point| will be invalid.
bool ReadUnicodeCharacter(const char* src, int32 src_len,
- int32* char_index, uint32* code_point) {
- U8_NEXT(src, *char_index, src_len, *code_point);
+ int32* char_index, uint32* code_point_out) {
+ // U8_NEXT expects to be able to use -1 to signal an error, so we must
+ // use a signed type for code_point. But this function returns false
+ // on error anyway, so code_point_out is unsigned.
+ int32 code_point;
+ U8_NEXT(src, *char_index, src_len, code_point);
+ *code_point_out = static_cast<uint32>(code_point);
// The ICU macro above moves to the next char, we want to point to the last
// char consumed.
(*char_index)--;
// Validate the decoded value.
- return U_IS_UNICODE_CHAR(*code_point);
+ return U_IS_UNICODE_CHAR(code_point);
}
// Reads a UTF-16 character. The usage is the same as the 8-bit version above.