]> granicus.if.org Git - icu/commitdiff
ICU-13275 Merge into some W3 warning fixes into trunk
authorWilliam Zhao <39807811+mingyzha@users.noreply.github.com>
Fri, 22 Sep 2017 18:00:51 +0000 (18:00 +0000)
committerWilliam Zhao <39807811+mingyzha@users.noreply.github.com>
Fri, 22 Sep 2017 18:00:51 +0000 (18:00 +0000)
X-SVN-Rev: 40446

icu4c/source/common/dictbe.cpp
icu4c/source/common/locdispnames.cpp
icu4c/source/common/locdspnm.cpp
icu4c/source/i18n/collationdatawriter.cpp
icu4c/source/i18n/collationfastlatinbuilder.cpp
icu4c/source/i18n/datefmt.cpp
icu4c/source/i18n/decNumber.cpp
icu4c/source/i18n/decimfmt.cpp

index dc9d348ef8fce593334612b214f998ee56f9b1c7..9da0d236072b7994072e4039846aab0e9af05df6 100644 (file)
@@ -1088,7 +1088,7 @@ static inline uint32_t getKatakanaCost(int32_t wordLength){
     return (wordLength > kMaxKatakanaLength) ? 8192 : katakanaCost[wordLength];
 }
 
-static inline bool isKatakana(uint16_t value) {
+static inline bool isKatakana(UChar32 value) {
     return (value >= 0x30A1u && value <= 0x30FEu && value != 0x30FBu) ||
             (value >= 0xFF66u && value <= 0xFF9fu);
 }
index 1aa3ca708226da77d24b074ef076cda54b0fcca4..95750e440069498d3b97544e8d20dc2ba21fdf03 100644 (file)
@@ -542,7 +542,7 @@ uloc_getDisplayName(const char *locale,
             return 0;
         }
         separator = (const UChar *)p0 + subLen;
-        sepLen = p1 - separator;
+        sepLen = static_cast<int32_t>(p1 - separator);
     }
 
     if(patLen==0 || (patLen==defaultPatLen && !u_strncmp(pattern, defaultPattern, patLen))) {
@@ -558,8 +558,8 @@ uloc_getDisplayName(const char *locale,
             *pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
             return 0;
         }
-        sub0Pos=p0-pattern;
-        sub1Pos=p1-pattern;
+        sub0Pos = static_cast<int32_t>(p0-pattern);
+        sub1Pos = static_cast<int32_t>(p1-pattern);
         if (sub1Pos < sub0Pos) { /* a very odd pattern */
             int32_t t=sub0Pos; sub0Pos=sub1Pos; sub1Pos=t;
             langi=1;
index 39934dc6c33020f174a23ea39313ee899581dc6a..b034a278a427b97f7cde884568d083d96930d277 100644 (file)
@@ -54,7 +54,7 @@ static int32_t ncat(char *buffer, uint32_t buflen, ...) {
   *p = 0;
   va_end(args);
 
-  return p - buffer;
+  return static_cast<int32_t>(p - buffer);
 }
 
 U_NAMESPACE_BEGIN
index a91119d8dfa4c9381efa0bcfea73093274e8a969..823c8eb0111d310e0ae17a6fc8205663f8446451 100644 (file)
@@ -224,7 +224,7 @@ CollationDataWriter::write(UBool isBase, const UVersionInfo dataVersion,
     int32_t totalSize = indexesLength * 4;
 
     if(hasMappings && (isBase || data.jamoCE32s != baseData->jamoCE32s)) {
-        indexes[CollationDataReader::IX_JAMO_CE32S_START] = data.jamoCE32s - data.ce32s;
+        indexes[CollationDataReader::IX_JAMO_CE32S_START] = static_cast<int32_t>(data.jamoCE32s - data.ce32s);
     } else {
         indexes[CollationDataReader::IX_JAMO_CE32S_START] = -1;
     }
index e889697d8a5007117bd49ef02e6a2c8ec5273314..e5ba2f0e21dd82e6ba5a8f755ce232962e58dd91 100644 (file)
@@ -607,7 +607,7 @@ CollationFastLatinBuilder::encodeContractions(UErrorCode &errorCode) {
         }
         UBool firstTriple = TRUE;
         for(int32_t index = (int32_t)ce & 0x7fffffff;; index += 3) {
-            int32_t x = contractionCEs.elementAti(index);
+            int32_t x = static_cast<int32_t>(contractionCEs.elementAti(index));
             if((uint32_t)x == CollationFastLatin::CONTR_CHAR_MASK && !firstTriple) { break; }
             int64_t cce0 = contractionCEs.elementAti(index + 1);
             int64_t cce1 = contractionCEs.elementAti(index + 2);
index f6a0d892388755fe81acb6670f3b13078857fdbf..e8641f43200e00147fbab2db59a13960a8a467e9 100644 (file)
@@ -739,7 +739,7 @@ DateFormat::setBooleanAttribute(UDateFormatBooleanAttribute attr,
 UBool 
 DateFormat::getBooleanAttribute(UDateFormatBooleanAttribute attr, UErrorCode &/*status*/) const {
 
-    return fBoolFlags.get(attr);
+    return static_cast<UBool>(fBoolFlags.get(attr));
 }
 
 U_NAMESPACE_END
index 969ea8f709f53d71517038610c12be8ec2eb46f2..149062e09213aaa4291af231626b6515ecef5fb7 100644 (file)
@@ -386,7 +386,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromUInt32(decNumber *dn, uInt uin) {
     *up=(Unit)(uin%(DECDPUNMAX+1));
     uin=uin/(DECDPUNMAX+1);
     }
-  dn->digits=decGetDigits(dn->lsu, up-dn->lsu);
+  dn->digits=decGetDigits(dn->lsu, static_cast<int32_t>(up - dn->lsu));
   return dn;
   } /* decNumberFromUInt32  */
 
@@ -666,7 +666,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberFromString(decNumber *dn, const char
 
     /* Handle decimal point...  */
     if (dotchar!=NULL && dotchar<last)  /* non-trailing '.' found?  */
-      exponent-=(last-dotchar);         /* adjust exponent  */
+      exponent -= static_cast<int32_t>(last-dotchar);         /* adjust exponent  */
     /* [we can now ignore the .]  */
 
     /* OK, the digits string is good.  Assemble in the decNumber, or in  */
@@ -866,7 +866,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberAnd(decNumber *res, const decNumber *
       } /* both OK  */
     } /* each unit  */
   /* [here uc-1 is the msu of the result]  */
-  res->digits=decGetDigits(res->lsu, uc-res->lsu);
+  res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc - res->lsu));
   res->exponent=0;                      /* integer  */
   res->bits=0;                          /* sign=0  */
   return res;  /* [no status to set]  */
@@ -1253,7 +1253,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberInvert(decNumber *res, const decNumbe
       } /* each digit  */
     } /* each unit  */
   /* [here uc-1 is the msu of the result]  */
-  res->digits=decGetDigits(res->lsu, uc-res->lsu);
+  res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc - res->lsu));
   res->exponent=0;                      /* integer  */
   res->bits=0;                          /* sign=0  */
   return res;  /* [no status to set]  */
