diff options
author | Moonchild <moonchild@palemoon.org> | 2021-03-31 15:41:38 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2021-03-31 15:41:38 +0000 |
commit | e07dee79c5daa6aebbf3014bcad822fa14fa7cfe (patch) | |
tree | 155bad3cd161ec6a054644c244424f3ad6d96b7a | |
parent | 685dafd7759e99afd09baa71dbe42f00543e28dc (diff) | |
download | uxp-e07dee79c5daa6aebbf3014bcad822fa14fa7cfe.tar.gz |
Issue #1756 - Clean up ICU patch.
We don't need ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS because we don't support any
ICU other than the one in-tree.
-rw-r--r-- | intl/icu-patches/unum_formatDoubleForFields.diff | 7 | ||||
-rw-r--r-- | intl/icu/source/i18n/unicode/unum.h | 5 | ||||
-rw-r--r-- | js/src/builtin/Intl.cpp | 26 |
3 files changed, 6 insertions, 32 deletions
diff --git a/intl/icu-patches/unum_formatDoubleForFields.diff b/intl/icu-patches/unum_formatDoubleForFields.diff index 75a684d4aa..148c7d2d97 100644 --- a/intl/icu-patches/unum_formatDoubleForFields.diff +++ b/intl/icu-patches/unum_formatDoubleForFields.diff @@ -23,7 +23,7 @@ diff --git a/intl/icu/source/i18n/unicode/unum.h b/intl/icu/source/i18n/unicode/ * <h2> Number Format C API </h2> * * Number Format C API Provides functions for -@@ -647,16 +648,67 @@ U_STABLE int32_t U_EXPORT2 +@@ -647,16 +648,66 @@ U_STABLE int32_t U_EXPORT2 unum_formatUFormattable(const UNumberFormat* fmt, const UFormattable *number, UChar *result, @@ -71,16 +71,15 @@ diff --git a/intl/icu/source/i18n/unicode/unum.h b/intl/icu/source/i18n/unicode/ +* @see unum_parseDouble +* @see UFieldPositionIterator +* @see UNumberFormatFields -+* @draft ICU 59 ++* @stable ICU 59 +*/ -+U_DRAFT int32_t U_EXPORT2 ++U_STABLE int32_t U_EXPORT2 +unum_formatDoubleForFields(const UNumberFormat* format, + double number, + UChar* result, + int32_t resultLength, + UFieldPositionIterator* fpositer, + UErrorCode* status); -+#define ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS + +/** * Parse a string into an integer using a UNumberFormat. diff --git a/intl/icu/source/i18n/unicode/unum.h b/intl/icu/source/i18n/unicode/unum.h index acc6abf8c5..8c37ec90ae 100644 --- a/intl/icu/source/i18n/unicode/unum.h +++ b/intl/icu/source/i18n/unicode/unum.h @@ -692,16 +692,15 @@ unum_formatUFormattable(const UNumberFormat* fmt, * @see unum_parseDouble * @see UFieldPositionIterator * @see UNumberFormatFields -* @draft ICU 59 +* @stable ICU 59 */ -U_DRAFT int32_t U_EXPORT2 +U_STABLE int32_t U_EXPORT2 unum_formatDoubleForFields(const UNumberFormat* format, double number, UChar* result, int32_t resultLength, UFieldPositionIterator* fpositer, UErrorCode* status); -#define ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS /** * Parse a string into an integer using a UNumberFormat. diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index 92dea5687e..5455b3a854 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -1202,23 +1202,11 @@ PartitionNumberPattern(JSContext* cx, UNumberFormat* nf, double* x, MOZ_ALWAYS_TRUE(formattedChars.resize(INITIAL_CHAR_BUFFER_SIZE)); UErrorCode status = U_ZERO_ERROR; -#if !defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) - MOZ_ASSERT(fpositer == nullptr, - "shouldn't be requesting field information from an ICU that " - "can't provide it"); -#endif - int32_t resultSize; -#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) resultSize = unum_formatDoubleForFields(nf, *x, Char16ToUChar(formattedChars.begin()), INITIAL_CHAR_BUFFER_SIZE, fpositer, &status); -#else - resultSize = - unum_formatDouble(nf, *x, Char16ToUChar(formattedChars.begin()), INITIAL_CHAR_BUFFER_SIZE, - nullptr, &status); -#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) if (status == U_BUFFER_OVERFLOW_ERROR) { if (!formattedChars.resize(size_t(resultSize))) return false; @@ -1226,13 +1214,8 @@ PartitionNumberPattern(JSContext* cx, UNumberFormat* nf, double* x, #ifdef DEBUG int32_t size = #endif -#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) unum_formatDoubleForFields(nf, *x, Char16ToUChar(formattedChars.begin()), resultSize, fpositer, &status); -#else - unum_formatDouble(nf, *x, Char16ToUChar(formattedChars.begin()), resultSize, - nullptr, &status); -#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) MOZ_ASSERT(size == resultSize); } if (U_FAILURE(status)) { @@ -1262,8 +1245,6 @@ intl_FormatNumber(JSContext* cx, UNumberFormat* nf, double x, MutableHandleValue using FieldType = ImmutablePropertyNamePtr JSAtomState::*; -#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) - static FieldType GetFieldTypeForNumberField(UNumberFormatFields fieldName, double d) { @@ -1658,8 +1639,6 @@ intl_FormatNumberToParts(JSContext* cx, UNumberFormat* nf, double x, MutableHand return true; } -#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) - bool js::intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp) { @@ -1699,12 +1678,9 @@ js::intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp) RootedValue result(cx); bool success; -#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) if (args[2].toBoolean()) { success = intl_FormatNumberToParts(cx, nf, d, &result); - } else -#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS) - { + } else { MOZ_ASSERT(!args[2].toBoolean(), "shouldn't be doing formatToParts without an ICU that " "supports it"); |