import cl @65785
diff --git a/i18n/decimfmt.cpp b/i18n/decimfmt.cpp
index dd2e809..00ac7a4 100644
--- a/i18n/decimfmt.cpp
+++ b/i18n/decimfmt.cpp
@@ -1320,12 +1320,11 @@
ParsePosition& parsePosition,
UBool parseCurrency) const {
bool resultAssigned;
- int scale;
DigitList digits;
- parse(text, resultAssigned, result, parsePosition, parseCurrency, digits, scale);
+ parse(text, resultAssigned, result, parsePosition, parseCurrency, digits);
if(!resultAssigned) {
- result.setDouble(digits.getDouble() / scale);
+ result.setDouble(digits.getDouble());
}
}
@@ -1344,17 +1343,14 @@
* @param parseCurrency if true, a currency amount is parsed;
* otherwise a Number is parsed
* @param digits The DigitList that represents the result will be returned
- * @param scale the scale with which the number in the DigitList
- * has to be scaled
- * ATTENTION: list and scale are only returned when result was not assigned
+ * ATTENTION: digits are only returned when result was not assigned
*/
void DecimalFormat::parse(const UnicodeString& text,
bool& resultAssigned,
Formattable& result,
ParsePosition& parsePosition,
UBool parseCurrency,
- DigitList& digits,
- int& scale) const {
+ DigitList& digits) const {
int32_t backup;
int32_t i = backup = parsePosition.getIndex();
@@ -1433,12 +1429,8 @@
else { // else handle the remainder
result.setDouble(((double)n) / mult);
}
- }/*
- else if (digits.fitsIntoDouble()) {
- result.setDouble(digits.getDouble() / mult);LOGI("fits into neither\n");
- }*/
+ }
else {
- scale = mult;
resultAssigned = false;
}
}
diff --git a/i18n/digitlst.cpp b/i18n/digitlst.cpp
index 83f84ca..10ee072 100644
--- a/i18n/digitlst.cpp
+++ b/i18n/digitlst.cpp
@@ -61,11 +61,6 @@
U_NAMESPACE_BEGIN
-// BEGIN android-added
-// capacity of a dynamically allocated fDecimalDigits buffer
-int fBufferSize = 0;
-// END android-added
-
// -------------------------------------
// default constructor
@@ -73,6 +68,7 @@
{
// BEGIN android-added
fDecimalDigits = fDecimalDigitsBuffer;
+ fBufferSize = MAX_DEC_DIGITS;
// END android-added
fDigits = fDecimalDigits + 1; // skip the decimal
clear();
@@ -107,6 +103,7 @@
{
// BEGIN android-added
fDecimalDigits = fDecimalDigitsBuffer;
+ fBufferSize = MAX_DEC_DIGITS;
// END android-added
fDigits = fDecimalDigits + 1; // skip the decimal
*this = other;
diff --git a/i18n/digitlst.h b/i18n/digitlst.h
index eae501c..653bfe6 100644
--- a/i18n/digitlst.h
+++ b/i18n/digitlst.h
@@ -261,9 +261,11 @@
inline void
DigitList::append(char digit)
{
+ // BEGIN android-changed
// Ignore digits which exceed the precision we can represent
- if (fCount < MAX_DIGITS)
+ if (fCount < fBufferSize)
fDigits[fCount++] = digit;
+ // END android-changed
}
#if 0
diff --git a/i18n/unicode/decimfmt.h b/i18n/unicode/decimfmt.h
index 92c96bf..cc10e19 100644
--- a/i18n/unicode/decimfmt.h
+++ b/i18n/unicode/decimfmt.h
@@ -978,8 +978,7 @@
Formattable& result,
ParsePosition& parsePosition,
UBool parseCurrency,
- DigitList& digits,
- int& scale) const;
+ DigitList& digits) const;
// END android-added
/**