]> granicus.if.org Git - icu/commitdiff
ICU-13574 Revising codePointZero loading based on feedback. release-61-rc
authorShane Carr <shane@unicode.org>
Thu, 8 Mar 2018 00:20:31 +0000 (00:20 +0000)
committerShane Carr <shane@unicode.org>
Thu, 8 Mar 2018 00:20:31 +0000 (00:20 +0000)
X-SVN-Rev: 41082

icu4c/source/i18n/dcfmtsym.cpp

index 02c0e077f43807d62854902627a16617950fb40a..a2cc58c4151ec4fe5f48af08e5f39ccd8b819942 100644 (file)
@@ -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;