ICU-13275 Merge into some W3 warning fixes into trunk

X-SVN-Rev: 40446
This commit is contained in:
William Zhao 2017-09-22 18:00:51 +00:00
parent 27c08578ac
commit 4bb34584ad
8 changed files with 24 additions and 24 deletions

View 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);
}

View 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;

View 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

View 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;
}

View 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);

View 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

View 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 */

View 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));
}
//------------------------------------------------------------------------------