Bug 1738422 - Part 1: Update or remove ICU patches. r=platform-i18n-reviewers,dminor

Remove the patches for bug 1636984, bug 1648137, and bug 1714933 because the
underlying bugs were fixed in ICU 70 resp. the local patches were backports from
the ICU development branch.

And update the local patches for Sorbian to apply cleanly on ICU 70.

Differential Revision: https://phabricator.services.mozilla.com/D129921
This commit is contained in:
André Bargull 2021-11-16 17:02:38 +00:00
Родитель 2bcdb5e1d8
Коммит 0b5e68fd05
8 изменённых файлов: 16 добавлений и 233 удалений

Просмотреть файл

@ -1,12 +1,12 @@
diff --git a/intl/icu/source/data/locales/dsb.txt b/intl/icu/source/data/locales/dsb.txt
--- a/intl/icu/source/data/locales/dsb.txt
+++ b/intl/icu/source/data/locales/dsb.txt
@@ -349,25 +349,29 @@ dsb{
Hms{"H:mm:ss"}
M{"L"}
MEd{"E, d.M."}
MMM{"LLL"}
MMMEd{"E, d. MMM"}
@@ -532,25 +532,29 @@ dsb{
few{"'tyźeń' W MMMM"}
one{"'tyźeń' W MMMM"}
other{"'tyźeń' W MMMM"}
two{"'tyźeń' W MMMM"}
}
- MMMMd{"d MMMM"}
+ MMMMd{"d. MMMM"}
MMMd{"d. MMM"}
@ -30,17 +30,17 @@ diff --git a/intl/icu/source/data/locales/dsb.txt b/intl/icu/source/data/locales
yMd{"d.M.y"}
yQQQ{"QQQ y"}
yQQQQ{"QQQQ y"}
}
dayNames{
yw{
few{"'tyźeń' w 'lěta' Y"}
diff --git a/intl/icu/source/data/locales/hsb.txt b/intl/icu/source/data/locales/hsb.txt
--- a/intl/icu/source/data/locales/hsb.txt
+++ b/intl/icu/source/data/locales/hsb.txt
@@ -349,25 +349,29 @@ hsb{
Hms{"H:mm:ss"}
M{"L"}
MEd{"E, d.M."}
MMM{"LLL"}
MMMEd{"E, d. MMM"}
@@ -531,25 +531,29 @@ hsb{
few{"'tydźeń' W MMMM"}
one{"'tydźeń' W MMMM"}
other{"'tydźeń' W MMMM"}
two{"'tydźeń' W MMMM"}
}
- MMMMd{"d MMMM"}
+ MMMMd{"d. MMMM"}
MMMd{"d. MMM"}
@ -64,5 +64,5 @@ diff --git a/intl/icu/source/data/locales/hsb.txt b/intl/icu/source/data/locales
yMd{"d.M.y"}
yQQQ{"QQQ y"}
yQQQQ{"QQQQ y"}
}
dayNames{
yw{
few{"'tydźeń' w 'lěta' Y"}

Просмотреть файл

@ -1,33 +0,0 @@
# Handle "alias" entries in DateTimePatternGenerator::AppendItemNamesSink.
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-20992
diff --git a/intl/icu/source/i18n/dtptngen.cpp b/intl/icu/source/i18n/dtptngen.cpp
--- a/intl/icu/source/i18n/dtptngen.cpp
+++ b/intl/icu/source/i18n/dtptngen.cpp
@@ -956,16 +956,25 @@ struct DateTimePatternGenerator::AppendI
virtual void put(const char *key, ResourceValue &value, UBool /*noFallback*/,
UErrorCode &errorCode) {
ResourceTable itemsTable = value.getTable(errorCode);
if (U_FAILURE(errorCode)) { return; }
for (int32_t i = 0; itemsTable.getKeyAndValue(i, key, value); ++i) {
UDateTimePGDisplayWidth width;
UDateTimePatternField field = dtpg.getFieldAndWidthIndices(key, &width);
if (field == UDATPG_FIELD_COUNT) { continue; }
+
+ UResType type = value.getType();
+ U_ASSERT(type == URES_TABLE || type == URES_ALIAS);
+
+ // TODO: Implement support for alias types.
+ if (type == URES_ALIAS) {
+ continue;
+ }
+
ResourceTable detailsTable = value.getTable(errorCode);
if (U_FAILURE(errorCode)) { return; }
for (int32_t j = 0; detailsTable.getKeyAndValue(j, key, value); ++j) {
if (uprv_strcmp(key, "dn") != 0) { continue; }
const UnicodeString& valueStr = value.getUnicodeString(errorCode);
if (dtpg.getFieldDisplayName(field,width).isEmpty() && !valueStr.isEmpty()) {
dtpg.setFieldDisplayName(field,width,valueStr);
}

Просмотреть файл

@ -1,51 +0,0 @@
# Fully clear the decimal quantity before setting it to a new value.
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-21674
diff --git a/intl/icu/source/i18n/number_capi.cpp b/intl/icu/source/i18n/number_capi.cpp
--- a/intl/icu/source/i18n/number_capi.cpp
+++ b/intl/icu/source/i18n/number_capi.cpp
@@ -112,40 +112,43 @@ unumf_openForSkeletonAndLocaleWithError(
U_CAPI void U_EXPORT2
unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNumber* uresult,
UErrorCode* ec) {
const UNumberFormatterData* formatter = UNumberFormatterData::validate(uformatter, *ec);
auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
if (U_FAILURE(*ec)) { return; }
result->fData.getStringRef().clear();
+ result->fData.quantity.clear();
result->fData.quantity.setToLong(value);
formatter->fFormatter.formatImpl(&result->fData, *ec);
}
U_CAPI void U_EXPORT2
unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedNumber* uresult,
UErrorCode* ec) {
const UNumberFormatterData* formatter = UNumberFormatterData::validate(uformatter, *ec);
auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
if (U_FAILURE(*ec)) { return; }
result->fData.getStringRef().clear();
+ result->fData.quantity.clear();
result->fData.quantity.setToDouble(value);
formatter->fFormatter.formatImpl(&result->fData, *ec);
}
U_CAPI void U_EXPORT2
unumf_formatDecimal(const UNumberFormatter* uformatter, const char* value, int32_t valueLen,
UFormattedNumber* uresult, UErrorCode* ec) {
const UNumberFormatterData* formatter = UNumberFormatterData::validate(uformatter, *ec);
auto* result = UFormattedNumberApiHelper::validate(uresult, *ec);
if (U_FAILURE(*ec)) { return; }
result->fData.getStringRef().clear();
+ result->fData.quantity.clear();
result->fData.quantity.setToDecNumber({value, valueLen}, *ec);
if (U_FAILURE(*ec)) { return; }
formatter->fFormatter.formatImpl(&result->fData, *ec);
}
U_CAPI int32_t U_EXPORT2
unumf_resultToString(const UFormattedNumber* uresult, UChar* buffer, int32_t bufferCapacity,
UErrorCode* ec) {

Просмотреть файл

@ -1,30 +0,0 @@
# Allow to support non-finite decimal number strings.
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-21675
diff --git a/intl/icu/source/i18n/number_utils.cpp b/intl/icu/source/i18n/number_utils.cpp
--- a/intl/icu/source/i18n/number_utils.cpp
+++ b/intl/icu/source/i18n/number_utils.cpp
@@ -175,22 +175,16 @@ void DecNum::_setTo(const char* str, int
if ((fContext.status & DEC_Conversion_syntax) != 0) {
status = U_DECIMAL_NUMBER_SYNTAX_ERROR;
return;
} else if (fContext.status != 0) {
// Not a syntax error, but some other error, like an exponent that is too large.
status = U_UNSUPPORTED_ERROR;
return;
}
-
- // For consistency with Java BigDecimal, no support for DecNum that is NaN or Infinity!
- if (decNumberIsSpecial(fData.getAlias())) {
- status = U_UNSUPPORTED_ERROR;
- return;
- }
}
void
DecNum::setTo(const uint8_t* bcd, int32_t length, int32_t scale, bool isNegative, UErrorCode& status) {
if (length > kDefaultDigits) {
fData.resize(length, 0);
fContext.digits = length;
} else {

Просмотреть файл

@ -1,29 +0,0 @@
# https://unicode-org.atlassian.net/browse/ICU-21539
#
# https://github.com/unicode-org/icu/commit/45b893c1f9af9e541b8812c2073471e134aaf773.diff
diff --git a/intl/icu/source/common/locid.cpp b/intl/icu/source/common/locid.cpp
index 4fec17d14fd..02cd82a7b8e 100644
--- a/intl/icu/source/common/locid.cpp
+++ b/intl/icu/source/common/locid.cpp
@@ -2515,16 +2515,16 @@ class UnicodeKeywordEnumeration : public KeywordEnumeration {
virtual const char* next(int32_t* resultLength, UErrorCode& status) {
const char* legacy_key = KeywordEnumeration::next(nullptr, status);
- if (U_SUCCESS(status) && legacy_key != nullptr) {
+ while (U_SUCCESS(status) && legacy_key != nullptr) {
const char* key = uloc_toUnicodeLocaleKey(legacy_key);
- if (key == nullptr) {
- status = U_ILLEGAL_ARGUMENT_ERROR;
- } else {
+ if (key != nullptr) {
if (resultLength != nullptr) {
*resultLength = static_cast<int32_t>(uprv_strlen(key));
}
return key;
}
+ // Not a Unicode keyword, could be a t, x or other, continue to look at the next one.
+ legacy_key = KeywordEnumeration::next(nullptr, status);
}
if (resultLength != nullptr) *resultLength = 0;
return nullptr;

Просмотреть файл

@ -1,39 +0,0 @@
# https://unicode-org.atlassian.net/browse/ICU-21587
#
# https://github.com/unicode-org/icu/commit/2dc5bea9061b4fb05cd03e21b775dd944a0eb81d.diff
diff --git a/intl/icu/source/common/locid.cpp b/intl/icu/source/common/locid.cpp
index 02cd82a7b8e..3c6e5b06690 100644
--- a/intl/icu/source/common/locid.cpp
+++ b/intl/icu/source/common/locid.cpp
@@ -469,14 +469,18 @@ Locale& Locale::operator=(Locale&& other) U_NOEXCEPT {
if ((baseName != fullName) && (baseName != fullNameBuffer)) uprv_free(baseName);
if (fullName != fullNameBuffer) uprv_free(fullName);
- if (other.fullName == other.fullNameBuffer) {
+ if (other.fullName == other.fullNameBuffer || other.baseName == other.fullNameBuffer) {
uprv_strcpy(fullNameBuffer, other.fullNameBuffer);
+ }
+ if (other.fullName == other.fullNameBuffer) {
fullName = fullNameBuffer;
} else {
fullName = other.fullName;
}
- if (other.baseName == other.fullName) {
+ if (other.baseName == other.fullNameBuffer) {
+ baseName = fullNameBuffer;
+ } else if (other.baseName == other.fullName) {
baseName = fullName;
} else {
baseName = other.baseName;
@@ -2681,6 +2685,9 @@ Locale::setKeywordValue(const char* keywordName, const char* keywordValue, UErro
if (fullName != fullNameBuffer) {
// if full Name is already on the heap, need to free it.
uprv_free(fullName);
+ if (baseName == fullName) {
+ baseName = newFullName; // baseName should not point to freed memory.
+ }
}
fullName = newFullName;
status = U_ZERO_ERROR;

Просмотреть файл

@ -1,29 +0,0 @@
# https://unicode-org.atlassian.net/browse/ICU-21597
#
# https://github.com/unicode-org/icu/commit/b13be666cd354c4ff177906d779273d7cfc155c0.diff
diff --git a/intl/icu/source/common/locid.cpp b/intl/icu/source/common/locid.cpp
index 3c6e5b06690..4b7d21ee13d 100644
--- a/intl/icu/source/common/locid.cpp
+++ b/intl/icu/source/common/locid.cpp
@@ -1571,6 +1571,7 @@ AliasReplacer::replaceTransformedExtensions(
const char* tvalue = uprv_strchr(tkey, '-');
if (tvalue == nullptr) {
status = U_ILLEGAL_ARGUMENT_ERROR;
+ return false;
}
const char* nextTKey = ultag_getTKeyStart(tvalue);
if (nextTKey != nullptr) {
@@ -1591,8 +1592,11 @@ AliasReplacer::replaceTransformedExtensions(
}
const char* tfield = (const char*) tfields.elementAt(i);
const char* tvalue = uprv_strchr(tfield, '-');
+ if (tvalue == nullptr) {
+ status = U_ILLEGAL_ARGUMENT_ERROR;
+ return false;
+ }
// Split the "tkey-tvalue" pair string so that we can canonicalize the tvalue.
- U_ASSERT(tvalue != nullptr);
*((char*)tvalue++) = '\0'; // NULL terminate tkey
output.append(tfield, status).append('-', status);
const char* bcpTValue = ulocimp_toBcpType(tfield, tvalue, nullptr, nullptr);

Просмотреть файл

@ -54,15 +54,9 @@ for patch in \
suppress-warnings.diff \
bug-1198952-workaround-make-3.82-bug.diff \
bug-1614941-dsb-hsb-dates.diff \
bug-1636984-alias-append-items-sink.diff \
bug-1636984-display-name-fractional-seconds.diff \
bug-1636984-append-item-dayperiod-fractional-seconds.diff \
bug-1706949-wasi-workaround.diff \
bug-1714933-1-locale-unicode-keywords.diff \
bug-1714933-2-locale-basename-memory-leak.diff \
bug-1714933-3-locale-nullptr-deref.diff \
bug-1648137-clear-formatter-number.diff \
bug-1648137-non-finite-decimal.diff \
; do
echo "Applying local patch $patch"
patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch