mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1648137 - Part 16: Allow to format non-decimal number strings. r=platform-i18n-reviewers,dminor
Remove this Java compatibility restriction to be able to format ranges starting resp. ending at infinity. Differential Revision: https://phabricator.services.mozilla.com/D119756
This commit is contained in:
parent
982d8dbbbf
commit
cbc4b735a9
30
intl/icu-patches/bug-1648137-non-finite-decimal.diff
Normal file
30
intl/icu-patches/bug-1648137-non-finite-decimal.diff
Normal file
@ -0,0 +1,30 @@
|
||||
# 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 {
|
@ -180,12 +180,6 @@ void DecNum::_setTo(const char* str, int32_t maxDigits, UErrorCode& status) {
|
||||
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
|
||||
|
@ -62,6 +62,7 @@ for patch in \
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user