]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/number_affixutils.cpp
ICU-64260.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / number_affixutils.cpp
index 8da29a03d52d56c1512236aed1ceb260a2c36bea..3eb9c59bf4909006bcd724c7f8b38ac16a105b4c 100644 (file)
@@ -64,7 +64,7 @@ int32_t AffixUtils::estimateLength(const UnicodeString &patternString, UErrorCod
                 }
                 break;
             default:
-                U_ASSERT(false);
+                UPRV_UNREACHABLE;
         }
 
         offset += U16_LENGTH(cp);
@@ -131,34 +131,33 @@ UnicodeString AffixUtils::escape(const UnicodeString &input) {
 Field AffixUtils::getFieldForType(AffixPatternType type) {
     switch (type) {
         case TYPE_MINUS_SIGN:
-            return Field::UNUM_SIGN_FIELD;
+            return UNUM_SIGN_FIELD;
         case TYPE_PLUS_SIGN:
-            return Field::UNUM_SIGN_FIELD;
+            return UNUM_SIGN_FIELD;
         case TYPE_PERCENT:
-            return Field::UNUM_PERCENT_FIELD;
+            return UNUM_PERCENT_FIELD;
         case TYPE_PERMILLE:
-            return Field::UNUM_PERMILL_FIELD;
+            return UNUM_PERMILL_FIELD;
         case TYPE_CURRENCY_SINGLE:
-            return Field::UNUM_CURRENCY_FIELD;
+            return UNUM_CURRENCY_FIELD;
         case TYPE_CURRENCY_DOUBLE:
-            return Field::UNUM_CURRENCY_FIELD;
+            return UNUM_CURRENCY_FIELD;
         case TYPE_CURRENCY_TRIPLE:
-            return Field::UNUM_CURRENCY_FIELD;
+            return UNUM_CURRENCY_FIELD;
         case TYPE_CURRENCY_QUAD:
-            return Field::UNUM_CURRENCY_FIELD;
+            return UNUM_CURRENCY_FIELD;
         case TYPE_CURRENCY_QUINT:
-            return Field::UNUM_CURRENCY_FIELD;
+            return UNUM_CURRENCY_FIELD;
         case TYPE_CURRENCY_OVERFLOW:
-            return Field::UNUM_CURRENCY_FIELD;
+            return UNUM_CURRENCY_FIELD;
         default:
-            U_ASSERT(false);
-            return Field::UNUM_FIELD_COUNT; // suppress "control reaches end of non-void function"
+            UPRV_UNREACHABLE;
     }
 }
 
 int32_t
 AffixUtils::unescape(const UnicodeString &affixPattern, NumberStringBuilder &output, int32_t position,
-                     const SymbolProvider &provider, UErrorCode &status) {
+                     const SymbolProvider &provider, Field field, UErrorCode &status) {
     int32_t length = 0;
     AffixTag tag;
     while (hasNext(tag, affixPattern)) {
@@ -171,7 +170,7 @@ AffixUtils::unescape(const UnicodeString &affixPattern, NumberStringBuilder &out
             length += output.insert(
                     position + length, provider.getSymbol(tag.type), getFieldForType(tag.type), status);
         } else {
-            length += output.insertCodePoint(position + length, tag.codePoint, UNUM_FIELD_COUNT, status);
+            length += output.insertCodePoint(position + length, tag.codePoint, field, status);
         }
     }
     return length;
@@ -382,7 +381,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString,
                     return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0);
                 }
             default:
-                U_ASSERT(false);
+                UPRV_UNREACHABLE;
         }
     }
     // End of string
@@ -411,8 +410,7 @@ AffixTag AffixUtils::nextToken(AffixTag tag, const UnicodeString &patternString,
         case STATE_OVERFLOW_CURR:
             return makeTag(offset, TYPE_CURRENCY_OVERFLOW, STATE_BASE, 0);
         default:
-            U_ASSERT(false);
-            return {-1}; // suppress "control reaches end of non-void function"
+            UPRV_UNREACHABLE;
     }
 }