Bug 853706 - Backported fix for formatting 0 with significant digits from ICU, and add a warning about this backported fix to update-icu.sh. r=jwalden
authorNorbert Lindenberg <mozilladev@lindenbergsoftware.com>
Tue, 16 Jul 2013 10:39:56 -0700
changeset 138717 107335e200360784dd5533df4bc7eed13fab9282
parent 138716 99217132cccc252a5fda615e73e963623c5fedea
child 138718 be7dfe6686b5d0131bbc1cd0dad3fcd6221b4f21
push id31101
push userjwalden@mit.edu
push dateTue, 16 Jul 2013 18:06:34 +0000
treeherdermozilla-inbound@703acacad625 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwalden
bugs853706
milestone25.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 853706 - Backported fix for formatting 0 with significant digits from ICU, and add a warning about this backported fix to update-icu.sh. r=jwalden
intl/icu/source/i18n/decimfmt.cpp
intl/update-icu.sh
--- a/intl/icu/source/i18n/decimfmt.cpp
+++ b/intl/icu/source/i18n/decimfmt.cpp
@@ -1709,16 +1709,24 @@ DecimalFormat::subformat(UnicodeString& 
             }
 
             // Output grouping separator if necessary.
             if (isGroupingPosition(i)) {
                 currentLength = appendTo.length();
                 appendTo.append(*grouping);
                 handler.addAttribute(kGroupingSeparatorField, currentLength, appendTo.length());
             }
+        } 
+
+        // This handles the special case of formatting 0. For zero only, we count the 
+        // zero to the left of the decimal point as one signficant digit. Ordinarily we 
+        // do not count any leading 0's as significant. If the number we are formatting 
+        // is not zero, then either sigCount or digits.getCount() will be non-zero. 
+        if (sigCount == 0 && digits.getCount() == 0) { 
+          sigCount = 1; 
         }
 
         // TODO(dlf): this looks like it was a bug, we marked the int field as ending
         // before the zero was generated.
         // Record field information for caller.
         // if (fieldPosition.getField() == NumberFormat::kIntegerField)
         //     fieldPosition.setEndIndex(appendTo.length());
 
--- a/intl/update-icu.sh
+++ b/intl/update-icu.sh
@@ -9,16 +9,25 @@
 # build with the Mozilla build tools for Windows. Check
 # http://bugs.icu-project.org/trac/ticket/9985
 # whether this has been addressed in the version you're updating to.
 # If not, obtain the patch "Make ICU build with Mozilla build for Windows" from
 # https://bugzilla.mozilla.org/show_bug.cgi?id=724533
 # and reapply it after running update-icu.sh (additional updates may be needed).
 # If the bug has been addressed, please delete this warning.
 
+# Warning
+# =======
+# The fix for ICU bug 10045 has been individually backported into this tree.
+# If you update ICU to a version that does not have this fix yet, obtain the
+# patch "Backported fix for formatting 0 with significant digits from ICU" from
+# https://bugzilla.mozilla.org/show_bug.cgi?id=853706
+# and reapply it after running update-icu.sh.
+# If you update ICU to a version that has the fix, please delete this warning.
+
 # Usage: update-icu.sh <URL of ICU SVN with release>
 # E.g., for ICU 50.1.1: update-icu.sh http://source.icu-project.org/repos/icu/icu/tags/release-50-1-1/
 
 if [ $# -lt 1 ]; then
   echo "Usage: update-icu.sh <URL of ICU SVN with release>"
   exit 1
 fi