@@ -1880,7 +1880,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberOr(decNumber *res, const decNumber *l
       } /* non-zero  */
     } /* each unit  */
   /* [here uc-1 is the msu of the result]  */
-  res->digits=decGetDigits(res->lsu, uc-res->lsu);
+  res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc-res->lsu));
   res->exponent=0;                      /* integer  */
   res->bits=0;                          /* sign=0  */
   return res;  /* [no status to set]  */
@@ -2586,7 +2586,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberRotate(decNumber *res, const decNumbe
           } /* whole units to rotate  */
         /* the rotation may have left an undetermined number of zeros  */
         /* on the left, so true length needs to be calculated  */
-        res->digits=decGetDigits(res->lsu, msumax-res->lsu+1);
+        res->digits=decGetDigits(res->lsu, static_cast<int32_t>(msumax-res->lsu+1));
         } /* rotate needed  */
       } /* rhs OK  */
     } /* numerics  */
@@ -3310,7 +3310,7 @@ U_CAPI decNumber * U_EXPORT2 uprv_decNumberXor(decNumber *res, const decNumber *
       } /* non-zero  */
     } /* each unit  */
   /* [here uc-1 is the msu of the result]  */
-  res->digits=decGetDigits(res->lsu, uc-res->lsu);
+  res->digits=decGetDigits(res->lsu, static_cast<int32_t>(uc-res->lsu));
   res->exponent=0;                      /* integer  */
   res->bits=0;                          /* sign=0  */
   return res;  /* [no status to set]  */
