From 8da6ef17765ec98742186ad8a6b8379cfb74dd81 Mon Sep 17 00:00:00 2001 From: Shane Carr Date: Thu, 8 Mar 2018 00:20:31 +0000 Subject: [PATCH] ICU-13574 Revising codePointZero loading based on feedback. X-SVN-Rev: 41082 --- icu4c/source/i18n/dcfmtsym.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/icu4c/source/i18n/dcfmtsym.cpp b/icu4c/source/i18n/dcfmtsym.cpp index 02c0e077f43..a2cc58c4151 100644 --- a/icu4c/source/i18n/dcfmtsym.cpp +++ b/icu4c/source/i18n/dcfmtsym.cpp @@ -437,15 +437,19 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status, sink.resolveMissingMonetarySeparators(fSymbols); // Resolve codePointZero - const UnicodeString& stringZero = getConstDigitSymbol(0); - UChar32 tempCodePointZero = stringZero.char32At(0); - if (u_isdigit(tempCodePointZero) && stringZero.countChar32() == 1) { - for (int32_t i=0; i<=9; i++) { - const UnicodeString& stringDigit = getConstDigitSymbol(i); - if (stringDigit.char32At(0) != tempCodePointZero + i || stringDigit.countChar32() != 1) { - tempCodePointZero = -1; - break; - } + UChar32 tempCodePointZero; + for (int32_t i=0; i<=9; i++) { + const UnicodeString& stringDigit = getConstDigitSymbol(i); + if (stringDigit.countChar32() != 1) { + tempCodePointZero = -1; + break; + } + UChar32 cp = stringDigit.char32At(0); + if (i == 0) { + tempCodePointZero = cp; + } else if (cp != tempCodePointZero + i) { + tempCodePointZero = -1; + break; } } fCodePointZero = tempCodePointZero; -- 2.40.0