| Index: source/i18n/msgfmt.cpp
|
| diff --git a/source/i18n/msgfmt.cpp b/source/i18n/msgfmt.cpp
|
| index 853a64ca4ba932fbd643570f5895b9df0f96c369..1fe2c8d622e04be9dfba3bb2fb6511a17f3d0530 100644
|
| --- a/source/i18n/msgfmt.cpp
|
| +++ b/source/i18n/msgfmt.cpp
|
| @@ -1,6 +1,6 @@
|
| /********************************************************************
|
| * COPYRIGHT:
|
| - * Copyright (c) 1997-2014, International Business Machines Corporation and
|
| + * Copyright (c) 1997-2015, International Business Machines Corporation and
|
| * others. All Rights Reserved.
|
| ********************************************************************
|
| *
|
| @@ -46,6 +46,7 @@
|
| #include "ustrfmt.h"
|
| #include "util.h"
|
| #include "uvector.h"
|
| +#include "visibledigits.h"
|
|
|
| // *****************************************************************************
|
| // class MessageFormat
|
| @@ -413,7 +414,7 @@ MessageFormat::operator==(const Format& rhs) const
|
| if (count != rhs_count) {
|
| return FALSE;
|
| }
|
| - int32_t idx = 0, rhs_idx = 0, pos = -1, rhs_pos = -1;
|
| + int32_t idx = 0, rhs_idx = 0, pos = UHASH_FIRST, rhs_pos = UHASH_FIRST;
|
| for (; idx < count && rhs_idx < rhs_count && U_SUCCESS(ec); ++idx, ++rhs_idx) {
|
| const UHashElement* cur = uhash_nextElement(customFormatArgStarts, &pos);
|
| const UHashElement* rhs_cur = uhash_nextElement(that.customFormatArgStarts, &rhs_pos);
|
| @@ -1332,7 +1333,7 @@ void MessageFormat::copyObjects(const MessageFormat& that, UErrorCode& ec) {
|
|
|
| const int32_t count = uhash_count(that.cachedFormatters);
|
| int32_t pos, idx;
|
| - for (idx = 0, pos = -1; idx < count && U_SUCCESS(ec); ++idx) {
|
| + for (idx = 0, pos = UHASH_FIRST; idx < count && U_SUCCESS(ec); ++idx) {
|
| const UHashElement* cur = uhash_nextElement(that.cachedFormatters, &pos);
|
| Format* newFormat = ((Format*)(cur->value.pointer))->clone();
|
| if (newFormat) {
|
| @@ -1350,7 +1351,7 @@ void MessageFormat::copyObjects(const MessageFormat& that, UErrorCode& ec) {
|
| }
|
| const int32_t count = uhash_count(that.customFormatArgStarts);
|
| int32_t pos, idx;
|
| - for (idx = 0, pos = -1; idx < count && U_SUCCESS(ec); ++idx) {
|
| + for (idx = 0, pos = UHASH_FIRST; idx < count && U_SUCCESS(ec); ++idx) {
|
| const UHashElement* cur = uhash_nextElement(that.customFormatArgStarts, &pos);
|
| uhash_iputi(customFormatArgStarts, cur->key.integer, cur->value.integer, &ec);
|
| }
|
| @@ -1955,8 +1956,12 @@ UnicodeString MessageFormat::PluralSelectorProvider::select(void *ctx, double nu
|
| context.formatter->format(context.number, context.numberString, ec);
|
| const DecimalFormat *decFmt = dynamic_cast<const DecimalFormat *>(context.formatter);
|
| if(decFmt != NULL) {
|
| - FixedDecimal dec = decFmt->getFixedDecimal(context.number, ec);
|
| - return rules->select(dec);
|
| + VisibleDigitsWithExponent digits;
|
| + decFmt->initVisibleDigitsWithExponent(context.number, digits, ec);
|
| + if (U_FAILURE(ec)) {
|
| + return UnicodeString(FALSE, OTHER_STRING, 5);
|
| + }
|
| + return rules->select(digits);
|
| } else {
|
| return rules->select(number);
|
| }
|
|
|