]> granicus.if.org Git - icu/commitdiff
ICU-20043 ICU-13214 ICU-13764 MSVC W3 and W4 warning cleanup (#53)
authorDaniel Ju <41210545+daniel-ju@users.noreply.github.com>
Sat, 11 Aug 2018 01:05:58 +0000 (18:05 -0700)
committerShane Carr <shane@unicode.org>
Thu, 27 Sep 2018 21:27:38 +0000 (14:27 -0700)
Cleaned up all of the MSVC W3 warnings and most of the W4 warnings in the common and i18n projects.

93 files changed:
icu4c/source/common/bmpset.cpp
icu4c/source/common/charstr.cpp
icu4c/source/common/common.vcxproj
icu4c/source/common/dictbe.cpp
icu4c/source/common/edits.cpp
icu4c/source/common/loadednormalizer2impl.cpp
icu4c/source/common/locdspnm.cpp
icu4c/source/common/locid.cpp
icu4c/source/common/normalizer2impl.cpp
icu4c/source/common/normalizer2impl.h
icu4c/source/common/rbbi.cpp
icu4c/source/common/rbbi_cache.cpp
icu4c/source/common/rbbiscan.cpp
icu4c/source/common/rbbitblb.cpp
icu4c/source/common/serv.cpp
icu4c/source/common/stringtriebuilder.cpp
icu4c/source/common/ubidi.cpp
icu4c/source/common/ubiditransform.cpp
icu4c/source/common/ucnv2022.cpp
icu4c/source/common/ucnv_ct.cpp
icu4c/source/common/ucnv_u16.cpp
icu4c/source/common/ucnv_u32.cpp
icu4c/source/common/ucnv_u8.cpp
icu4c/source/common/ucnvhz.cpp
icu4c/source/common/ucnvmbcs.cpp
icu4c/source/common/ucnvsel.cpp
icu4c/source/common/ucurr.cpp
icu4c/source/common/uhash.cpp
icu4c/source/common/uloc.cpp
icu4c/source/common/uloc_keytype.cpp
icu4c/source/common/unames.cpp
icu4c/source/common/unicode/messagepattern.h
icu4c/source/common/unicode/stringtriebuilder.h
icu4c/source/common/unifiedcache.cpp
icu4c/source/common/uniset_props.cpp
icu4c/source/common/uprops.cpp
icu4c/source/common/uresbund.cpp
icu4c/source/common/uresdata.h
icu4c/source/common/ushape.cpp
icu4c/source/common/usprep.cpp
icu4c/source/common/ustrcase.cpp
icu4c/source/common/utext.cpp
icu4c/source/common/utrie2.cpp
icu4c/source/common/utrie2_builder.cpp
icu4c/source/common/wintz.cpp
icu4c/source/i18n/alphaindex.cpp
icu4c/source/i18n/anytrans.cpp
icu4c/source/i18n/coll.cpp
icu4c/source/i18n/collationkeys.cpp
icu4c/source/i18n/csrmbcs.cpp
icu4c/source/i18n/currpinf.cpp
icu4c/source/i18n/dcfmtsym.cpp
icu4c/source/i18n/dtfmtsym.cpp
icu4c/source/i18n/dtitvfmt.cpp
icu4c/source/i18n/dtitvinf.cpp
icu4c/source/i18n/dtptngen.cpp
icu4c/source/i18n/i18n.vcxproj
icu4c/source/i18n/measfmt.cpp
icu4c/source/i18n/msgfmt.cpp
icu4c/source/i18n/nfrule.cpp
icu4c/source/i18n/nfrule.h
icu4c/source/i18n/number_grouping.cpp
icu4c/source/i18n/number_multiplier.cpp
icu4c/source/i18n/number_multiplier.h
icu4c/source/i18n/number_patternmodifier.cpp
icu4c/source/i18n/number_patternmodifier.h
icu4c/source/i18n/olsontz.cpp
icu4c/source/i18n/plurrule.cpp
icu4c/source/i18n/rbnf.cpp
icu4c/source/i18n/rbt_pars.cpp
icu4c/source/i18n/region.cpp
icu4c/source/i18n/reldatefmt.cpp
icu4c/source/i18n/reldtfmt.cpp
icu4c/source/i18n/rematch.cpp
icu4c/source/i18n/rulebasedcollator.cpp
icu4c/source/i18n/scriptset.cpp
icu4c/source/i18n/smpdtfmt.cpp
icu4c/source/i18n/timezone.cpp
icu4c/source/i18n/transreg.cpp
icu4c/source/i18n/tzfmt.cpp
icu4c/source/i18n/tzgnames.cpp
icu4c/source/i18n/tznames.cpp
icu4c/source/i18n/tznames_impl.cpp
icu4c/source/i18n/ucol_res.cpp
icu4c/source/i18n/udat.cpp
icu4c/source/i18n/ulocdata.cpp
icu4c/source/i18n/unicode/measfmt.h
icu4c/source/i18n/unicode/rbnf.h
icu4c/source/i18n/unicode/region.h
icu4c/source/i18n/uregex.cpp
icu4c/source/i18n/usearch.cpp
icu4c/source/i18n/vtzone.cpp
icu4c/source/i18n/zonemeta.cpp

index 35bc80dce359eb90ffcdd968c209b3361c5e5f7f..bc79f5e5a63be1cacf4b142acde01bd39bba633e 100644 (file)
@@ -241,13 +241,13 @@ void BMPSet::overrideIllegal() {
             bmpBlockBits[i]|=bits;
         }
 
-        mask=~(0x10001<<0xd);   // Lead byte 0xED.
+        mask= static_cast<uint32_t>(~(0x10001<<0xd));   // Lead byte 0xED.
         bits=1<<0xd;
         for(i=32; i<64; ++i) {  // Second half of 4k block.
             bmpBlockBits[i]=(bmpBlockBits[i]&mask)|bits;
         }
     } else {
-        mask=~(0x10001<<0xd);   // Lead byte 0xED.
+        mask= static_cast<uint32_t>(~(0x10001<<0xd));   // Lead byte 0xED.
         for(i=32; i<64; ++i) {  // Second half of 4k block.
             bmpBlockBits[i]&=mask;
         }
index 353f1d52542fa250a4e7012da7fadcb4144023d4..0b785e9c01076594585211089110d93ae6ab1254 100644 (file)
@@ -79,7 +79,7 @@ CharString &CharString::append(const char *s, int32_t sLength, UErrorCode &error
         return *this;
     }
     if(sLength<0) {
-        sLength=uprv_strlen(s);
+        sLength= static_cast<int32_t>(uprv_strlen(s));
     }
     if(sLength>0) {
         if(s==(buffer.getAlias()+len)) {
index 0f501406fc06c4ac8782eb02b66e532f6bd48c28..99c4533a5738a7f195ed3fb1f5e36027dcb378f9 100644 (file)
@@ -2,7 +2,6 @@
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <!-- The following import will include the 'default' configuration options for VS projects. -->
   <Import Project="..\allinone\Build.Windows.ProjectConfiguration.props" />
-
   <PropertyGroup Label="Globals">
     <ProjectGuid>{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}</ProjectGuid>
   </PropertyGroup>
   <Import Project="$(SolutionDir)\Windows.CopyUnicodeHeaderFiles.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
index d8ae45c68260f363874750ba412c9f7cfea2e295..cdef79386982e99b4c96775ca2109623d3b20f75 100644 (file)
@@ -325,9 +325,9 @@ foundBest:
                         // two characters after uc were not 0x0E4C THANTHAKHAT before
                         // checking the dictionary. That is just a performance filter,
                         // but it's not clear it's faster than checking the trie.
-                        int32_t candidates = words[(wordsFound + 1) % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
+                        int32_t num_candidates = words[(wordsFound + 1) % THAI_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
                         utext_setNativeIndex(text, current + cuWordLength + chars);
-                        if (candidates > 0) {
+                        if (num_candidates > 0) {
                             break;
                         }
                     }
@@ -555,9 +555,9 @@ foundBest:
                     if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) {
                         // Maybe. See if it's in the dictionary.
                         // TODO: this looks iffy; compare with old code.
-                        int32_t candidates = words[(wordsFound + 1) % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
+                        int32_t num_candidates = words[(wordsFound + 1) % LAO_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
                         utext_setNativeIndex(text, current + cuWordLength + chars);
-                        if (candidates > 0) {
+                        if (num_candidates > 0) {
                             break;
                         }
                     }
@@ -748,9 +748,9 @@ foundBest:
                     if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) {
                         // Maybe. See if it's in the dictionary.
                         // TODO: this looks iffy; compare with old code.
-                        int32_t candidates = words[(wordsFound + 1) % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
+                        int32_t num_candidates = words[(wordsFound + 1) % BURMESE_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
                         utext_setNativeIndex(text, current + cuWordLength + chars);
-                        if (candidates > 0) {
+                        if (num_candidates > 0) {
                             break;
                         }
                     }
@@ -953,9 +953,9 @@ foundBest:
                     uc = utext_current32(text);
                     if (fEndWordSet.contains(pc) && fBeginWordSet.contains(uc)) {
                         // Maybe. See if it's in the dictionary.
-                        int32_t candidates = words[(wordsFound + 1) % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
+                        int32_t num_candidates = words[(wordsFound + 1) % KHMER_LOOKAHEAD].candidates(text, fDictionary, rangeEnd);
                         utext_setNativeIndex(text, current+cuWordLength+chars);
-                        if (candidates > 0) {
+                        if (num_candidates > 0) {
                             break;
                         }
                     }
index 3b3611fcf80cfec050c4342d0b7904d6d6570353..00a8d601a1cc80fbfcc46b7e1c677803e41511b8 100644 (file)
@@ -276,7 +276,7 @@ Edits &Edits::mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &error
         // ab deletions meet bc insertions at the same intermediate-string index.
         // Some users expect the bc insertions to come first, so we fetch from bc first.
         if (bc_bLength == 0) {
-            if (bcHasNext && (bcHasNext = bcIter.next(errorCode))) {
+            if (bcHasNext && (bcHasNext = bcIter.next(errorCode)) != 0) {
                 bc_bLength = bcIter.oldLength();
                 cLength = bcIter.newLength();
                 if (bc_bLength == 0) {
@@ -293,7 +293,7 @@ Edits &Edits::mergeAndAppend(const Edits &ab, const Edits &bc, UErrorCode &error
             // else see if the other iterator is done, too.
         }
         if (ab_bLength == 0) {
-            if (abHasNext && (abHasNext = abIter.next(errorCode))) {
+            if (abHasNext && (abHasNext = abIter.next(errorCode)) != 0) {
                 aLength = abIter.oldLength();
                 ab_bLength = abIter.newLength();
                 if (ab_bLength == 0) {
index 288a7d69536a57530c05a16ce4a1ecb85e0d8014..041d11853c41e7ab6389782b7f8f64eb6a4732a2 100644 (file)
@@ -247,7 +247,7 @@ Normalizer2::getInstance(const char *packageName,
                 }
                 void *temp=uhash_get(cache, name);
                 if(temp==NULL) {
-                    int32_t keyLength=uprv_strlen(name)+1;
+                    int32_t keyLength= static_cast<int32_t>(uprv_strlen(name)+1);
                     char *nameCopy=(char *)uprv_malloc(keyLength);
                     if(nameCopy==NULL) {
                         errorCode=U_MEMORY_ALLOCATION_ERROR;
index 6ceb6cfc8bc6537edae4351069a88714b8c24ddd..2d9389e910a2ab93c3de2b5d2acfe99d71fedf2c 100644 (file)
@@ -45,9 +45,9 @@ static int32_t ncat(char *buffer, uint32_t buflen, ...) {
   }
 
   va_start(args, buflen);
-  while ((str = va_arg(args, char *))) {
+  while ((str = va_arg(args, char *)) != 0) {
     char c;
-    while (p != e && (c = *str++)) {
+    while (p != e && (c = *str++) != 0) {
       *p++ = c;
     }
   }
@@ -98,7 +98,7 @@ ICUDataTable::ICUDataTable(const char* path, const Locale& locale)
     : path(NULL), locale(Locale::getRoot())
 {
   if (path) {
-    int32_t len = uprv_strlen(path);
+    int32_t len = static_cast<int32_t>(uprv_strlen(path));
     this->path = (const char*) uprv_malloc(len + 1);
     if (this->path) {
       uprv_strcpy((char *)this->path, path);
@@ -560,21 +560,21 @@ LocaleDisplayNamesImpl::adjustForUsageAndContext(CapContextUsage usage,
 }
 
 UnicodeString&
-LocaleDisplayNamesImpl::localeDisplayName(const Locale& locale,
+LocaleDisplayNamesImpl::localeDisplayName(const Locale& loc,
                                           UnicodeString& result) const {
-  if (locale.isBogus()) {
+  if (loc.isBogus()) {
     result.setToBogus();
     return result;
   }
   UnicodeString resultName;
 
-  const char* lang = locale.getLanguage();
+  const char* lang = loc.getLanguage();
   if (uprv_strlen(lang) == 0) {
     lang = "root";
   }
-  const char* script = locale.getScript();
-  const char* country = locale.getCountry();
-  const char* variant = locale.getVariant();
+  const char* script = loc.getScript();
+  const char* country = loc.getCountry();
+  const char* variant = loc.getVariant();
 
   UBool hasScript = uprv_strlen(script) > 0;
   UBool hasCountry = uprv_strlen(country) > 0;
@@ -630,14 +630,14 @@ LocaleDisplayNamesImpl::localeDisplayName(const Locale& locale,
   resultRemainder.findAndReplace(formatOpenParen, formatReplaceOpenParen);
   resultRemainder.findAndReplace(formatCloseParen, formatReplaceCloseParen);
 
-  LocalPointer<StringEnumeration> e(locale.createKeywords(status));
+  LocalPointer<StringEnumeration> e(loc.createKeywords(status));
   if (e.isValid() && U_SUCCESS(status)) {
     UnicodeString temp2;
     char value[ULOC_KEYWORD_AND_VALUES_CAPACITY]; // sigh, no ULOC_VALUE_CAPACITY
     const char* key;
     while ((key = e->next((int32_t *)0, status)) != NULL) {
       value[0] = 0;
-      locale.getKeywordValue(key, value, ULOC_KEYWORD_AND_VALUES_CAPACITY, status);
+      loc.getKeywordValue(key, value, ULOC_KEYWORD_AND_VALUES_CAPACITY, status);
       if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
         return result;
       }
index afc8b81ca26c5180f1adaaf039432a33bba77e63..d799f5dc9cc7383c6505beb108ceff855d6868fb 100644 (file)
@@ -552,7 +552,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
         /* after uloc_getName/canonicalize() we know that only '_' are separators */
         separator = field[0] = fullName;
         fieldIdx = 1;
-        while ((separator = uprv_strchr(field[fieldIdx-1], SEP_CHAR)) && fieldIdx < UPRV_LENGTHOF(field)-1) {
+        while ((separator = uprv_strchr(field[fieldIdx-1], SEP_CHAR)) != 0 && fieldIdx < UPRV_LENGTHOF(field)-1) {
             field[fieldIdx] = separator + 1;
             fieldLen[fieldIdx-1] = (int32_t)(separator - field[fieldIdx-1]);
             fieldIdx++;
@@ -659,7 +659,7 @@ Locale::initBaseName(UErrorCode &status) {
 int32_t
 Locale::hashCode() const
 {
-    return ustr_hashCharsN(fullName, uprv_strlen(fullName));
+    return ustr_hashCharsN(fullName, static_cast<int32_t>(uprv_strlen(fullName)));
 }
 
 void
index 15b4a52893477937cabd047ccac73ebdbf963262..eba0f03544a2d627585051944f12327b75ecba57 100644 (file)
@@ -122,7 +122,7 @@ int32_t getJamoTMinusBase(const uint8_t *src, const uint8_t *limit) {
             }
         } else if (src[1] == 0x87) {
             uint8_t t = src[2];
-            if ((int8_t)t <= (int8_t)0x82) {
+            if ((int8_t)t <= (int8_t)0x82u) {
                 return t - (0xa7 - 0x40);
             }
         }
@@ -422,20 +422,20 @@ Normalizer2Impl::~Normalizer2Impl() {
 void
 Normalizer2Impl::init(const int32_t *inIndexes, const UTrie2 *inTrie,
                       const uint16_t *inExtraData, const uint8_t *inSmallFCD) {
-    minDecompNoCP=inIndexes[IX_MIN_DECOMP_NO_CP];
-    minCompNoMaybeCP=inIndexes[IX_MIN_COMP_NO_MAYBE_CP];
-    minLcccCP=inIndexes[IX_MIN_LCCC_CP];
-
-    minYesNo=inIndexes[IX_MIN_YES_NO];
-    minYesNoMappingsOnly=inIndexes[IX_MIN_YES_NO_MAPPINGS_ONLY];
-    minNoNo=inIndexes[IX_MIN_NO_NO];
-    minNoNoCompBoundaryBefore=inIndexes[IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE];
-    minNoNoCompNoMaybeCC=inIndexes[IX_MIN_NO_NO_COMP_NO_MAYBE_CC];
-    minNoNoEmpty=inIndexes[IX_MIN_NO_NO_EMPTY];
-    limitNoNo=inIndexes[IX_LIMIT_NO_NO];
-    minMaybeYes=inIndexes[IX_MIN_MAYBE_YES];
-    U_ASSERT((minMaybeYes&7)==0);  // 8-aligned for noNoDelta bit fields
-    centerNoNoDelta=(minMaybeYes>>DELTA_SHIFT)-MAX_DELTA-1;
+    minDecompNoCP = static_cast<UChar>(inIndexes[IX_MIN_DECOMP_NO_CP]);
+    minCompNoMaybeCP = static_cast<UChar>(inIndexes[IX_MIN_COMP_NO_MAYBE_CP]);
+    minLcccCP = static_cast<UChar>(inIndexes[IX_MIN_LCCC_CP]);
+
+    minYesNo = static_cast<uint16_t>(inIndexes[IX_MIN_YES_NO]);
+    minYesNoMappingsOnly = static_cast<uint16_t>(inIndexes[IX_MIN_YES_NO_MAPPINGS_ONLY]);
+    minNoNo = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO]);
+    minNoNoCompBoundaryBefore = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO_COMP_BOUNDARY_BEFORE]);
+    minNoNoCompNoMaybeCC = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO_COMP_NO_MAYBE_CC]);
+    minNoNoEmpty = static_cast<uint16_t>(inIndexes[IX_MIN_NO_NO_EMPTY]);
+    limitNoNo = static_cast<uint16_t>(inIndexes[IX_LIMIT_NO_NO]);
+    minMaybeYes = static_cast<uint16_t>(inIndexes[IX_MIN_MAYBE_YES]);
+    U_ASSERT((minMaybeYes & 7) == 0);  // 8-aligned for noNoDelta bit fields
+    centerNoNoDelta = (minMaybeYes >> DELTA_SHIFT) - MAX_DELTA - 1;
 
     normTrie=inTrie;
 
index 9dd4d1e5ab188b699e72ec0ba54ca1929182e09e..8f187522ae1da8981c56c8fd39ee34fda6abe12b 100644 (file)
@@ -118,7 +118,7 @@ public:
             buffer[0]=(UChar)(JAMO_L_BASE+c/JAMO_V_COUNT);
             buffer[1]=(UChar)(JAMO_V_BASE+c%JAMO_V_COUNT);
         } else {
-            buffer[0]=orig-c2;  // LV syllable
+            buffer[0]=(UChar)(orig-c2);  // LV syllable
             buffer[1]=(UChar)(JAMO_T_BASE+c2);
         }
     }
index c5ea2770ba98549b34a6e65312d6b4c5b9449bdf..f7e82cb15d8f7db7d28953df29a971700424cc60 100644 (file)
@@ -628,7 +628,7 @@ int32_t RuleBasedBreakIterator::preceding(int32_t offset) {
     // or on a trail byte if the input is UTF-8.
 
     utext_setNativeIndex(&fText, offset);
-    int32_t adjustedOffset = utext_getNativeIndex(&fText);
+    int32_t adjustedOffset = static_cast<int32_t>(utext_getNativeIndex(&fText));
 
     UErrorCode status = U_ZERO_ERROR;
     fBreakCache->preceding(adjustedOffset, status);
@@ -655,7 +655,7 @@ UBool RuleBasedBreakIterator::isBoundary(int32_t offset) {
     // But we still need the side effect of leaving iteration at the following boundary.
 
     utext_setNativeIndex(&fText, offset);
-    int32_t adjustedOffset = utext_getNativeIndex(&fText);
+    int32_t adjustedOffset = static_cast<int32_t>(utext_getNativeIndex(&fText));
 
     bool result = false;
     UErrorCode status = U_ZERO_ERROR;
@@ -848,7 +848,7 @@ int32_t RuleBasedBreakIterator::handleNext() {
 
        #ifdef RBBI_DEBUG
             if (gTrace) {
-                RBBIDebugPrintf("             %4ld   ", utext_getNativeIndex(&fText));
+                RBBIDebugPrintf("             %4lld   ", utext_getNativeIndex(&fText));
                 if (0x20<=c && c<0x7f) {
                     RBBIDebugPrintf("\"%c\"  ", c);
                 } else {
index 60316ce6420dc5ecf5dc96ebbb5eebdd13059b5c..519c61049894e65c854f0514a2b64296eee262b6 100644 (file)
@@ -603,7 +603,7 @@ void RuleBasedBreakIterator::BreakCache::addFollowing(int32_t position, int32_t
         fStartBufIdx = modChunkSize(fStartBufIdx + 6);    // TODO: experiment. Probably revert to 1.
     }
     fBoundaries[nextIdx] = position;
-    fStatuses[nextIdx] = ruleStatusIdx;
+    fStatuses[nextIdx] = static_cast<uint16_t>(ruleStatusIdx);
     fEndBufIdx = nextIdx;
     if (update == UpdateCachePosition) {
         // Set current position to the newly added boundary.
@@ -631,7 +631,7 @@ bool RuleBasedBreakIterator::BreakCache::addPreceding(int32_t position, int32_t
         fEndBufIdx = modChunkSize(fEndBufIdx - 1);
     }
     fBoundaries[nextIdx] = position;
-    fStatuses[nextIdx] = ruleStatusIdx;
+    fStatuses[nextIdx] = static_cast<uint16_t>(ruleStatusIdx);
     fStartBufIdx = nextIdx;
     if (update == UpdateCachePosition) {
         fBufIdx = nextIdx;
index c82e1ea0315157938835063a48ee6c917cc298eb..f536ab5d39863c270e711d48e951858b48ae11c7 100644 (file)
@@ -380,7 +380,7 @@ UBool RBBIRuleScanner::doParseActions(int32_t action)
             // with the current rule expression (on the Node Stack)
             //  with the resulting OR expression going to *destRules
             //
-            RBBINode  *thisRule    = fNodeStack[fNodeStackPtr];
+                       thisRule    = fNodeStack[fNodeStackPtr];
             RBBINode  *prevRules   = *destRules;
             RBBINode  *orNode      = pushNewNode(RBBINode::opOr);
             if (U_FAILURE(*fRB->fStatus)) {
index 18da5231b97be5a061ddcdd82e3d6b7f0dcf95cb..a20b51777cda7adf209fe08fedc4d45aa5bd745c 100644 (file)
@@ -428,8 +428,8 @@ void RBBITableBuilder::calcChainedFollowPos(RBBINode *tree) {
     addRuleRootNodes(&ruleRootNodes, tree);
 
     UVector matchStartNodes(*fStatus);
-    for (int i=0; i<ruleRootNodes.size(); ++i) {
-        RBBINode *node = static_cast<RBBINode *>(ruleRootNodes.elementAt(i));
+    for (int j=0; j<ruleRootNodes.size(); ++j) {
+        RBBINode *node = static_cast<RBBINode *>(ruleRootNodes.elementAt(j));
         if (node->fChainIn) {
             setAdd(&matchStartNodes, node->fFirstPosSet);
         }
@@ -1082,21 +1082,22 @@ bool RBBITableBuilder::findDuplCharClassFrom(IntPair *categories) {
     int32_t numStates = fDStates->size();
     int32_t numCols = fRB->fSetBuilder->getNumCharCategories();
 
-    uint16_t table_base;
-    uint16_t table_dupl;
     for (; categories->first < numCols-1; categories->first++) {
         for (categories->second=categories->first+1; categories->second < numCols; categories->second++) {
-             for (int32_t state=0; state<numStates; state++) {
-                 RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state);
-                 table_base = (uint16_t)sd->fDtran->elementAti(categories->first);
-                 table_dupl = (uint16_t)sd->fDtran->elementAti(categories->second);
-                 if (table_base != table_dupl) {
-                     break;
-                 }
-             }
-             if (table_base == table_dupl) {
-                 return true;
-             }
+            // Initialized to different values to prevent returning true if numStates = 0 (implies no duplicates).
+            uint16_t table_base = 0;
+            uint16_t table_dupl = 1;
+            for (int32_t state=0; state<numStates; state++) {
+                RBBIStateDescriptor *sd = (RBBIStateDescriptor *)fDStates->elementAt(state);
+                table_base = (uint16_t)sd->fDtran->elementAti(categories->first);
+                table_dupl = (uint16_t)sd->fDtran->elementAti(categories->second);
+                if (table_base != table_dupl) {
+                    break;
+                }
+            }
+            if (table_base == table_dupl) {
+                return true;
+            }
         }
     }
     return false;
@@ -1236,7 +1237,7 @@ void RBBITableBuilder::removeSafeState(IntPair duplStates) {
             } else if (existingVal > duplState) {
                 newVal = existingVal - 1;
             }
-            sd->setCharAt(col, newVal);
+            sd->setCharAt(col, static_cast<char16_t>(newVal));
         }
     }
 }
@@ -1415,7 +1416,7 @@ void RBBITableBuilder::buildSafeReverseTable(UErrorCode &status) {
     UnicodeString &startState = *static_cast<UnicodeString *>(fSafeTable->elementAt(1));
     for (int32_t charClass=0; charClass < numCharClasses; ++charClass) {
         // Note: +2 for the start & stop state.
-        startState.setCharAt(charClass, charClass+2);
+        startState.setCharAt(charClass, static_cast<char16_t>(charClass+2));
     }
 
     // Initially make every other state table row look like the start state row,
index 959ab604c68d48629097cb3bef3c34cf7eccfcff..619e8c7c8bd38c9049b3de85f1323f5e4f529fe5 100644 (file)
@@ -702,9 +702,9 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
             }
 
             // fallback
-            UErrorCode status = U_ZERO_ERROR;
+            status = U_ZERO_ERROR;
             ICUServiceKey* fallbackKey = createKey(&id, status);
-            while (fallbackKey->fallback()) {
+            while (fallbackKey != NULL && fallbackKey->fallback()) {
                 UnicodeString us;
                 fallbackKey->currentID(us);
                 f = (ICUServiceFactory*)map->get(us);
index cf5b7b73ae2c1f23d6e99a37d3d14e88af49d5de..6f9cc2e5c22b55f8f0dba8b1354707e438a3cad1 100644 (file)
@@ -373,7 +373,7 @@ StringTrieBuilder::registerFinalValue(int32_t value, UErrorCode &errorCode) {
     return newNode;
 }
 
-UBool
+int32_t
 StringTrieBuilder::hashNode(const void *node) {
     return ((const Node *)node)->hashCode();
 }
index 531ed64cff6ec8a635fbd6a6f05a0e03cf0850d2..4b65d491859bfaa9616300d0b49b8f8b8c3f08e1 100644 (file)
@@ -624,7 +624,7 @@ getDirProps(UBiDi *pBiDi) {
         pBiDi->paras[pBiDi->paraCount-1].level=1;
     }
     if(isDefaultLevel) {
-        pBiDi->paraLevel=pBiDi->paras[0].level;
+        pBiDi->paraLevel=static_cast<UBiDiLevel>(pBiDi->paras[0].level);
     }
     /* The following is needed to resolve the text direction for default level
        paragraphs containing no strong character */
@@ -825,28 +825,28 @@ bracketProcessClosing(BracketData *bd, int32_t openIdx, int32_t position) {
        N0c1. */
 
     if((direction==0 && pOpening->flags&FOUND_L) ||
-       (direction==1 && pOpening->flags&FOUND_R)) { /* N0b */
-        newProp=direction;
+       (direction==1 && pOpening->flags&FOUND_R)) {                         /* N0b */
+        newProp=static_cast<DirProp>(direction);
     }
-    else if(pOpening->flags&(FOUND_L|FOUND_R)) {    /* N0c */
+    else if(pOpening->flags&(FOUND_L|FOUND_R)) {                            /* N0c */
         /* it is stable if there is no containing pair or in
            conditions too complicated and not worth checking */
         stable=(openIdx==pLastIsoRun->start);
         if(direction!=pOpening->contextDir)
-            newProp=pOpening->contextDir;           /* N0c1 */
+            newProp= static_cast<DirProp>(pOpening->contextDir);           /* N0c1 */
         else
-            newProp=direction;                      /* N0c2 */
+            newProp= static_cast<DirProp>(direction);                      /* N0c2 */
     } else {
         /* forget this and any brackets nested within this pair */
-        pLastIsoRun->limit=openIdx;
-        return ON;                                  /* N0d */
+        pLastIsoRun->limit= static_cast<uint16_t>(openIdx);
+        return ON;                                                          /* N0d */
     }
     bd->pBiDi->dirProps[pOpening->position]=newProp;
     bd->pBiDi->dirProps[position]=newProp;
     /* Update nested N0c pairs that may be affected */
     fixN0c(bd, openIdx, pOpening->position, newProp);
     if(stable) {
-        pLastIsoRun->limit=openIdx; /* forget any brackets nested within this pair */
+        pLastIsoRun->limit= static_cast<uint16_t>(openIdx); /* forget any brackets nested within this pair */
         /* remove lower located synonyms if any */
         while(pLastIsoRun->limit>pLastIsoRun->start &&
               bd->openings[pLastIsoRun->limit-1].position==pOpening->position)
@@ -918,7 +918,7 @@ bracketProcessChar(BracketData *bd, int32_t position) {
            bracket or it is a case of N0d */
         /* Now see if it is an opening bracket */
         if(c)
-            match=u_getBidiPairedBracket(c);    /* get the matching char */
+            match= static_cast<UChar>(u_getBidiPairedBracket(c));    /* get the matching char */
         else
             match=0;
         if(match!=c &&                  /* has a matching char */
@@ -948,7 +948,7 @@ bracketProcessChar(BracketData *bd, int32_t position) {
         pLastIsoRun->contextPos=position;
     }
     else if(dirProp<=R || dirProp==AL) {
-        newProp=DIR_FROM_STRONG(dirProp);
+        newProp= static_cast<DirProp>(DIR_FROM_STRONG(dirProp));
         pLastIsoRun->lastBase=dirProp;
         pLastIsoRun->lastStrong=dirProp;
         pLastIsoRun->contextDir=(UBiDiDirection)newProp;
@@ -1101,7 +1101,7 @@ resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
             else
                 start=pBiDi->paras[paraIndex-1].limit;
             limit=pBiDi->paras[paraIndex].limit;
-            level=pBiDi->paras[paraIndex].level;
+            level= static_cast<UBiDiLevel>(pBiDi->paras[paraIndex].level);
             for(i=start; i<limit; i++)
                 levels[i]=level;
         }
@@ -1119,7 +1119,7 @@ resolveExplicitLevels(UBiDi *pBiDi, UErrorCode *pErrorCode) {
             else
                 start=pBiDi->paras[paraIndex-1].limit;
             limit=pBiDi->paras[paraIndex].limit;
-            level=pBiDi->paras[paraIndex].level;
+            level= static_cast<UBiDiLevel>(pBiDi->paras[paraIndex].level);
             for(i=start; i<limit; i++) {
                 levels[i]=level;
                 dirProp=dirProps[i];
@@ -2827,7 +2827,7 @@ ubidi_setPara(UBiDi *pBiDi, const UChar *text, int32_t length,
         DirProp dirProp;
         for(i=0; i<pBiDi->paraCount; i++) {
             last=(pBiDi->paras[i].limit)-1;
-            level=pBiDi->paras[i].level;
+            level= static_cast<UBiDiLevel>(pBiDi->paras[i].level);
             if(level==0)
                 continue;           /* LTR paragraph */
             start= i==0 ? 0 : pBiDi->paras[i-1].limit;
index fd7b90fd37c7ce9f0f128b87f15bd09291d0bef1..e6d1d9c086dd74aad15c1fed230221b38f2fb280 100644 (file)
@@ -146,7 +146,7 @@ static UBool
 action_reorder(UBiDiTransform *pTransform, UErrorCode *pErrorCode)
 {
     ubidi_writeReordered(pTransform->pBidi, pTransform->dest, pTransform->destSize,
-            pTransform->reorderingOptions, pErrorCode);
+            static_cast<uint16_t>(pTransform->reorderingOptions), pErrorCode);
 
     *pTransform->pDestLength = pTransform->srcLength;
     pTransform->reorderingOptions = UBIDI_REORDER_DEFAULT;
@@ -393,9 +393,9 @@ resolveBaseDirection(const UChar *text, uint32_t length,
     switch (*pInLevel) {
         case UBIDI_DEFAULT_LTR:
         case UBIDI_DEFAULT_RTL: {
-            UBiDiLevel level = ubidi_getBaseDirection(text, length);
-            *pInLevel = level != UBIDI_NEUTRAL ? level
-                    : *pInLevel == UBIDI_DEFAULT_RTL ? RTL : LTR;
+            UBiDiLevel level = static_cast<UBiDiLevel>(ubidi_getBaseDirection(text, length));
+            *pInLevel = static_cast<UBiDiLevel>(level != UBIDI_NEUTRAL) ? level
+                    : *pInLevel == UBIDI_DEFAULT_RTL ? static_cast<UBiDiLevel>(RTL) : static_cast<UBiDiLevel>(LTR);
             break;
         }
         default:
index 2ef5db9775415232aef0ebbbbcb4a14dbdd3889f..d1a50d269f1b24bfd481b9dabc4d79c0616c1756 100644 (file)
@@ -2772,7 +2772,7 @@ getTrailByte:
                         /* report a pair of illegal bytes if the second byte is not a DBCS starter */
                         ++mySource;
                         /* add another bit so that the code below writes 2 bytes in case of error */
-                        mySourceChar = 0x10000 | (mySourceChar << 8) | trailByte;
+                        mySourceChar = static_cast<UChar>(0x10000 | (mySourceChar << 8) | trailByte);
                     }
                 } else {
                     args->converter->toUBytes[0] = (uint8_t)mySourceChar;
@@ -3304,7 +3304,7 @@ UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
                     myData->isEmptySegment = FALSE;    /* we are handling it, reset to avoid future spurious errors */
                     *err = U_ILLEGAL_ESCAPE_SEQUENCE;
                     args->converter->toUCallbackReason = UCNV_IRREGULAR;
-                    args->converter->toUBytes[0] = mySourceChar;
+                    args->converter->toUBytes[0] = static_cast<uint8_t>(mySourceChar);
                     args->converter->toULength = 1;
                     args->target = myTarget;
                     args->source = mySource;
index 51e31aa4116bd3817bc73320d1695e6d117848f0..b40e1b2c970e51c1aea820550cef1eaa21cc9ae9 100644 (file)
@@ -180,7 +180,7 @@ _CompoundTextgetName(const UConverter* cnv);
 
 
 static int32_t findNextEsc(const char *source, const char *sourceLimit) {
-    int32_t length = sourceLimit - source;
+    int32_t length = static_cast<int32_t>(sourceLimit - source);
     int32_t i;
     for (i = 1; i < length; i++) {
         if (*(source + i) == 0x1B) {
index 28f2727ecdf122df9f967d0bc2b2d683f382374a..a5e8367400ae69a81b1af614c001c4fa8de19dfe 100644 (file)
@@ -71,7 +71,7 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
 
     /* write the BOM if necessary */
     if(cnv->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
-        static const char bom[]={ (char)0xfe, (char)0xff };
+        static const char bom[]={ (char)0xfeu, (char)0xffu };
         ucnv_fromUWriteBytes(cnv,
                              bom, 2,
                              &pArgs->target, pArgs->targetLimit,
@@ -672,7 +672,7 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
 
     /* write the BOM if necessary */
     if(cnv->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
-        static const char bom[]={ (char)0xff, (char)0xfe };
+        static const char bom[]={ (char)0xffu, (char)0xfeu };
         ucnv_fromUWriteBytes(cnv,
                              bom, 2,
                              &pArgs->target, pArgs->targetLimit,
index 5777117a924d8adee5a1a44937cb9ed46e15bb5f..9f98914b9d734dd8bb1046bace2f5776596c7fca 100644 (file)
@@ -228,7 +228,7 @@ T_UConverter_fromUnicode_UTF32_BE(UConverterFromUnicodeArgs * args,
 
     /* write the BOM if necessary */
     if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
-        static const char bom[]={ 0, 0, (char)0xfe, (char)0xff };
+        static const char bom[]={ 0, 0, (char)0xfeu, (char)0xffu };
         ucnv_fromUWriteBytes(args->converter,
                              bom, 4,
                              &args->target, args->targetLimit,
@@ -331,7 +331,7 @@ T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
 
     /* write the BOM if necessary */
     if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
-        static const char bom[]={ 0, 0, (char)0xfe, (char)0xff };
+        static const char bom[]={ 0, 0, (char)0xfeu, (char)0xffu };
         ucnv_fromUWriteBytes(args->converter,
                              bom, 4,
                              &args->target, args->targetLimit,
@@ -706,7 +706,7 @@ T_UConverter_fromUnicode_UTF32_LE(UConverterFromUnicodeArgs * args,
 
     /* write the BOM if necessary */
     if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
-        static const char bom[]={ (char)0xff, (char)0xfe, 0, 0 };
+        static const char bom[]={ (char)0xffu, (char)0xfeu, 0, 0 };
         ucnv_fromUWriteBytes(args->converter,
                              bom, 4,
                              &args->target, args->targetLimit,
@@ -817,7 +817,7 @@ T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC(UConverterFromUnicodeArgs * args,
 
     /* write the BOM if necessary */
     if(args->converter->fromUnicodeStatus==UCNV_NEED_TO_WRITE_BOM) {
-        static const char bom[]={ (char)0xff, (char)0xfe, 0, 0 };
+        static const char bom[]={ (char)0xffu, (char)0xfeu, 0, 0 };
         ucnv_fromUWriteBytes(args->converter,
                              bom, 4,
                              &args->target, args->targetLimit,
@@ -1043,7 +1043,7 @@ _UTF32Open(UConverter *cnv,
     _UTF32Reset(cnv, UCNV_RESET_BOTH);
 }
 
-static const char utf32BOM[8]={ 0, 0, (char)0xfe, (char)0xff,    (char)0xff, (char)0xfe, 0, 0 };
+static const char utf32BOM[8]={ 0, 0, (char)0xfeu, (char)0xffu, (char)0xffu, (char)0xfeu, 0, 0 };
 
 static void U_CALLCONV
 _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
@@ -1071,7 +1071,7 @@ _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
             b=*source;
             if(b==0) {
                 state=1; /* could be 00 00 FE FF */
-            } else if(b==(char)0xff) {
+            } else if(b==(char)0xffu) {
                 state=5; /* could be FF FE 00 00 */
             } else {
                 state=8; /* default to UTF-32BE */
index 7089d9400c6e95a496162d4bbfcd7d6ab50a9b89..9b518e08df6785da63cd8629810e7e28504136e3 100644 (file)
@@ -108,7 +108,7 @@ morebytes:
                 if (mySource < sourceLimit)
                 {
                     toUBytes[i] = (char) (ch2 = *mySource);
-                    if (!icu::UTF8::isValidTrail(ch, ch2, i, inBytes) &&
+                    if (!icu::UTF8::isValidTrail(ch, static_cast<uint8_t>(ch2), i, inBytes) &&
                             !(isCESU8 && i == 1 && ch == 0xed && U8_IS_TRAIL(ch2)))
                     {
                         break; /* i < inBytes */
@@ -225,7 +225,7 @@ morebytes:
                 if (mySource < sourceLimit)
                 {
                     toUBytes[i] = (char) (ch2 = *mySource);
-                    if (!icu::UTF8::isValidTrail(ch, ch2, i, inBytes) &&
+                    if (!icu::UTF8::isValidTrail(ch, static_cast<uint8_t>(ch2), i, inBytes) &&
                             !(isCESU8 && i == 1 && ch == 0xed && U8_IS_TRAIL(ch2)))
                     {
                         break; /* i < inBytes */
index 79a83d759f182e94f178b59aa274b5de08b5bec5..e9f5206c16341cc45a791f9d83c59292abb27b9b 100644 (file)
@@ -199,7 +199,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
                         *err = U_ILLEGAL_ESCAPE_SEQUENCE;
                         args->converter->toUCallbackReason = UCNV_IRREGULAR;
                         args->converter->toUBytes[0] = UCNV_TILDE;
-                        args->converter->toUBytes[1] = mySourceChar;
+                        args->converter->toUBytes[1] = static_cast<uint8_t>(mySourceChar);
                         args->converter->toULength = 2;
                         args->target = myTarget;
                         args->source = mySource;
@@ -229,7 +229,7 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
                         --mySource;
                     } else {
                         /* Include the current byte in the illegal sequence. */
-                        args->converter->toUBytes[1] = mySourceChar;
+                        args->converter->toUBytes[1] = static_cast<uint8_t>(mySourceChar);
                         args->converter->toULength = 2;
                     }
                     args->target = myTarget;
index 2d0c857758d9bc93898eca2338b3a57e4e0b20d5..583744b73a30dc21f6c43b1518ab6ad48fe2a6e8 100644 (file)
@@ -4164,8 +4164,8 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
     nextSourceIndex=0;
 
     /* Get the SI/SO character for the converter */
-    siLength = getSISOBytes(SI, cnv->options, siBytes);
-    soLength = getSISOBytes(SO, cnv->options, soBytes);
+    siLength = static_cast<uint8_t>(getSISOBytes(SI, cnv->options, siBytes));
+    soLength = static_cast<uint8_t>(getSISOBytes(SO, cnv->options, soBytes));
 
     /* conversion loop */
     /*
index ba062b35ceca8b9b0f62b0cda8874aaa87b4a3e0..2b46d1c581be1d4b33baec2fff0733dcb3328803 100644 (file)
@@ -72,7 +72,7 @@ static void generateSelectorData(UConverterSelector* result,
   // set errorValue to all-ones
   for (int32_t col = 0; col < columns; col++) {
     upvec_setValue(upvec, UPVEC_ERROR_VALUE_CP, UPVEC_ERROR_VALUE_CP,
-                   col, ~0, ~0, status);
+                   col, static_cast<uint32_t>(~0), static_cast<uint32_t>(~0), status);
   }
 
   for (int32_t i = 0; i < result->encodingsCount; ++i) {
@@ -109,7 +109,7 @@ static void generateSelectorData(UConverterSelector* result,
         // this will be reached for the converters that fill the set with
         // strings. Those should be ignored by our system
       } else {
-        upvec_setValue(upvec, start_char, end_char, column, ~0, mask,
+        upvec_setValue(upvec, start_char, end_char, column, static_cast<uint32_t>(~0), mask,
                        status);
       }
     }
@@ -130,7 +130,7 @@ static void generateSelectorData(UConverterSelector* result,
       uset_getItem(excludedCodePoints, j, &start_char, &end_char, NULL, 0,
                    status);
       for (int32_t col = 0; col < columns; col++) {
-        upvec_setValue(upvec, start_char, end_char, col, ~0, ~0,
+        upvec_setValue(upvec, start_char, end_char, col, static_cast<uint32_t>(~0), static_cast<uint32_t>(~0),
                       status);
       }
     }
@@ -684,7 +684,7 @@ static int16_t countOnes(uint32_t* mask, int32_t len) {
       ent &= ent - 1; // clear the least significant bit set
     }
   }
-  return totalOnes;
+  return static_cast<int16_t>(totalOnes);
 }
 
 
index e9a09cc1799775888a0e66050811a039add18f5e..1062a9f3099777834b5bfc84791749b277916191 100644 (file)
@@ -1077,11 +1077,11 @@ collectCurrencyNames(const char* locale,
         }
 
         // currency plurals
-        UErrorCode ec3 = U_ZERO_ERROR;
-        UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, NULL, &ec3);
+        UErrorCode ec5 = U_ZERO_ERROR;
+        UResourceBundle* curr_p = ures_getByKey(rb, CURRENCYPLURALS, NULL, &ec5);
         n = ures_getSize(curr_p);
         for (int32_t i=0; i<n; ++i) {
-            UResourceBundle* names = ures_getByIndex(curr_p, i, NULL, &ec3);
+            UResourceBundle* names = ures_getByIndex(curr_p, i, NULL, &ec5);
             iso = (char*)ures_getKey(names);
             // Using hash to remove duplicated ISO codes in fallback chain.
             if (localeLevel == 0) {
@@ -1099,7 +1099,7 @@ collectCurrencyNames(const char* locale,
             for (int32_t j = 0; j < num; ++j) {
                 // TODO: remove duplicates between singular name and 
                 // currency long name?
-                s = ures_getStringByIndex(names, j, &len, &ec3);
+                s = ures_getStringByIndex(names, j, &len, &ec5);
                 (*currencyNames)[*total_currency_name_count].IsoCode = iso;
                 UChar* upperName = toUpperCase(s, len, locale);
                 (*currencyNames)[*total_currency_name_count].currencyName = upperName;
@@ -1449,7 +1449,7 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
     umtx_lock(&gCurrencyCacheMutex);
     // in order to handle racing correctly,
     // not putting 'search' in a separate function.
-    int8_t  found = -1;
+    int8_t found = -1;
     for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
         if (currCache[i]!= NULL &&
             uprv_strcmp(locale, currCache[i]->locale) == 0) {
@@ -1469,7 +1469,6 @@ getCacheEntry(const char* locale, UErrorCode& ec) {
         }
         umtx_lock(&gCurrencyCacheMutex);
         // check again.
-        int8_t  found = -1;
         for (int8_t i = 0; i < CURRENCY_NAME_CACHE_NUM; ++i) {
             if (currCache[i]!= NULL &&
                 uprv_strcmp(locale, currCache[i]->locale) == 0) {
index a80e7b8ff27b42822c89132c2de98cc6debecc20..239997d05d7e38b0abcdc51f66e67c06531fea42 100644 (file)
@@ -218,7 +218,7 @@ _uhash_allocate(UHashtable *hash,
 
     U_ASSERT(primeIndex >= 0 && primeIndex < PRIMES_LENGTH);
 
-    hash->primeIndex = primeIndex;
+    hash->primeIndex = static_cast<int8_t>(primeIndex);
     hash->length = PRIMES[primeIndex];
 
     p = hash->elements = (UHashElement*)
@@ -860,13 +860,13 @@ uhash_hashUChars(const UHashTok key) {
 U_CAPI int32_t U_EXPORT2
 uhash_hashChars(const UHashTok key) {
     const char *s = (const char *)key.pointer;
-    return s == NULL ? 0 : static_cast<int32_t>(ustr_hashCharsN(s, uprv_strlen(s)));
+    return s == NULL ? 0 : static_cast<int32_t>(ustr_hashCharsN(s, static_cast<int32_t>(uprv_strlen(s))));
 }
 
 U_CAPI int32_t U_EXPORT2
 uhash_hashIChars(const UHashTok key) {
     const char *s = (const char *)key.pointer;
-    return s == NULL ? 0 : ustr_hashICharsN(s, uprv_strlen(s));
+    return s == NULL ? 0 : ustr_hashICharsN(s, static_cast<int32_t>(uprv_strlen(s)));
 }
 
 U_CAPI UBool U_EXPORT2
index 7a1dc723cff619f82fd5b244dced43da1507ee0d..f7073fec31fb5f2dc9136a7287879ad143404a16 100644 (file)
@@ -1133,7 +1133,7 @@ uloc_setKeywordValue(const char* keywordName,
             keyValuePrefix = ';'; /* for any subsequent key-value pair */
             updatedKeysAndValues.append(localeKeywordNameBuffer, keyValueLen, *status);
             updatedKeysAndValues.append('=', *status);
-            updatedKeysAndValues.append(nextEqualsign, keyValueTail-nextEqualsign, *status);
+            updatedKeysAndValues.append(nextEqualsign, static_cast<int32_t>(keyValueTail-nextEqualsign), *status);
         }
         if (!nextSeparator && keywordValueLen > 0 && !handledInputKeyAndValue) {
             /* append new entry at the end, it sorts later than existing entries */
@@ -1500,7 +1500,7 @@ _deleteVariant(char* variants, int32_t variantsLen,
         }
         if (uprv_strncmp(variants, toDelete, toDeleteLen) == 0 &&
             (variantsLen == toDeleteLen ||
-             (flag=(variants[toDeleteLen] == '_'))))
+             (flag=(variants[toDeleteLen] == '_')) != 0))
         {
             int32_t d = toDeleteLen + (flag?1:0);
             variantsLen -= d;
@@ -2412,7 +2412,7 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult
         /* eat spaces prior to semi */
         for(t=(paramEnd-1);(paramEnd>s)&&isspace(*t);t--)
             ;
-        int32_t slen = ((t+1)-s);
+        int32_t slen = static_cast<int32_t>(((t+1)-s));
         if(slen > ULOC_FULLNAME_CAPACITY) {
           *status = U_BUFFER_OVERFLOW_ERROR;
           return -1; // too big
index 4eea504bc26b774494f499834307aaccdd23c121..b6f0752a7077b68d6fed567529ab95a023886f9d 100644 (file)
@@ -228,7 +228,7 @@ initFromResourceBundle(UErrorCode& sts) {
                     // a timezone key uses a colon instead of a slash in the resource.
                     // e.g. America:Los_Angeles
                     if (uprv_strchr(legacyTypeId, ':') != NULL) {
-                        int32_t legacyTypeIdLen = uprv_strlen(legacyTypeId);
+                        int32_t legacyTypeIdLen = static_cast<int32_t>(uprv_strlen(legacyTypeId));
                         char* legacyTypeIdBuf = (char*)uprv_malloc(legacyTypeIdLen + 1);
                         if (legacyTypeIdBuf == NULL) {
                             sts = U_MEMORY_ALLOCATION_ERROR;
@@ -320,7 +320,7 @@ initFromResourceBundle(UErrorCode& sts) {
                             if (isTZ) {
                                 // replace colon with slash if necessary
                                 if (uprv_strchr(from, ':') != NULL) {
-                                    int32_t fromLen = uprv_strlen(from);
+                                    int32_t fromLen = static_cast<int32_t>(uprv_strlen(from));
                                     char* fromBuf = (char*)uprv_malloc(fromLen + 1);
                                     if (fromBuf == NULL) {
                                         sts = U_MEMORY_ALLOCATION_ERROR;
@@ -472,7 +472,6 @@ isSpecialTypeRgKeyValue(const char* val) {
         p++;
     }
     return (subtagLen == 6);
-    return TRUE;
 }
 
 U_CFUNC const char*
index 6ad349c2e3bcfaacfd2018af92478f4149b13f62..9c230dc93ee2f3be2ebe3c0ae8a285e5841eff7b 100644 (file)
@@ -466,7 +466,7 @@ static uint16_t getExtName(uint32_t code, char *buffer, uint16_t bufferLength) {
         buffer[--i] = (v < 10 ? '0' + v : 'A' + v - 10);
     }
     buffer += ndigits;
-    length += ndigits;
+    length += static_cast<uint16_t>(ndigits);
     WRITE_CHAR(buffer, bufferLength, length, '>');
 
     return length;
index f28adafee0d2acd481ff40bb684855b68f7b2c3d..9f2a86551ca417dd8ab00a12189da062757b44ee 100644 (file)
@@ -771,8 +771,8 @@ public:
          * @stable ICU 4.8
          */
         UMessagePatternArgType getArgType() const {
-            UMessagePatternPartType type=getType();
-            if(type==UMSGPAT_PART_TYPE_ARG_START || type==UMSGPAT_PART_TYPE_ARG_LIMIT) {
+            UMessagePatternPartType msgType=getType();
+            if(msgType ==UMSGPAT_PART_TYPE_ARG_START || msgType ==UMSGPAT_PART_TYPE_ARG_LIMIT) {
                 return (UMessagePatternArgType)value;
             } else {
                 return UMSGPAT_ARG_TYPE_NONE;
index 15321b45dab81a17891e567ac25787b75b210316..fe99fdb41fdd4f5a3cb7ffff1eb3b2d06716fe93 100644 (file)
@@ -66,7 +66,7 @@ class U_COMMON_API StringTrieBuilder : public UObject {
 public:
 #ifndef U_HIDE_INTERNAL_API
     /** @internal */
-    static UBool hashNode(const void *node);
+    static int32_t hashNode(const void *node);
     /** @internal */
     static UBool equalNodes(const void *left, const void *right);
 #endif  /* U_HIDE_INTERNAL_API */
index f0f660ed06bb1939a4b57fa4d4cc753b1c0ff2c9..d33d8d2c01c0e510afdd5d53a9f7e53785a990a3 100644 (file)
@@ -251,7 +251,7 @@ UBool UnifiedCache::_flush(UBool all) const {
         if (all || _isEvictable(element)) {
             const SharedObject *sharedObject =
                     (const SharedObject *) element->value.pointer;
-            U_ASSERT(sharedObject->cachePtr = this);
+            U_ASSERT(sharedObject->cachePtr == this);
             uhash_removeElement(fHashtable, element);
             removeSoftRef(sharedObject);    // Deletes the sharedObject when softRefCount goes to zero.
             result = TRUE;
index 6ae6e71289b6d8b40959f0059707fee4192870a1..e9d9473c2cb7b762fd51566d8f7db49e93817baf 100644 (file)
@@ -1030,13 +1030,13 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop,
                     p == UCHAR_TRAIL_CANONICAL_COMBINING_CLASS ||
                     p == UCHAR_LEAD_CANONICAL_COMBINING_CLASS) {
                     char* end;
-                    double value = uprv_strtod(vname.data(), &end);
+                    double val = uprv_strtod(vname.data(), &end);
                     // Anything between 0 and 255 is valid even if unused.
                     // Cast double->int only after range check.
                     // We catch NaN here because comparing it with both 0 and 255 will be false
                     // (as are all comparisons with NaN).
-                    if (*end != 0 || !(0 <= value && value <= 255) ||
-                            (v = (int32_t)value) != value) {
+                    if (*end != 0 || !(0 <= val && val <= 255) ||
+                            (v = (int32_t)val) != val) {
                         // non-integral value or outside 0..255, or trailing junk
                         FAIL(ec);
                     }
@@ -1052,11 +1052,11 @@ UnicodeSet::applyPropertyAlias(const UnicodeString& prop,
             case UCHAR_NUMERIC_VALUE:
                 {
                     char* end;
-                    double value = uprv_strtod(vname.data(), &end);
+                    double val = uprv_strtod(vname.data(), &end);
                     if (*end != 0) {
                         FAIL(ec);
                     }
-                    applyFilter(numericValueFilter, &value, UPROPS_SRC_CHAR, ec);
+                    applyFilter(numericValueFilter, &val, UPROPS_SRC_CHAR, ec);
                     return *this;
                 }
             case UCHAR_NAME:
index 21723b32aa7c8d15691f3d5a94c8d562f281fb9c..3461c0b9228031c3517919928d76f34449098ee5 100644 (file)
@@ -56,7 +56,7 @@ static UBool defaultContains(const BinaryProperty &prop, UChar32 c, UProperty /*
 }
 
 static UBool caseBinaryPropertyContains(const BinaryProperty &/*prop*/, UChar32 c, UProperty which) {
-    return ucase_hasBinaryProperty(c, which);
+    return static_cast<UBool>(ucase_hasBinaryProperty(c, which));
 }
 
 static UBool isBidiControl(const BinaryProperty &/*prop*/, UChar32 c, UProperty /*which*/) {
index c51f7fdb64cc964c7750b8e1df7b540d8a4a96c1..2a8ec7292b4d41023e279c9dafe8c0f7485a2e6e 100644 (file)
@@ -2421,7 +2421,7 @@ ures_loc_nextLocale(UEnumeration* en,
     UResourceBundle *k = NULL;
     const char *result = NULL;
     int32_t len = 0;
-    if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status))) {
+    if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status)) != 0) {
         result = ures_getKey(k);
         len = (int32_t)uprv_strlen(result);
     }
@@ -2843,7 +2843,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
     valuesBuf[0]=0;
     valuesBuf[1]=0;
     
-    while((locale = uenum_next(locs, &locLen, status))) {
+    while((locale = uenum_next(locs, &locLen, status)) != 0) {
         UResourceBundle   *bund = NULL;
         UResourceBundle   *subPtr = NULL;
         UErrorCode subStatus = U_ZERO_ERROR; /* don't fail if a bundle is unopenable */
@@ -2868,7 +2868,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
             continue;
         }
         
-        while((subPtr = ures_getNextResource(&item,&subItem,&subStatus))
+        while((subPtr = ures_getNextResource(&item,&subItem,&subStatus)) != 0
             && U_SUCCESS(subStatus)) {
             const char *k;
             int32_t i;
index 8d845e3dfcfc8391bec08463dfd184afad1e7627..4e28ddccf63199a4dac23fb14dc73aba509b7f90 100644 (file)
@@ -475,7 +475,7 @@ U_NAMESPACE_BEGIN
 
 class ResourceDataValue : public ResourceValue {
 public:
-    ResourceDataValue() : pResData(NULL), res(URES_NONE) {}
+    ResourceDataValue() : pResData(NULL), res(static_cast<Resource>(URES_NONE)) {}
     virtual ~ResourceDataValue();
 
     void setData(const ResourceData *data) { pResData = data; }
index a640ae2907c264ac1d132ba244fd225d3d1f0721..ae13b5c11834c50e787d300e0f366d1b4b216a86 100644 (file)
@@ -1323,7 +1323,7 @@ shapeUnicode(UChar *dest, int32_t sourceLength,
                         /* to ensure the array index is within the range */
                         U_ASSERT(dest[i] >= 0x064Bu
                             && dest[i]-0x064Bu < UPRV_LENGTHOF(IrrelevantPos));
-                        dest[i] =  0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + Shape;
+                        dest[i] =  0xFE70 + IrrelevantPos[(dest[i] - 0x064B)] + static_cast<UChar>(Shape);
                     }
                 }else if ((currLink & APRESENT) > 0) {
                     dest[i] = (UChar)(0xFB50 + (currLink >> 8) + Shape);
index 067ecfe7cfcb129ad001fc99bb32ada32d5ab7b7..1af1d07490a9bc3aa8a4bc582e020a2d210bed42 100644 (file)
@@ -351,9 +351,9 @@ usprep_getProfile(const char* path,
         LocalMemory<char> keyName;
         LocalMemory<char> keyPath;
         if( key.allocateInsteadAndReset() == NULL ||
-            keyName.allocateInsteadAndCopy(uprv_strlen(name)+1) == NULL ||
+            keyName.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(name)+1)) == NULL ||
             (path != NULL &&
-             keyPath.allocateInsteadAndCopy(uprv_strlen(path)+1) == NULL)
+             keyPath.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(path)+1)) == NULL)
          ) {
             *status = U_MEMORY_ALLOCATION_ERROR;
             usprep_unload(newProfile.getAlias());
index 978bd3b7b8618e1f8030b3fadef01cfd62568d17..618e847c65d5a66c428bd9dac31d0559f3c8ce06 100644 (file)
@@ -218,7 +218,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options,
     int32_t srcIndex = srcStart;
     for (;;) {
         // fast path for simple cases
-        UChar lead;
+        UChar lead = 0;
         while (srcIndex < srcLimit) {
             lead = src[srcIndex];
             int32_t delta;
@@ -238,7 +238,7 @@ int32_t toLower(int32_t caseLocale, uint32_t options,
                     continue;
                 }
             }
-            lead += delta;
+            lead += static_cast<UChar>(delta);
             destIndex = appendUnchanged(dest, destIndex, destCapacity,
                                         src + prev, srcIndex - 1 - prev, options, edits);
             if (destIndex >= 0) {
@@ -313,7 +313,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options,
     int32_t srcIndex = 0;
     for (;;) {
         // fast path for simple cases
-        UChar lead;
+        UChar lead = 0;
         while (srcIndex < srcLength) {
             lead = src[srcIndex];
             int32_t delta;
@@ -333,7 +333,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t options,
                     continue;
                 }
             }
-            lead += delta;
+            lead += static_cast<UChar>(delta);
             destIndex = appendUnchanged(dest, destIndex, destCapacity,
                                         src + prev, srcIndex - 1 - prev, options, edits);
             if (destIndex >= 0) {
@@ -1747,8 +1747,8 @@ static int32_t _cmpFold(
     }
 
     if(matchLen1) {
-        *matchLen1=m1-org1;
-        *matchLen2=m2-org2;
+        *matchLen1=static_cast<int32_t>(m1-org1);
+        *matchLen2=static_cast<int32_t>(m2-org2);
     }
     return cmpRes;
 }
index a2c9008abf668d56c9bb29582ae79192a3e8c6ea..6f579bd4f2732fd0ec20df824cc3d0d370e9c485 100644 (file)
@@ -1196,9 +1196,9 @@ fillForward:
         // Swap the UText buffers.
         //  We want to fill what was previously the alternate buffer,
         //  and make what was the current buffer be the new alternate.
-        UTF8Buf *u8b = (UTF8Buf *)ut->q;
+        UTF8Buf *u8b_swap = (UTF8Buf *)ut->q;
         ut->q = ut->p;
-        ut->p = u8b;
+        ut->p = u8b_swap;
 
         int32_t strLen = ut->b;
         UBool   nulTerminated = FALSE;
@@ -1207,9 +1207,9 @@ fillForward:
             nulTerminated = TRUE;
         }
 
-        UChar   *buf = u8b->buf;
-        uint8_t *mapToNative  = u8b->mapToNative;
-        uint8_t *mapToUChars  = u8b->mapToUChars;
+        UChar   *buf = u8b_swap->buf;
+        uint8_t *mapToNative  = u8b_swap->mapToNative;
+        uint8_t *mapToUChars  = u8b_swap->mapToUChars;
         int32_t  destIx       = 0;
         int32_t  srcIx        = ix;
         UBool    seenNonAscii = FALSE;
@@ -1230,7 +1230,7 @@ fillForward:
                 // General case, handle everything.
                 if (seenNonAscii == FALSE) {
                     seenNonAscii = TRUE;
-                    u8b->bufNILimit = destIx;
+                    u8b_swap->bufNILimit = destIx;
                 }
 
                 int32_t  cIx      = srcIx;
@@ -1263,22 +1263,22 @@ fillForward:
         mapToUChars[srcIx - ix] = (uint8_t)destIx;
 
         //  fill in Buffer descriptor
-        u8b->bufNativeStart     = ix;
-        u8b->bufNativeLimit     = srcIx;
-        u8b->bufStartIdx        = 0;
-        u8b->bufLimitIdx        = destIx;
+        u8b_swap->bufNativeStart     = ix;
+        u8b_swap->bufNativeLimit     = srcIx;
+        u8b_swap->bufStartIdx        = 0;
+        u8b_swap->bufLimitIdx        = destIx;
         if (seenNonAscii == FALSE) {
-            u8b->bufNILimit     = destIx;
+            u8b_swap->bufNILimit     = destIx;
         }
-        u8b->toUCharsMapStart   = u8b->bufNativeStart;
+        u8b_swap->toUCharsMapStart   = u8b_swap->bufNativeStart;
 
         // Set UText chunk to refer to this buffer.
         ut->chunkContents       = buf;
         ut->chunkOffset         = 0;
-        ut->chunkLength         = u8b->bufLimitIdx;
-        ut->chunkNativeStart    = u8b->bufNativeStart;
-        ut->chunkNativeLimit    = u8b->bufNativeLimit;
-        ut->nativeIndexingLimit = u8b->bufNILimit;
+        ut->chunkLength         = u8b_swap->bufLimitIdx;
+        ut->chunkNativeStart    = u8b_swap->bufNativeStart;
+        ut->chunkNativeLimit    = u8b_swap->bufNativeLimit;
+        ut->nativeIndexingLimit = u8b_swap->bufNILimit;
 
         // For zero terminated strings, keep track of the maximum point
         //   scanned so far.
@@ -1311,13 +1311,13 @@ fillReverse:
         // Swap the UText buffers.
         //  We want to fill what was previously the alternate buffer,
         //  and make what was the current buffer be the new alternate.
-        UTF8Buf *u8b = (UTF8Buf *)ut->q;
+        UTF8Buf *u8b_swap = (UTF8Buf *)ut->q;
         ut->q = ut->p;
-        ut->p = u8b;
+        ut->p = u8b_swap;
 
-        UChar   *buf = u8b->buf;
-        uint8_t *mapToNative = u8b->mapToNative;
-        uint8_t *mapToUChars = u8b->mapToUChars;
+        UChar   *buf = u8b_swap->buf;
+        uint8_t *mapToNative = u8b_swap->mapToNative;
+        uint8_t *mapToUChars = u8b_swap->mapToUChars;
         int32_t  toUCharsMapStart = ix - sizeof(UTF8Buf::mapToUChars) + 1;
         // Note that toUCharsMapStart can be negative. Happens when the remaining
         // text from current position to the beginning is less than the buffer size.
@@ -1387,19 +1387,19 @@ fillReverse:
                 bufNILimit = destIx;
             }
         }
-        u8b->bufNativeStart     = srcIx;
-        u8b->bufNativeLimit     = ix;
-        u8b->bufStartIdx        = destIx;
-        u8b->bufLimitIdx        = UTF8_TEXT_CHUNK_SIZE+2;
-        u8b->bufNILimit         = bufNILimit - u8b->bufStartIdx;
-        u8b->toUCharsMapStart   = toUCharsMapStart;
-
-        ut->chunkContents       = &buf[u8b->bufStartIdx];
-        ut->chunkLength         = u8b->bufLimitIdx - u8b->bufStartIdx;
+        u8b_swap->bufNativeStart     = srcIx;
+        u8b_swap->bufNativeLimit     = ix;
+        u8b_swap->bufStartIdx        = destIx;
+        u8b_swap->bufLimitIdx        = UTF8_TEXT_CHUNK_SIZE+2;
+        u8b_swap->bufNILimit         = bufNILimit - u8b_swap->bufStartIdx;
+        u8b_swap->toUCharsMapStart   = toUCharsMapStart;
+
+        ut->chunkContents       = &buf[u8b_swap->bufStartIdx];
+        ut->chunkLength         = u8b_swap->bufLimitIdx - u8b_swap->bufStartIdx;
         ut->chunkOffset         = ut->chunkLength;
-        ut->chunkNativeStart    = u8b->bufNativeStart;
-        ut->chunkNativeLimit    = u8b->bufNativeLimit;
-        ut->nativeIndexingLimit = u8b->bufNILimit;
+        ut->chunkNativeStart    = u8b_swap->bufNativeStart;
+        ut->chunkNativeLimit    = u8b_swap->bufNativeLimit;
+        ut->nativeIndexingLimit = u8b_swap->bufNILimit;
         return TRUE;
     }
 
index 8f9183bafad71fd8a457035c6d38fb417e37030e..fb6c67f0397e63a1fcd18d76d5329297d5bce488 100644 (file)
@@ -746,7 +746,7 @@ uint16_t BackwardUTrie2StringIterator::previous16() {
     codePointLimit=codePointStart;
     if(start>=codePointStart) {
         codePoint=U_SENTINEL;
-        return trie->errorValue;
+        return static_cast<uint16_t>(trie->errorValue);
     }
     uint16_t result;
     UTRIE2_U16_PREV16(trie, start, codePointStart, codePoint, result);
@@ -757,7 +757,7 @@ uint16_t ForwardUTrie2StringIterator::next16() {
     codePointStart=codePointLimit;
     if(codePointLimit==limit) {
         codePoint=U_SENTINEL;
-        return trie->errorValue;
+        return static_cast<uint16_t>(trie->errorValue);
     }
     uint16_t result;
     UTRIE2_U16_NEXT16(trie, codePointLimit, limit, codePoint, result);
index d8a3a06757370da5702ecfeca5e2fcf31790e9e6..6a92b442c313bacf4f2da0d682c384a943eefb87 100644 (file)
@@ -1334,7 +1334,7 @@ utrie2_freeze(UTrie2 *trie, UTrie2ValueBits valueBits, UErrorCode *pErrorCode) {
     if(highStart<=0x10000) {
         trie->index2NullOffset=0xffff;
     } else {
-        trie->index2NullOffset=UTRIE2_INDEX_2_OFFSET+newTrie->index2NullOffset;
+        trie->index2NullOffset=static_cast<uint16_t>(UTRIE2_INDEX_2_OFFSET+newTrie->index2NullOffset);
     }
     trie->dataNullOffset=(uint16_t)(dataMove+newTrie->dataNullOffset);
     trie->highValueIndex=dataMove+trie->dataLength-UTRIE2_DATA_GRANULARITY;
index 3aaa36a0632f4a08e0fb5f4933ce74c5252ede5f..1ea8c9eed6c8ab7013678390a223ff249b39e689 100644 (file)
@@ -380,7 +380,7 @@ uprv_detectWindowsTimeZone()
      */
     if (tmpid[0] != 0) 
     {
-        len = uprv_strlen(tmpid);
+        len = static_cast<int32_t>(uprv_strlen(tmpid));
         icuid = (char*)uprv_calloc(len + 1, sizeof(char));
         if (icuid != NULL) 
         {
index d36a2cc6de3bb0eca9eca09c1f5c7551234d3bc2..3950d1a13f1eaf17bd5feff28aecd43d378bbc95 100644 (file)
@@ -511,8 +511,8 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
                                           ces, errorCode) &&
                 current.charAt(current.length() - 1) != 0xFFFF /* !current.endsWith("\uffff") */) {
             // "AE-ligature" or "Sch" etc.
-            for (int32_t i = bucketList->size() - 2;; --i) {
-                Bucket *singleBucket = getBucket(*bucketList, i);
+            for (int32_t j = bucketList->size() - 2;; --j) {
+                Bucket *singleBucket = getBucket(*bucketList, j);
                 if (singleBucket->labelType_ != U_ALPHAINDEX_NORMAL) {
                     // There is no single-character bucket since the last
                     // underflow or inflow label.
@@ -608,8 +608,8 @@ BucketList *AlphabeticIndex::createBucketList(UErrorCode &errorCode) const {
     }
     // Do not call publicBucketList->setDeleter():
     // This vector shares its objects with the bucketList.
-    for (int32_t i = 0; i < bucketList->size(); ++i) {
-        bucket = getBucket(*bucketList, i);
+    for (int32_t j = 0; j < bucketList->size(); ++j) {
+        bucket = getBucket(*bucketList, j);
         if (bucket->displayBucket_ == NULL) {
             publicBucketList->addElement(bucket, errorCode);
         }
index d06469e2ae274633bede136323d502704373f0b2..6e382b824b95b7cd6ba8932c3b18c2cee0756c19 100644 (file)
@@ -391,12 +391,12 @@ void AnyTransliterator::registerIDs() {
                 UnicodeString id;
                 TransliteratorIDParser::STVtoID(UnicodeString(TRUE, ANY, 3), target, variant, id);
                 ec = U_ZERO_ERROR;
-                AnyTransliterator* t = new AnyTransliterator(id, target, variant,
+                AnyTransliterator* tl = new AnyTransliterator(id, target, variant,
                                                              targetScript, ec);
                 if (U_FAILURE(ec)) {
-                    delete t;
+                    delete tl;
                 } else {
-                    Transliterator::_registerInstance(t);
+                    Transliterator::_registerInstance(tl);
                     Transliterator::_registerSpecialInverse(target, UnicodeString(TRUE, NULL_ID, 4), FALSE);
                 }
             }
index 25c8745cbf203b3c590ffea65a67a65394bd653d..8775d29cfe1be8d9273c949334092f6e16ae8679 100644 (file)
@@ -986,8 +986,8 @@ Collator::internalCompareUTF8(const char *left, int32_t leftLength,
         return UCOL_EQUAL;
     }
     return compareUTF8(
-            StringPiece(left, (leftLength < 0) ? uprv_strlen(left) : leftLength),
-            StringPiece(right, (rightLength < 0) ? uprv_strlen(right) : rightLength),
+            StringPiece(left, (leftLength < 0) ? static_cast<int32_t>(uprv_strlen(left)) : leftLength),
+            StringPiece(right, (rightLength < 0) ? static_cast<int32_t>(uprv_strlen(right)) : rightLength),
             errorCode);
 }
 
index 4b9e6b59075e1dcb4452a1654cc62f7f23cbdc1c..b5c322fb44679b5790f10176555ea628eec5e764 100644 (file)
@@ -403,13 +403,13 @@ CollationKeys::writeSortKeyUpToQuaternary(CollationIterator &iter,
                     uint8_t *secs = secondaries.data();
                     int32_t last = secondaries.length() - 1;
                     if(secSegmentStart < last) {
-                        uint8_t *p = secs + secSegmentStart;
-                        uint8_t *q = secs + last;
+                        uint8_t *q = secs + secSegmentStart;
+                        uint8_t *r = secs + last;
                         do {
-                            uint8_t b = *p;
-                            *p++ = *q;
-                            *q-- = b;
-                        } while(p < q);
+                            uint8_t b = *q;
+                            *q++ = *r;
+                            *r-- = b;
+                        } while(q < r);
                     }
                     secondaries.appendByte(p == Collation::NO_CE_PRIMARY ?
                         Collation::LEVEL_SEPARATOR_BYTE : Collation::MERGE_SEPARATOR_BYTE);
index d98f18a19cb117cce614aee86a4e54533a2f6bfd..5579ba8ec3febff1c492b69e39792870b58fc1d4 100644 (file)
@@ -166,7 +166,7 @@ int32_t CharsetRecog_mbcs::match_mbcs(InputText *det, const uint16_t commonChars
                 doubleByteCharCount++;
 
                 if (commonChars != 0) {
-                    if (binarySearch(commonChars, commonCharsLen, iter.charValue) >= 0){
+                    if (binarySearch(commonChars, commonCharsLen, static_cast<uint16_t>(iter.charValue)) >= 0){
                         commonCharCount += 1;
                     }
                 }
index b794b760041d4c9008bfef97bf645b50636436ac..af9c837af89e4412993c00109c036527e331b9d8 100644 (file)
@@ -333,15 +333,15 @@ CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& st
     if (U_SUCCESS(ec)) {
         const char* pluralCount;
         while (((pluralCount = keywords->next(nullptr, ec)) != nullptr) && U_SUCCESS(ec)) {
-            int32_t ptnLen;
+            int32_t ptnLength;
             UErrorCode err = U_ZERO_ERROR;
-            const UChar* patternChars = ures_getStringByKeyWithFallback(currencyRes.getAlias(), pluralCount, &ptnLen, &err);
+            const UChar* patternChars = ures_getStringByKeyWithFallback(currencyRes.getAlias(), pluralCount, &ptnLength, &err);
             if (err == U_MEMORY_ALLOCATION_ERROR || patternChars == nullptr) {
                 ec = err;
                 break;
             }
-            if (U_SUCCESS(err) && ptnLen > 0) {
-                UnicodeString* pattern = new UnicodeString(patternChars, ptnLen);
+            if (U_SUCCESS(err) && ptnLength > 0) {
+                UnicodeString* pattern = new UnicodeString(patternChars, ptnLength);
                 if (pattern == nullptr) {
                     ec = U_MEMORY_ALLOCATION_ERROR;
                     break;
@@ -356,7 +356,7 @@ CurrencyPluralInfo::setupCurrencyPluralPattern(const Locale& loc, UErrorCode& st
                 pattern->findAndReplace(UnicodeString(TRUE, gPart1, 3), UnicodeString(TRUE, gTripleCurrencySign, 3));
 
                 if (hasSeparator) {
-                    UnicodeString negPattern(patternChars, ptnLen);
+                    UnicodeString negPattern(patternChars, ptnLength);
                     negPattern.findAndReplace(UnicodeString(TRUE, gPart0, 3), 
                         UnicodeString(negNumberStylePattern, negNumberStylePatternLen));
                     negPattern.findAndReplace(UnicodeString(TRUE, gPart1, 3), UnicodeString(TRUE, gTripleCurrencySign, 3));
index e6785ab7a1f0537929f29b12d161b9c5fd2dcfe6..d8b1ecdbea1e68dd25cb87bb929364aaaa3156d6 100644 (file)
@@ -436,7 +436,7 @@ DecimalFormatSymbols::initialize(const Locale& loc, UErrorCode& status,
     sink.resolveMissingMonetarySeparators(fSymbols);
 
     // Resolve codePointZero
-    UChar32 tempCodePointZero;
+    UChar32 tempCodePointZero = -1;
     for (int32_t i=0; i<=9; i++) {
         const UnicodeString& stringDigit = getConstDigitSymbol(i);
         if (stringDigit.countChar32() != 1) {
index 455a8e1ee41fef101e698cb5104cc651cb4ed0a8..ab61cf4236288208c7d881f1ffaddc0c336d2058 100644 (file)
@@ -1311,7 +1311,7 @@ DateFormatSymbols::initZoneStringsArray(void) {
         UDate now = Calendar::getNow();
         UnicodeString tzDispName;
 
-        while ((tzid = tzids->snext(status))) {
+        while ((tzid = tzids->snext(status)) != 0) {
             if (U_FAILURE(status)) {
                 break;
             }
@@ -2224,8 +2224,8 @@ DateFormatSymbols::initializeData(const Locale& locale, const char *type, UError
                             ++typeMapPtr;
                         }
                         if (typeMapPtr->usageTypeName != NULL && compResult == 0) {
-                            fCapitalization[typeMapPtr->usageTypeEnumValue][0] = intVector[0];
-                            fCapitalization[typeMapPtr->usageTypeEnumValue][1] = intVector[1];
+                            fCapitalization[typeMapPtr->usageTypeEnumValue][0] = static_cast<UBool>(intVector[0]);
+                            fCapitalization[typeMapPtr->usageTypeEnumValue][1] = static_cast<UBool>(intVector[1]);
                         }
                     }
                 }
index 743b534fc8f9cf1deaf4c76096c7f381703c9664..d952cbf509dc406b60f969b4710ebb38239990a1 100644 (file)
@@ -877,8 +877,7 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton,
         if ( MCount < 3 ) {
             normalizedDateSkeleton.append(CAP_M);
         } else {
-            int32_t i;
-            for ( i = 0; i < MCount && i < MAX_M_COUNT; ++i ) {
+            for ( int32_t j = 0; j < MCount && j < MAX_M_COUNT; ++j) {
                  normalizedDateSkeleton.append(CAP_M);
             }
         }
@@ -887,8 +886,7 @@ DateIntervalFormat::getDateTimeSkeleton(const UnicodeString& skeleton,
         if ( ECount <= 3 ) {
             normalizedDateSkeleton.append(CAP_E);
         } else {
-            int32_t i;
-            for ( i = 0; i < ECount && i < MAX_E_COUNT; ++i ) {
+            for ( int32_t j = 0; j < ECount && j < MAX_E_COUNT; ++j ) {
                  normalizedDateSkeleton.append(CAP_E);
             }
         }
index c863a683a5c2f8d0475e6071df3cc0ea67cab6f3..a289fc79c8da0e628ec752cbfb1a339d6c9fd418 100644 (file)
@@ -594,7 +594,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton,
     const UHashElement* elem = NULL;
     while ( (elem = fIntervalPatterns->nextElement(pos)) != NULL ) {
         const UHashTok keyTok = elem->key;
-        UnicodeString* skeleton = (UnicodeString*)keyTok.pointer;
+        UnicodeString* newSkeleton = (UnicodeString*)keyTok.pointer;
 #ifdef DTITVINF_DEBUG
     skeleton->extract(0,  skeleton->length(), result, "UTF-8");
     sprintf(mesg, "available skeletons: skeleton: %s; \n", result);
@@ -606,7 +606,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton,
         for ( i = 0; i < fieldLength; ++i ) {
             skeletonFieldWidth[i] = 0;
         }
-        parseSkeleton(*skeleton, skeletonFieldWidth);
+        parseSkeleton(*newSkeleton, skeletonFieldWidth);
         // calculate distance
         int32_t distance = 0;
         int8_t fieldDifference = 1;
@@ -632,7 +632,7 @@ DateIntervalInfo::getBestSkeleton(const UnicodeString& skeleton,
             }
         }
         if ( distance < bestDistance ) {
-            bestSkeleton = skeleton;
+            bestSkeleton = newSkeleton;
             bestDistance = distance;
             bestMatchDistanceInfo = fieldDifference;
         }
index 16e64d723777c5ccc32e3de4df21a8e59af8f091..d7b60d34c45153b0c6d90b06b429a0f0b7accfca 100644 (file)
@@ -629,10 +629,10 @@ void DateTimePatternGenerator::getAllowedHourFormats(const Locale &locale, UErro
 UnicodeString
 DateTimePatternGenerator::getSkeleton(const UnicodeString& pattern, UErrorCode&
 /*status*/) {
-    FormatParser fp;
+    FormatParser fp2;
     DateTimeMatcher matcher;
     PtnSkeleton localSkeleton;
-    matcher.set(pattern, &fp, localSkeleton);
+    matcher.set(pattern, &fp2, localSkeleton);
     return localSkeleton.getSkeleton();
 }
 
@@ -648,10 +648,10 @@ DateTimePatternGenerator::staticGetSkeleton(
 
 UnicodeString
 DateTimePatternGenerator::getBaseSkeleton(const UnicodeString& pattern, UErrorCode& /*status*/) {
-    FormatParser fp;
+    FormatParser fp2;
     DateTimeMatcher matcher;
     PtnSkeleton localSkeleton;
-    matcher.set(pattern, &fp, localSkeleton);
+    matcher.set(pattern, &fp2, localSkeleton);
     return localSkeleton.getBaseSkeleton();
 }
 
@@ -888,9 +888,9 @@ struct DateTimePatternGenerator::AppendItemNamesSink : public ResourceSink {
                 valueStr.getTerminatedBuffer();
             }
             for (int32_t j = 1; j < UDATPG_WIDTH_COUNT; j++) {
-                UnicodeString& valueStr = dtpg.getMutableFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)j);
-                if (valueStr.isEmpty()) {
-                    valueStr = dtpg.getFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)(j-1));
+                UnicodeString& valueStr2 = dtpg.getMutableFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)j);
+                if (valueStr2.isEmpty()) {
+                    valueStr2 = dtpg.getFieldDisplayName((UDateTimePatternField)i, (UDateTimePGDisplayWidth)(j-1));
                 }
             }
         }
index 0af58a630416019af0534ea9b674e9ab60a67804..3297ab20f373693762f05c3ef846dbf3a21862ac 100644 (file)
   <Import Project="$(SolutionDir)\Windows.CopyUnicodeHeaderFiles.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
index 5970262de1a51815a47b3bbea11d7ae28ef501fd..b03d6e2f1f58542ffb553cea9adb0b319767b27a 100644 (file)
@@ -618,7 +618,7 @@ MeasureFormat::MeasureFormat(
         : cache(NULL),
           numberFormat(NULL),
           pluralRules(NULL),
-          width(w),
+          fWidth(w),
           listFormatter(NULL) {
     initMeasureFormat(locale, w, NULL, status);
 }
@@ -631,7 +631,7 @@ MeasureFormat::MeasureFormat(
         : cache(NULL),
           numberFormat(NULL),
           pluralRules(NULL),
-          width(w),
+          fWidth(w),
           listFormatter(NULL) {
     initMeasureFormat(locale, w, nfToAdopt, status);
 }
@@ -641,7 +641,7 @@ MeasureFormat::MeasureFormat(const MeasureFormat &other) :
         cache(other.cache),
         numberFormat(other.numberFormat),
         pluralRules(other.pluralRules),
-        width(other.width),
+        fWidth(other.fWidth),
         listFormatter(NULL) {
     cache->addRef();
     numberFormat->addRef();
@@ -659,7 +659,7 @@ MeasureFormat &MeasureFormat::operator=(const MeasureFormat &other) {
     SharedObject::copyPtr(other.cache, cache);
     SharedObject::copyPtr(other.numberFormat, numberFormat);
     SharedObject::copyPtr(other.pluralRules, pluralRules);
-    width = other.width;
+    fWidth = other.fWidth;
     delete listFormatter;
     if (other.listFormatter != NULL) {
         listFormatter = new ListFormatter(*other.listFormatter);
@@ -673,7 +673,7 @@ MeasureFormat::MeasureFormat() :
         cache(NULL),
         numberFormat(NULL),
         pluralRules(NULL),
-        width(UMEASFMT_WIDTH_SHORT),
+        fWidth(UMEASFMT_WIDTH_SHORT),
         listFormatter(NULL) {
 }
 
@@ -703,7 +703,7 @@ UBool MeasureFormat::operator==(const Format &other) const {
     // don't have to check it here.
 
     // differing widths aren't equivalent
-    if (width != rhs.width) {
+    if (fWidth != rhs.fWidth) {
         return FALSE;
     }
     // Width the same check locales.
@@ -805,7 +805,7 @@ UnicodeString &MeasureFormat::formatMeasures(
     if (measureCount == 1) {
         return formatMeasure(measures[0], **numberFormat, appendTo, pos, status);
     }
-    if (width == UMEASFMT_WIDTH_NUMERIC) {
+    if (fWidth == UMEASFMT_WIDTH_NUMERIC) {
         Formattable hms[3];
         int32_t bitMap = toHMS(measures, measureCount, hms, status);
         if (bitMap > 0) {
@@ -839,7 +839,7 @@ UnicodeString &MeasureFormat::formatMeasures(
 }
 
 UnicodeString MeasureFormat::getUnitDisplayName(const MeasureUnit& unit, UErrorCode& /*status*/) const {
-    UMeasureFormatWidth width = getRegularWidth(this->width);
+    UMeasureFormatWidth width = getRegularWidth(fWidth);
     const UChar* const* styleToDnam = cache->dnams[unit.getIndex()];
     const UChar* dnam = styleToDnam[width];
     if (dnam == NULL) {
@@ -895,11 +895,11 @@ void MeasureFormat::initMeasureFormat(
             return;
         }
     }
-    width = w;
+    fWidth = w;
     delete listFormatter;
     listFormatter = ListFormatter::createInstance(
             locale,
-            listStyles[getRegularWidth(width)],
+            listStyles[getRegularWidth(fWidth)],
             status);
 }
 
@@ -922,7 +922,7 @@ UBool MeasureFormat::setMeasureFormatLocale(const Locale &locale, UErrorCode &st
     if (U_FAILURE(status) || locale == getLocale(status)) {
         return FALSE;
     }
-    initMeasureFormat(locale, width, NULL, status);
+    initMeasureFormat(locale, fWidth, NULL, status);
     return U_SUCCESS(status);
 } 
 
@@ -956,7 +956,7 @@ UnicodeString &MeasureFormat::formatMeasure(
     if (isCurrency(amtUnit)) {
         UChar isoCode[4];
         u_charsToUChars(amtUnit.getSubtype(), isoCode, 4);
-        return cache->getCurrencyFormat(width)->format(
+        return cache->getCurrencyFormat(fWidth)->format(
                 new CurrencyAmount(amtNumber, isoCode, status),
                 appendTo,
                 pos,
@@ -965,7 +965,7 @@ UnicodeString &MeasureFormat::formatMeasure(
     UnicodeString formattedNumber;
     StandardPlural::Form pluralForm = QuantityFormatter::selectPlural(
             amtNumber, nf, **pluralRules, formattedNumber, pos, status);
-    const SimpleFormatter *formatter = getPluralFormatter(amtUnit, width, pluralForm, status);
+    const SimpleFormatter *formatter = getPluralFormatter(amtUnit, fWidth, pluralForm, status);
     return QuantityFormatter::format(*formatter, formattedNumber, appendTo, pos, status);
 }
 
@@ -1016,7 +1016,6 @@ UnicodeString &MeasureFormat::formatNumeric(
         return appendTo;
         break;
     }
-    return appendTo;
 }
 
 static void appendRange(
@@ -1173,7 +1172,7 @@ int32_t MeasureFormat::withPerUnitAndAppend(
     if (U_FAILURE(status)) {
         return offset;
     }
-    const SimpleFormatter *perUnitFormatter = getFormatterOrNull(perUnit, width, PER_UNIT_INDEX);
+    const SimpleFormatter *perUnitFormatter = getFormatterOrNull(perUnit, fWidth, PER_UNIT_INDEX);
     if (perUnitFormatter != NULL) {
         const UnicodeString *params[] = {&formatted};
         perUnitFormatter->formatAndAppend(
@@ -1185,9 +1184,9 @@ int32_t MeasureFormat::withPerUnitAndAppend(
                 status);
         return offset;
     }
-    const SimpleFormatter *perFormatter = getPerFormatter(width, status);
+    const SimpleFormatter *perFormatter = getPerFormatter(fWidth, status);
     const SimpleFormatter *pattern =
-            getPluralFormatter(perUnit, width, StandardPlural::ONE, status);
+            getPluralFormatter(perUnit, fWidth, StandardPlural::ONE, status);
     if (U_FAILURE(status)) {
         return offset;
     }
index 8b3807e67148a462f57dd70fa011e5e01c0649d4..8ff86a2cacf018116a8683ca264b4de9b2a76899 100644 (file)
@@ -1078,7 +1078,7 @@ void MessageFormat::format(int32_t msgStart, const void *plNumber,
                 // that formats the number without subtracting the offset.
                 appendTo.formatAndAppend(pluralNumber.formatter, *arg, success);
             }
-        } else if ((formatter = getCachedFormatter(i -2))) {
+        } else if ((formatter = getCachedFormatter(i -2)) != 0) {
             // Handles all ArgType.SIMPLE, and formatters from setFormat() and its siblings.
             if (dynamic_cast<const ChoiceFormat*>(formatter) ||
                 dynamic_cast<const PluralFormat*>(formatter) ||
index c75ecf067052ec79abcfbb1ef649e66f5753d8b3..3ad0291649e66c385b2594ed86dc00b97fd5431e 100644 (file)
@@ -39,14 +39,14 @@ NFRule::NFRule(const RuleBasedNumberFormat* _rbnf, const UnicodeString &_ruleTex
   , radix(10)
   , exponent(0)
   , decimalPoint(0)
-  , ruleText(_ruleText)
+  , fRuleText(_ruleText)
   , sub1(NULL)
   , sub2(NULL)
   , formatter(_rbnf)
   , rulePatternFormat(NULL)
 {
-    if (!ruleText.isEmpty()) {
-        parseRuleDescriptor(ruleText, status);
+    if (!fRuleText.isEmpty()) {
+        parseRuleDescriptor(fRuleText, status);
     }
 }
 
@@ -122,7 +122,7 @@ NFRule::makeRules(UnicodeString& description,
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
-    description = rule1->ruleText;
+    description = rule1->fRuleText;
 
     // check the description to see whether there's text enclosed
     // in brackets
@@ -314,7 +314,7 @@ NFRule::parseRuleDescriptor(UnicodeString& description, UErrorCode& status)
             if (c == gSlash) {
                 val = 0;
                 ++p;
-                int64_t ll_10 = 10;
+                ll_10 = 10;
                 while (p < descriptorLength) {
                     c = descriptor.charAt(p);
                     if (c >= gZero && c <= gNine) {
@@ -418,7 +418,7 @@ NFRule::extractSubstitutions(const NFRuleSet* ruleSet,
     if (U_FAILURE(status)) {
         return;
     }
-    this->ruleText = ruleText;
+    fRuleText = ruleText;
     sub1 = extractSubstitution(ruleSet, predecessor, status);
     if (sub1 == NULL) {
         // Small optimization. There is no need to create a redundant NullSubstitution.
@@ -427,15 +427,15 @@ NFRule::extractSubstitutions(const NFRuleSet* ruleSet,
     else {
         sub2 = extractSubstitution(ruleSet, predecessor, status);
     }
-    int32_t pluralRuleStart = this->ruleText.indexOf(gDollarOpenParenthesis, -1, 0);
-    int32_t pluralRuleEnd = (pluralRuleStart >= 0 ? this->ruleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) : -1);
+    int32_t pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
+    int32_t pluralRuleEnd = (pluralRuleStart >= 0 ? fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) : -1);
     if (pluralRuleEnd >= 0) {
-        int32_t endType = this->ruleText.indexOf(gComma, pluralRuleStart);
+        int32_t endType = fRuleText.indexOf(gComma, pluralRuleStart);
         if (endType < 0) {
             status = U_PARSE_ERROR;
             return;
         }
-        UnicodeString type(this->ruleText.tempSubString(pluralRuleStart + 2, endType - pluralRuleStart - 2));
+        UnicodeString type(fRuleText.tempSubString(pluralRuleStart + 2, endType - pluralRuleStart - 2));
         UPluralType pluralType;
         if (type.startsWith(UNICODE_STRING_SIMPLE("cardinal"))) {
             pluralType = UPLURAL_TYPE_CARDINAL;
@@ -448,7 +448,7 @@ NFRule::extractSubstitutions(const NFRuleSet* ruleSet,
             return;
         }
         rulePatternFormat = formatter->createPluralFormat(pluralType,
-                this->ruleText.tempSubString(endType + 1, pluralRuleEnd - endType - 1), status);
+                fRuleText.tempSubString(endType + 1, pluralRuleEnd - endType - 1), status);
     }
 }
 
@@ -484,16 +484,16 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet,
 
     // special-case the ">>>" token, since searching for the > at the
     // end will actually find the > in the middle
-    if (ruleText.indexOf(gGreaterGreaterGreater, 3, 0) == subStart) {
+    if (fRuleText.indexOf(gGreaterGreaterGreater, 3, 0) == subStart) {
         subEnd = subStart + 2;
 
         // otherwise the substitution token ends with the same character
         // it began with
     } else {
-        UChar c = ruleText.charAt(subStart);
-        subEnd = ruleText.indexOf(c, subStart + 1);
+        UChar c = fRuleText.charAt(subStart);
+        subEnd = fRuleText.indexOf(c, subStart + 1);
         // special case for '<%foo<<'
-        if (c == gLessThan && subEnd != -1 && subEnd < ruleText.length() - 1 && ruleText.charAt(subEnd+1) == c) {
+        if (c == gLessThan && subEnd != -1 && subEnd < fRuleText.length() - 1 && fRuleText.charAt(subEnd+1) == c) {
             // ordinals use "=#,##0==%abbrev=" as their rule.  Notice that the '==' in the middle
             // occurs because of the juxtaposition of two different rules.  The check for '<' is a hack
             // to get around this.  Having the duplicate at the front would cause problems with
@@ -513,12 +513,12 @@ NFRule::extractSubstitution(const NFRuleSet* ruleSet,
     // some text bounded by substitution token characters).  Use
     // makeSubstitution() to create the right kind of substitution
     UnicodeString subToken;
-    subToken.setTo(ruleText, subStart, subEnd + 1 - subStart);
+    subToken.setTo(fRuleText, subStart, subEnd + 1 - subStart);
     result = NFSubstitution::makeSubstitution(subStart, this, predecessor, ruleSet,
         this->formatter, subToken, status);
 
     // remove the substitution from the rule text
-    ruleText.removeBetween(subStart, subEnd+1);
+    fRuleText.removeBetween(subStart, subEnd+1);
 
     return result;
 }
@@ -601,7 +601,7 @@ NFRule::indexOfAnyRulePrefix() const
 {
     int result = -1;
     for (int i = 0; RULE_PREFIXES[i]; i++) {
-        int32_t pos = ruleText.indexOf(*RULE_PREFIXES[i]);
+        int32_t pos = fRuleText.indexOf(*RULE_PREFIXES[i]);
         if (pos != -1 && (result == -1 || pos < result)) {
             result = pos;
         }
@@ -637,7 +637,7 @@ NFRule::operator==(const NFRule& rhs) const
     return baseValue == rhs.baseValue
         && radix == rhs.radix
         && exponent == rhs.exponent
-        && ruleText == rhs.ruleText
+        && fRuleText == rhs.fRuleText
         && util_equalSubstitutions(sub1, rhs.sub1)
         && util_equalSubstitutions(sub2, rhs.sub2);
 }
@@ -690,14 +690,14 @@ NFRule::_appendRuleText(UnicodeString& result) const
     // if the rule text begins with a space, write an apostrophe
     // (whitespace after the rule descriptor is ignored; the
     // apostrophe is used to make the whitespace significant)
-    if (ruleText.charAt(0) == gSpace && (sub1 == NULL || sub1->getPos() != 0)) {
+    if (fRuleText.charAt(0) == gSpace && (sub1 == NULL || sub1->getPos() != 0)) {
         result.append(gTick);
     }
 
     // now, write the rule's rule text, inserting appropriate
     // substitution tokens in the appropriate places
     UnicodeString ruleTextCopy;
-    ruleTextCopy.setTo(ruleText);
+    ruleTextCopy.setTo(fRuleText);
 
     UnicodeString temp;
     if (sub2 != NULL) {
@@ -743,24 +743,24 @@ NFRule::doFormat(int64_t number, UnicodeString& toInsertInto, int32_t pos, int32
     // into the right places in toInsertInto (notice we do the
     // substitutions in reverse order so that the offsets don't get
     // messed up)
-    int32_t pluralRuleStart = ruleText.length();
+    int32_t pluralRuleStart = fRuleText.length();
     int32_t lengthOffset = 0;
     if (!rulePatternFormat) {
-        toInsertInto.insert(pos, ruleText);
+        toInsertInto.insert(pos, fRuleText);
     }
     else {
-        pluralRuleStart = ruleText.indexOf(gDollarOpenParenthesis, -1, 0);
-        int pluralRuleEnd = ruleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart);
+        pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
+        int pluralRuleEnd = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart);
         int initialLength = toInsertInto.length();
-        if (pluralRuleEnd < ruleText.length() - 1) {
-            toInsertInto.insert(pos, ruleText.tempSubString(pluralRuleEnd + 2));
+        if (pluralRuleEnd < fRuleText.length() - 1) {
+            toInsertInto.insert(pos, fRuleText.tempSubString(pluralRuleEnd + 2));
         }
         toInsertInto.insert(pos,
             rulePatternFormat->format((int32_t)(number/util64_pow(radix, exponent)), status));
         if (pluralRuleStart > 0) {
-            toInsertInto.insert(pos, ruleText.tempSubString(0, pluralRuleStart));
+            toInsertInto.insert(pos, fRuleText.tempSubString(0, pluralRuleStart));
         }
-        lengthOffset = ruleText.length() - (toInsertInto.length() - initialLength);
+        lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength);
     }
 
     if (sub2 != NULL) {
@@ -789,17 +789,17 @@ NFRule::doFormat(double number, UnicodeString& toInsertInto, int32_t pos, int32_
     // [again, we have two copies of this routine that do the same thing
     // so that we don't sacrifice precision in a long by casting it
     // to a double]
-    int32_t pluralRuleStart = ruleText.length();
+    int32_t pluralRuleStart = fRuleText.length();
     int32_t lengthOffset = 0;
     if (!rulePatternFormat) {
-        toInsertInto.insert(pos, ruleText);
+        toInsertInto.insert(pos, fRuleText);
     }
     else {
-        pluralRuleStart = ruleText.indexOf(gDollarOpenParenthesis, -1, 0);
-        int pluralRuleEnd = ruleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart);
+        pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
+        int pluralRuleEnd = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart);
         int initialLength = toInsertInto.length();
-        if (pluralRuleEnd < ruleText.length() - 1) {
-            toInsertInto.insert(pos, ruleText.tempSubString(pluralRuleEnd + 2));
+        if (pluralRuleEnd < fRuleText.length() - 1) {
+            toInsertInto.insert(pos, fRuleText.tempSubString(pluralRuleEnd + 2));
         }
         double pluralVal = number;
         if (0 <= pluralVal && pluralVal < 1) {
@@ -812,9 +812,9 @@ NFRule::doFormat(double number, UnicodeString& toInsertInto, int32_t pos, int32_
         }
         toInsertInto.insert(pos, rulePatternFormat->format((int32_t)(pluralVal), status));
         if (pluralRuleStart > 0) {
-            toInsertInto.insert(pos, ruleText.tempSubString(0, pluralRuleStart));
+            toInsertInto.insert(pos, fRuleText.tempSubString(0, pluralRuleStart));
         }
-        lengthOffset = ruleText.length() - (toInsertInto.length() - initialLength);
+        lengthOffset = fRuleText.length() - (toInsertInto.length() - initialLength);
     }
 
     if (sub2 != NULL) {
@@ -908,15 +908,15 @@ NFRule::doParse(const UnicodeString& text,
     ParsePosition pp;
     UnicodeString workText(text);
 
-    int32_t sub1Pos = sub1 != NULL ? sub1->getPos() : ruleText.length();
-    int32_t sub2Pos = sub2 != NULL ? sub2->getPos() : ruleText.length();
+    int32_t sub1Pos = sub1 != NULL ? sub1->getPos() : fRuleText.length();
+    int32_t sub2Pos = sub2 != NULL ? sub2->getPos() : fRuleText.length();
 
     // check to see whether the text before the first substitution
     // matches the text at the beginning of the string being
     // parsed.  If it does, strip that off the front of workText;
     // otherwise, dump out with a mismatch
     UnicodeString prefix;
-    prefix.setTo(ruleText, 0, sub1Pos);
+    prefix.setTo(fRuleText, 0, sub1Pos);
 
 #ifdef RBNF_DEBUG
     fprintf(stderr, "doParse %p ", this);
@@ -1000,7 +1000,7 @@ NFRule::doParse(const UnicodeString& text,
         // the substitution, giving us a new partial parse result
         pp.setIndex(0);
 
-        temp.setTo(ruleText, sub1Pos, sub2Pos - sub1Pos);
+        temp.setTo(fRuleText, sub1Pos, sub2Pos - sub1Pos);
         double partialResult = matchToDelimiter(workText, start, tempBaseValue,
             temp, pp, sub1,
             nonNumericalExecutedRuleMask,
@@ -1021,7 +1021,7 @@ NFRule::doParse(const UnicodeString& text,
             // partial result with whatever it gets back from its
             // substitution if there's a successful match, giving us
             // a real result
-            temp.setTo(ruleText, sub2Pos, ruleText.length() - sub2Pos);
+            temp.setTo(fRuleText, sub2Pos, fRuleText.length() - sub2Pos);
             partialResult = matchToDelimiter(workText2, 0, partialResult,
                 temp, pp2, sub2,
                 nonNumericalExecutedRuleMask,
@@ -1039,18 +1039,18 @@ NFRule::doParse(const UnicodeString& text,
             else {
                 // commented out because ParsePosition doesn't have error index in 1.1.x
                 // restored for ICU4C port
-                int32_t temp = pp2.getErrorIndex() + sub1Pos + pp.getIndex();
-                if (temp> parsePosition.getErrorIndex()) {
-                    parsePosition.setErrorIndex(temp);
+                int32_t i_temp = pp2.getErrorIndex() + sub1Pos + pp.getIndex();
+                if (i_temp> parsePosition.getErrorIndex()) {
+                    parsePosition.setErrorIndex(i_temp);
                 }
             }
         }
         else {
             // commented out because ParsePosition doesn't have error index in 1.1.x
             // restored for ICU4C port
-            int32_t temp = sub1Pos + pp.getErrorIndex();
-            if (temp > parsePosition.getErrorIndex()) {
-                parsePosition.setErrorIndex(temp);
+            int32_t i_temp = sub1Pos + pp.getErrorIndex();
+            if (i_temp > parsePosition.getErrorIndex()) {
+                parsePosition.setErrorIndex(i_temp);
             }
         }
         // keep trying to match things until the outer matchToDelimiter()
@@ -1483,11 +1483,11 @@ NFRule::findText(const UnicodeString& str,
         rulePatternFormat->parseType(str, this, result, position);
         int start = position.getBeginIndex();
         if (start >= 0) {
-            int32_t pluralRuleStart = ruleText.indexOf(gDollarOpenParenthesis, -1, 0);
-            int32_t pluralRuleSuffix = ruleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) + 2;
+            int32_t pluralRuleStart = fRuleText.indexOf(gDollarOpenParenthesis, -1, 0);
+            int32_t pluralRuleSuffix = fRuleText.indexOf(gClosedParenthesisDollar, -1, pluralRuleStart) + 2;
             int32_t matchLen = position.getEndIndex() - start;
-            UnicodeString prefix(ruleText.tempSubString(0, pluralRuleStart));
-            UnicodeString suffix(ruleText.tempSubString(pluralRuleSuffix));
+            UnicodeString prefix(fRuleText.tempSubString(0, pluralRuleStart));
+            UnicodeString suffix(fRuleText.tempSubString(pluralRuleSuffix));
             if (str.compare(start - prefix.length(), prefix.length(), prefix, 0, prefix.length()) == 0
                     && str.compare(start + matchLen, suffix.length(), suffix, 0, suffix.length()) == 0)
             {
index 698b75bb637531fa6d9559f6cd4dcd2c5a96e3f9..ed33eaa5af7605d8deb143393874e78cc461bcb0 100644 (file)
@@ -109,7 +109,7 @@ private:
     int32_t radix;
     int16_t exponent;
     UChar decimalPoint;
-    UnicodeString ruleText;
+    UnicodeString fRuleText;
     NFSubstitution* sub1;
     NFSubstitution* sub2;
     const RuleBasedNumberFormat* formatter;
index 4a1cceb49948b914dd658d9ad763b1f88309a236..da32cca99a38df0e97236503ddaf051e8ad76acc 100644 (file)
@@ -80,7 +80,7 @@ void Grouper::setLocaleData(const impl::ParsedPatternInfo &patternInfo, const Lo
     if (fMinGrouping == -2) {
         fMinGrouping = getMinGroupingForLocale(locale);
     } else if (fMinGrouping == -3) {
-        fMinGrouping = uprv_max(2, getMinGroupingForLocale(locale));
+        fMinGrouping = static_cast<int16_t>(uprv_max(2, getMinGroupingForLocale(locale)));
     } else {
         // leave fMinGrouping alone
     }
index a27142c9bd689b69df3f1e252af0fe9e0c358568..ecb50dd9b820194d5854159b01ed71d77e4e50bb 100644 (file)
@@ -143,14 +143,14 @@ void Scale::applyReciprocalTo(impl::DecimalQuantity& quantity) const {
 
 void
 MultiplierFormatHandler::setAndChain(const Scale& multiplier, const MicroPropsGenerator* parent) {
-    this->multiplier = multiplier;
-    this->parent = parent;
+    fMultiplier = multiplier;
+    fParent = parent;
 }
 
 void MultiplierFormatHandler::processQuantity(DecimalQuantity& quantity, MicroProps& micros,
                                               UErrorCode& status) const {
-    parent->processQuantity(quantity, micros, status);
-    multiplier.applyTo(quantity);
+    fParent->processQuantity(quantity, micros, status);
+    fMultiplier.applyTo(quantity);
 }
 
 #endif /* #if !UCONFIG_NO_FORMATTING */
index 82c30c78426cdbf5ddb796ad857b7d102c2e4bcf..d8235dc601b559218ad2db70a5ae6fd0e18ca168 100644 (file)
@@ -28,8 +28,8 @@ class U_I18N_API MultiplierFormatHandler : public MicroPropsGenerator, public UM
                          UErrorCode& status) const U_OVERRIDE;
 
   private:
-    Scale multiplier;
-    const MicroPropsGenerator *parent;
+    Scale fMultiplier;
+    const MicroPropsGenerator *fParent;
 };
 
 
index 6417e14378bea66e80e7705b22bfde1417965dae..09f4f3921822d464888d1b0b1c17a707d88e87a3 100644 (file)
@@ -24,11 +24,11 @@ MutablePatternModifier::MutablePatternModifier(bool isStrong)
         : fStrong(isStrong) {}
 
 void MutablePatternModifier::setPatternInfo(const AffixPatternProvider* patternInfo) {
-    this->patternInfo = patternInfo;
+    fPatternInfo = patternInfo;
 }
 
 void MutablePatternModifier::setPatternAttributes(UNumberSignDisplay signDisplay, bool perMille) {
-    this->signDisplay = signDisplay;
+    fSignDisplay = signDisplay;
     this->perMilleReplacesPercent = perMille;
 }
 
@@ -36,20 +36,20 @@ void MutablePatternModifier::setSymbols(const DecimalFormatSymbols* symbols,
                                         const CurrencySymbols* currencySymbols,
                                         const UNumberUnitWidth unitWidth, const PluralRules* rules) {
     U_ASSERT((rules != nullptr) == needsPlurals());
-    this->symbols = symbols;
-    this->currencySymbols = currencySymbols;
-    this->unitWidth = unitWidth;
-    this->rules = rules;
+    fSymbols = symbols;
+    fCurrencySymbols = currencySymbols;
+    fUnitWidth = unitWidth;
+    fRules = rules;
 }
 
 void MutablePatternModifier::setNumberProperties(int8_t signum, StandardPlural::Form plural) {
-    this->signum = signum;
-    this->plural = plural;
+    fSignum = signum;
+    fPlural = plural;
 }
 
 bool MutablePatternModifier::needsPlurals() const {
     UErrorCode statusLocal = U_ZERO_ERROR;
-    return patternInfo->containsSymbolType(AffixPatternType::TYPE_CURRENCY_TRIPLE, statusLocal);
+    return fPatternInfo->containsSymbolType(AffixPatternType::TYPE_CURRENCY_TRIPLE, statusLocal);
     // Silently ignore any error codes.
 }
 
@@ -89,7 +89,7 @@ MutablePatternModifier::createImmutableAndChain(const MicroPropsGenerator* paren
             delete pm;
             return nullptr;
         }
-        return new ImmutablePatternModifier(pm, rules, parent);  // adopts pm
+        return new ImmutablePatternModifier(pm, fRules, parent);  // adopts pm
     } else {
         // Faster path when plural keyword is not needed.
         setNumberProperties(1, StandardPlural::Form::COUNT);
@@ -112,11 +112,11 @@ ConstantMultiFieldModifier* MutablePatternModifier::createConstantModifier(UErro
     NumberStringBuilder b;
     insertPrefix(a, 0, status);
     insertSuffix(b, 0, status);
-    if (patternInfo->hasCurrencySign()) {
+    if (fPatternInfo->hasCurrencySign()) {
         return new CurrencySpacingEnabledModifier(
-                a, b, !patternInfo->hasBody(), fStrong, *symbols, status);
+                a, b, !fPatternInfo->hasBody(), fStrong, *fSymbols, status);
     } else {
-        return new ConstantMultiFieldModifier(a, b, !patternInfo->hasBody(), fStrong);
+        return new ConstantMultiFieldModifier(a, b, !fPatternInfo->hasBody(), fStrong);
     }
 }
 
@@ -153,13 +153,13 @@ const Modifier* ImmutablePatternModifier::getModifier(int8_t signum, StandardPlu
 
 /** Used by the unsafe code path. */
 MicroPropsGenerator& MutablePatternModifier::addToChain(const MicroPropsGenerator* parent) {
-    this->parent = parent;
+    fParent = parent;
     return *this;
 }
 
 void MutablePatternModifier::processQuantity(DecimalQuantity& fq, MicroProps& micros,
                                              UErrorCode& status) const {
-    parent->processQuantity(fq, micros, status);
+    fParent->processQuantity(fq, micros, status);
     // The unsafe code path performs self-mutation, so we need a const_cast.
     // This method needs to be const because it overrides a const method in the parent class.
     auto nonConstThis = const_cast<MutablePatternModifier*>(this);
@@ -167,7 +167,7 @@ void MutablePatternModifier::processQuantity(DecimalQuantity& fq, MicroProps& mi
         // TODO: Fix this. Avoid the copy.
         DecimalQuantity copy(fq);
         micros.rounder.apply(copy, status);
-        nonConstThis->setNumberProperties(fq.signum(), utils::getStandardPlural(rules, copy));
+        nonConstThis->setNumberProperties(fq.signum(), utils::getStandardPlural(fRules, copy));
     } else {
         nonConstThis->setNumberProperties(fq.signum(), StandardPlural::Form::COUNT);
     }
@@ -183,7 +183,7 @@ int32_t MutablePatternModifier::apply(NumberStringBuilder& output, int32_t leftI
     int32_t suffixLen = nonConstThis->insertSuffix(output, rightIndex + prefixLen, status);
     // If the pattern had no decimal stem body (like #,##0.00), overwrite the value.
     int32_t overwriteLen = 0;
-    if (!patternInfo->hasBody()) {
+    if (!fPatternInfo->hasBody()) {
         overwriteLen = output.splice(
                 leftIndex + prefixLen,
                 rightIndex + prefixLen,
@@ -199,7 +199,7 @@ int32_t MutablePatternModifier::apply(NumberStringBuilder& output, int32_t leftI
             prefixLen,
             rightIndex + overwriteLen + prefixLen,
             suffixLen,
-            *symbols,
+            *fSymbols,
             status);
     return prefixLen + overwriteLen + suffixLen;
 }
@@ -247,40 +247,40 @@ int32_t MutablePatternModifier::insertSuffix(NumberStringBuilder& sb, int positi
 /** This method contains the heart of the logic for rendering LDML affix strings. */
 void MutablePatternModifier::prepareAffix(bool isPrefix) {
     PatternStringUtils::patternInfoToStringBuilder(
-            *patternInfo, isPrefix, signum, signDisplay, plural, perMilleReplacesPercent, currentAffix);
+            *fPatternInfo, isPrefix, fSignum, fSignDisplay, fPlural, perMilleReplacesPercent, currentAffix);
 }
 
 UnicodeString MutablePatternModifier::getSymbol(AffixPatternType type) const {
     UErrorCode localStatus = U_ZERO_ERROR;
     switch (type) {
         case AffixPatternType::TYPE_MINUS_SIGN:
-            return symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kMinusSignSymbol);
+            return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kMinusSignSymbol);
         case AffixPatternType::TYPE_PLUS_SIGN:
-            return symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPlusSignSymbol);
+            return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPlusSignSymbol);
         case AffixPatternType::TYPE_PERCENT:
-            return symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPercentSymbol);
+            return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPercentSymbol);
         case AffixPatternType::TYPE_PERMILLE:
-            return symbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPerMillSymbol);
+            return fSymbols->getSymbol(DecimalFormatSymbols::ENumberFormatSymbol::kPerMillSymbol);
         case AffixPatternType::TYPE_CURRENCY_SINGLE: {
             // UnitWidth ISO and HIDDEN overrides the singular currency symbol.
-            if (unitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_ISO_CODE) {
-                return currencySymbols->getIntlCurrencySymbol(localStatus);
-            } else if (unitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_HIDDEN) {
+            if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_ISO_CODE) {
+                return fCurrencySymbols->getIntlCurrencySymbol(localStatus);
+            } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_HIDDEN) {
                 return UnicodeString();
-            } else if (unitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_NARROW) {
-                return currencySymbols->getNarrowCurrencySymbol(localStatus);
+            } else if (fUnitWidth == UNumberUnitWidth::UNUM_UNIT_WIDTH_NARROW) {
+                return fCurrencySymbols->getNarrowCurrencySymbol(localStatus);
             } else {
-                return currencySymbols->getCurrencySymbol(localStatus);
+                return fCurrencySymbols->getCurrencySymbol(localStatus);
             }
         }
         case AffixPatternType::TYPE_CURRENCY_DOUBLE:
-            return currencySymbols->getIntlCurrencySymbol(localStatus);
+            return fCurrencySymbols->getIntlCurrencySymbol(localStatus);
         case AffixPatternType::TYPE_CURRENCY_TRIPLE:
             // NOTE: This is the code path only for patterns containing "¤¤¤".
             // Plural currencies set via the API are formatted in LongNameHandler.
             // This code path is used by DecimalFormat via CurrencyPluralInfo.
-            U_ASSERT(plural != StandardPlural::Form::COUNT);
-            return currencySymbols->getPluralName(plural, localStatus);
+            U_ASSERT(fPlural != StandardPlural::Form::COUNT);
+            return fCurrencySymbols->getPluralName(fPlural, localStatus);
         case AffixPatternType::TYPE_CURRENCY_QUAD:
             return UnicodeString(u"\uFFFD");
         case AffixPatternType::TYPE_CURRENCY_QUINT:
index f1359bd5747d897e6887c1a0c3843f9cd59d4ce5..2854ca056a115c47a639e576354a2a5f65a0e877 100644 (file)
@@ -196,22 +196,22 @@ class U_I18N_API MutablePatternModifier
     const bool fStrong;
 
     // Pattern details (initialized in setPatternInfo and setPatternAttributes)
-    const AffixPatternProvider *patternInfo;
-    UNumberSignDisplay signDisplay;
+    const AffixPatternProvider *fPatternInfo;
+    UNumberSignDisplay fSignDisplay;
     bool perMilleReplacesPercent;
 
     // Symbol details (initialized in setSymbols)
-    const DecimalFormatSymbols *symbols;
-    UNumberUnitWidth unitWidth;
-    const CurrencySymbols *currencySymbols;
-    const PluralRules *rules;
+    const DecimalFormatSymbols *fSymbols;
+    UNumberUnitWidth fUnitWidth;
+    const CurrencySymbols *fCurrencySymbols;
+    const PluralRules *fRules;
 
     // Number details (initialized in setNumberProperties)
-    int8_t signum;
-    StandardPlural::Form plural;
+    int8_t fSignum;
+    StandardPlural::Form fPlural;
 
     // QuantityChain details (initialized in addToChain)
-    const MicroPropsGenerator *parent;
+    const MicroPropsGenerator *fParent;
 
     // Transient fields for rendering
     UnicodeString currentAffix;
index 00a59d16d73de902dbc74577366af011cc3cc4f8..8c68d8b52cfb7656d7be77185e87c50ea1218b7c 100644 (file)
@@ -140,7 +140,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
         // Pre-32bit second transitions
         ures_getByKey(res, kTRANSPRE32, &r, &ec);
         transitionTimesPre32 = ures_getIntVector(&r, &len, &ec);
-        transitionCountPre32 = len >> 1;
+        transitionCountPre32 = static_cast<int16_t>(len >> 1);
         if (ec == U_MISSING_RESOURCE_ERROR) {
             // No pre-32bit transitions
             transitionTimesPre32 = NULL;
@@ -153,7 +153,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
         // 32bit second transitions
         ures_getByKey(res, kTRANS, &r, &ec);
         transitionTimes32 = ures_getIntVector(&r, &len, &ec);
-        transitionCount32 = len;
+        transitionCount32 = static_cast<int16_t>(len);
         if (ec == U_MISSING_RESOURCE_ERROR) {
             // No 32bit transitions
             transitionTimes32 = NULL;
@@ -166,7 +166,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top,
         // Post-32bit second transitions
         ures_getByKey(res, kTRANSPOST32, &r, &ec);
         transitionTimesPost32 = ures_getIntVector(&r, &len, &ec);
-        transitionCountPost32 = len >> 1;
+        transitionCountPost32 = static_cast<int16_t>(len >> 1);
         if (ec == U_MISSING_RESOURCE_ERROR) {
             // No pre-32bit transitions
             transitionTimesPost32 = NULL;
index 4a4c21e7ac2aee4bff7e1373f4819ca1630e6ea1..ba5450c637970fad95c3beb695d4fa095822c9ee 100644 (file)
@@ -699,8 +699,8 @@ PluralRules::getRuleFromResource(const Locale& locale, UPluralType type, UErrorC
         // Check parent locales.
         UErrorCode status = U_ZERO_ERROR;
         char parentLocaleName[ULOC_FULLNAME_CAPACITY];
-        const char *curLocaleName=locale.getName();
-        uprv_strcpy(parentLocaleName, curLocaleName);
+        const char *curLocaleName2=locale.getName();
+        uprv_strcpy(parentLocaleName, curLocaleName2);
 
         while (uloc_getParent(parentLocaleName, parentLocaleName,
                                        ULOC_FULLNAME_CAPACITY, &status) > 0) {
index b9b0a5bc47cf5931fe83961905686e926c1ae801..27afc1faaa19d2b81e834350f8ec9a1b36acbb68 100644 (file)
@@ -680,7 +680,7 @@ StringLocalizationInfo::getDisplayName(int32_t localeIndex, int32_t ruleIndex) c
 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 
                                              const UnicodeString& locs,
                                              const Locale& alocale, UParseError& perror, UErrorCode& status)
-  : ruleSets(NULL)
+  : fRuleSets(NULL)
   , ruleSetDescriptions(NULL)
   , numRuleSets(0)
   , defaultRuleSet(NULL)
@@ -689,7 +689,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
   , decimalFormatSymbols(NULL)
   , defaultInfinityRule(NULL)
   , defaultNaNRule(NULL)
-  , roundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+  , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(FALSE)
   , lenientParseRules(NULL)
   , localizations(NULL)
@@ -705,7 +705,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 
                                              const UnicodeString& locs,
                                              UParseError& perror, UErrorCode& status)
-  : ruleSets(NULL)
+  : fRuleSets(NULL)
   , ruleSetDescriptions(NULL)
   , numRuleSets(0)
   , defaultRuleSet(NULL)
@@ -714,7 +714,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
   , decimalFormatSymbols(NULL)
   , defaultInfinityRule(NULL)
   , defaultNaNRule(NULL)
-  , roundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+  , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(FALSE)
   , lenientParseRules(NULL)
   , localizations(NULL)
@@ -730,7 +730,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 
                                              LocalizationInfo* info,
                                              const Locale& alocale, UParseError& perror, UErrorCode& status)
-  : ruleSets(NULL)
+  : fRuleSets(NULL)
   , ruleSetDescriptions(NULL)
   , numRuleSets(0)
   , defaultRuleSet(NULL)
@@ -739,7 +739,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
   , decimalFormatSymbols(NULL)
   , defaultInfinityRule(NULL)
   , defaultNaNRule(NULL)
-  , roundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+  , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(FALSE)
   , lenientParseRules(NULL)
   , localizations(NULL)
@@ -754,7 +754,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
 RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description, 
                          UParseError& perror, 
                          UErrorCode& status) 
-  : ruleSets(NULL)
+  : fRuleSets(NULL)
   , ruleSetDescriptions(NULL)
   , numRuleSets(0)
   , defaultRuleSet(NULL)
@@ -763,7 +763,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
   , decimalFormatSymbols(NULL)
   , defaultInfinityRule(NULL)
   , defaultNaNRule(NULL)
-  , roundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+  , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(FALSE)
   , lenientParseRules(NULL)
   , localizations(NULL)
@@ -779,7 +779,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
                          const Locale& aLocale,
                          UParseError& perror, 
                          UErrorCode& status) 
-  : ruleSets(NULL)
+  : fRuleSets(NULL)
   , ruleSetDescriptions(NULL)
   , numRuleSets(0)
   , defaultRuleSet(NULL)
@@ -788,7 +788,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
   , decimalFormatSymbols(NULL)
   , defaultInfinityRule(NULL)
   , defaultNaNRule(NULL)
-  , roundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+  , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(FALSE)
   , lenientParseRules(NULL)
   , localizations(NULL)
@@ -801,7 +801,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const UnicodeString& description,
 }
 
 RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale& alocale, UErrorCode& status)
-  : ruleSets(NULL)
+  : fRuleSets(NULL)
   , ruleSetDescriptions(NULL)
   , numRuleSets(0)
   , defaultRuleSet(NULL)
@@ -810,7 +810,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
   , decimalFormatSymbols(NULL)
   , defaultInfinityRule(NULL)
   , defaultNaNRule(NULL)
-  , roundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+  , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(FALSE)
   , lenientParseRules(NULL)
   , localizations(NULL)
@@ -868,7 +868,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(URBNFRuleSetTag tag, const Locale&
 
 RuleBasedNumberFormat::RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs)
   : NumberFormat(rhs)
-  , ruleSets(NULL)
+  , fRuleSets(NULL)
   , ruleSetDescriptions(NULL)
   , numRuleSets(0)
   , defaultRuleSet(NULL)
@@ -877,7 +877,7 @@ RuleBasedNumberFormat::RuleBasedNumberFormat(const RuleBasedNumberFormat& rhs)
   , decimalFormatSymbols(NULL)
   , defaultInfinityRule(NULL)
   , defaultNaNRule(NULL)
-  , roundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
+  , fRoundingMode(DecimalFormat::ERoundingMode::kRoundUnnecessary)
   , lenient(FALSE)
   , lenientParseRules(NULL)
   , localizations(NULL)
@@ -950,8 +950,8 @@ RuleBasedNumberFormat::operator==(const Format& other) const
                     ? FALSE
                     : *localizations == rhs.localizations))) {
 
-            NFRuleSet** p = ruleSets;
-            NFRuleSet** q = rhs.ruleSets;
+            NFRuleSet** p = fRuleSets;
+            NFRuleSet** q = rhs.fRuleSets;
             if (p == NULL) {
                 return q == NULL;
             } else if (q == NULL) {
@@ -972,8 +972,8 @@ UnicodeString
 RuleBasedNumberFormat::getRules() const
 {
     UnicodeString result;
-    if (ruleSets != NULL) {
-        for (NFRuleSet** p = ruleSets; *p; ++p) {
+    if (fRuleSets != NULL) {
+        for (NFRuleSet** p = fRuleSets; *p; ++p) {
             (*p)->appendRules(result);
         }
     }
@@ -987,9 +987,9 @@ RuleBasedNumberFormat::getRuleSetName(int32_t index) const
         UnicodeString string(TRUE, localizations->getRuleSetName(index), (int32_t)-1);
         return string;
     }
-    else if (ruleSets) {
+    else if (fRuleSets) {
         UnicodeString result;
-        for (NFRuleSet** p = ruleSets; *p; ++p) {
+        for (NFRuleSet** p = fRuleSets; *p; ++p) {
             NFRuleSet* rs = *p;
             if (rs->isPublic()) {
                 if (--index == -1) {
@@ -1010,8 +1010,8 @@ RuleBasedNumberFormat::getNumberOfRuleSetNames() const
     if (localizations) {
         result = localizations->getNumberOfRuleSets();
     }
-    else if (ruleSets) {
-        for (NFRuleSet** p = ruleSets; *p; ++p) {
+    else if (fRuleSets) {
+        for (NFRuleSet** p = fRuleSets; *p; ++p) {
             if ((**p).isPublic()) {
                 ++result;
             }
@@ -1098,8 +1098,8 @@ RuleBasedNumberFormat::getRuleSetDisplayName(const UnicodeString& ruleSetName, c
 NFRuleSet*
 RuleBasedNumberFormat::findRuleSet(const UnicodeString& name, UErrorCode& status) const
 {
-    if (U_SUCCESS(status) && ruleSets) {
-        for (NFRuleSet** p = ruleSets; *p; ++p) {
+    if (U_SUCCESS(status) && fRuleSets) {
+        for (NFRuleSet** p = fRuleSets; *p; ++p) {
             NFRuleSet* rs = *p;
             if (rs->isNamed(name)) {
                 return rs;
@@ -1378,7 +1378,7 @@ RuleBasedNumberFormat::parse(const UnicodeString& text,
                              Formattable& result,
                              ParsePosition& parsePosition) const
 {
-    if (!ruleSets) {
+    if (!fRuleSets) {
         parsePosition.setErrorIndex(0);
         return;
     }
@@ -1389,7 +1389,7 @@ RuleBasedNumberFormat::parse(const UnicodeString& text,
     ParsePosition high_pp(0);
     Formattable high_result;
 
-    for (NFRuleSet** p = ruleSets; *p; ++p) {
+    for (NFRuleSet** p = fRuleSets; *p; ++p) {
         NFRuleSet *rp = *p;
         if (rp->isPublic() && rp->isParseable()) {
             ParsePosition working_pp(0);
@@ -1477,7 +1477,7 @@ void
 RuleBasedNumberFormat::initDefaultRuleSet()
 {
     defaultRuleSet = NULL;
-    if (!ruleSets) {
+    if (!fRuleSets) {
         return;
     }
 
@@ -1485,7 +1485,7 @@ RuleBasedNumberFormat::initDefaultRuleSet()
     const UnicodeString ordinal(UNICODE_STRING_SIMPLE("%digits-ordinal"));
     const UnicodeString duration(UNICODE_STRING_SIMPLE("%duration"));
 
-    NFRuleSet**p = &ruleSets[0];
+    NFRuleSet**p = &fRuleSets[0];
     while (*p) {
         if ((*p)->isNamed(spellout) || (*p)->isNamed(ordinal) || (*p)->isNamed(duration)) {
             defaultRuleSet = *p;
@@ -1497,7 +1497,7 @@ RuleBasedNumberFormat::initDefaultRuleSet()
 
     defaultRuleSet = *--p;
     if (!defaultRuleSet->isPublic()) {
-        while (p != ruleSets) {
+        while (p != fRuleSets) {
             if ((*--p)->isPublic()) {
                 defaultRuleSet = *p;
                 break;
@@ -1588,15 +1588,15 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
     ++numRuleSets;
 
     // our rule list is an array of the appropriate size
-    ruleSets = (NFRuleSet **)uprv_malloc((numRuleSets + 1) * sizeof(NFRuleSet *));
+    fRuleSets = (NFRuleSet **)uprv_malloc((numRuleSets + 1) * sizeof(NFRuleSet *));
     /* test for NULL */
-    if (ruleSets == 0) {
+    if (fRuleSets == 0) {
         status = U_MEMORY_ALLOCATION_ERROR;
         return;
     }
 
     for (int i = 0; i <= numRuleSets; ++i) {
-        ruleSets[i] = NULL;
+        fRuleSets[i] = NULL;
     }
 
     // divide up the descriptions into individual rule-set descriptions
@@ -1622,8 +1622,8 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
         int32_t start = 0;
         for (int32_t p = description.indexOf(gSemiPercent, 2, 0); p != -1; p = description.indexOf(gSemiPercent, 2, start)) {
             ruleSetDescriptions[curRuleSet].setTo(description, start, p + 1 - start);
-            ruleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleSet, status);
-            if (ruleSets[curRuleSet] == nullptr) {
+            fRuleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleSet, status);
+            if (fRuleSets[curRuleSet] == nullptr) {
                 status = U_MEMORY_ALLOCATION_ERROR;
                 return;
             }
@@ -1631,8 +1631,8 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
             start = p + 1;
         }
         ruleSetDescriptions[curRuleSet].setTo(description, start, description.length() - start);
-        ruleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleSet, status);
-        if (ruleSets[curRuleSet] == nullptr) {
+        fRuleSets[curRuleSet] = new NFRuleSet(this, ruleSetDescriptions, curRuleSet, status);
+        if (fRuleSets[curRuleSet] == nullptr) {
             status = U_MEMORY_ALLOCATION_ERROR;
             return;
         }
@@ -1654,7 +1654,7 @@ RuleBasedNumberFormat::init(const UnicodeString& rules, LocalizationInfo* locali
     // away the temporary descriptions as we go)
     {
         for (int i = 0; i < numRuleSets; i++) {
-            ruleSets[i]->parseRules(ruleSetDescriptions[i], status);
+            fRuleSets[i]->parseRules(ruleSetDescriptions[i], status);
         }
     }
 
@@ -1700,7 +1700,7 @@ RuleBasedNumberFormat::setContext(UDisplayContext value, UErrorCode& status)
         if ( capitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
                 (value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && capitalizationForUIListMenu) ||
                 (value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && capitalizationForStandAlone)) ) {
-            UErrorCode status = U_ZERO_ERROR;
+            status = U_ZERO_ERROR;
             capitalizationBrkIter = BreakIterator::createSentenceInstance(locale, status);
             if (U_FAILURE(status)) {
                 delete capitalizationBrkIter;
@@ -1724,8 +1724,8 @@ RuleBasedNumberFormat::initCapitalizationContextInfo(const Locale& thelocale)
         int32_t len = 0;
         const int32_t * intVector = ures_getIntVector(rb, &len, &status);
         if (U_SUCCESS(status) && intVector != NULL && len >= 2) {
-            capitalizationForUIListMenu = intVector[0];
-            capitalizationForStandAlone = intVector[1];
+            capitalizationForUIListMenu = static_cast<UBool>(intVector[0]);
+            capitalizationForStandAlone = static_cast<UBool>(intVector[1]);
         }
     }
     ures_close(rb);
@@ -1776,12 +1776,12 @@ RuleBasedNumberFormat::stripWhitespace(UnicodeString& description)
 void
 RuleBasedNumberFormat::dispose()
 {
-    if (ruleSets) {
-        for (NFRuleSet** p = ruleSets; *p; ++p) {
+    if (fRuleSets) {
+        for (NFRuleSet** p = fRuleSets; *p; ++p) {
             delete *p;
         }
-        uprv_free(ruleSets);
-        ruleSets = NULL;
+        uprv_free(fRuleSets);
+        fRuleSets = NULL;
     }
 
     if (ruleSetDescriptions) {
@@ -1831,7 +1831,7 @@ const RuleBasedCollator*
 RuleBasedNumberFormat::getCollator() const
 {
 #if !UCONFIG_NO_COLLATION
-    if (!ruleSets) {
+    if (!fRuleSets) {
         return NULL;
     }
 
@@ -1974,9 +1974,9 @@ RuleBasedNumberFormat::adoptDecimalFormatSymbols(DecimalFormatSymbols* symbolsTo
         defaultNaNRule = NULL;
         initializeDefaultNaNRule(status); // Reset with the new DecimalFormatSymbols
 
-        if (ruleSets) {
+        if (fRuleSets) {
             for (int32_t i = 0; i < numRuleSets; i++) {
-                ruleSets[i]->setDecimalFormatSymbols(*symbolsToAdopt, status);
+                fRuleSets[i]->setDecimalFormatSymbols(*symbolsToAdopt, status);
             }
         }
     }
@@ -2006,7 +2006,7 @@ RuleBasedNumberFormat::createPluralFormat(UPluralType pluralType,
  * @return A rounding mode
  */
 DecimalFormat::ERoundingMode RuleBasedNumberFormat::getRoundingMode() const {
-    return roundingMode;
+    return fRoundingMode;
 }
 
 /**
@@ -2015,7 +2015,7 @@ DecimalFormat::ERoundingMode RuleBasedNumberFormat::getRoundingMode() const {
  * @param roundingMode A rounding mode
  */
 void RuleBasedNumberFormat::setRoundingMode(DecimalFormat::ERoundingMode roundingMode) {
-    this->roundingMode = roundingMode;
+    fRoundingMode = roundingMode;
 }
 
 U_NAMESPACE_END
index 6ed89b1fc584c9584630c4ec7f1573e744ccda7b..9932dbdc95e3cc06bf35d035797ddc5e6060634a 100644 (file)
@@ -194,9 +194,9 @@ const UnicodeFunctor* ParseData::lookupMatcher(UChar32 ch) const {
     const UnicodeFunctor* set = NULL;
     int32_t i = ch - data->variablesBase;
     if (i >= 0 && i < variablesVector->size()) {
-        int32_t i = ch - data->variablesBase;
-        set = (i < variablesVector->size()) ?
-            (UnicodeFunctor*) variablesVector->elementAt(i) : 0;
+        int32_t j = ch - data->variablesBase;
+        set = (j < variablesVector->size()) ?
+            (UnicodeFunctor*) variablesVector->elementAt(j) : 0;
     }
     return set;
 }
@@ -1108,8 +1108,8 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
             }
             
             data->variableNames.removeAll();
-            int32_t pos = UHASH_FIRST;
-            const UHashElement* he = variableNames.nextElement(pos);
+            int32_t p = UHASH_FIRST;
+            const UHashElement* he = variableNames.nextElement(p);
             while (he != NULL) {
                 UnicodeString* tempus = (UnicodeString*)(((UnicodeString*)(he->value.pointer))->clone());
                 if (tempus == NULL) {
@@ -1118,7 +1118,7 @@ void TransliteratorParser::parseRules(const UnicodeString& rule,
                 }
                 data->variableNames.put(*((UnicodeString*)(he->key.pointer)),
                     tempus, status);
-                he = variableNames.nextElement(pos);
+                he = variableNames.nextElement(p);
             }
         }
         variablesVector.removeAllElements();   // keeps them from getting deleted when we succeed
index 66de31de8b326198f88b99e87658a865bb28abde..d1ae02accb3feae3a408c4a2c88b712e6d81d2cf 100644 (file)
@@ -182,7 +182,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
         r->idStr = *regionName;
 
         r->idStr.extract(0,r->idStr.length(),r->id,sizeof(r->id),US_INV);
-        r->type = URGN_TERRITORY; // Only temporary - figure out the real type later once the aliases are known.
+        r->fType = URGN_TERRITORY; // Only temporary - figure out the real type later once the aliases are known.
 
         Formattable result;
         UErrorCode ps = U_ZERO_ERROR;
@@ -190,7 +190,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
         if ( U_SUCCESS(ps) ) {
             r->code = result.getLong(); // Convert string to number
             uhash_iput(newNumericCodeMap.getAlias(),r->code,(void *)(r.getAlias()),&status);
-            r->type = URGN_SUBCONTINENT;
+            r->fType = URGN_SUBCONTINENT;
         } else {
             r->code = -1;
         }
@@ -231,9 +231,9 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
                 } else {
                     aliasFromRegion->code = -1;
                 }
-                aliasFromRegion->type = URGN_DEPRECATED;
+                aliasFromRegion->fType = URGN_DEPRECATED;
             } else {
-                aliasFromRegion->type = URGN_DEPRECATED;
+                aliasFromRegion->fType = URGN_DEPRECATED;
             }
 
             {
@@ -290,26 +290,26 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
     UnicodeString WORLD_ID_STRING(WORLD_ID);
     r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&WORLD_ID_STRING);
     if ( r ) {
-        r->type = URGN_WORLD;
+        r->fType = URGN_WORLD;
     }
 
     UnicodeString UNKNOWN_REGION_ID_STRING(UNKNOWN_REGION_ID);
     r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&UNKNOWN_REGION_ID_STRING);
     if ( r ) {
-        r->type = URGN_UNKNOWN;
+        r->fType = URGN_UNKNOWN;
     }
 
     for ( int32_t i = 0 ; i < continents->size() ; i++ ) {
         r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)continents->elementAt(i));
         if ( r ) {
-            r->type = URGN_CONTINENT;
+            r->fType = URGN_CONTINENT;
         }
     }
 
     for ( int32_t i = 0 ; i < groupings->size() ; i++ ) {
         r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)groupings->elementAt(i));
         if ( r ) {
-            r->type = URGN_GROUPING;
+            r->fType = URGN_GROUPING;
         }
     }
 
@@ -319,7 +319,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
     UnicodeString OUTLYING_OCEANIA_REGION_ID_STRING(OUTLYING_OCEANIA_REGION_ID);
     r = (Region *) uhash_get(newRegionIDMap.getAlias(),(void *)&OUTLYING_OCEANIA_REGION_ID_STRING);
     if ( r ) {
-        r->type = URGN_SUBCONTINENT;
+        r->fType = URGN_SUBCONTINENT;
     }
 
     // Load territory containment info from the supplemental data.
@@ -356,7 +356,7 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
                 // Set the parent region to be the containing region of the child.
                 // Regions of type GROUPING can't be set as the parent, since another region
                 // such as a SUBCONTINENT, CONTINENT, or WORLD must always be the parent.
-                if ( parentRegion->type != URGN_GROUPING) {
+                if ( parentRegion->fType != URGN_GROUPING) {
                     childRegion->containingRegion = parentRegion;
                 }
             }
@@ -367,15 +367,15 @@ void U_CALLCONV Region::loadRegionData(UErrorCode &status) {
     int32_t pos = UHASH_FIRST;
     while ( const UHashElement* element = uhash_nextElement(newRegionIDMap.getAlias(),&pos)) {
         Region *ar = (Region *)element->value.pointer;
-        if ( availableRegions[ar->type] == NULL ) {
+        if ( availableRegions[ar->fType] == NULL ) {
             LocalPointer<UVector> newAr(new UVector(uprv_deleteUObject, uhash_compareUnicodeString, status), status);
-            availableRegions[ar->type] = newAr.orphan();
+            availableRegions[ar->fType] = newAr.orphan();
         }
         LocalPointer<UnicodeString> arString(new UnicodeString(ar->idStr), status);
         if( U_FAILURE(status) ) {
             return;  // error out
         }
-        availableRegions[ar->type]->addElement((void *)arString.orphan(),status);
+        availableRegions[ar->fType]->addElement((void *)arString.orphan(),status);
     }
     
     ucln_i18n_registerCleanup(UCLN_I18N_REGION, region_cleanup);
@@ -416,7 +416,7 @@ void Region::cleanupRegionData() {
 
 Region::Region ()
         : code(-1),
-          type(URGN_UNKNOWN),
+          fType(URGN_UNKNOWN),
           containingRegion(NULL),
           containedRegions(NULL),
           preferredValues(NULL) {
@@ -481,7 +481,7 @@ Region::getInstance(const char *region_code, UErrorCode &status) {
         return NULL;
     }
 
-    if ( r->type == URGN_DEPRECATED && r->preferredValues->size() == 1) {
+    if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) {
         StringEnumeration *pv = r->getPreferredValues(status);
         pv->reset(status);
         const UnicodeString *ustr = pv->snext(status);
@@ -529,7 +529,7 @@ Region::getInstance (int32_t code, UErrorCode &status) {
         return NULL;
     }
 
-    if ( r->type == URGN_DEPRECATED && r->preferredValues->size() == 1) {
+    if ( r->fType == URGN_DEPRECATED && r->preferredValues->size() == 1) {
         StringEnumeration *pv = r->getPreferredValues(status);
         pv->reset(status);
         const UnicodeString *ustr = pv->snext(status);
@@ -580,7 +580,7 @@ Region::getContainingRegion(URegionType type) const {
         return NULL;
     }
 
-    return ( containingRegion->type == type )? containingRegion: containingRegion->getContainingRegion(type);
+    return ( containingRegion->fType == type)? containingRegion: containingRegion->getContainingRegion(type);
 }
 
 /**
@@ -618,9 +618,9 @@ Region::getContainedRegions( URegionType type, UErrorCode &status ) const {
     StringEnumeration *cr = getContainedRegions(status);
 
     for ( int32_t i = 0 ; i < cr->count(status) ; i++ ) {
-        const char *id = cr->next(NULL,status);
-        const Region *r = Region::getInstance(id,status);
-        if ( r->getType() == type ) {
+        const char *regionId = cr->next(NULL,status);
+        const Region *r = Region::getInstance(regionId,status);
+        if ( r->getType() == type) {
             result->addElement((void *)&r->idStr,status);
         } else {
             StringEnumeration *children = r->getContainedRegions(type, status);
@@ -672,7 +672,7 @@ Region::contains(const Region &other) const {
 StringEnumeration*
 Region::getPreferredValues(UErrorCode &status) const {
     umtx_initOnce(gRegionDataInitOnce, &loadRegionData, status); // returns immediately if U_FAILURE(status)
-    if (U_FAILURE(status) ||  type != URGN_DEPRECATED) {
+    if (U_FAILURE(status) || fType != URGN_DEPRECATED) {
         return NULL;
     }
     return new RegionNameEnumeration(preferredValues,status);
@@ -697,7 +697,7 @@ Region::getNumericCode() const {
  */
 URegionType
 Region::getType() const {
-    return type;
+    return fType;
 }
 
 RegionNameEnumeration::RegionNameEnumeration(UVector *fNameList, UErrorCode& status) {
index aad026cb62d12897c307d57a07430908a950952e..0a28a743e280d77786fdc446a39dbd1467338549 100644 (file)
@@ -312,7 +312,7 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
 
     // Utility functions
     static UDateRelativeDateTimeFormatterStyle styleFromString(const char *s) {
-        int32_t len = uprv_strlen(s);
+        int32_t len = static_cast<int32_t>(uprv_strlen(s));
         if (len >= 7 && uprv_strcmp(s + len - 7, "-narrow") == 0) {
             return UDAT_STYLE_NARROW;
         }
@@ -546,7 +546,7 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
                 consumeAlias(key, value, errorCode);
             } else {
                 style = styleFromString(key);
-                int32_t unitSize = uprv_strlen(key) - styleSuffixLength(style);
+                int32_t unitSize = static_cast<int32_t>(uprv_strlen(key)) - styleSuffixLength(style);
                 genericUnit = unitOrNegativeFromString(key, unitSize);
                 if (style >= 0 && genericUnit != INVALID_UNIT) {
                     consumeTimeUnit(key, value, errorCode);
index 839198b3859c125d9764a6bde9137686e3549a56..5e7ddddf74a5b202d1ac419521b757aa4d99caf2 100644 (file)
@@ -430,7 +430,7 @@ RelativeDateFormat::setContext(UDisplayContext value, UErrorCode& status)
         if ( fCapitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
                 (value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU && fCapitalizationOfRelativeUnitsForUIListMenu) ||
                 (value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE && fCapitalizationOfRelativeUnitsForStandAlone)) ) {
-            UErrorCode status = U_ZERO_ERROR;
+            status = U_ZERO_ERROR;
             fCapitalizationBrkIter = BreakIterator::createSentenceInstance(fLocale, status);
             if (U_FAILURE(status)) {
                 delete fCapitalizationBrkIter;
@@ -456,8 +456,8 @@ RelativeDateFormat::initCapitalizationContextInfo(const Locale& thelocale)
         const int32_t * intVector = ures_getIntVector(rb.getAlias(),
                                                       &len, &status);
         if (U_SUCCESS(status) && intVector != NULL && len >= 2) {
-            fCapitalizationOfRelativeUnitsForUIListMenu = intVector[0];
-            fCapitalizationOfRelativeUnitsForStandAlone = intVector[1];
+            fCapitalizationOfRelativeUnitsForUIListMenu = static_cast<UBool>(intVector[0]);
+            fCapitalizationOfRelativeUnitsForStandAlone = static_cast<UBool>(intVector[1]);
         }
     }
 #endif
index efa3909e5e9df5fa135d5fb3aa15990a977f1d58..cfdc1fe4d99b3c9d32ceaad57dcb9f1e9d3765e7 100644 (file)
@@ -801,7 +801,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
 
     case START_LINE:
         {
-            UChar32  c;
+            UChar32 ch;
             if (startPos == fAnchorStart) {
                 MatchAt(startPos, FALSE, status);
                 if (U_FAILURE(status)) {
@@ -811,17 +811,17 @@ UBool RegexMatcher::find(UErrorCode &status) {
                     return TRUE;
                 }
                 UTEXT_SETNATIVEINDEX(fInputText, startPos);
-                c = UTEXT_NEXT32(fInputText);
+                ch = UTEXT_NEXT32(fInputText);
                 startPos = UTEXT_GETNATIVEINDEX(fInputText);
             } else {
                 UTEXT_SETNATIVEINDEX(fInputText, startPos);
-                c = UTEXT_PREVIOUS32(fInputText);
+                ch = UTEXT_PREVIOUS32(fInputText);
                 UTEXT_SETNATIVEINDEX(fInputText, startPos);
             }
 
             if (fPattern->fFlags & UREGEX_UNIX_LINES) {
                 for (;;) {
-                    if (c == 0x0a) {
+                    if (ch == 0x0a) {
                             MatchAt(startPos, FALSE, status);
                             if (U_FAILURE(status)) {
                                 return FALSE;
@@ -836,7 +836,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
                         fHitEnd = TRUE;
                         return FALSE;
                     }
-                    c = UTEXT_NEXT32(fInputText);
+                    ch = UTEXT_NEXT32(fInputText);
                     startPos = UTEXT_GETNATIVEINDEX(fInputText);
                     // Note that it's perfectly OK for a pattern to have a zero-length
                     //   match at the end of a string, so we must make sure that the loop
@@ -846,8 +846,8 @@ UBool RegexMatcher::find(UErrorCode &status) {
                 }
             } else {
                 for (;;) {
-                    if (isLineTerminator(c)) {
-                        if (c == 0x0d && startPos < fActiveLimit && UTEXT_CURRENT32(fInputText) == 0x0a) {
+                    if (isLineTerminator(ch)) {
+                        if (ch == 0x0d && startPos < fActiveLimit && UTEXT_CURRENT32(fInputText) == 0x0a) {
                             (void)UTEXT_NEXT32(fInputText);
                             startPos = UTEXT_GETNATIVEINDEX(fInputText);
                         }
@@ -865,7 +865,7 @@ UBool RegexMatcher::find(UErrorCode &status) {
                         fHitEnd = TRUE;
                         return FALSE;
                     }
-                    c = UTEXT_NEXT32(fInputText);
+                    ch = UTEXT_NEXT32(fInputText);
                     startPos = UTEXT_GETNATIVEINDEX(fInputText);
                     // Note that it's perfectly OK for a pattern to have a zero-length
                     //   match at the end of a string, so we must make sure that the loop
@@ -1034,7 +1034,7 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
                 return FALSE;
         }
     }
-        U_ASSERT(FALSE);
+    U_ASSERT(FALSE);
 
     case START_STRING:
     case START_CHAR:
@@ -1067,7 +1067,7 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
 
     case START_LINE:
     {
-        UChar32  c;
+        UChar32 ch;
         if (startPos == fAnchorStart) {
             MatchChunkAt(startPos, FALSE, status);
             if (U_FAILURE(status)) {
@@ -1081,8 +1081,8 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
 
         if (fPattern->fFlags & UREGEX_UNIX_LINES) {
             for (;;) {
-                c = inputBuf[startPos-1];
-                if (c == 0x0a) {
+                ch = inputBuf[startPos-1];
+                if (ch == 0x0a) {
                     MatchChunkAt(startPos, FALSE, status);
                     if (U_FAILURE(status)) {
                         return FALSE;
@@ -1105,9 +1105,9 @@ UBool RegexMatcher::findUsingChunk(UErrorCode &status) {
             }
         } else {
             for (;;) {
-                c = inputBuf[startPos-1];
-                if (isLineTerminator(c)) {
-                    if (c == 0x0d && startPos < fActiveLimit && inputBuf[startPos] == 0x0a) {
+                ch = inputBuf[startPos-1];
+                if (isLineTerminator(ch)) {
+                    if (ch == 0x0d && startPos < fActiveLimit && inputBuf[startPos] == 0x0a) {
                         startPos++;
                     }
                     MatchChunkAt(startPos, FALSE, status);
@@ -2774,7 +2774,7 @@ void RegexMatcher::MatchAt(int64_t startIdx, UBool toEnd, UErrorCode &status) {
     int64_t             *pat           = fPattern->fCompiledPat->getBuffer();
 
     const UChar         *litText       = fPattern->fLiteralText.getBuffer();
-    UVector             *sets          = fPattern->fSets;
+    UVector             *fSets         = fPattern->fSets;
 
     fFrameSize = fPattern->fFrameSize;
     REStackFrame        *fp            = resetStack();
@@ -3376,7 +3376,7 @@ GC_Done:
 
                 // There is input left.  Pick up one char and test it for set membership.
                 UChar32 c = UTEXT_NEXT32(fInputText);
-                U_ASSERT(opValue > 0 && opValue < sets->size());
+                U_ASSERT(opValue > 0 && opValue < fSets->size());
                 if (c<256) {
                     Regex8BitSet *s8 = &fPattern->fSets8[opValue];
                     if (s8->contains(c)) {
@@ -3384,7 +3384,7 @@ GC_Done:
                         break;
                     }
                 } else {
-                    UnicodeSet *s = (UnicodeSet *)sets->elementAt(opValue);
+                    UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
                     if (s->contains(c)) {
                         // The character is in the set.  A Match.
                         fp->fInputIdx = UTEXT_GETNATIVEINDEX(fInputText);
@@ -3671,9 +3671,9 @@ GC_Done:
                 if (newFP == (int64_t *)fp) {
                     break;
                 }
-                int32_t i;
-                for (i=0; i<fFrameSize; i++) {
-                    newFP[i] = ((int64_t *)fp)[i];
+                int32_t j;
+                for (j=0; j<fFrameSize; j++) {
+                    newFP[j] = ((int64_t *)fp)[j];
                 }
                 fp = (REStackFrame *)newFP;
                 fStack->setSize(newStackSize);
@@ -3830,9 +3830,9 @@ GC_Done:
                     //   This makes the capture groups from within the look-ahead
                     //   expression available.
                     int64_t *newFP = fStack->getBuffer() + newStackSize - fFrameSize;
-                    int32_t i;
-                    for (i=0; i<fFrameSize; i++) {
-                        newFP[i] = ((int64_t *)fp)[i];
+                    int32_t j;
+                    for (j=0; j<fFrameSize; j++) {
+                        newFP[j] = ((int64_t *)fp)[j];
                     }
                     fp = (REStackFrame *)newFP;
                     fStack->setSize(newStackSize);
@@ -4123,9 +4123,9 @@ GC_Done:
             //   This op scans through all matching input.
             //   The following LOOP_C op emulates stack unwinding if the following pattern fails.
             {
-                U_ASSERT(opValue > 0 && opValue < sets->size());
+                U_ASSERT(opValue > 0 && opValue < fSets->size());
                 Regex8BitSet *s8 = &fPattern->fSets8[opValue];
-                UnicodeSet   *s  = (UnicodeSet *)sets->elementAt(opValue);
+                UnicodeSet   *s  = (UnicodeSet *)fSets->elementAt(opValue);
 
                 // Loop through input, until either the input is exhausted or
                 //   we reach a character that is not a member of the set.
@@ -4350,7 +4350,7 @@ void RegexMatcher::MatchChunkAt(int32_t startIdx, UBool toEnd, UErrorCode &statu
     int64_t             *pat           = fPattern->fCompiledPat->getBuffer();
 
     const UChar         *litText       = fPattern->fLiteralText.getBuffer();
-    UVector             *sets          = fPattern->fSets;
+    UVector             *fSets         = fPattern->fSets;
 
     const UChar         *inputBuf      = fInputText->chunkContents;
 
@@ -4928,7 +4928,7 @@ GC_Done:
                     break;
                 }
 
-                U_ASSERT(opValue > 0 && opValue < sets->size());
+                U_ASSERT(opValue > 0 && opValue < fSets->size());
 
                 // There is input left.  Pick up one char and test it for set membership.
                 UChar32  c;
@@ -4940,7 +4940,7 @@ GC_Done:
                         break;
                     }
                 } else {
-                    UnicodeSet *s = (UnicodeSet *)sets->elementAt(opValue);
+                    UnicodeSet *s = (UnicodeSet *)fSets->elementAt(opValue);
                     if (s->contains(c)) {
                         // The character is in the set.  A Match.
                         break;
@@ -5214,9 +5214,9 @@ GC_Done:
                 if (newFP == (int64_t *)fp) {
                     break;
                 }
-                int32_t i;
-                for (i=0; i<fFrameSize; i++) {
-                    newFP[i] = ((int64_t *)fp)[i];
+                int32_t j;
+                for (j=0; j<fFrameSize; j++) {
+                    newFP[j] = ((int64_t *)fp)[j];
                 }
                 fp = (REStackFrame *)newFP;
                 fStack->setSize(newStackSize);
@@ -5361,9 +5361,9 @@ GC_Done:
                     //   This makes the capture groups from within the look-ahead
                     //   expression available.
                     int64_t *newFP = fStack->getBuffer() + newStackSize - fFrameSize;
-                    int32_t i;
-                    for (i=0; i<fFrameSize; i++) {
-                        newFP[i] = ((int64_t *)fp)[i];
+                    int32_t j;
+                    for (j=0; j<fFrameSize; j++) {
+                        newFP[j] = ((int64_t *)fp)[j];
                     }
                     fp = (REStackFrame *)newFP;
                     fStack->setSize(newStackSize);
@@ -5623,9 +5623,9 @@ GC_Done:
             //   This op scans through all matching input.
             //   The following LOOP_C op emulates stack unwinding if the following pattern fails.
             {
-                U_ASSERT(opValue > 0 && opValue < sets->size());
+                U_ASSERT(opValue > 0 && opValue < fSets->size());
                 Regex8BitSet *s8 = &fPattern->fSets8[opValue];
-                UnicodeSet   *s  = (UnicodeSet *)sets->elementAt(opValue);
+                UnicodeSet   *s  = (UnicodeSet *)fSets->elementAt(opValue);
 
                 // Loop through input, until either the input is exhausted or
                 //   we reach a character that is not a member of the set.
index ab65f10a3bdfa8ccdc33954596abfd8eb2db34e9..b057b6bbd5a12f7e5dac84e28703d192e54da779 100644 (file)
@@ -764,9 +764,9 @@ RuleBasedCollator::internalCompareUTF8(const char *left, int32_t leftLength,
     // Make sure both or neither strings have a known length.
     // We do not optimize for mixed length/termination.
     if(leftLength >= 0) {
-        if(rightLength < 0) { rightLength = uprv_strlen(right); }
+        if(rightLength < 0) { rightLength = static_cast<int32_t>(uprv_strlen(right)); }
     } else {
-        if(rightLength >= 0) { leftLength = uprv_strlen(left); }
+        if(rightLength >= 0) { leftLength = static_cast<int32_t>(uprv_strlen(left)); }
     }
     return doCompare(reinterpret_cast<const uint8_t *>(left), leftLength,
                      reinterpret_cast<const uint8_t *>(right), rightLength, errorCode);
@@ -862,9 +862,9 @@ public:
         } else {
             str.setTo(text, (int32_t)(spanLimit - text));
             {
-                ReorderingBuffer buffer(nfcImpl, str);
-                if(buffer.init(str.length(), errorCode)) {
-                    nfcImpl.makeFCD(spanLimit, textLimit, &buffer, errorCode);
+                ReorderingBuffer r_buffer(nfcImpl, str);
+                if(r_buffer.init(str.length(), errorCode)) {
+                    nfcImpl.makeFCD(spanLimit, textLimit, &r_buffer, errorCode);
                 }
             }
             if(U_SUCCESS(errorCode)) {
index 073e839f890003ed89f39abaf7ead5c52e7d394b..54ead803c2a3d3f65e8ef3697f4c7ec5ac6e993a 100644 (file)
@@ -298,7 +298,7 @@ uhash_compareScriptSet(UElement key0, UElement key1) {
     icu::ScriptSet *s0 = static_cast<icu::ScriptSet *>(key0.pointer);
     icu::ScriptSet *s1 = static_cast<icu::ScriptSet *>(key1.pointer);
     int32_t diff = s0->countMembers() - s1->countMembers();
-    if (diff != 0) return diff;
+    if (diff != 0) return static_cast<UBool>(diff);
     int32_t i0 = s0->nextSetBit(0);
     int32_t i1 = s1->nextSetBit(0);
     while ((diff = i0-i1) == 0 && i0 > 0) {
index b1b90882fceeadd7d82542b9e2013212df51e116..2bc8e49625fe293e743fffd6e8a75fae8ea9b5ba 100644 (file)
@@ -244,9 +244,9 @@ SimpleDateFormat::NSOverride::~NSOverride() {
 void SimpleDateFormat::NSOverride::free() {
     NSOverride *cur = this;
     while (cur) {
-        NSOverride *next = cur->next;
+        NSOverride *next_temp = cur->next;
         delete cur;
-        cur = next;
+        cur = next_temp;
     }
 }
 
@@ -1304,15 +1304,15 @@ SimpleDateFormat::processOverrideString(const Locale &locale, const UnicodeStrin
 
         int32_t nsNameHash = nsName.hashCode();
         // See if the numbering system is in the override list, if not, then add it.
-        NSOverride *cur = overrideList;
+        NSOverride *curr = overrideList;
         const SharedNumberFormat *snf = NULL;
         UBool found = FALSE;
-        while ( cur && !found ) {
-            if ( cur->hash == nsNameHash ) {
-                snf = cur->snf;
+        while ( curr && !found ) {
+            if ( curr->hash == nsNameHash ) {
+                snf = curr->snf;
                 found = TRUE;
             }
-            cur = cur->next;
+            curr = curr->next;
         }
 
         if (!found) {
@@ -1824,14 +1824,14 @@ SimpleDateFormat::subFormat(UnicodeString &appendTo,
             // Stealing am/pm value to use as our array index.
             // It works out: am/midnight are both 0, pm/noon are both 1,
             // 12 am is 12 midnight, and 12 pm is 12 noon.
-            int32_t value = cal.get(UCAL_AM_PM, status);
+            int32_t val = cal.get(UCAL_AM_PM, status);
 
             if (count <= 3) {
-                toAppend = &fSymbols->fAbbreviatedDayPeriods[value];
+                toAppend = &fSymbols->fAbbreviatedDayPeriods[val];
             } else if (count == 4 || count > 5) {
-                toAppend = &fSymbols->fWideDayPeriods[value];
+                toAppend = &fSymbols->fWideDayPeriods[val];
             } else { // count == 5
-                toAppend = &fSymbols->fNarrowDayPeriods[value];
+                toAppend = &fSymbols->fNarrowDayPeriods[val];
             }
         }
 
@@ -2281,10 +2281,10 @@ SimpleDateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition&
 
                     if (i+1 < fPattern.length()) {
                         // move to next pattern character
-                        UChar ch = fPattern.charAt(i+1);
+                        UChar c = fPattern.charAt(i+1);
 
                         // check for whitespace
-                        if (PatternProps::isWhiteSpace(ch)) {
+                        if (PatternProps::isWhiteSpace(c)) {
                             i++;
                             // Advance over run in pattern
                             while ((i+1)<fPattern.length() &&
@@ -3162,8 +3162,8 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             if (!strcmp(cal.getType(),"hebrew")) {
                 HebrewCalendar *hc = (HebrewCalendar*)&cal;
                 if (cal.isSet(UCAL_YEAR)) {
-                   UErrorCode status = U_ZERO_ERROR;
-                   if (!hc->isLeapYear(hc->get(UCAL_YEAR,status)) && value >= 6) {
+                   UErrorCode monthStatus = U_ZERO_ERROR;
+                   if (!hc->isLeapYear(hc->get(UCAL_YEAR, monthStatus)) && value >= 6) {
                        cal.set(UCAL_MONTH, value);
                    } else {
                        cal.set(UCAL_MONTH, value - 1);
@@ -3571,21 +3571,21 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             static const UChar alt_sep = DateFormatSymbols::ALTERNATE_TIME_SEPARATOR;
 
             // Try matching a time separator.
-            int32_t count = 1;
+            int32_t count_sep = 1;
             UnicodeString data[3];
             fSymbols->getTimeSeparatorString(data[0]);
 
             // Add the default, if different from the locale.
             if (data[0].compare(&def_sep, 1) != 0) {
-                data[count++].setTo(def_sep);
+                data[count_sep++].setTo(def_sep);
             }
 
             // If lenient, add also the alternate, if different from the locale.
             if (isLenient() && data[0].compare(&alt_sep, 1) != 0) {
-                data[count++].setTo(alt_sep);
+                data[count_sep++].setTo(alt_sep);
             }
 
-            return matchString(text, start, UCAL_FIELD_COUNT /* => nothing to set */, data, count, NULL, cal);
+            return matchString(text, start, UCAL_FIELD_COUNT /* => nothing to set */, data, count_sep, NULL, cal);
         }
 
     case UDAT_AM_PM_MIDNIGHT_NOON_FIELD:
@@ -3674,7 +3674,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
     }
     parseInt(*src, number, pos, allowNegative,currentNumberFormat);
     if (pos.getIndex() != parseStart) {
-        int32_t value = number.getLong();
+        int32_t val = number.getLong();
 
         // Don't need suffix processing here (as in number processing at the beginning of the function);
         // the new fields being handled as numeric values (month, weekdays, quarters) should not have suffixes.
@@ -3682,7 +3682,7 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
         if (!getBooleanAttribute(UDAT_PARSE_ALLOW_NUMERIC, status)) {
             // Check the range of the value
             int32_t bias = gFieldRangeBias[patternCharIndex];
-            if (bias >= 0 && (value > cal.getMaximum(field) + bias || value < cal.getMinimum(field) + bias)) {
+            if (bias >= 0 && (val > cal.getMaximum(field) + bias || val < cal.getMinimum(field) + bias)) {
                 return -start;
             }
         }
@@ -3696,35 +3696,35 @@ int32_t SimpleDateFormat::subParse(const UnicodeString& text, int32_t& start, UC
             if (!strcmp(cal.getType(),"hebrew")) {
                 HebrewCalendar *hc = (HebrewCalendar*)&cal;
                 if (cal.isSet(UCAL_YEAR)) {
-                   UErrorCode status = U_ZERO_ERROR;
-                   if (!hc->isLeapYear(hc->get(UCAL_YEAR,status)) && value >= 6) {
-                       cal.set(UCAL_MONTH, value);
+                   UErrorCode monthStatus = U_ZERO_ERROR;
+                   if (!hc->isLeapYear(hc->get(UCAL_YEAR, monthStatus)) && val >= 6) {
+                       cal.set(UCAL_MONTH, val);
                    } else {
-                       cal.set(UCAL_MONTH, value - 1);
+                       cal.set(UCAL_MONTH, val - 1);
                    }
                 } else {
-                    saveHebrewMonth = value;
+                    saveHebrewMonth = val;
                 }
             } else {
-                cal.set(UCAL_MONTH, value - 1);
+                cal.set(UCAL_MONTH, val - 1);
             }
             break;
         case UDAT_STANDALONE_MONTH_FIELD:
-            cal.set(UCAL_MONTH, value - 1);
+            cal.set(UCAL_MONTH, val - 1);
             break;
         case UDAT_DOW_LOCAL_FIELD:
         case UDAT_STANDALONE_DAY_FIELD:
-            cal.set(UCAL_DOW_LOCAL, value);
+            cal.set(UCAL_DOW_LOCAL, val);
             break;
         case UDAT_QUARTER_FIELD:
         case UDAT_STANDALONE_QUARTER_FIELD:
-             cal.set(UCAL_MONTH, (value - 1) * 3);
+             cal.set(UCAL_MONTH, (val - 1) * 3);
              break;
         case UDAT_RELATED_YEAR_FIELD:
-            cal.setRelatedYear(value);
+            cal.setRelatedYear(val);
             break;
         default:
-            cal.set(field, value);
+            cal.set(field, val);
             break;
         }
         return pos.getIndex();
@@ -3971,7 +3971,7 @@ SimpleDateFormat::setContext(UDisplayContext value, UErrorCode& status)
     if (U_SUCCESS(status)) {
         if ( fCapitalizationBrkIter == NULL && (value==UDISPCTX_CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ||
                 value==UDISPCTX_CAPITALIZATION_FOR_UI_LIST_OR_MENU || value==UDISPCTX_CAPITALIZATION_FOR_STANDALONE) ) {
-            UErrorCode status = U_ZERO_ERROR;
+            status = U_ZERO_ERROR;
             fCapitalizationBrkIter = BreakIterator::createSentenceInstance(fLocale, status);
             if (U_FAILURE(status)) {
                 delete fCapitalizationBrkIter;
index 12c3039d7cb627affdd7a92db25e7354bd3d8d15..234f52cc3dd70764d4d3301148466f5236b38134 100644 (file)
@@ -1031,8 +1031,8 @@ TimeZone::getEquivalentID(const UnicodeString& id, int32_t index) {
         UResourceBundle *ares = ures_getByKey(top, kNAMES, NULL, &ec); // dereference Zones section
         if (U_SUCCESS(ec)) {
             int32_t idLen = 0;
-            const UChar* id = ures_getStringByIndex(ares, zone, &idLen, &ec);
-            result.fastCopyFrom(UnicodeString(TRUE, id, idLen));
+            const UChar* id2 = ures_getStringByIndex(ares, zone, &idLen, &ec);
+            result.fastCopyFrom(UnicodeString(TRUE, id2, idLen));
             U_DEBUG_TZ_MSG(("gei(%d) -> %d, len%d, %s\n", index, zone, result.length(), u_errorName(ec)));
         }
         ures_close(ares);
@@ -1199,7 +1199,7 @@ TimeZone::getDisplayName(UBool daylight, EDisplayType style, const Locale& local
 {
     UErrorCode status = U_ZERO_ERROR;
     UDate date = Calendar::getNow();
-    UTimeZoneFormatTimeType timeType;
+    UTimeZoneFormatTimeType timeType = UTZFMT_TIME_TYPE_UNKNOWN;
     int32_t offset;
 
     if (style == GENERIC_LOCATION || style == LONG_GENERIC || style == SHORT_GENERIC) {
@@ -1612,7 +1612,7 @@ TimeZone::getWindowsID(const UnicodeString& id, UnicodeString& winid, UErrorCode
                     end = tzids + len;
                     hasNext = FALSE;
                 }
-                if (canonicalID.compare(start, end - start) == 0) {
+                if (canonicalID.compare(start, static_cast<int32_t>(end - start)) == 0) {
                     winid = UnicodeString(ures_getKey(winzone), -1 , US_INV);
                     found = TRUE;
                     break;
@@ -1673,7 +1673,7 @@ TimeZone::getIDForWindowsID(const UnicodeString& winid, const char* region, Unic
             if (end == NULL) {
                 id.setTo(tzids, -1);
             } else {
-                id.setTo(tzids, end - tzids);
+                id.setTo(tzids, static_cast<int32_t>(end - tzids));
             }
             gotID = TRUE;
         }
index 36dcebe987d372cb70777e4b71c3a45e3001aef7..1a96ad367f20d0a4d78da5e99f2a3119c35a5aeb 100644 (file)
@@ -1330,12 +1330,12 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID
             int32_t passNumber = 1;
             for (int32_t i = 0; U_SUCCESS(status) && i < entry->u.dataVector->size(); i++) {
                 // TODO: Should passNumber be turned into a decimal-string representation (1 -> "1")?
-                Transliterator* t = new RuleBasedTransliterator(UnicodeString(CompoundTransliterator::PASS_STRING) + UnicodeString(passNumber++),
+                Transliterator* tl = new RuleBasedTransliterator(UnicodeString(CompoundTransliterator::PASS_STRING) + UnicodeString(passNumber++),
                     (TransliterationRuleData*)(entry->u.dataVector->elementAt(i)), FALSE);
-                if (t == 0)
+                if (tl == 0)
                     status = U_MEMORY_ALLOCATION_ERROR;
                 else
-                    rbts->addElement(t, status);
+                    rbts->addElement(tl, status);
             }
             if (U_FAILURE(status)) {
                 delete rbts;
index 3de84f42940368e5e431a653b13e5079defee87f..769977a3e31b9cccfc02c57448678fd6435446ee 100644 (file)
@@ -2648,12 +2648,12 @@ TimeZoneFormat::checkAbuttingHoursAndMinutes() {
         UVector *items = fGMTOffsetPatternItems[type];
         for (int32_t i = 0; i < items->size(); i++) {
             const GMTOffsetField* item = (GMTOffsetField*)items->elementAt(i);
-            GMTOffsetField::FieldType type = item->getType();
-            if (type != GMTOffsetField::TEXT) {
+            GMTOffsetField::FieldType fieldType = item->getType();
+            if (fieldType != GMTOffsetField::TEXT) {
                 if (afterH) {
                     fAbuttingOffsetHoursAndMinutes = TRUE;
                     break;
-                } else if (type == GMTOffsetField::HOUR) {
+                } else if (fieldType == GMTOffsetField::HOUR) {
                     afterH = TRUE;
                 }
             } else if (afterH) {
index c2e685272e9b36713dcee19462d3f31220371faf..5f5b7db30227cccdc928122302359d1f763fb2d1 100644 (file)
@@ -407,7 +407,7 @@ TZGNCore::initialize(const Locale& locale, UErrorCode& status) {
 
     // target region
     const char* region = fLocale.getCountry();
-    int32_t regionLen = uprv_strlen(region);
+    int32_t regionLen = static_cast<int32_t>(uprv_strlen(region));
     if (regionLen == 0) {
         char loc[ULOC_FULLNAME_CAPACITY];
         uloc_addLikelySubtags(fLocale.getName(), loc, sizeof(loc), &status);
index 689fdeb0915300146cd8f1aeeb4ee86be58687ab..5a79c22aacf8f970e421aac80c01edeee2e2b320 100644 (file)
@@ -87,7 +87,7 @@ static void sweepCache() {
     const UHashElement* elem;
     double now = (double)uprv_getUTCtime();
 
-    while ((elem = uhash_nextElement(gTimeZoneNamesCache, &pos))) {
+    while ((elem = uhash_nextElement(gTimeZoneNamesCache, &pos)) != 0) {
         TimeZoneNamesCacheEntry *entry = (TimeZoneNamesCacheEntry *)elem->value.pointer;
         if (entry->refCount <= 0 && (now - entry->lastAccess) > CACHE_EXPIRATION) {
             // delete this entry
index 7045f099516e512f4e35587a978fd75e28824f93..7bfbc04e180051243471bcde5fee1536442a0fde 100644 (file)
@@ -1285,7 +1285,7 @@ static void mergeTimeZoneKey(const UnicodeString& mzID, char* result) {
 
     char mzIdChar[ZID_KEY_MAX + 1];
     int32_t keyLen;
-    int32_t prefixLen = uprv_strlen(gMZPrefix);
+    int32_t prefixLen = static_cast<int32_t>(uprv_strlen(gMZPrefix));
     keyLen = mzID.extract(0, mzID.length(), mzIdChar, ZID_KEY_MAX + 1, US_INV);
     uprv_memcpy((void *)result, (void *)gMZPrefix, prefixLen);
     uprv_memcpy((void *)(result + prefixLen), (void *)mzIdChar, keyLen);
@@ -1453,7 +1453,7 @@ struct TimeZoneNamesImpl::ZoneStringsLoader : public ResourceSink {
     virtual ~ZoneStringsLoader();
 
     void* createKey(const char* key, UErrorCode& status) {
-        int32_t len = sizeof(char) * (uprv_strlen(key) + 1);
+        int32_t len = sizeof(char) * (static_cast<int32_t>(uprv_strlen(key)) + 1);
         char* newKey = (char*) uprv_malloc(len);
         if (newKey == NULL) {
             status = U_MEMORY_ALLOCATION_ERROR;
@@ -1469,7 +1469,7 @@ struct TimeZoneNamesImpl::ZoneStringsLoader : public ResourceSink {
     }
 
     UnicodeString mzIDFromKey(const char* key) {
-        return UnicodeString(key + MZ_PREFIX_LEN, uprv_strlen(key) - MZ_PREFIX_LEN, US_INV);
+        return UnicodeString(key + MZ_PREFIX_LEN, static_cast<int32_t>(uprv_strlen(key)) - MZ_PREFIX_LEN, US_INV);
     }
 
     UnicodeString tzIDFromKey(const char* key) {
@@ -1944,8 +1944,8 @@ TZDBNameSearchHandler::handleMatch(int32_t matchLength, const CharacterNode *nod
                     // metazone mapping for "CST" is America_Central,
                     // but if region is one of CN/MO/TW, "CST" is parsed
                     // as metazone China (China Standard Time).
-                    for (int32_t i = 0; i < ninfo->nRegions; i++) {
-                        const char *region = ninfo->parseRegions[i];
+                    for (int32_t j = 0; j < ninfo->nRegions; j++) {
+                        const char *region = ninfo->parseRegions[j];
                         if (uprv_strcmp(fRegion, region) == 0) {
                             match = ninfo;
                             matchRegion = TRUE;
@@ -2059,7 +2059,7 @@ static void U_CALLCONV prepareFind(UErrorCode &status) {
     const UnicodeString *mzID;
     StringEnumeration *mzIDs = TimeZoneNamesImpl::_getAvailableMetaZoneIDs(status);
     if (U_SUCCESS(status)) {
-        while ((mzID = mzIDs->snext(status)) && U_SUCCESS(status)) {
+        while ((mzID = mzIDs->snext(status)) != 0 && U_SUCCESS(status)) {
             const TZDBNames *names = TZDBTimeZoneNames::getMetaZoneNames(*mzID, status);
             if (U_FAILURE(status)) {
                 break;
@@ -2128,7 +2128,7 @@ TZDBTimeZoneNames::TZDBTimeZoneNames(const Locale& locale)
 : fLocale(locale) {
     UBool useWorld = TRUE;
     const char* region = fLocale.getCountry();
-    int32_t regionLen = uprv_strlen(region);
+    int32_t regionLen = static_cast<int32_t>(uprv_strlen(region));
     if (regionLen == 0) {
         UErrorCode status = U_ZERO_ERROR;
         char loc[ULOC_FULLNAME_CAPACITY];
index 76975ecc01de638af22f6028c699ccbb3897f9e4..56ed5b3c19cacadb265808050c6f73c7ec255a74 100644 (file)
@@ -400,11 +400,11 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
     // Try to fetch the optional rules string.
     {
         UErrorCode internalErrorCode = U_ZERO_ERROR;
-        int32_t length;
-        const UChar *s = ures_getStringByKey(data, "Sequence", &length,
+        int32_t len;
+        const UChar *s = ures_getStringByKey(data, "Sequence", &len,
                                              &internalErrorCode);
         if(U_SUCCESS(internalErrorCode)) {
-            t->rules.setTo(TRUE, s, length);
+            t->rules.setTo(TRUE, s, len);
         }
     }
 
@@ -426,10 +426,10 @@ CollationLoader::loadFromData(UErrorCode &errorCode) {
         LocalUResourceBundlePointer def(
                 ures_getByKeyWithFallback(actualBundle.getAlias(), "collations/default", NULL,
                                           &internalErrorCode));
-        int32_t length;
-        const UChar *s = ures_getString(def.getAlias(), &length, &internalErrorCode);
-        if(U_SUCCESS(internalErrorCode) && length < UPRV_LENGTHOF(defaultType)) {
-            u_UCharsToChars(s, defaultType, length + 1);
+        int32_t len;
+        const UChar *s = ures_getString(def.getAlias(), &len, &internalErrorCode);
+        if(U_SUCCESS(internalErrorCode) && len < UPRV_LENGTHOF(defaultType)) {
+            u_UCharsToChars(s, defaultType, len + 1);
         } else {
             uprv_strcpy(defaultType, "standard");
         }
index 5e06dd6d069556fc888e4b0b3cc3c65a349f33fd..b47e3219885a8cb8ff5607ed34c93964f84805a8 100644 (file)
@@ -603,7 +603,7 @@ udat_getSymbols(const   UDateFormat     *fmt,
     } else {
         return -1;
     }
-    int32_t count;
+    int32_t count = 0;
     const UnicodeString *res = NULL;
 
     switch(type) {
index d406b8e8c3782e905d3a5f08c02ff4ebd7d65f7a..7f4e7b9b116e0920ac21245c041520376e0d4f47 100644 (file)
@@ -372,7 +372,7 @@ ulocdata_getLocaleSeparator(ULocaleData *uld,
     p1=u_strstr(separator, sub1);
     if (p0!=NULL && p1!=NULL && p0<=p1) {
         separator = (const UChar *)p0 + subLen;
-        len = p1 - separator;
+        len = static_cast<int32_t>(p1 - separator);
         /* Desired separator is no longer zero-terminated; handle that if necessary */
         if (len < resultCapacity) {
             u_strncpy(result, separator, len);
index 5e70269282496914e72cbbac9ebda26d5af442b2..3167a76c33a66862991c8bfeea91defeff63a98a 100644 (file)
@@ -348,7 +348,7 @@ class U_I18N_API MeasureFormat : public Format {
     const MeasureFormatCacheData *cache;
     const SharedNumberFormat *numberFormat;
     const SharedPluralRules *pluralRules;
-    UMeasureFormatWidth width;    
+    UMeasureFormatWidth fWidth;    
 
     // Declared outside of MeasureFormatSharedData because ListFormatter
     // objects are relatively cheap to copy; therefore, they don't need to be
index 8bdbe96bee443be4282e4e9e1d097019ffba7b04..df234cea040c68d1e634de014561c50e68db2dd3 100644 (file)
@@ -1094,7 +1094,7 @@ private:
     void format(double number, NFRuleSet& rs, UnicodeString& toAppendTo, UErrorCode& status) const;
 
 private:
-    NFRuleSet **ruleSets;
+    NFRuleSet **fRuleSets;
     UnicodeString* ruleSetDescriptions;
     int32_t numRuleSets;
     NFRuleSet *defaultRuleSet;
@@ -1103,7 +1103,7 @@ private:
     DecimalFormatSymbols* decimalFormatSymbols;
     NFRule *defaultInfinityRule;
     NFRule *defaultNaNRule;
-    ERoundingMode roundingMode;
+    ERoundingMode fRoundingMode;
     UBool lenient;
     UnicodeString* lenientParseRules;
     LocalizationInfo* localizations;
index 80b2929e9f00c3c63b1de632358a1e104d41904d..4014025f6f237155f031d3d7bb2e4830989a5625 100644 (file)
@@ -192,7 +192,7 @@ private:
     char id[4];
     UnicodeString idStr;
     int32_t code;
-    URegionType type;
+    URegionType fType;
     Region *containingRegion;
     UVector *containedRegions;
     UVector *preferredValues;
index 12f36894d71c4e45ee0de38c0ed1ffba210a2ca4..9a189a328713a9457a5fe097ab19154ec5d464a7 100644 (file)
@@ -1654,8 +1654,8 @@ int32_t RegexCImpl::appendTail(RegularExpression    *regexp,
         } else if (UTEXT_USES_U16(m->fInputText)) {
             srcIdx = (int32_t)nativeIdx;
         } else {
-            UErrorCode status = U_ZERO_ERROR;
-            srcIdx = utext_extract(m->fInputText, 0, nativeIdx, NULL, 0, &status);
+            UErrorCode newStatus = U_ZERO_ERROR;
+            srcIdx = utext_extract(m->fInputText, 0, nativeIdx, NULL, 0, &newStatus);
         }
 
         for (;;) {
index 645db01ecb1e6edb110dc88001d5333fd8b1123e..4f758bac5156977149e950bd6a0dd73858f6913f 100644 (file)
@@ -498,7 +498,7 @@ inline void setShiftTable(int16_t   shift[], int16_t backshift[],
     for (count = 0; count < cesize; count ++) {
         // number of ces from right of array to the count
         int temp = defaultforward - count - 1;
-        shift[hashFromCE32(cetable[count])] = temp > 1 ? temp : 1;
+        shift[hashFromCE32(cetable[count])] = temp > 1 ? static_cast<int16_t>(temp) : 1;
     }
     shift[hashFromCE32(cetable[cesize])] = 1;
     // for ignorables we just shift by one. see test examples.
index 6ddcf4117d1d7af2763ffad358aa139c4435eea7..cb84c6260f630ca5e7cad41fc068e1b5ef376e0e 100644 (file)
@@ -135,7 +135,7 @@ static UnicodeString& appendAsciiDigits(int32_t number, uint8_t length, UnicodeS
             digits[i++] = number % 10;
             number /= 10;
         } while (number != 0);
-        length = i;
+        length = static_cast<uint8_t>(i);
     } else {
         // fixed digits
         for (i = 0; i < length; i++) {
index 02562048a525da623890fb8eb0459a273c57605e..b7139a807b3fb751be65d4431e7d626b17d03c2f 100644 (file)
@@ -319,10 +319,10 @@ ZoneMeta::getCanonicalCLDRID(const UnicodeString &tzid, UErrorCode& status) {
                 id[len] = (char) 0; // Make sure it is null terminated.
 
                 // replace '/' with ':'
-                char *p = id;
-                while (*p++) {
-                    if (*p == '/') {
-                        *p = ':';
+                char *q = id;
+                while (*q++) {
+                    if (*q == '/') {
+                        *q = ':';
                     }
                 }
 
@@ -850,13 +850,13 @@ ZoneMeta::createCustomTimeZone(int32_t offset) {
         negative = TRUE;
         tmp = -offset;
     }
-    int32_t hour, min, sec;
+    uint8_t hour, min, sec;
 
     tmp /= 1000;
-    sec = tmp % 60;
+    sec = static_cast<uint8_t>(tmp % 60);
     tmp /= 60;
-    min = tmp % 60;
-    hour = tmp / 60;
+    min = static_cast<uint8_t>(tmp % 60);
+    hour = static_cast<uint8_t>(tmp / 60);
 
     UnicodeString zid;
     formatCustomID(hour, min, sec, negative, zid);