Bug 1927706 - Part 1: Remove ICU patch files. r=platform-i18n-reviewers,gregtatum

Remove files for patches which have been integrated upstream.

Differential Revision: https://phabricator.services.mozilla.com/D227165
This commit is contained in:
André Bargull 2024-10-31 09:43:22 +00:00
Родитель c0563a27ba
Коммит 35d599f022
5 изменённых файлов: 0 добавлений и 318 удалений

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

@ -1,201 +0,0 @@
# Support relative date formatting with UCONFIG_NO_BREAK_ITERATION
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-22260
diff --git a/intl/icu/source/i18n/reldatefmt.cpp b/intl/icu/source/i18n/reldatefmt.cpp
index 24d22a4b4b..6a0c9e65ef 100644
--- a/intl/icu/source/i18n/reldatefmt.cpp
+++ b/intl/icu/source/i18n/reldatefmt.cpp
@@ -12,7 +12,7 @@
#include "unicode/reldatefmt.h"
-#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION
+#if !UCONFIG_NO_FORMATTING
#include <cmath>
#include <functional>
@@ -761,6 +761,7 @@ RelativeDateTimeFormatter::RelativeDateTimeFormatter(UErrorCode& status) :
fStyle(UDAT_STYLE_LONG),
fContext(UDISPCTX_CAPITALIZATION_NONE),
fOptBreakIterator(nullptr) {
+ (void)fOptBreakIterator; // suppress unused field warning
init(nullptr, nullptr, status);
}
@@ -809,11 +810,16 @@ RelativeDateTimeFormatter::RelativeDateTimeFormatter(
return;
}
if (capitalizationContext == UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE) {
+#if !UCONFIG_NO_BREAK_ITERATION
BreakIterator *bi = BreakIterator::createSentenceInstance(locale, status);
if (U_FAILURE(status)) {
return;
}
init(nfToAdopt, bi, status);
+#else
+ status = U_UNSUPPORTED_ERROR;
+ return;
+#endif // !UCONFIG_NO_BREAK_ITERATION
} else {
init(nfToAdopt, nullptr, status);
}
@@ -832,9 +838,11 @@ RelativeDateTimeFormatter::RelativeDateTimeFormatter(
fCache->addRef();
fNumberFormat->addRef();
fPluralRules->addRef();
+#if !UCONFIG_NO_BREAK_ITERATION
if (fOptBreakIterator != nullptr) {
fOptBreakIterator->addRef();
}
+#endif // !UCONFIG_NO_BREAK_ITERATION
}
RelativeDateTimeFormatter& RelativeDateTimeFormatter::operator=(
@@ -843,7 +851,9 @@ RelativeDateTimeFormatter& RelativeDateTimeFormatter::operator=(
SharedObject::copyPtr(other.fCache, fCache);
SharedObject::copyPtr(other.fNumberFormat, fNumberFormat);
SharedObject::copyPtr(other.fPluralRules, fPluralRules);
+#if !UCONFIG_NO_BREAK_ITERATION
SharedObject::copyPtr(other.fOptBreakIterator, fOptBreakIterator);
+#endif // !UCONFIG_NO_BREAK_ITERATION
fStyle = other.fStyle;
fContext = other.fContext;
fLocale = other.fLocale;
@@ -861,9 +871,11 @@ RelativeDateTimeFormatter::~RelativeDateTimeFormatter() {
if (fPluralRules != nullptr) {
fPluralRules->removeRef();
}
+#if !UCONFIG_NO_BREAK_ITERATION
if (fOptBreakIterator != nullptr) {
fOptBreakIterator->removeRef();
}
+#endif // !UCONFIG_NO_BREAK_ITERATION
}
const NumberFormat& RelativeDateTimeFormatter::getNumberFormat() const {
@@ -1191,6 +1203,7 @@ UnicodeString& RelativeDateTimeFormatter::combineDateAndTime(
}
UnicodeString& RelativeDateTimeFormatter::adjustForContext(UnicodeString &str) const {
+#if !UCONFIG_NO_BREAK_ITERATION
if (fOptBreakIterator == nullptr
|| str.length() == 0 || !u_islower(str.char32At(0))) {
return str;
@@ -1204,25 +1217,36 @@ UnicodeString& RelativeDateTimeFormatter::adjustForContext(UnicodeString &str) c
fOptBreakIterator->get(),
fLocale,
U_TITLECASE_NO_LOWERCASE | U_TITLECASE_NO_BREAK_ADJUSTMENT);
+#endif // !UCONFIG_NO_BREAK_ITERATION
return str;
}
UBool RelativeDateTimeFormatter::checkNoAdjustForContext(UErrorCode& status) const {
+#if !UCONFIG_NO_BREAK_ITERATION
// This is unsupported because it's hard to keep fields in sync with title
// casing. The code could be written and tested if there is demand.
if (fOptBreakIterator != nullptr) {
status = U_UNSUPPORTED_ERROR;
return false;
}
+#else
+ (void)status; // suppress unused argument warning
+#endif // !UCONFIG_NO_BREAK_ITERATION
return true;
}
void RelativeDateTimeFormatter::init(
NumberFormat *nfToAdopt,
+#if !UCONFIG_NO_BREAK_ITERATION
BreakIterator *biToAdopt,
+#else
+ std::nullptr_t,
+#endif // !UCONFIG_NO_BREAK_ITERATION
UErrorCode &status) {
LocalPointer<NumberFormat> nf(nfToAdopt);
+#if !UCONFIG_NO_BREAK_ITERATION
LocalPointer<BreakIterator> bi(biToAdopt);
+#endif // !UCONFIG_NO_BREAK_ITERATION
UnifiedCache::getByLocale(fLocale, fCache, status);
if (U_FAILURE(status)) {
return;
@@ -1251,6 +1275,7 @@ void RelativeDateTimeFormatter::init(
nf.orphan();
SharedObject::copyPtr(shared, fNumberFormat);
}
+#if !UCONFIG_NO_BREAK_ITERATION
if (bi.isNull()) {
SharedObject::clearPtr(fOptBreakIterator);
} else {
@@ -1262,6 +1287,7 @@ void RelativeDateTimeFormatter::init(
bi.orphan();
SharedObject::copyPtr(shared, fOptBreakIterator);
}
+#endif // !UCONFIG_NO_BREAK_ITERATION
}
U_NAMESPACE_END
diff --git a/intl/icu/source/i18n/unicode/reldatefmt.h b/intl/icu/source/i18n/unicode/reldatefmt.h
index 4123468c65..5dc4905b12 100644
--- a/intl/icu/source/i18n/unicode/reldatefmt.h
+++ b/intl/icu/source/i18n/unicode/reldatefmt.h
@@ -248,8 +248,6 @@ typedef enum UDateDirection {
#endif // U_HIDE_DEPRECATED_API
} UDateDirection;
-#if !UCONFIG_NO_BREAK_ITERATION
-
U_NAMESPACE_BEGIN
class BreakIterator;
@@ -696,11 +694,19 @@ class U_I18N_API RelativeDateTimeFormatter : public UObject {
const SharedPluralRules *fPluralRules;
UDateRelativeDateTimeFormatterStyle fStyle;
UDisplayContext fContext;
+#if !UCONFIG_NO_BREAK_ITERATION
const SharedBreakIterator *fOptBreakIterator;
+#else
+ std::nullptr_t fOptBreakIterator = nullptr;
+#endif // !UCONFIG_NO_BREAK_ITERATION
Locale fLocale;
void init(
NumberFormat *nfToAdopt,
+#if !UCONFIG_NO_BREAK_ITERATION
BreakIterator *brkIter,
+#else
+ std::nullptr_t,
+#endif // !UCONFIG_NO_BREAK_ITERATION
UErrorCode &status);
UnicodeString& adjustForContext(UnicodeString &) const;
UBool checkNoAdjustForContext(UErrorCode& status) const;
@@ -743,7 +749,6 @@ class U_I18N_API RelativeDateTimeFormatter : public UObject {
U_NAMESPACE_END
-#endif /* !UCONFIG_NO_BREAK_ITERATION */
#endif /* !UCONFIG_NO_FORMATTING */
#endif /* U_SHOW_CPLUSPLUS_API */
diff --git a/intl/icu/source/i18n/unicode/ureldatefmt.h b/intl/icu/source/i18n/unicode/ureldatefmt.h
index 3c44890043..0882360d14 100644
--- a/intl/icu/source/i18n/unicode/ureldatefmt.h
+++ b/intl/icu/source/i18n/unicode/ureldatefmt.h
@@ -12,7 +12,7 @@
#include "unicode/utypes.h"
-#if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION
+#if !UCONFIG_NO_FORMATTING
#include "unicode/unum.h"
#include "unicode/udisplaycontext.h"
@@ -505,6 +505,6 @@ ureldatefmt_combineDateAndTime( const URelativeDateTimeFormatter* reldatefmt,
int32_t resultCapacity,
UErrorCode* status );
-#endif /* !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION */
+#endif /* !UCONFIG_NO_FORMATTING */
#endif
--
2.34.1

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

@ -1,47 +0,0 @@
# Allow to set the Gregorian change date for ISO8601 calendars.
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-22412
diff --git a/intl/icu/source/i18n/ucal.cpp b/intl/icu/source/i18n/ucal.cpp
--- a/intl/icu/source/i18n/ucal.cpp
+++ b/intl/icu/source/i18n/ucal.cpp
@@ -22,10 +22,11 @@
#include "unicode/ustring.h"
#include "unicode/strenum.h"
#include "unicode/localpointer.h"
#include "cmemory.h"
#include "cstring.h"
+#include "iso8601cal.h"
#include "ustrenum.h"
#include "uenumimp.h"
#include "ulist.h"
#include "ulocimp.h"
@@ -305,11 +306,12 @@ ucal_setGregorianChange(UCalendar *cal,
// We normally don't check "this" pointers for nullptr, but this here avoids
// compiler-generated exception-throwing code in case cal == nullptr.
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
- if(typeid(*cpp_cal) != typeid(GregorianCalendar)) {
+ if(typeid(*cpp_cal) != typeid(GregorianCalendar) &&
+ typeid(*cpp_cal) != typeid(ISO8601Calendar)) {
*pErrorCode = U_UNSUPPORTED_ERROR;
return;
}
gregocal->setGregorianChange(date, *pErrorCode);
}
@@ -327,11 +329,12 @@ ucal_getGregorianChange(const UCalendar
// We normally don't check "this" pointers for nullptr, but this here avoids
// compiler-generated exception-throwing code in case cal == nullptr.
*pErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
return (UDate)0;
}
- if(typeid(*cpp_cal) != typeid(GregorianCalendar)) {
+ if(typeid(*cpp_cal) != typeid(GregorianCalendar) &&
+ typeid(*cpp_cal) != typeid(ISO8601Calendar)) {
*pErrorCode = U_UNSUPPORTED_ERROR;
return (UDate)0;
}
return gregocal->getGregorianChange();
}

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

@ -1,27 +0,0 @@
# Increase the minimum limit for time zone offsets to -24 hours to support
# time zone offset strings like "-23:59".
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-22526
diff --git a/intl/icu/source/i18n/calendar.cpp b/intl/icu/source/i18n/calendar.cpp
--- a/intl/icu/source/i18n/calendar.cpp
+++ b/intl/icu/source/i18n/calendar.cpp
@@ -649,17 +649,17 @@ static const int32_t kCalendarLimits[UCA
{ 1, 1, 7, 7 }, // DAY_OF_WEEK
{/*N/A*/-1, /*N/A*/-1, /*N/A*/-1, /*N/A*/-1}, // DAY_OF_WEEK_IN_MONTH
{ 0, 0, 1, 1 }, // AM_PM
{ 0, 0, 11, 11 }, // HOUR
{ 0, 0, 23, 23 }, // HOUR_OF_DAY
{ 0, 0, 59, 59 }, // MINUTE
{ 0, 0, 59, 59 }, // SECOND
{ 0, 0, 999, 999 }, // MILLISECOND
- {-16*kOneHour, -16*kOneHour, 12*kOneHour, 30*kOneHour }, // ZONE_OFFSET
+ {-24*kOneHour, -16*kOneHour, 12*kOneHour, 30*kOneHour }, // ZONE_OFFSET
{ -1*kOneHour, -1*kOneHour, 2*kOneHour, 2*kOneHour }, // DST_OFFSET
{/*N/A*/-1, /*N/A*/-1, /*N/A*/-1, /*N/A*/-1}, // YEAR_WOY
{ 1, 1, 7, 7 }, // DOW_LOCAL
{/*N/A*/-1, /*N/A*/-1, /*N/A*/-1, /*N/A*/-1}, // EXTENDED_YEAR
{ -0x7F000000, -0x7F000000, 0x7F000000, 0x7F000000 }, // JULIAN_DAY
{ 0, 0, 24*kOneHour-1, 24*kOneHour-1 }, // MILLISECONDS_IN_DAY
{ 0, 0, 1, 1 }, // IS_LEAP_MONTH
{ 0, 0, 11, 11 } // ORDINAL_MONTH

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

@ -1,39 +0,0 @@
# Fix MacOS 14 default timezone issue
#
# ICU bug: https://unicode-org.atlassian.net/browse/ICU-22541
diff --git a/intl/icu/source/common/putil.cpp b/intl/icu/source/common/putil.cpp
--- a/intl/icu/source/common/putil.cpp
+++ b/intl/icu/source/common/putil.cpp
@@ -1170,16 +1170,31 @@ uprv_tzname(int n)
This is a trick to look at the name of the link to get the Olson ID
because the tzfile contents is underspecified.
This isn't guaranteed to work because it may not be a symlink.
*/
char *ret = realpath(TZDEFAULT, gTimeZoneBuffer);
if (ret != nullptr && uprv_strcmp(TZDEFAULT, gTimeZoneBuffer) != 0) {
int32_t tzZoneInfoTailLen = uprv_strlen(TZZONEINFOTAIL);
const char *tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
+ // MacOS14 has the realpath as something like
+ // /usr/share/zoneinfo.default/Australia/Melbourne
+ // which will not have "/zoneinfo/" in the path.
+ // Therefore if we fail, we fall back to read the link which is
+ // /var/db/timezone/zoneinfo/Australia/Melbourne
+ // We also fall back to reading the link if the realpath leads to something like
+ // /usr/share/zoneinfo/posixrules
+ if (tzZoneInfoTailPtr == nullptr ||
+ uprv_strcmp(tzZoneInfoTailPtr + tzZoneInfoTailLen, "posixrules") == 0) {
+ ssize_t size = readlink(TZDEFAULT, gTimeZoneBuffer, sizeof(gTimeZoneBuffer)-1);
+ if (size > 0) {
+ gTimeZoneBuffer[size] = 0;
+ tzZoneInfoTailPtr = uprv_strstr(gTimeZoneBuffer, TZZONEINFOTAIL);
+ }
+ }
if (tzZoneInfoTailPtr != nullptr) {
tzZoneInfoTailPtr += tzZoneInfoTailLen;
skipZoneIDPrefix(&tzZoneInfoTailPtr);
if (isValidOlsonID(tzZoneInfoTailPtr)) {
return (gTimeZoneBufferPtr = tzZoneInfoTailPtr);
}
}
} else {

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

@ -58,12 +58,8 @@ for patch in \
bug-1636984-append-item-dayperiod-fractional-seconds.diff \
bug-1706949-wasi-workaround.diff \
bug-1790071-ICU-22132-standardize-vtzone-output.diff \
bug-1838173-ICU-22412-start-time-iso8601.diff \
bug-1814862-ICU-22260.diff \
double-conversion.diff \
bug-1856428-ICU-22541.diff \
bug-1856290-ICU-20548-dateinterval-timezone.diff \
bug-1856291-ICU-22526-calendar-timezone-offset-limit.diff \
; do
echo "Applying local patch $patch"
patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch