summaryrefslogtreecommitdiff
path: root/deps/icu-small/source/i18n/decimfmt.cpp
diff options
context:
space:
mode:
authorSteven R. Loomis <srloomis@us.ibm.com>2018-10-17 09:43:52 -0700
committerSteven R. Loomis <srloomis@us.ibm.com>2018-10-24 08:27:36 -0700
commit6786ff4d3688512d8b717ec24188818ac5493d0b (patch)
treeab18b7a66afee52420fe0bedf7b38eb93f671373 /deps/icu-small/source/i18n/decimfmt.cpp
parentd8f2d2726143ecfbf99b90b7bbbc6f41b3cd95fc (diff)
downloadandroid-node-v8-6786ff4d3688512d8b717ec24188818ac5493d0b.tar.gz
android-node-v8-6786ff4d3688512d8b717ec24188818ac5493d0b.tar.bz2
android-node-v8-6786ff4d3688512d8b717ec24188818ac5493d0b.zip
deps: icu 63.1 bump (CLDR 34)
- Full release notes: http://site.icu-project.org/download/63 Fixes: https://github.com/nodejs/node/issues/22344 PR-URL: https://github.com/nodejs/node/pull/23715 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'deps/icu-small/source/i18n/decimfmt.cpp')
-rw-r--r--deps/icu-small/source/i18n/decimfmt.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/deps/icu-small/source/i18n/decimfmt.cpp b/deps/icu-small/source/i18n/decimfmt.cpp
index a2638bb742..edd8910d9d 100644
--- a/deps/icu-small/source/i18n/decimfmt.cpp
+++ b/deps/icu-small/source/i18n/decimfmt.cpp
@@ -1057,12 +1057,19 @@ UBool DecimalFormat::areSignificantDigitsUsed() const {
void DecimalFormat::setSignificantDigitsUsed(UBool useSignificantDigits) {
// These are the default values from the old implementation.
+ if (useSignificantDigits) {
+ if (fields->properties->minimumSignificantDigits != -1 ||
+ fields->properties->maximumSignificantDigits != -1) {
+ return;
+ }
+ } else {
+ if (fields->properties->minimumSignificantDigits == -1 &&
+ fields->properties->maximumSignificantDigits == -1) {
+ return;
+ }
+ }
int32_t minSig = useSignificantDigits ? 1 : -1;
int32_t maxSig = useSignificantDigits ? 6 : -1;
- if (fields->properties->minimumSignificantDigits == minSig &&
- fields->properties->maximumSignificantDigits == maxSig) {
- return;
- }
fields->properties->minimumSignificantDigits = minSig;
fields->properties->maximumSignificantDigits = maxSig;
touchNoError();
@@ -1175,7 +1182,12 @@ void DecimalFormat::setPropertiesFromPattern(const UnicodeString& pattern, int32
}
const numparse::impl::NumberParserImpl* DecimalFormat::getParser(UErrorCode& status) const {
- if (U_FAILURE(status)) { return nullptr; }
+ // TODO: Move this into umutex.h? (similar logic also in numrange_fluent.cpp)
+ // See ICU-20146
+
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
// First try to get the pre-computed parser
auto* ptr = fields->atomicParser.load();
@@ -1185,13 +1197,17 @@ const numparse::impl::NumberParserImpl* DecimalFormat::getParser(UErrorCode& sta
// Try computing the parser on our own
auto* temp = NumberParserImpl::createParserFromProperties(*fields->properties, *fields->symbols, false, status);
+ if (U_FAILURE(status)) {
+ return nullptr;
+ }
if (temp == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
- // although we may still dereference, call sites should be guarded
+ return nullptr;
}
- // Note: ptr starts as nullptr; during compare_exchange, it is set to what is actually stored in the
- // atomic if another thread beat us to computing the parser object.
+ // Note: ptr starts as nullptr; during compare_exchange,
+ // it is set to what is actually stored in the atomic
+ // if another thread beat us to computing the parser object.
auto* nonConstThis = const_cast<DecimalFormat*>(this);
if (!nonConstThis->fields->atomicParser.compare_exchange_strong(ptr, temp)) {
// Another thread beat us to computing the parser