diff options
author | romankoshelev <romankoshelev@yandex-team.com> | 2023-08-14 19:51:50 +0300 |
---|---|---|
committer | romankoshelev <romankoshelev@yandex-team.com> | 2023-08-15 01:24:11 +0300 |
commit | cfcd865e05c0d0525ea27d1e153a043b32a85138 (patch) | |
tree | 68d3b3b25271e8a4998505897a269ff7ce119b76 /contrib/libs/icu/i18n/nfrs.cpp | |
parent | ccb790c507bd5e8ffe2ef9886ce5ee0a7ce22a15 (diff) | |
download | ydb-cfcd865e05c0d0525ea27d1e153a043b32a85138.tar.gz |
Update ICU to 73.2
Diffstat (limited to 'contrib/libs/icu/i18n/nfrs.cpp')
-rw-r--r-- | contrib/libs/icu/i18n/nfrs.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/contrib/libs/icu/i18n/nfrs.cpp b/contrib/libs/icu/i18n/nfrs.cpp index df04e33e04..1f4b9b9d29 100644 --- a/contrib/libs/icu/i18n/nfrs.cpp +++ b/contrib/libs/icu/i18n/nfrs.cpp @@ -118,17 +118,17 @@ util_lcm(int64_t x, int64_t y) } #endif -static const UChar gPercent = 0x0025; -static const UChar gColon = 0x003a; -static const UChar gSemicolon = 0x003b; -static const UChar gLineFeed = 0x000a; +static const char16_t gPercent = 0x0025; +static const char16_t gColon = 0x003a; +static const char16_t gSemicolon = 0x003b; +static const char16_t gLineFeed = 0x000a; -static const UChar gPercentPercent[] = +static const char16_t gPercentPercent[] = { 0x25, 0x25, 0 }; /* "%%" */ -static const UChar gNoparse[] = +static const char16_t gNoparse[] = { 0x40, 0x6E, 0x6F, 0x70, 0x61, 0x72, 0x73, 0x65, 0 }; /* "@noparse" */ @@ -138,12 +138,12 @@ NFRuleSet::NFRuleSet(RuleBasedNumberFormat *_owner, UnicodeString* descriptions, , rules(0) , owner(_owner) , fractionRules() - , fIsFractionRuleSet(FALSE) - , fIsPublic(FALSE) - , fIsParseable(TRUE) + , fIsFractionRuleSet(false) + , fIsPublic(false) + , fIsParseable(true) { for (int32_t i = 0; i < NON_NUMERICAL_RULE_LENGTH; ++i) { - nonNumericalRules[i] = NULL; + nonNumericalRules[i] = nullptr; } if (U_FAILURE(status)) { @@ -185,7 +185,7 @@ NFRuleSet::NFRuleSet(RuleBasedNumberFormat *_owner, UnicodeString* descriptions, fIsPublic = name.indexOf(gPercentPercent, 2, 0) != 0; if ( name.endsWith(gNoparse,8) ) { - fIsParseable = FALSE; + fIsParseable = false; name.truncate(name.length()-8); // remove the @noparse from the name } @@ -273,13 +273,13 @@ void NFRuleSet::setNonNumericalRule(NFRule *rule) { nonNumericalRules[NEGATIVE_RULE_INDEX] = rule; } else if (baseValue == NFRule::kImproperFractionRule) { - setBestFractionRule(IMPROPER_FRACTION_RULE_INDEX, rule, TRUE); + setBestFractionRule(IMPROPER_FRACTION_RULE_INDEX, rule, true); } else if (baseValue == NFRule::kProperFractionRule) { - setBestFractionRule(PROPER_FRACTION_RULE_INDEX, rule, TRUE); + setBestFractionRule(PROPER_FRACTION_RULE_INDEX, rule, true); } else if (baseValue == NFRule::kDefaultRule) { - setBestFractionRule(DEFAULT_RULE_INDEX, rule, TRUE); + setBestFractionRule(DEFAULT_RULE_INDEX, rule, true); } else if (baseValue == NFRule::kInfinityRule) { delete nonNumericalRules[INFINITY_RULE_INDEX]; @@ -303,7 +303,7 @@ void NFRuleSet::setBestFractionRule(int32_t originalIndex, NFRule *newRule, UBoo fractionRules.add(newRule); } NFRule *bestResult = nonNumericalRules[originalIndex]; - if (bestResult == NULL) { + if (bestResult == nullptr) { nonNumericalRules[originalIndex] = newRule; } else { @@ -339,9 +339,9 @@ util_equalRules(const NFRule* rule1, const NFRule* rule2) return *rule1 == *rule2; } } else if (!rule2) { - return TRUE; + return true; } - return FALSE; + return false; } bool @@ -380,7 +380,7 @@ NFRuleSet::setDecimalFormatSymbols(const DecimalFormatSymbols &newSymbols, UErro for (uint32_t fIdx = 0; fIdx < fractionRules.size(); fIdx++) { NFRule *fractionRule = fractionRules[fIdx]; if (nonNumericalRules[nonNumericalIdx]->getBaseValue() == fractionRule->getBaseValue()) { - setBestFractionRule(nonNumericalIdx, fractionRule, FALSE); + setBestFractionRule(nonNumericalIdx, fractionRule, false); } } } @@ -535,7 +535,7 @@ NFRuleSet::findNormalRule(int64_t number) const } } if (hi == 0) { // bad rule set, minimum base > 0 - return NULL; // want to throw exception here + return nullptr; // want to throw exception here } NFRule *result = rules[hi - 1]; @@ -547,7 +547,7 @@ NFRuleSet::findNormalRule(int64_t number) const // return if (result->shouldRollBack(number)) { if (hi == 1) { // bad rule set, no prior rule to rollback to from this base - return NULL; + return nullptr; } result = rules[hi - 2]; } @@ -671,7 +671,7 @@ NFRuleSet::findFractionRuleSetRule(double number) const static void dumpUS(FILE* f, const UnicodeString& us) { int len = us.length(); char* buf = (char *)uprv_malloc((len+1)*sizeof(char)); //new char[len+1]; - if (buf != NULL) { + if (buf != nullptr) { us.extract(0, len, buf); buf[len] = 0; fprintf(f, "%s", buf); @@ -860,7 +860,7 @@ static const uint8_t asciiDigits[] = { 0x77u, 0x78u, 0x79u, 0x7au, }; -static const UChar kUMinus = (UChar)0x002d; +static const char16_t kUMinus = (char16_t)0x002d; #ifdef RBNF_DEBUG static const char kMinus = '-'; @@ -910,7 +910,7 @@ int64_t util64_atoi(const char* str, uint32_t radix) return result; } -int64_t util64_utoi(const UChar* str, uint32_t radix) +int64_t util64_utoi(const char16_t* str, uint32_t radix) { if (radix > 36) { radix = 36; @@ -925,7 +925,7 @@ int64_t util64_utoi(const UChar* str, uint32_t radix) neg = 1; } int64_t result = 0; - UChar c; + char16_t c; uint8_t b; while (((c = *str++) < 0x0080) && (b = digitInfo[c]) && ((b &= 0x7f) < radix)) { result *= lradix; @@ -983,7 +983,7 @@ uint32_t util64_toa(int64_t w, char* buf, uint32_t len, uint32_t radix, UBool ra } #endif -uint32_t util64_tou(int64_t w, UChar* buf, uint32_t len, uint32_t radix, UBool raw) +uint32_t util64_tou(int64_t w, char16_t* buf, uint32_t len, uint32_t radix, UBool raw) { if (radix > 36) { radix = 36; @@ -992,13 +992,13 @@ uint32_t util64_tou(int64_t w, UChar* buf, uint32_t len, uint32_t radix, UBool r } int64_t base = radix; - UChar* p = buf; + char16_t* p = buf; if (len && (w < 0) && (radix == 10) && !raw) { w = -w; *p++ = kUMinus; --len; } else if (len && (w == 0)) { - *p++ = (UChar)raw ? 0 : asciiDigits[0]; + *p++ = (char16_t)raw ? 0 : asciiDigits[0]; --len; } @@ -1006,7 +1006,7 @@ uint32_t util64_tou(int64_t w, UChar* buf, uint32_t len, uint32_t radix, UBool r int64_t n = w / base; int64_t m = n * base; int32_t d = (int32_t)(w-m); - *p++ = (UChar)(raw ? d : asciiDigits[d]); + *p++ = (char16_t)(raw ? d : asciiDigits[d]); w = n; --len; } @@ -1019,7 +1019,7 @@ uint32_t util64_tou(int64_t w, UChar* buf, uint32_t len, uint32_t radix, UBool r ++buf; } while (--p > buf) { - UChar c = *p; + char16_t c = *p; *p = *buf; *buf = c; ++buf; |