@@ -5101,7 +5101,7 @@ static decNumber * decMultiplyOp(decNumber *res, const decNumber *lhs,
           } /* p  */
         *up=(Unit)item; up++;                /* [final needs no division]  */
         } /* lp  */
-      accunits=up-acc;                       /* count of units  */
+      accunits = static_cast<int32_t>(up-acc);                       /* count of units  */
       }
      else { /* here to use units directly, without chunking ['old code']  */
     #endif
@@ -6587,11 +6587,11 @@ static Int decUnitAddSub(const Unit *a, Int alength,
 
   /* OK, all A and B processed; might still have carry or borrow  */
   /* return number of Units in the result, negated if a borrow  */
-  if (carry==0) return c-clsu;     /* no carry, so no more to do  */
+  if (carry==0) return static_cast<int32_t>(c-clsu);     /* no carry, so no more to do  */
   if (carry>0) {                   /* positive carry  */
     *c=(Unit)carry;                /* place as new unit  */
     c++;                           /* ..  */
-    return c-clsu;
+    return static_cast<int32_t>(c-clsu);
     }
   /* -ve carry: it's a borrow; complement needed  */
   add=1;                           /* temporary carry...  */
@@ -6614,7 +6614,7 @@ static Int decUnitAddSub(const Unit *a, Int alength,
     *c=(Unit)(add-carry-1);
     c++;                      /* interesting, include it  */
     }
-  return clsu-c;              /* -ve result indicates borrowed  */
+  return static_cast<int32_t>(clsu-c);              /* -ve result indicates borrowed  */
   } /* decUnitAddSub  */
 
 /* ------------------------------------------------------------------ */
@@ -6798,7 +6798,7 @@ static Int decShiftToLeast(Unit *uar, Int units, Int shift) {
   if (cut==DECDPUN) {              /* unit-boundary case; easy  */
     up=uar+D2U(shift);
     for (; up<uar+units; target++, up++) *target=*up;
-    return target-uar;
+    return static_cast<int32_t>(target-uar);
     }
 
   /* messier  */
@@ -6826,7 +6826,7 @@ static Int decShiftToLeast(Unit *uar, Int units, Int shift) {
     count-=cut;
     if (count<=0) break;
     }
-  return target-uar+1;
+  return static_cast<int32_t>(target-uar+1);
   } /* decShiftToLeast  */
 
 #if DECSUBSET
@@ -7690,7 +7690,7 @@ static decNumber *decDecap(decNumber *dn, Int drop) {
   cut=MSUDIGITS(dn->digits-drop);       /* digits to be in use in msu  */
   if (cut!=DECDPUN) *msu%=powers[cut];  /* clear left digits  */
   /* that may have left leading zero digits, so do a proper count...  */
-  dn->digits=decGetDigits(dn->lsu, msu-dn->lsu+1);
+  dn->digits=decGetDigits(dn->lsu, static_cast<int32_t>(msu-dn->lsu+1));
   return dn;
   } /* decDecap  */
 
index 613c2ddf56797bf942526659bb0ddf090860bfb1..2a8a226c77ea0f238701ed0dc48c72b1e7d05e2f 100644 (file)
@@ -2543,7 +2543,7 @@ UnicodeString DecimalFormat::getPadCharacterString() const {
 }
 
 void DecimalFormat::setPadCharacter(const UnicodeString &padChar) {
-    UChar pad;
+    UChar32 pad;
     if (padChar.length() > 0) {
         pad = padChar.char32At(0);
     }
@@ -2792,7 +2792,7 @@ DecimalFormat::setDecimalSeparatorAlwaysShown(UBool newValue)
 UBool 
 DecimalFormat::isDecimalPatternMatchRequired(void) const
 {
-    return fBoolFlags.contains(UNUM_PARSE_DECIMAL_MARK_REQUIRED);
+    return static_cast<UBool>(fBoolFlags.contains(UNUM_PARSE_DECIMAL_MARK_REQUIRED));
 }
 
 //------------------------------------------------------------------------------