Bug 1418477 - Part 1. Should check error status of unum_open. r=jfkthame
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Wed, 22 Nov 2017 11:57:53 +0900
changeset 393387 adfc65d1acc67ea35d74d28a8aab7b7bc21bc4c5
parent 393386 a853772ccf73f120e80d3443cafd6d9f0a58400f
child 393388 b43f8e68097f8bee81221edb66cd3a5fba579b60
push id32959
push usertoros@mozilla.com
push dateThu, 23 Nov 2017 22:24:31 +0000
treeherdermozilla-central@b705100d6ca8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1418477
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1418477 - Part 1. Should check error status of unum_open. r=jfkthame We don't check error of unum_open, so we should check it. Because unum_setAttribute doesn't have UErrorCode parameter. MozReview-Commit-ID: 3j7jeiKbdG
intl/unicharutil/util/ICUUtils.cpp
--- a/intl/unicharutil/util/ICUUtils.cpp
+++ b/intl/unicharutil/util/ICUUtils.cpp
@@ -95,16 +95,22 @@ ICUUtils::LocalizeNumber(double aValue,
   UChar buffer[kBufferSize];
 
   nsAutoCString langTag;
   aLangTags.GetNext(langTag);
   while (!langTag.IsEmpty()) {
     UErrorCode status = U_ZERO_ERROR;
     AutoCloseUNumberFormat format(unum_open(UNUM_DECIMAL, nullptr, 0,
                                             langTag.get(), nullptr, &status));
+    // Since unum_setAttribute have no UErrorCode parameter, we have to
+    // check error status.
+    if (U_FAILURE(status)) {
+      aLangTags.GetNext(langTag);
+      continue;
+    }
     unum_setAttribute(format, UNUM_GROUPING_USED,
                       LocaleNumberGroupingIsEnabled());
     // ICU default is a maximum of 3 significant fractional digits. We don't
     // want that limit, so we set it to the maximum that a double can represent
     // (14-16 decimal fractional digits).
     unum_setAttribute(format, UNUM_MAX_FRACTION_DIGITS, 16);
     int32_t length = unum_formatDouble(format, aValue, buffer, kBufferSize,
                                        nullptr, &status);