ICU-21966 Cleanup -Wunused-but-set-variable
See #2055
diff --git a/icu4c/source/i18n/csrmbcs.cpp b/icu4c/source/i18n/csrmbcs.cpp
index 4c5bdfa..b9f268a 100644
--- a/icu4c/source/i18n/csrmbcs.cpp
+++ b/icu4c/source/i18n/csrmbcs.cpp
@@ -146,7 +146,6 @@
}
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 @@
if (iter.error) {
badCharCount++;
} else {
- if (iter.charValue <= 0xFF) {
- singleByteCharCount++;
- } else {
+ if (iter.charValue > 0xFF) {
doubleByteCharCount++;
if (commonChars != 0) {
diff --git a/icu4c/source/i18n/nfsubs.cpp b/icu4c/source/i18n/nfsubs.cpp
index 70ac18b..7e50a81 100644
--- a/icu4c/source/i18n/nfsubs.cpp
+++ b/icu4c/source/i18n/nfsubs.cpp
@@ -1310,10 +1310,8 @@
// 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) {
diff --git a/icu4c/source/i18n/transreg.cpp b/icu4c/source/i18n/transreg.cpp
index 726ad56..2d371f2 100644
--- a/icu4c/source/i18n/transreg.cpp
+++ b/icu4c/source/i18n/transreg.cpp
@@ -141,16 +141,10 @@
// 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);
}
diff --git a/icu4c/source/i18n/unesctrn.cpp b/icu4c/source/i18n/unesctrn.cpp
index 0636fe1..d57e9c8 100644
--- a/icu4c/source/i18n/unesctrn.cpp
+++ b/icu4c/source/i18n/unesctrn.cpp
@@ -175,13 +175,13 @@
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++];