]> granicus.if.org Git - icu/commitdiff
ICU-13529 Make some changes based on review feedback.
authorGeorge Rhoten <grhoten@users.noreply.github.com>
Fri, 16 Feb 2018 18:07:32 +0000 (18:07 +0000)
committerGeorge Rhoten <grhoten@users.noreply.github.com>
Fri, 16 Feb 2018 18:07:32 +0000 (18:07 +0000)
X-SVN-Rev: 40939

icu4c/source/i18n/nfrs.cpp
icu4c/source/i18n/nfrs.h
icu4c/source/i18n/nfrule.cpp
icu4c/source/i18n/nfrule.h
icu4c/source/i18n/nfsubs.cpp
icu4c/source/i18n/nfsubs.h
icu4c/source/test/intltest/itrbnf.cpp

index d5b368d42300b31410b1deb720151a054e22ac0c..e7b17b46c3a0566244f94ee28379ce35f3d35770 100644 (file)
@@ -681,7 +681,7 @@ static void dumpUS(FILE* f, const UnicodeString& us) {
 #endif
 
 UBool
-NFRuleSet::parse(const UnicodeString& text, ParsePosition& pos, double upperBound, int32_t nonNumericalExecutedRuleMask, Formattable& result) const
+NFRuleSet::parse(const UnicodeString& text, ParsePosition& pos, double upperBound, uint32_t nonNumericalExecutedRuleMask, Formattable& result) const
 {
     // try matching each rule in the rule set against the text being
     // parsed.  Whichever one matches the most characters is the one
index d4797e7ff5547e1ea539de37393f82e3647fc94f..db03c9039deda80aea78dc95509a204e492706ab 100644 (file)
@@ -55,7 +55,7 @@ public:
     void  format(int64_t number, UnicodeString& toAppendTo, int32_t pos, int32_t recursionCount, UErrorCode& status) const;
     void  format(double number, UnicodeString& toAppendTo, int32_t pos, int32_t recursionCount, UErrorCode& status) const;
 
-    UBool parse(const UnicodeString& text, ParsePosition& pos, double upperBound, int32_t nonNumericalExecutedRuleMask, Formattable& result) const;
+    UBool parse(const UnicodeString& text, ParsePosition& pos, double upperBound, uint32_t nonNumericalExecutedRuleMask, Formattable& result) const;
 
     void appendRules(UnicodeString& result) const; // toString
 
index f32ed5a747c057d1f6b84c86cba1ac0720d28329..c75ecf067052ec79abcfbb1ef649e66f5753d8b3 100644 (file)
@@ -900,7 +900,7 @@ NFRule::doParse(const UnicodeString& text,
                 ParsePosition& parsePosition,
                 UBool isFractionRule,
                 double upperBound,
-                int32_t nonNumericalExecutedRuleMask,
+                uint32_t nonNumericalExecutedRuleMask,
                 Formattable& resVal) const
 {
     // internally we operate on a copy of the string being parsed
@@ -1161,7 +1161,7 @@ NFRule::matchToDelimiter(const UnicodeString& text,
                          const UnicodeString& delimiter,
                          ParsePosition& pp,
                          const NFSubstitution* sub,
-                         int32_t nonNumericalExecutedRuleMask,
+                         uint32_t nonNumericalExecutedRuleMask,
                          double upperBound) const
 {
        UErrorCode status = U_ZERO_ERROR;
index 0fabe20237336a19ec13cbda5d0e1aa8cd6a3af1..698b75bb637531fa6d9559f6cd4dcd2c5a96e3f9 100644 (file)
@@ -74,7 +74,7 @@ public:
                   ParsePosition& pos, 
                   UBool isFractional, 
                   double upperBound,
-                  int32_t nonNumericalExecutedRuleMask,
+                  uint32_t nonNumericalExecutedRuleMask,
                   Formattable& result) const;
 
     UBool shouldRollBack(int64_t number) const;
@@ -95,7 +95,7 @@ private:
     int32_t indexOfAnyRulePrefix() const;
     double matchToDelimiter(const UnicodeString& text, int32_t startPos, double baseValue,
                             const UnicodeString& delimiter, ParsePosition& pp, const NFSubstitution* sub, 
-                            int32_t nonNumericalExecutedRuleMask,
+                            uint32_t nonNumericalExecutedRuleMask,
                             double upperBound) const;
     void stripPrefix(UnicodeString& text, const UnicodeString& prefix, ParsePosition& pp) const;
 
index ec9e9b873cb9a20947cb19d0249b302eddbbe378..4c17aa28186f29f3328d505aebf52275573e113e 100644 (file)
@@ -155,7 +155,7 @@ public:
         double baseValue,
         double upperBound,
         UBool lenientParse,
-        int32_t nonNumericalExecutedRuleMask,
+        uint32_t nonNumericalExecutedRuleMask,
         Formattable& result) const;
 
     virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const {
@@ -222,7 +222,7 @@ public:
         double baseValue,
         double upperBound,
         UBool lenientParse,
-        int32_t nonNumericalExecutedRuleMask,
+        uint32_t nonNumericalExecutedRuleMask,
         Formattable& result) const;
 
     virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue + oldRuleValue; }
@@ -294,7 +294,7 @@ public:
         double baseValue,
         double upperBound,
         UBool /*lenientParse*/,
-        int32_t nonNumericalExecutedRuleMask,
+        uint32_t nonNumericalExecutedRuleMask,
         Formattable& result) const;
 
     virtual double composeRuleValue(double newRuleValue, double oldRuleValue) const { return newRuleValue / oldRuleValue; }
