ICU-13574 Revising codePointZero loading based on feedback.

X-SVN-Rev: 41082
This commit is contained in:
Shane Carr 2018-03-08 00:20:31 +00:00
parent 4a5c8afa5b
commit 8da6ef1776

View 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;