ICU-13275 Merge warning cleanup fixes into trunk

X-SVN-Rev: 40283
This commit is contained in:
William Zhao 2017-07-22 01:11:59 +00:00
parent 7c841c6bb2
commit d847a21238
30 changed files with 86 additions and 80 deletions

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

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

View 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

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

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

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

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

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

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

View 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

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

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

View 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

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

View File

@ -102,10 +102,7 @@
{
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 */
@ -143,6 +140,11 @@
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)) {

View 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

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

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

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

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

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

View 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

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

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

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

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

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

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

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

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