]> granicus.if.org Git - icu/commitdiff
ICU-13275 Merge warning cleanup fixes into trunk
authorWilliam Zhao <39807811+mingyzha@users.noreply.github.com>
Sat, 22 Jul 2017 01:11:59 +0000 (01:11 +0000)
committerWilliam Zhao <39807811+mingyzha@users.noreply.github.com>
Sat, 22 Jul 2017 01:11:59 +0000 (01:11 +0000)
X-SVN-Rev: 40283

30 files changed:
icu4c/source/common/caniter.cpp
icu4c/source/common/locmap.cpp
icu4c/source/common/putil.cpp
icu4c/source/common/uchar.cpp
icu4c/source/common/uchar_props_data.h
icu4c/source/common/ucnv_ct.cpp
icu4c/source/common/ucnv_lmb.cpp
icu4c/source/common/ucnvmbcs.cpp
icu4c/source/common/udata.cpp
icu4c/source/common/uhash.cpp
icu4c/source/common/uinvchar.cpp
icu4c/source/common/ulist.cpp
icu4c/source/common/uloc.cpp
icu4c/source/common/uloc_tag.cpp
icu4c/source/common/umapfile.cpp
icu4c/source/common/umutex.cpp
icu4c/source/common/unifiedcache.h
icu4c/source/common/ustrtrns.cpp
icu4c/source/common/uts46.cpp
icu4c/source/i18n/plurrule.cpp
icu4c/source/i18n/tzfmt.cpp
icu4c/source/i18n/tzgnames.cpp
icu4c/source/i18n/tznames_impl.cpp
icu4c/source/i18n/ucol_res.cpp
icu4c/source/i18n/unum.cpp
icu4c/source/i18n/uspoof.cpp
icu4c/source/i18n/windtfmt.cpp
icu4c/source/i18n/winnmfmt.cpp
icu4c/source/i18n/wintzimpl.cpp
icu4c/source/i18n/zonemeta.cpp

