Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: source/i18n/visibledigits.cpp

Issue 2440913002: Update ICU to 58.1
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/i18n/visibledigits.h ('k') | source/i18n/vtzone.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/i18n/visibledigits.cpp
diff --git a/source/i18n/visibledigits.cpp b/source/i18n/visibledigits.cpp
index a6cbd0fdce276ee73a34bda6fdce5c20c94829d8..1fea3504dfeee8cfa4b619293d809cd850deb1d3 100644
--- a/source/i18n/visibledigits.cpp
+++ b/source/i18n/visibledigits.cpp
@@ -1,5 +1,7 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
- * Copyright (C) 2015, International Business Machines
+ * Copyright (C) 2016, International Business Machines
* Corporation and others. All Rights Reserved.
*
* file name: visibledigits.cpp
@@ -84,8 +86,11 @@ double VisibleDigits::computeAbsDoubleValue() const {
}
// stack allocate a decNumber to hold MAX_DBL_DIGITS+3 significant digits
- char rawNumber[sizeof(decNumber) + MAX_DBL_DIGITS+3];
- decNumber *numberPtr = (decNumber *) rawNumber;
+ struct {
+ decNumber decNum;
+ char digits[MAX_DBL_DIGITS+3];
+ } decNumberWithStorage;
+ decNumber *numberPtr = &decNumberWithStorage.decNum;
int32_t mostSig = fInterval.getMostSignificantExclusive();
int32_t mostSigNonZero = fExponent + fDigits.length();
@@ -109,15 +114,8 @@ double VisibleDigits::computeAbsDoubleValue() const {
char str[MAX_DBL_DIGITS+18];
uprv_decNumberToString(numberPtr, str);
U_ASSERT(uprv_strlen(str) < MAX_DBL_DIGITS+18);
- char decimalSeparator = DigitList::getStrtodDecimalSeparator();
- if (decimalSeparator != '.') {
- char *decimalPt = strchr(str, '.');
- if (decimalPt != NULL) {
- *decimalPt = decimalSeparator;
- }
- }
char *unused = NULL;
- return uprv_strtod(str, &unused);
+ return DigitList::decimalStrToDouble(str, &unused);
}
void VisibleDigits::getFixedDecimal(
@@ -165,7 +163,8 @@ void VisibleDigits::getFixedDecimal(
// f (decimal digits)
// skip over any leading 0's in fraction digits.
int32_t idx = -1;
- for (; idx >= -v && getDigitByExponent(idx) == 0; --idx);
+ for (; idx >= -v && getDigitByExponent(idx) == 0; --idx)
+ ;
// Only process up to first 18 non zero fraction digits for decimalDigits
// since that is all we can fit into an int64.
« no previous file with comments | « source/i18n/visibledigits.h ('k') | source/i18n/vtzone.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698