mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 16:47:29 +09:00
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.
This commit is contained in:
parent
bdcb9cc504
commit
4651d97342
3 changed files with 6 additions and 32 deletions
|
|
@ -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>
|
* <h2> Number Format C API </h2>
|
||||||
*
|
*
|
||||||
* Number Format C API Provides functions for
|
* 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,
|
unum_formatUFormattable(const UNumberFormat* fmt,
|
||||||
const UFormattable *number,
|
const UFormattable *number,
|
||||||
UChar *result,
|
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 unum_parseDouble
|
||||||
+* @see UFieldPositionIterator
|
+* @see UFieldPositionIterator
|
||||||
+* @see UNumberFormatFields
|
+* @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,
|
+unum_formatDoubleForFields(const UNumberFormat* format,
|
||||||
+ double number,
|
+ double number,
|
||||||
+ UChar* result,
|
+ UChar* result,
|
||||||
+ int32_t resultLength,
|
+ int32_t resultLength,
|
||||||
+ UFieldPositionIterator* fpositer,
|
+ UFieldPositionIterator* fpositer,
|
||||||
+ UErrorCode* status);
|
+ UErrorCode* status);
|
||||||
+#define ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS
|
|
||||||
+
|
+
|
||||||
+/**
|
+/**
|
||||||
* Parse a string into an integer using a UNumberFormat.
|
* Parse a string into an integer using a UNumberFormat.
|
||||||
|
|
|
||||||
|
|
@ -692,16 +692,15 @@ unum_formatUFormattable(const UNumberFormat* fmt,
|
||||||
* @see unum_parseDouble
|
* @see unum_parseDouble
|
||||||
* @see UFieldPositionIterator
|
* @see UFieldPositionIterator
|
||||||
* @see UNumberFormatFields
|
* @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,
|
unum_formatDoubleForFields(const UNumberFormat* format,
|
||||||
double number,
|
double number,
|
||||||
UChar* result,
|
UChar* result,
|
||||||
int32_t resultLength,
|
int32_t resultLength,
|
||||||
UFieldPositionIterator* fpositer,
|
UFieldPositionIterator* fpositer,
|
||||||
UErrorCode* status);
|
UErrorCode* status);
|
||||||
#define ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a string into an integer using a UNumberFormat.
|
* Parse a string into an integer using a UNumberFormat.
|
||||||
|
|
|
||||||
|
|
@ -1202,23 +1202,11 @@ PartitionNumberPattern(JSContext* cx, UNumberFormat* nf, double* x,
|
||||||
MOZ_ALWAYS_TRUE(formattedChars.resize(INITIAL_CHAR_BUFFER_SIZE));
|
MOZ_ALWAYS_TRUE(formattedChars.resize(INITIAL_CHAR_BUFFER_SIZE));
|
||||||
UErrorCode status = U_ZERO_ERROR;
|
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;
|
int32_t resultSize;
|
||||||
#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
|
||||||
resultSize =
|
resultSize =
|
||||||
unum_formatDoubleForFields(nf, *x,
|
unum_formatDoubleForFields(nf, *x,
|
||||||
Char16ToUChar(formattedChars.begin()), INITIAL_CHAR_BUFFER_SIZE,
|
Char16ToUChar(formattedChars.begin()), INITIAL_CHAR_BUFFER_SIZE,
|
||||||
fpositer, &status);
|
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 (status == U_BUFFER_OVERFLOW_ERROR) {
|
||||||
if (!formattedChars.resize(size_t(resultSize)))
|
if (!formattedChars.resize(size_t(resultSize)))
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -1226,13 +1214,8 @@ PartitionNumberPattern(JSContext* cx, UNumberFormat* nf, double* x,
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int32_t size =
|
int32_t size =
|
||||||
#endif
|
#endif
|
||||||
#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
|
||||||
unum_formatDoubleForFields(nf, *x, Char16ToUChar(formattedChars.begin()), resultSize,
|
unum_formatDoubleForFields(nf, *x, Char16ToUChar(formattedChars.begin()), resultSize,
|
||||||
fpositer, &status);
|
fpositer, &status);
|
||||||
#else
|
|
||||||
unum_formatDouble(nf, *x, Char16ToUChar(formattedChars.begin()), resultSize,
|
|
||||||
nullptr, &status);
|
|
||||||
#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
|
||||||
MOZ_ASSERT(size == resultSize);
|
MOZ_ASSERT(size == resultSize);
|
||||||
}
|
}
|
||||||
if (U_FAILURE(status)) {
|
if (U_FAILURE(status)) {
|
||||||
|
|
@ -1262,8 +1245,6 @@ intl_FormatNumber(JSContext* cx, UNumberFormat* nf, double x, MutableHandleValue
|
||||||
|
|
||||||
using FieldType = ImmutablePropertyNamePtr JSAtomState::*;
|
using FieldType = ImmutablePropertyNamePtr JSAtomState::*;
|
||||||
|
|
||||||
#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
|
||||||
|
|
||||||
static FieldType
|
static FieldType
|
||||||
GetFieldTypeForNumberField(UNumberFormatFields fieldName, double d)
|
GetFieldTypeForNumberField(UNumberFormatFields fieldName, double d)
|
||||||
{
|
{
|
||||||
|
|
@ -1658,8 +1639,6 @@ intl_FormatNumberToParts(JSContext* cx, UNumberFormat* nf, double x, MutableHand
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
js::intl_FormatNumber(JSContext* cx, unsigned argc, Value* vp)
|
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);
|
RootedValue result(cx);
|
||||||
|
|
||||||
bool success;
|
bool success;
|
||||||
#if defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
|
||||||
if (args[2].toBoolean()) {
|
if (args[2].toBoolean()) {
|
||||||
success = intl_FormatNumberToParts(cx, nf, d, &result);
|
success = intl_FormatNumberToParts(cx, nf, d, &result);
|
||||||
} else
|
} else {
|
||||||
#endif // defined(ICU_UNUM_HAS_FORMATDOUBLEFORFIELDS)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(!args[2].toBoolean(),
|
MOZ_ASSERT(!args[2].toBoolean(),
|
||||||
"shouldn't be doing formatToParts without an ICU that "
|
"shouldn't be doing formatToParts without an ICU that "
|
||||||
"supports it");
|
"supports it");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue