gecko-dev/intl/icu-patches/bug-1504656-relativetimefor...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 строки
1.6 KiB
Diff
Исходник Обычный вид История

Workaround for https://unicode-org.atlassian.net/browse/ICU-20253
https://bugzilla.mozilla.org/show_bug.cgi?id=1504656
diff --git a/intl/icu/source/i18n/reldatefmt.cpp b/intl/icu/source/i18n/reldatefmt.cpp
--- a/intl/icu/source/i18n/reldatefmt.cpp
+++ b/intl/icu/source/i18n/reldatefmt.cpp
@@ -157,24 +157,30 @@ const UnicodeString& RelativeDateTimeCac
}
// Use fallback cache for SimpleFormatter relativeUnits.
const SimpleFormatter* RelativeDateTimeCacheData::getRelativeDateTimeUnitFormatter(
int32_t fStyle,
URelativeDateTimeUnit unit,
int32_t pastFutureIndex,
int32_t pluralUnit) const {
- int32_t style = fStyle;
- do {
- if (relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit] != nullptr) {
- return relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit];
+ while (true) {
+ int32_t style = fStyle;
+ do {
+ if (relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit] != nullptr) {
+ return relativeUnitsFormatters[style][unit][pastFutureIndex][pluralUnit];
+ }
+ style = fallBackCache[style];
+ } while (style != -1);
+
+ if (pluralUnit == StandardPlural::OTHER) {
+ return nullptr; // No formatter found.
}
- style = fallBackCache[style];
- } while (style != -1);
- return nullptr; // No formatter found.
+ pluralUnit = StandardPlural::OTHER;
+ }
}
static UBool getStringWithFallback(
const UResourceBundle *resource,
const char *key,
UnicodeString &result,
UErrorCode &status) {
int32_t len = 0;