mirror of
https://codeberg.org/guix/guix.git
synced 2026-01-25 03:55:08 -06:00
Suggested by Deltafire. * gnu/packages/patches/icu4c-icu-22132-fix-vtimezone.patch: Rename to... * gnu/packages/patches/icu4c-22132-standardize-vtzone-output.patch: ... this. * gnu/packages/patches/icu4c-20548-dateinterval-timezone.patch: New file. * gnu/packages/patches/icu4c-dayperiod-fractional-seconds.patch: New file. * gnu/packages/patches/icu4c-23069-rosh-hashanah-postponement.patch * gnu/packages/patches/icu4c-dtitvfmt-adopt-calendar.patch * gnu/packages/patches/icu4c-wasi-workaround.patch: New files. * gnu/packages/patches/icu4c-double-conversion.patch: New file. * gnu/local.mk (dist_patch_DATA): Update accordingly. * gnu/packages/icu4c.scm (icu4c-77) [source]: Apply patches. Fixes: #3166 Change-Id: I9ce64a81f763e5c9ff2940a2d844a0b44d2800a8
71 lines
2.8 KiB
Diff
71 lines
2.8 KiB
Diff
Retrieved from: <https://raw.githubusercontent.com/mozilla-firefox/firefox/refs/heads/main/intl/icu-patches/bug-1954138-dtitvfmt-adopt-calendar.diff>
|
|
|
|
diff --git a/source/i18n/dtitvfmt.cpp b/source/i18n/dtitvfmt.cpp
|
|
--- a/source/i18n/dtitvfmt.cpp
|
|
+++ b/source/i18n/dtitvfmt.cpp
|
|
@@ -631,16 +631,38 @@ DateIntervalFormat::getTimeZone() const
|
|
if (fDateFormat != nullptr) {
|
|
Mutex lock(&gFormatterMutex);
|
|
return fDateFormat->getTimeZone();
|
|
}
|
|
// If fDateFormat is nullptr (unexpected), create default timezone.
|
|
return *(TimeZone::createDefault());
|
|
}
|
|
|
|
+void DateIntervalFormat::adoptCalendar(Calendar *calendarToAdopt) {
|
|
+ if (fDateFormat != nullptr) {
|
|
+ fDateFormat->adoptCalendar(calendarToAdopt);
|
|
+ }
|
|
+
|
|
+ // The fDateFormat has the primary calendar for the DateIntervalFormat and has
|
|
+ // ownership of any adopted Calendar; fFromCalendar and fToCalendar are internal
|
|
+ // work clones of that calendar.
|
|
+
|
|
+ delete fFromCalendar;
|
|
+ fFromCalendar = nullptr;
|
|
+
|
|
+ delete fToCalendar;
|
|
+ fToCalendar = nullptr;
|
|
+
|
|
+ const Calendar *calendar = fDateFormat->getCalendar();
|
|
+ if (calendar != nullptr) {
|
|
+ fFromCalendar = calendar->clone();
|
|
+ fToCalendar = calendar->clone();
|
|
+ }
|
|
+}
|
|
+
|
|
void
|
|
DateIntervalFormat::setContext(UDisplayContext value, UErrorCode& status)
|
|
{
|
|
if (U_FAILURE(status))
|
|
return;
|
|
if (static_cast<UDisplayContextType>(static_cast<uint32_t>(value) >> 8) == UDISPCTX_TYPE_CAPITALIZATION) {
|
|
fCapitalizationContext = value;
|
|
} else {
|
|
diff --git a/source/i18n/unicode/dtitvfmt.h b/source/i18n/unicode/dtitvfmt.h
|
|
--- a/source/i18n/unicode/dtitvfmt.h
|
|
+++ b/source/i18n/unicode/dtitvfmt.h
|
|
@@ -637,16 +637,23 @@ public:
|
|
/**
|
|
* Sets the time zone for the calendar used by this DateIntervalFormat object.
|
|
* @param zone the new time zone.
|
|
* @stable ICU 4.8
|
|
*/
|
|
virtual void setTimeZone(const TimeZone& zone);
|
|
|
|
/**
|
|
+ * Sets the calendar used by this DateIntervalFormat object. The caller no longer owns
|
|
+ * the Calendar object and should not delete it after this call.
|
|
+ * @param calendarToAdopt the Calendar to be adopted.
|
|
+ */
|
|
+ virtual void adoptCalendar(Calendar *calendarToAdopt);
|
|
+
|
|
+ /**
|
|
* Set a particular UDisplayContext value in the formatter, such as
|
|
* UDISPCTX_CAPITALIZATION_FOR_STANDALONE. This causes the formatted
|
|
* result to be capitalized appropriately for the context in which
|
|
* it is intended to be used, considering both the locale and the
|
|
* type of field at the beginning of the formatted result.
|
|
* @param value The UDisplayContext value to set.
|
|
* @param status Input/output status. If at entry this indicates a failure
|
|
* status, the function will do nothing; otherwise this will be
|