index aee9f4ee31afab2e86d6140f99d396a7cb6c1951..b28acfc84ee3b0bd93eb6e8f925ef4d4f1f280df 100644 (file)
@@ -405,7 +405,7 @@ UnicodeString* CanonicalIterator::getEquivalents(const UnicodeString &segment, i
     //String[] finalResult = new String[result.size()];
     UnicodeString *finalResult = NULL;
     int32_t resultCount;
-    if((resultCount = result.count())) {
+    if((resultCount = result.count()) != 0) {
         finalResult = new UnicodeString[resultCount];
         if (finalResult == 0) {
             status = U_MEMORY_ALLOCATION_ERROR;
index ea4d61efe4b5737df240ff60e7b34bbd23960c60..cbb2b810a58f2f2535bd4ca0f5a5ab58a4a387dd 100644 (file)
@@ -1132,7 +1132,7 @@ uprv_convertToPosix(uint32_t hostid, char *posixID, int32_t posixIDCapacity, UEr
     }
 
     if (pPosixID) {
-        int32_t resLen = uprv_strlen(pPosixID);
+        int32_t resLen = static_cast<int32_t>(uprv_strlen(pPosixID));
         int32_t copyLen = resLen <= posixIDCapacity ? resLen : posixIDCapacity;
         uprv_memcpy(posixID, pPosixID, copyLen);
         if (resLen < posixIDCapacity) {
@@ -1206,7 +1206,7 @@ uprv_convertToLCIDPlatform(const char* localeID)
 
     char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {};
     // this will change it from de_DE@collation=phonebook to de-DE-u-co-phonebk form
-    int32_t bcp47Len = uloc_toLanguageTag(mylocaleID, asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &myStatus);
+    (void)uloc_toLanguageTag(mylocaleID, asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &myStatus);
 
     if (U_SUCCESS(myStatus))
     {
index 96f343635a76fc605290eb157a8371824ba0aa18..1bfd2475228e81832b1e3535fa96a1db37849f7d 100644 (file)
@@ -1050,7 +1050,7 @@ uprv_getWindowsTimeZone()
             hr = timezone->GetTimeZone(timezoneString.GetAddressOf());
             if (SUCCEEDED(hr))
             {
-                int32_t length = wcslen(timezoneString.GetRawBuffer(NULL));
+                int32_t length = static_cast<int32_t>(wcslen(timezoneString.GetRawBuffer(NULL)));
                 char* asciiId = (char*)uprv_calloc(length + 1, sizeof(char));
                 if (asciiId != nullptr)
                 {
@@ -1069,6 +1069,7 @@ uprv_getWindowsTimeZone()
 U_CAPI const char* U_EXPORT2
 uprv_tzname(int n)
 {
+    n; // Avoid unreferenced parameter warning.
     const char *tzid = NULL;
 #if U_PLATFORM_USES_ONLY_WIN32_API
 #if U_PLATFORM_HAS_WINUWP_API > 0
@@ -1292,7 +1293,7 @@ u_setDataDirectory(const char *directory) {
 #if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
         {
             char *p;
-            while(p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) {
+            while((p = uprv_strchr(newDataDir, U_FILE_ALT_SEP_CHAR)) != NULL) {
                 *p = U_FILE_SEP_CHAR;
             }
         }
@@ -1450,7 +1451,7 @@ static void setTimeZoneFilesDir(const char *path, UErrorCode &status) {
     gTimeZoneFilesDirectory->append(path, status);
 #if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
     char *p = gTimeZoneFilesDirectory->data();
-    while (p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) {
+    while ((p = uprv_strchr(p, U_FILE_ALT_SEP_CHAR)) != NULL) {
         *p = U_FILE_SEP_CHAR;
     }
 #endif
index 6d96f342fc7f29420eea7ce79fa5c2c88090893e..a7374b7e9add3f13e1f53bba185214566fe4cc5d 100644 (file)
@@ -729,8 +729,5 @@ upropsvec_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
     }
 
     /* add the start code point of each same-value range of the properties vectors trie */
-    if(propsVectorsColumns>0) {
-        /* if propsVectorsColumns==0 then the properties vectors trie may not be there at all */
-        utrie2_enum(&propsVectorsTrie, NULL, _enumPropertyStartsRange, sa);
-    }
+    utrie2_enum(&propsVectorsTrie, NULL, _enumPropertyStartsRange, sa);
 }
index 5b5c4ddca1ee578194dcc99d9cc889be5099dc9f..94de36673d72e3d90ad747e70f45c4d248ef0fe7 100644 (file)
@@ -3601,7 +3601,7 @@ static const uint32_t propsVectors[6375]={
 0xe30000,0xa00b1596,0x7c00300,0xe30000,0xa040af86,0x6800400,0x962540};
 
 static const int32_t countPropsVectors=6375;
-static const int32_t propsVectorsColumns=3;
+static const int32_t propsVectorsColumns=3; /* The code assumes that this value is  > 0*/
 static const uint16_t scriptExtensions[198]={
 0x800e,0x8019,8,0x8059,8,2,8,0x8038,8,6,8,0x8019,3,0x800c,2,0x22,
 0x8025,2,0xe,2,0x22,0x54,0x79,0x7b,0x80a7,2,0x8022,2,0x8025,2,0x1b,4,
index c9a0ce36930ec91cfcffddf2ac0e83839f123ac5..e363193860a0534c3f5d75fd4a3eedbb672c71fa 100644 (file)
@@ -519,7 +519,7 @@ UConverter_toUnicode_CompoundText_OFFSETS(UConverterToUnicodeArgs *args,
                     currentState = tmpState;
                 }
 
-                sourceOffset = uprv_strlen((char*)escSeqCompoundText[currentState]) - args->converter->toULength;
+                sourceOffset = static_cast<int32_t>(uprv_strlen((char*)escSeqCompoundText[currentState]) - args->converter->toULength);
 
                 mySource += sourceOffset;
 
index ec6dc66bda9ab78f3b32a7fa1ff7fd58628b932d..1ec56f7a45fbc41c5590f32b0daef0dd83c026cb 100644 (file)
@@ -966,26 +966,26 @@ _LMBCSFromUnicode(UConverterFromUnicodeArgs*     args,
 
                 if(extraInfo->localeConverterIndex < ULMBCS_DOUBLEOPTGROUP_START)
                 {
-                  bytes_written = LMBCSConversionWorker (extraInfo,
+                  bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
                      ULMBCS_GRP_L1, pLMBCS, &uniChar,
                      &lastConverterIndex, groups_tried);
 
                   if(!bytes_written)
                   {
-                     bytes_written = LMBCSConversionWorker (extraInfo,
+                     bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
                          ULMBCS_GRP_EXCEPT, pLMBCS, &uniChar,
                          &lastConverterIndex, groups_tried);
                   }
                   if(!bytes_written)
                   {
-                      bytes_written = LMBCSConversionWorker (extraInfo,
+                      bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
                           extraInfo->localeConverterIndex, pLMBCS, &uniChar,
                           &lastConverterIndex, groups_tried);
                   }
                 }
                 else
                 {
-                     bytes_written = LMBCSConversionWorker (extraInfo,
+                     bytes_written = (int32_t)LMBCSConversionWorker (extraInfo,
                          extraInfo->localeConverterIndex, pLMBCS, &uniChar,
                          &lastConverterIndex, groups_tried);
                 }
index 7f37eeeeaafbbaae81728b58461085bea87282cb..21a651f89684db6e0d6f2a46f51851362409375c 100644 (file)
@@ -5037,7 +5037,7 @@ ucnv_SBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
     uint8_t b, t1, t2;
 
     uint32_t asciiRoundtrips;
-    uint16_t value, minValue;
+    uint16_t value, minValue = 0;
     UBool hasSupplementary;
 
     /* set up the local pointers */
@@ -5344,7 +5344,7 @@ ucnv_DBCSFromUTF8(UConverterFromUnicodeArgs *pFromUArgs,
 
     uint32_t stage2Entry;
     uint32_t asciiRoundtrips;
-    uint16_t value;
+    uint16_t value = 0;
     UBool hasSupplementary;
 
     /* set up the local pointers */
index 29074a64c45618693009d51053c747031b34081a..3cb8863f6c373cf4de898971a6bc2182dd546993 100644 (file)
@@ -206,6 +206,8 @@ setCommonICUData(UDataMemory *pData,     /*  The new common data.  Belongs to ca
     return didUpdate;
 }
 
+#if U_PLATFORM_HAS_WINUWP_API == 0 
+
 static UBool
 setCommonICUDataPointer(const void *pData, UBool /*warn*/, UErrorCode *pErrorCode) {
     UDataMemory tData;
@@ -215,6 +217,8 @@ setCommonICUDataPointer(const void *pData, UBool /*warn*/, UErrorCode *pErrorCod
     return setCommonICUData(&tData, FALSE, pErrorCode);
 }
 
+#endif
+
 static const char *
 findBasename(const char *path) {
     const char *basename=uprv_strrchr(path, U_FILE_SEP_CHAR);
@@ -982,7 +986,7 @@ static UDataMemory *doLoadFromIndividualFiles(const char *pkgName,
     /* init path iterator for individual files */
     UDataPathIterator iter(dataPath, pkgName, path, tocEntryPathSuffix, FALSE, pErrorCode);
 
-    while((pathBuffer = iter.next(pErrorCode)))
+    while((pathBuffer = iter.next(pErrorCode)) != NULL)
     {
 #ifdef UDATA_DEBUG
         fprintf(stderr, "UDATA: trying individual file %s\n", pathBuffer);
@@ -1165,7 +1169,7 @@ doOpenChoice(const char *path, const char *type, const char *name,
         if(uprv_strchr(path,U_FILE_ALT_SEP_CHAR) != NULL) {
             altSepPath.append(path, *pErrorCode);
             char *p;
-            while((p=uprv_strchr(altSepPath.data(), U_FILE_ALT_SEP_CHAR))) {
+            while ((p = uprv_strchr(altSepPath.data(), U_FILE_ALT_SEP_CHAR)) != NULL) {
                 *p = U_FILE_SEP_CHAR;
             }
 #if defined (UDATA_DEBUG)
index 6bde9e59f0131e73d204faa6c0cbbf18d43eb734..b7326f238cc1e18058335c20a53bf620d41ed5c0 100644 (file)
@@ -844,7 +844,7 @@ 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 : ustr_hashCharsN(s, uprv_strlen(s));
+    return s == NULL ? 0 : static_cast<int32_t>(ustr_hashCharsN(s, uprv_strlen(s)));
 }
 
 U_CAPI int32_t U_EXPORT2
index c478e363658d7ac29f3dffd0b4cf4acd45cfcbd8..a0fd9dfbb1cd9d3c8fa4aaefbbddd8e351af8d8a 100644 (file)
@@ -573,7 +573,7 @@ uprv_aestrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
   uint8_t *orig_dst = dst;
 
   if(n==-1) { 
-    n = uprv_strlen((const char*)src)+1; /* copy NUL */
+    n = static_cast<int32_t>(uprv_strlen((const char*)src)+1); /* copy NUL */
   }
   /* copy non-null */
   while(*src && n>0) {
@@ -594,7 +594,7 @@ uprv_eastrncpy(uint8_t *dst, const uint8_t *src, int32_t n)
   uint8_t *orig_dst = dst;
 
   if(n==-1) { 
-    n = uprv_strlen((const char*)src)+1; /* copy NUL */
+    n = static_cast<int32_t>(uprv_strlen((const char*)src)+1); /* copy NUL */
   }
   /* copy non-null */
   while(*src && n>0) {
index b3f3fd8b7e859124c0464f65895bc6ea91ee785e..c5180431c31b75c28d21bfdd92f77507b433caf9 100644 (file)
@@ -252,7 +252,7 @@ U_CAPI const char * U_EXPORT2 ulist_next_keyword_value(UEnumeration *en, int32_t
 
     s = (const char *)ulist_getNext((UList *)(en->context));
     if (s != NULL && resultLength != NULL) {
-        *resultLength = uprv_strlen(s);
+        *resultLength = static_cast<int32_t>(uprv_strlen(s));
     }
     return s;
 }
index 9ca901607249c684a9272e2166862a027cfee7f2..4a6cdbcc197337939aa1730780edba6a54ea6b55 100644 (file)
@@ -538,7 +538,7 @@ static const VariantMap VARIANT_MAP[] = {
         }
 /* Gets the size of the shortest subtag in the given localeID. */
 static int32_t getShortestSubtagLength(const char *localeID) {
-    int32_t localeIDLength = uprv_strlen(localeID);
+    int32_t localeIDLength = static_cast<int32_t>(uprv_strlen(localeID));
     int32_t length = localeIDLength;
     int32_t tmpLength = 0;
     int32_t i;
@@ -2488,7 +2488,7 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable,
 #if defined(ULOC_DEBUG)
         fprintf(stderr,"%02d: %s\n", i, acceptList[i]);
 #endif
-        while((l=uenum_next(availableLocales, NULL, status))) {
+        while((l=uenum_next(availableLocales, NULL, status)) != NULL) {
 #if defined(ULOC_DEBUG)
             fprintf(stderr,"  %s\n", l);
 #endif
@@ -2528,7 +2528,7 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable,
 #if defined(ULOC_DEBUG)
                 fprintf(stderr,"Try: [%s]", fallbackList[i]);
 #endif
-                while((l=uenum_next(availableLocales, NULL, status))) {
+                while((l=uenum_next(availableLocales, NULL, status)) != NULL) {
 #if defined(ULOC_DEBUG)
                     fprintf(stderr,"  %s\n", l);
 #endif
index dcd727165390fce9c0a60fbeb55e8681d381821e..87b9f63f279a826f5b275236f68d419598c5dd12 100644 (file)
@@ -1022,7 +1022,7 @@ _appendKeywordsToLanguageTag(const char* localeID, char* appendAt, int32_t capac
                     no known mapping. This implementation normalizes the
                     the value to lower case
                     */
-                    int32_t bcpValueLen = uprv_strlen(bcpValue);
+                    int32_t bcpValueLen = static_cast<int32_t>(uprv_strlen(bcpValue));
                     if (bcpValueLen < extBufCapacity) {
                         uprv_strcpy(pExtBuf, bcpValue);
                         T_CString_toLowerCase(pExtBuf);
@@ -1288,7 +1288,7 @@ _appendLDMLExtensionAsKeywords(const char* ldmlext, ExtensionListEntry** appendT
                 bufIdx++;
             }
 
-            len = uprv_strlen(attr->attribute);
+            len = static_cast<int32_t>(uprv_strlen(attr->attribute));
             uprv_memcpy(buf + bufIdx, attr->attribute, len);
             bufIdx += len;
 
@@ -1841,7 +1841,7 @@ ultag_parse(const char* tag, int32_t tagLen, int32_t* parsedLen, UErrorCode* sta
             int32_t newTagLength;
 
             grandfatheredLen = tagLen;  /* back up for output parsedLen */
-            newTagLength = uprv_strlen(GRANDFATHERED[i+1]);
+            newTagLength = static_cast<int32_t>(uprv_strlen(GRANDFATHERED[i+1]));
             if (tagLen < newTagLength) {
                 uprv_free(tagBuf);
                 tagBuf = (char*)uprv_malloc(newTagLength + 1);
index df588a4f9502932dcd9b91b6d63e8ac351fb230a..53699e762b265dc1bd963687c7131ef49a5a5cd1 100644 (file)
     {
         HANDLE map;
         HANDLE file;
-        SECURITY_ATTRIBUTES mappingAttributes;
-        SECURITY_ATTRIBUTES *mappingAttributesPtr = NULL;
-        SECURITY_DESCRIPTOR securityDesc;
-
+        
         UDataMemory_init(pData); /* Clear the output struct.        */
 
         /* open the input file */
            This is required for multiuser systems on Windows 2000 SP4 and beyond */
         // TODO: UWP does not have this function and I do not think it is required?
 #if U_PLATFORM_HAS_WINUWP_API == 0
+
+        SECURITY_ATTRIBUTES mappingAttributes;
+        SECURITY_ATTRIBUTES *mappingAttributesPtr = NULL;
+        SECURITY_DESCRIPTOR securityDesc;
+
         if (InitializeSecurityDescriptor(&securityDesc, SECURITY_DESCRIPTOR_REVISION)) {
             /* give the security descriptor a Null Dacl done using the  "TRUE, (PACL)NULL" here */
             if (SetSecurityDescriptorDacl(&securityDesc, TRUE, (PACL)NULL, FALSE)) {
index 77c17782677e91fae6ea44792d1cd09c02d5f188..29dbc90ec9854d21487e472f5f0c3f32184ba684 100644 (file)
@@ -132,7 +132,7 @@ umtx_condBroadcast(UConditionVar *condition) {
 }
 
 U_CAPI void U_EXPORT2
-umtx_condSignal(UConditionVar *condition) {
+umtx_condSignal(UConditionVar * /* condition */) {
     // Function not implemented. There is no immediate requirement from ICU to have it.
     // Once ICU drops support for Windows XP and Server 2003, ICU Condition Variables will be
     // changed to be thin wrappers on native Windows CONDITION_VARIABLEs, and this function
index 97da7ff5f772984a554045ee33a216f92ddb3942..957c0dbd73bc88eab25b8bf2e1ea835b3fac0981 100644 (file)
@@ -107,7 +107,7 @@ class CacheKey : public CacheKeyBase {
     */
    virtual int32_t hashCode() const {
        const char *s = typeid(T).name();
-       return ustr_hashCharsN(s, uprv_strlen(s));
+       return ustr_hashCharsN(s, static_cast<int32_t>(uprv_strlen(s)));
    }
 
    /**
index a4682870442cce40f797d1a5c9d74ba395ef1852..09eca22fda31828946e83c1d2968854ac86c5fc2 100644 (file)
@@ -1312,7 +1312,7 @@ u_strFromJavaModifiedUTF8WithSub(
             u_terminateUChars(dest, destCapacity, reqLength, pErrorCode);
             return dest;
         }
-        srcLength = uprv_strlen((const char *)pSrc);
+        srcLength = static_cast<int32_t>(uprv_strlen((const char *)pSrc));
     }
 
     /* Faster loop without ongoing checking for pSrcLimit and pDestLimit. */
index 98a9cf627e06ab69674e18d03c1315d3e62d519c..9b8d3ded2fddd161ae660251d20950dffffd95c9 100644 (file)
@@ -1415,7 +1415,7 @@ uidna_labelToASCII_UTF8(const UIDNA *idna,
     if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) {
         return 0;
     }
-    StringPiece src(label, length<0 ? uprv_strlen(label) : length);
+    StringPiece src(label, length<0 ? static_cast<int32_t>(uprv_strlen(label)) : length);
     CheckedArrayByteSink sink(dest, capacity);
     IDNAInfo info;
     reinterpret_cast<const IDNA *>(idna)->labelToASCII_UTF8(src, sink, info, *pErrorCode);
@@ -1431,7 +1431,7 @@ uidna_labelToUnicodeUTF8(const UIDNA *idna,
     if(!checkArgs(label, length, dest, capacity, pInfo, pErrorCode)) {
         return 0;
     }
-    StringPiece src(label, length<0 ? uprv_strlen(label) : length);
+    StringPiece src(label, length<0 ? static_cast<int32_t>(uprv_strlen(label)) : length);
     CheckedArrayByteSink sink(dest, capacity);
     IDNAInfo info;
     reinterpret_cast<const IDNA *>(idna)->labelToUnicodeUTF8(src, sink, info, *pErrorCode);
@@ -1447,7 +1447,7 @@ uidna_nameToASCII_UTF8(const UIDNA *idna,
     if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) {
         return 0;
     }
-    StringPiece src(name, length<0 ? uprv_strlen(name) : length);
+    StringPiece src(name, length<0 ? static_cast<int32_t>(uprv_strlen(name)) : length);
     CheckedArrayByteSink sink(dest, capacity);
     IDNAInfo info;
     reinterpret_cast<const IDNA *>(idna)->nameToASCII_UTF8(src, sink, info, *pErrorCode);
@@ -1463,7 +1463,7 @@ uidna_nameToUnicodeUTF8(const UIDNA *idna,
     if(!checkArgs(name, length, dest, capacity, pInfo, pErrorCode)) {
         return 0;
     }
-    StringPiece src(name, length<0 ? uprv_strlen(name) : length);
+    StringPiece src(name, length<0 ? static_cast<int32_t>(uprv_strlen(name)) : length);
     CheckedArrayByteSink sink(dest, capacity);
     IDNAInfo info;
     reinterpret_cast<const IDNA *>(idna)->nameToUnicodeUTF8(src, sink, info, *pErrorCode);
index c4155cb4732c78180367f86d67c16e0f22a5898c..013d3fcac35e7b4f45943af3ff91697005aba659 100644 (file)
@@ -1665,7 +1665,7 @@ const char *PluralAvailableLocalesEnumeration::next(int32_t *resultLength, UErro
     }
     const char *result = ures_getKey(fRes);
     if (resultLength != NULL) {
-        *resultLength = uprv_strlen(result);
+        *resultLength = static_cast<int32_t>(uprv_strlen(result));
     }
     return result;
 }
index 7f26d196b7ee2e7dd303426b2c4a59e068b97aaa..383fb514835df2865fa669b9bd1a3e402e87efc1 100644 (file)
@@ -320,7 +320,7 @@ TimeZoneFormat::TimeZoneFormat(const Locale& locale, UErrorCode& status)
     }
 
     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);
@@ -1812,7 +1812,9 @@ TimeZoneFormat::parseOffsetFields(const UnicodeString& text, int32_t start, UBoo
         // but it should be parsed as 00:10:20.
         int32_t tmpLen = 0;
         int32_t tmpSign = 1;
-        int32_t tmpH, tmpM, tmpS;
+        int32_t tmpH = 0;
+        int32_t tmpM = 0;
+        int32_t tmpS = 0;
 
         for (int32_t patidx = 0; PARSE_GMT_OFFSET_TYPES[patidx] >= 0; patidx++) {
             int32_t gmtPatType = PARSE_GMT_OFFSET_TYPES[patidx];
@@ -2752,7 +2754,7 @@ static void U_CALLCONV initZoneIdTrie(UErrorCode &status) {
     }
     StringEnumeration *tzenum = TimeZone::createEnumeration();
     const UnicodeString *id;
-    while ((id = tzenum->snext(status))) {
+    while ((id = tzenum->snext(status)) != NULL) {
         const UChar* uid = ZoneMeta::findTimeZoneID(*id);
         if (uid) {
             gZoneIdTrie->put(uid, const_cast<UChar *>(uid), status);
@@ -2799,7 +2801,7 @@ static void U_CALLCONV initShortZoneIdTrie(UErrorCode &status) {
             status = U_MEMORY_ALLOCATION_ERROR;
         } else {
             const UnicodeString *id;
-            while ((id = tzenum->snext(status))) {
+            while ((id = tzenum->snext(status)) != NULL) {
                 const UChar* uID = ZoneMeta::findTimeZoneID(*id);
                 const UChar* shortID = ZoneMeta::getShortID(*id);
                 if (shortID && uID) {
index b14e9835d9ab976072fb04abee8be5b3ea5f17eb..236ec760ed67ca620d6ede5296095e16ec1dc2f7 100644 (file)
@@ -856,7 +856,7 @@ TZGNCore::loadStrings(const UnicodeString& tzCanonicalID) {
     };
 
     StringEnumeration *mzIDs = fTimeZoneNames->getAvailableMetaZoneIDs(tzCanonicalID, status);
-    while ((mzID = mzIDs->snext(status))) {
+    while ((mzID = mzIDs->snext(status)) != NULL) {
         if (U_FAILURE(status)) {
             break;
         }
@@ -1044,7 +1044,7 @@ TZGNCore::findLocal(const UnicodeString& text, int32_t start, uint32_t types, UE
             StringEnumeration *tzIDs = TimeZone::createTimeZoneIDEnumeration(UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, status);
             if (U_SUCCESS(status)) {
                 const UnicodeString *tzID;
-                while ((tzID = tzIDs->snext(status))) {
+                while ((tzID = tzIDs->snext(status)) != NULL) {
                     if (U_FAILURE(status)) {
                         break;
                     }
@@ -1164,7 +1164,7 @@ static void sweepCache() {
     const UHashElement* elem;
     double now = (double)uprv_getUTCtime();
 
-    while ((elem = uhash_nextElement(gTZGNCoreCache, &pos))) {
+    while ((elem = uhash_nextElement(gTZGNCoreCache, &pos)) != NULL) {
         TZGNCoreRef *entry = (TZGNCoreRef *)elem->value.pointer;
         if (entry->refCount <= 0 && (now - entry->lastAccess) > CACHE_EXPIRATION) {
             // delete this entry
index 6817a88af8f06b359732edc6ba242cdaeee8ac6c..8accb84d2d5b67fa8a113f711a3313009402d6f0 100644 (file)
@@ -1070,7 +1070,7 @@ TimeZoneNamesImpl::loadStrings(const UnicodeString& tzCanonicalID, UErrorCode& s
     U_ASSERT(!mzIDs.isNull());
 
     const UnicodeString *mzID;
-    while ((mzID = mzIDs->snext(status)) && U_SUCCESS(status)) {
+    while (((mzID = mzIDs->snext(status)) != NULL) && U_SUCCESS(status)) {
         loadMetaZoneNames(*mzID, status);
     }
 }
@@ -1651,7 +1651,7 @@ void TimeZoneNamesImpl::internalLoadAllDisplayNames(UErrorCode& status) {
         StringEnumeration *tzIDs = TimeZone::createTimeZoneIDEnumeration(
             UCAL_ZONE_TYPE_CANONICAL, NULL, NULL, status);
         if (U_SUCCESS(status)) {
-            while ((id = tzIDs->snext(status))) {
+            while ((id = tzIDs->snext(status)) != NULL) {
                 if (U_FAILURE(status)) {
                     break;
                 }
index d1597021c3ee4751d7304111ea8e802de20c4b88..1c70bbfd5abeaef76d9023038b40ffd07cef0154 100644 (file)
@@ -110,7 +110,7 @@ CollationLoader::loadRules(const char *localeID, const char *collationType,
     U_ASSERT(collationType != NULL && *collationType != 0);
     // Copy the type for lowercasing.
     char type[16];
-    int32_t typeLength = uprv_strlen(collationType);
+    int32_t typeLength = static_cast<int32_t>(uprv_strlen(collationType));
     if(typeLength >= UPRV_LENGTHOF(type)) {
         errorCode = U_ILLEGAL_ARGUMENT_ERROR;
         return;
@@ -318,7 +318,7 @@ CollationLoader::loadFromCollations(UErrorCode &errorCode) {
     // Load the collations/type tailoring, with type fallback.
     LocalUResourceBundlePointer localData(
             ures_getByKeyWithFallback(collations, type, NULL, &errorCode));
-    int32_t typeLength = uprv_strlen(type);
+    int32_t typeLength = static_cast<int32_t>(uprv_strlen(type));
     if(errorCode == U_MISSING_RESOURCE_ERROR) {
         errorCode = U_USING_DEFAULT_WARNING;
         typeFallback = TRUE;
index b8d26612ff2f96c5c4c90b577e7e020f8b393648..11c2f8c8337eddbb0c41551d831568120c5d6a83 100644 (file)
@@ -298,7 +298,7 @@ unum_formatDecimal(const    UNumberFormat*  fmt,
     }
 
     if (length < 0) {
-        length = uprv_strlen(number);
+        length = static_cast<int32_t>(uprv_strlen(number));
     }
     StringPiece numSP(number, length);
     Formattable numFmtbl(numSP, *status);
index 92b3b0c13cafda3667d522d4f3a682fe716704ca..515bdce2a05fe34ce74e5dedaca54f6139636f36 100644 (file)
@@ -374,7 +374,7 @@ uspoof_check2UTF8(const USpoofChecker *sc,
     if (U_FAILURE(*status)) {
         return 0;
     }
-    UnicodeString idStr = UnicodeString::fromUTF8(StringPiece(id, length>=0 ? length : uprv_strlen(id)));
+    UnicodeString idStr = UnicodeString::fromUTF8(StringPiece(id, length>=0 ? length : static_cast<int32_t>(uprv_strlen(id))));
     int32_t result = uspoof_check2UnicodeString(sc, idStr, checkResult, status);
     return result;
 }
@@ -413,8 +413,8 @@ uspoof_areConfusableUTF8(const USpoofChecker *sc,
         *status = U_ILLEGAL_ARGUMENT_ERROR;
         return 0;
     }
-    UnicodeString id1Str = UnicodeString::fromUTF8(StringPiece(id1, length1>=0? length1 : uprv_strlen(id1)));
-    UnicodeString id2Str = UnicodeString::fromUTF8(StringPiece(id2, length2>=0? length2 : uprv_strlen(id2)));
+    UnicodeString id1Str = UnicodeString::fromUTF8(StringPiece(id1, length1>=0? length1 : static_cast<int32_t>(uprv_strlen(id1))));
+    UnicodeString id2Str = UnicodeString::fromUTF8(StringPiece(id2, length2>=0? length2 : static_cast<int32_t>(uprv_strlen(id2))));
     int32_t results = uspoof_areConfusableUnicodeString(sc, id1Str, id2Str, status);
     return results;
 }
@@ -680,7 +680,7 @@ uspoof_getSkeletonUTF8(const USpoofChecker *sc,
         return 0;
     }
 
-    UnicodeString srcStr = UnicodeString::fromUTF8(StringPiece(id, length>=0 ? length : uprv_strlen(id)));
+    UnicodeString srcStr = UnicodeString::fromUTF8(StringPiece(id, length>=0 ? length : static_cast<int32_t>(uprv_strlen(id))));
     UnicodeString destStr;
     uspoof_getSkeletonUnicodeString(sc, type, srcStr, destStr, status);
     if (U_FAILURE(*status)) {
index be5f384c2c6871e984478d75e03f13e4921016a1..253e919def954e0ab3833f7763fe85f1df49ab50 100644 (file)
@@ -102,7 +102,7 @@ static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeSt
     char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {};
 
     // Convert from names like "en_CA" and "de_DE@collation=phonebook" to "en-CA" and "de-DE-u-co-phonebk".
-    int32_t length = uloc_toLanguageTag(locale.getName(), asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &status);
+    (void)uloc_toLanguageTag(locale.getName(), asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &status);
 
     if (U_SUCCESS(status))
     {
@@ -219,7 +219,7 @@ Format *Win32DateFormat::clone(void) const
 }
 
 // TODO: Is just ignoring pos the right thing?
-UnicodeString &Win32DateFormat::format(Calendar &cal, UnicodeString &appendTo, FieldPosition &pos) const
+UnicodeString &Win32DateFormat::format(Calendar &cal, UnicodeString &appendTo, FieldPosition & /* pos */) const
 {
     FILETIME ft;
     SYSTEMTIME st_gmt;
@@ -263,7 +263,7 @@ UnicodeString &Win32DateFormat::format(Calendar &cal, UnicodeString &appendTo, F
     return appendTo;
 }
 
-void Win32DateFormat::parse(const UnicodeString& text, Calendar& cal, ParsePosition& pos) const
+void Win32DateFormat::parse(const UnicodeString& /* text */, Calendar& /* cal */, ParsePosition& pos) const
 {
     pos.setErrorIndex(pos.getIndex());
 }
index 3e03cb1feef2e0ffd12de4c2cc441760abd8fa3d..5637a0f4a13b2588a0a8928c048ecac8609f7d80 100644 (file)
@@ -147,7 +147,7 @@ static UErrorCode GetEquivalentWindowsLocaleName(const Locale& locale, UnicodeSt
     char asciiBCP47Tag[LOCALE_NAME_MAX_LENGTH] = {};
 
     // Convert from names like "en_CA" and "de_DE@collation=phonebook" to "en-CA" and "de-DE-u-co-phonebk".
-    int32_t length = uloc_toLanguageTag(locale.getName(), asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &status);
+    (void) uloc_toLanguageTag(locale.getName(), asciiBCP47Tag, UPRV_LENGTHOF(asciiBCP47Tag), FALSE, &status);
 
     if (U_SUCCESS(status))
     {
@@ -299,17 +299,17 @@ Format *Win32NumberFormat::clone(void) const
     return new Win32NumberFormat(*this);
 }
 
-UnicodeString& Win32NumberFormat::format(double number, UnicodeString& appendTo, FieldPosition& pos) const
+UnicodeString& Win32NumberFormat::format(double number, UnicodeString& appendTo, FieldPosition& /* pos */) const
 {
     return format(getMaximumFractionDigits(), appendTo, L"%.16f", number);
 }
 
-UnicodeString& Win32NumberFormat::format(int32_t number, UnicodeString& appendTo, FieldPosition& pos) const
+UnicodeString& Win32NumberFormat::format(int32_t number, UnicodeString& appendTo, FieldPosition& /* pos */) const
 {
     return format(getMinimumFractionDigits(), appendTo, L"%I32d", number);
 }
 
-UnicodeString& Win32NumberFormat::format(int64_t number, UnicodeString& appendTo, FieldPosition& pos) const
+UnicodeString& Win32NumberFormat::format(int64_t number, UnicodeString& appendTo, FieldPosition& /* pos */) const
 {
     return format(getMinimumFractionDigits(), appendTo, L"%I64d", number);
 }
index 7a87d1c4f596b15f1cf3237e78c153432fc2ebe3..433ed4c29398c0dadae20e26e383a66cbf38f378 100644 (file)
@@ -65,12 +65,12 @@ static UBool getSystemTimeInformation(TimeZone *tz, SYSTEMTIME &daylightDate, SY
             // Always use DOW type rule
             int32_t hour, min, sec, mil;
             standardDate.wYear = 0;
-            standardDate.wMonth = std->getRule()->getRuleMonth() + 1;
-            standardDate.wDay = std->getRule()->getRuleWeekInMonth();
+            standardDate.wMonth = static_cast<WORD>(std->getRule()->getRuleMonth()) + 1;
+            standardDate.wDay = static_cast<WORD>(std->getRule()->getRuleWeekInMonth());
             if (standardDate.wDay < 0) {
                 standardDate.wDay = 5;
             }
-            standardDate.wDayOfWeek = std->getRule()->getRuleDayOfWeek() - 1;
+            standardDate.wDayOfWeek = static_cast<WORD>(std->getRule()->getRuleDayOfWeek()) - 1;
 
             mil = std->getRule()->getRuleMillisInDay();
             hour = mil/3600000;
@@ -80,18 +80,18 @@ static UBool getSystemTimeInformation(TimeZone *tz, SYSTEMTIME &daylightDate, SY
             sec = mil/1000;
             mil %= 1000;
 
-            standardDate.wHour = hour;
-            standardDate.wMinute = min;
-            standardDate.wSecond = sec;
-            standardDate.wMilliseconds = mil;
+            standardDate.wHour = static_cast<WORD>(hour);
+            standardDate.wMinute = static_cast<WORD>(min);
+            standardDate.wSecond = static_cast<WORD>(sec);
+            standardDate.wMilliseconds = static_cast<WORD>(mil);
 
             daylightDate.wYear = 0;
-            daylightDate.wMonth = dst->getRule()->getRuleMonth() + 1;
-            daylightDate.wDay = dst->getRule()->getRuleWeekInMonth();
+            daylightDate.wMonth = static_cast<WORD>(dst->getRule()->getRuleMonth()) + 1;
+            daylightDate.wDay = static_cast<WORD>(dst->getRule()->getRuleWeekInMonth());
             if (daylightDate.wDay < 0) {
                 daylightDate.wDay = 5;
             }
-            daylightDate.wDayOfWeek = dst->getRule()->getRuleDayOfWeek() - 1;
+            daylightDate.wDayOfWeek = static_cast<WORD>(dst->getRule()->getRuleDayOfWeek()) - 1;
 
             mil = dst->getRule()->getRuleMillisInDay();
             hour = mil/3600000;
@@ -101,10 +101,10 @@ static UBool getSystemTimeInformation(TimeZone *tz, SYSTEMTIME &daylightDate, SY
             sec = mil/1000;
             mil %= 1000;
 
-            daylightDate.wHour = hour;
-            daylightDate.wMinute = min;
-            daylightDate.wSecond = sec;
-            daylightDate.wMilliseconds = mil;
+            daylightDate.wHour = static_cast<WORD>(hour);
+            daylightDate.wMinute = static_cast<WORD>(min);
+            daylightDate.wSecond = static_cast<WORD>(sec);
+            daylightDate.wMilliseconds = static_cast<WORD>(mil);
         }
     } else {
         result = FALSE;
index 84a965780291c9de458f4931c19f960ba18380ad..b26798f990a399703265dd385f0bb7469edea614 100644 (file)
@@ -792,7 +792,7 @@ static void U_CALLCONV initAvailableMetaZoneIDs () {
             break;
         }
         const char *mzID = ures_getKey(&res);
-        int32_t len = uprv_strlen(mzID);
+        int32_t len = static_cast<int32_t>(uprv_strlen(mzID));
         UChar *uMzID = (UChar*)uprv_malloc(sizeof(UChar) * (len + 1));
         if (uMzID == NULL) {
             status = U_MEMORY_ALLOCATION_ERROR;