]> granicus.if.org Git - icu/commitdiff
ICU-21966 Cleanup -Wunused-but-set-variable
authorFrank Yung-Fong Tang <ftang@chromium.org>
Tue, 29 Mar 2022 22:53:01 +0000 (22:53 +0000)
committerFrank Yung-Fong Tang <ftang@google.com>
Wed, 6 Apr 2022 19:51:46 +0000 (12:51 -0700)
See #2055

icu4c/source/i18n/csrmbcs.cpp
icu4c/source/i18n/nfsubs.cpp
icu4c/source/i18n/transreg.cpp
icu4c/source/i18n/unesctrn.cpp

index 4c5bdfa560baa306125822d73c5f29231c04118b..b9f268ab3f4a5cc5e4f7db9dfbb53602be52ced4 100644 (file)
@@ -146,7 +146,6 @@ CharsetRecog_mbcs::~CharsetRecog_mbcs()
 }
 
 int32_t CharsetRecog_mbcs::match_mbcs(InputText *det, const uint16_t commonChars[], int32_t commonCharsLen) const {
-    int32_t singleByteCharCount = 0;
     int32_t doubleByteCharCount = 0;
     int32_t commonCharCount     = 0;
     int32_t badCharCount        = 0;
@@ -160,9 +159,7 @@ int32_t CharsetRecog_mbcs::match_mbcs(InputText *det, const uint16_t commonChars
         if (iter.error) {
             badCharCount++;
         } else {
-            if (iter.charValue <= 0xFF) {
-                singleByteCharCount++;
-            } else {
+            if (iter.charValue > 0xFF) {
                 doubleByteCharCount++;
 
                 if (commonChars != 0) {
index 70ac18be4686358afb699e4d2cb5bb490c2c7fa4..7e50a81ca265285e6c4e850ca86778e4ede9fb9d 100644 (file)
@@ -1310,10 +1310,8 @@ NumeratorSubstitution::doParse(const UnicodeString& text,
         // compute the 'effective' base and prescale the value down
         int64_t n = result.getLong(status); // force conversion!
         int64_t d = 1;
-        int32_t pow = 0;
         while (d <= n) {
             d *= 10;
-            ++pow;
         }
         // now add the zeros
         while (zeroCount > 0) {
index 726ad56f0f6f20130f734b93a68996d568bbe264..2d371f27c37d6f0bf6f3e6468e47874306a00f01 100644 (file)
@@ -141,16 +141,10 @@ Transliterator* TransliteratorAlias::create(UParseError& pe,
             // to see whether there really are ID blocks at the beginning and end (by looking for U+FFFF, which
             // marks the position where an anonymous transliterator goes) and adjust accordingly
             int32_t anonymousRBTs = transes->size();
-            int32_t transCount = anonymousRBTs * 2 + 1;
-            if (!aliasesOrRules.isEmpty() && aliasesOrRules[0] == (UChar)(0xffff))
-                --transCount;
-            if (aliasesOrRules.length() >= 2 && aliasesOrRules[aliasesOrRules.length() - 1] == (UChar)(0xffff))
-                --transCount;
             UnicodeString noIDBlock((UChar)(0xffff));
             noIDBlock += ((UChar)(0xffff));
             int32_t pos = aliasesOrRules.indexOf(noIDBlock);
             while (pos >= 0) {
-                --transCount;
                 pos = aliasesOrRules.indexOf(noIDBlock, pos + 1);
             }
 
index 0636fe1d149b60003e1635f4fda134ccf90e9ff3..d57e9c84708f3620cfc130c301c9af4447a22066 100644 (file)
@@ -175,13 +175,13 @@ void UnescapeTransliterator::handleTransliterate(Replaceable& text, UTransPositi
                                                  UBool isIncremental) const {
     int32_t start = pos.start;
     int32_t limit = pos.limit;
-    int32_t i, j, ipat;
+    int32_t i, ipat;
 
     while (start < limit) {
         // Loop over the forms in spec[].  Exit this loop when we
         // match one of the specs.  Exit the outer loop if a
         // partial match is detected and isIncremental is true.
-        for (j=0, ipat=0; spec[ipat] != END; ++j) {
+        for (ipat=0; spec[ipat] != END;) {
 
             // Read the header
             int32_t prefixLen = spec[ipat++];