@@ -692,7 +692,7 @@ NFSubstitution::doParse(const UnicodeString& text,
                         double baseValue,
                         double upperBound,
                         UBool lenientParse,
-                        int32_t nonNumericalExecutedRuleMask,
+                        uint32_t nonNumericalExecutedRuleMask,
                         Formattable& result) const
 {
 #ifdef RBNF_DEBUG
@@ -935,7 +935,7 @@ ModulusSubstitution::doParse(const UnicodeString& text,
                              double baseValue,
                              double upperBound,
                              UBool lenientParse,
-                             int32_t nonNumericalExecutedRuleMask,
+                             uint32_t nonNumericalExecutedRuleMask,
                              Formattable& result) const
 {
     // if this isn't a >>> substitution, we can just use the
@@ -1123,7 +1123,7 @@ FractionalPartSubstitution::doParse(const UnicodeString& text,
                 double baseValue,
                 double /*upperBound*/,
                 UBool lenientParse,
-                int32_t nonNumericalExecutedRuleMask,
+                uint32_t nonNumericalExecutedRuleMask,
                 Formattable& resVal) const
 {
     // if we're not in byDigits mode, we can just use the inherited
@@ -1255,7 +1255,7 @@ NumeratorSubstitution::doParse(const UnicodeString& text,
                                double baseValue,
                                double upperBound,
                                UBool /*lenientParse*/,
-                               int32_t nonNumericalExecutedRuleMask,
+                               uint32_t nonNumericalExecutedRuleMask,
                                Formattable& result) const
 {
     // we don't have to do anything special to do the parsing here,
index b8a5fc66198194c6217817e0f91281abf106d70e..948627c0cc9740b462835aebdfd9efbb87e5439b 100644 (file)
@@ -191,7 +191,7 @@ public:
         double baseValue,
         double upperBound, 
         UBool lenientParse,
-        int32_t nonNumericalExecutedRuleMask,
+        uint32_t nonNumericalExecutedRuleMask,
         Formattable& result) const;
     
     /**
index 719df6202aa1890460764f6c7cd43631f18d00bc..4689df40745a0134ddd1e736a6a73c2f0a9206f3 100644 (file)
@@ -2287,18 +2287,15 @@ void IntlTestRBNF::TestCompactDecimalFormatStyle() {
 void IntlTestRBNF::TestParseFailure() {
     UErrorCode status = U_ZERO_ERROR;
     RuleBasedNumberFormat rbnf(URBNF_SPELLOUT, Locale::getJapanese(), status);
-    static const char* testData[][1] = {
-        { "\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB\u30FB" },
-        { NULL }
+    static const UChar* testData[] = {
+        u"・・・・・・・・・・・・・・・・・・・・・・・・"
     };
-    for (int i = 0; testData[i][0]; ++i) {
-        const char* spelledNumber = testData[i][0]; // spelled-out number
-        
-        UnicodeString spelledNumberString = UnicodeString(spelledNumber).unescape();
+    for (int i = 0; i < UPRV_LENGTHOF(testData); ++i) {
+        UnicodeString spelledNumberString = UnicodeString(testData[i]).unescape();
         Formattable actualNumber;
         rbnf.parse(spelledNumberString, actualNumber, status);
         if (status != U_INVALID_FORMAT_ERROR) { // I would have expected U_PARSE_ERROR, but NumberFormat::parse gives U_INVALID_FORMAT_ERROR
-            errln("FAIL: string should be unparseable %s %s", spelledNumber, u_errorName(status));
+            errln("FAIL: string should be unparseable index=%d %s", i, u_errorName(status));
         }
     }
 }