summaryrefslogtreecommitdiffstats
path: root/base/string_util_icu.cc
diff options
context:
space:
mode:
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.