ICU-4288 Fix some compiler warnings.

X-SVN-Rev: 16927
This commit is contained in:
George Rhoten 2004-12-08 01:05:40 +00:00
parent ac893ce00e
commit 70b126c727
21 changed files with 127 additions and 127 deletions

View File

@ -553,7 +553,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
fieldIdx = 1;
while ((separator = uprv_strchr(field[fieldIdx-1], SEP_CHAR)) && fieldIdx < (int32_t)(sizeof(field)/sizeof(field[0]))-1) {
field[fieldIdx] = separator + 1;
fieldLen[fieldIdx-1] = separator - field[fieldIdx-1];
fieldLen[fieldIdx-1] = (int32_t)(separator - field[fieldIdx-1]);
fieldIdx++;
}
// variant may contain @foo or .foo POSIX cruft; remove it
@ -563,7 +563,7 @@ Locale& Locale::init(const char* localeID, UBool canonicalize)
if (separator==NULL || (sep2!=NULL && separator > sep2)) {
separator = sep2;
}
fieldLen[fieldIdx-1] = separator - field[fieldIdx-1];
fieldLen[fieldIdx-1] = (int32_t)(separator - field[fieldIdx-1]);
} else {
fieldLen[fieldIdx-1] = length - (int32_t)(field[fieldIdx-1] - fullName);
}
@ -1242,7 +1242,7 @@ public:
int32_t len;
if(U_SUCCESS(status) && *current != 0) {
result = current;
len = uprv_strlen(current);
len = (int32_t)uprv_strlen(current);
current += len+1;
if(resultLength != NULL) {
*resultLength = len;

View File

@ -1587,7 +1587,7 @@ ucnv_toUChars(UConverter *cnv,
ucnv_resetToUnicode(cnv);
originalDest=dest;
if(srcLength==-1) {
srcLength=uprv_strlen(src);
srcLength=(int32_t)uprv_strlen(src);
}
if(srcLength>0) {
srcLimit=src+srcLength;
@ -1984,7 +1984,7 @@ ucnv_internalConvert(UConverter *outConverter, UConverter *inConverter,
FALSE,
TRUE,
pErrorCode);
targetLength=myTarget-target;
targetLength=(int32_t)(myTarget-target);
}
/*
@ -2007,7 +2007,7 @@ ucnv_internalConvert(UConverter *outConverter, UConverter *inConverter,
FALSE,
TRUE,
pErrorCode);
targetLength+=(myTarget-targetBuffer);
targetLength+=(int32_t)(myTarget-targetBuffer);
} while(*pErrorCode==U_BUFFER_OVERFLOW_ERROR);
/* done with preflighting, set warnings and errors as appropriate */
@ -2322,7 +2322,7 @@ ucnv_detectUnicodeSignature( const char* source,
}
if(sourceLength==-1){
sourceLength=uprv_strlen(source);
sourceLength=(int32_t)uprv_strlen(source);
}

View File

@ -427,7 +427,7 @@ _ISO2022Open(UConverter *cnv, const char *name, const char *locale,uint32_t opti
version = options & UCNV_OPTIONS_VERSION_MASK;
if(myLocale[0]=='j' && (myLocale[1]=='a'|| myLocale[1]=='p') &&
(myLocale[2]=='_' || myLocale[2]=='\0')){
int len=0;
size_t len=0;
/* open the required converters and cache them */
if(jpCharsetMasks[version]&CSM(ISO8859_7)) {
myConverterData->myConverterArray[ISO8859_7]= ucnv_loadSharedData("ISO8859_7", NULL, errorCode);
@ -1535,7 +1535,7 @@ getTrail:
if(outLen == 1) {
*target++ = buffer[0];
if(offsets) {
*offsets++ = source - args->source - 1; /* -1: known to be ASCII */
*offsets++ = (int32_t)(source - args->source - 1); /* -1: known to be ASCII */
}
} else if(outLen == 2 && (target + 2) <= targetLimit) {
*target++ = buffer[0];
@ -1781,7 +1781,7 @@ getTrailByte:
}
if(targetUniChar < (missingCharMarker-1/*0xfffe*/)){
if(args->offsets){
args->offsets[myTarget - args->target]= mySource - args->source - (mySourceChar <= 0xff ? 1 : 2);
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
*(myTarget++)=(UChar)targetUniChar;
}
@ -1790,13 +1790,13 @@ getTrailByte:
targetUniChar-=0x0010000;
*myTarget = (UChar)(0xd800+(UChar)(targetUniChar>>10));
if(args->offsets){
args->offsets[myTarget - args->target]= mySource - args->source - (mySourceChar <= 0xff ? 1 : 2);
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
++myTarget;
if(myTarget< args->targetLimit){
*myTarget = (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff));
if(args->offsets){
args->offsets[myTarget - args->target]= mySource - args->source - (mySourceChar <= 0xff ? 1 : 2);
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
++myTarget;
}else{
@ -1917,14 +1917,14 @@ UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args
else
*target++ = UCNV_SI;
if(offsets)
*(offsets++)= source - args->source-1;
*(offsets++) = (int32_t)(source - args->source-1);
}
/* write the targetUniChar to target */
if(targetByteUnit <= 0x00FF){
if( target < targetLimit){
*(target++) = (unsigned char) targetByteUnit;
if(offsets){
*(offsets++) = source - args->source-1;
*(offsets++) = (int32_t)(source - args->source-1);
}
}else{
@ -1935,12 +1935,12 @@ UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args
if(target < targetLimit){
*(target++) =(unsigned char) ((targetByteUnit>>8) -0x80);
if(offsets){
*(offsets++) = source - args->source-1;
*(offsets++) = (int32_t)(source - args->source-1);
}
if(target < targetLimit){
*(target++) =(unsigned char) (targetByteUnit -0x80);
if(offsets){
*(offsets++) = source - args->source-1;
*(offsets++) = (int32_t)(source - args->source-1);
}
}else{
args->converter->charErrorBuffer[args->converter->charErrorBufferLength++] = (unsigned char) (targetByteUnit -0x80);
@ -2242,7 +2242,7 @@ getTrailByte:
}
if(targetUniChar < 0xfffe){
if(args->offsets) {
args->offsets[myTarget - args->target]= mySource - args->source - (mySourceChar <= 0xff ? 1 : 2);
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
*(myTarget++)=(UChar)targetUniChar;
}
@ -2591,7 +2591,7 @@ getTrail:
if(len == 1) {
*target++ = buffer[0];
if(offsets) {
*offsets++ = source - args->source - 1; /* -1: known to be ASCII */
*offsets++ = (int32_t)(source - args->source - 1); /* -1: known to be ASCII */
}
} else if(len == 2 && (target + 2) <= targetLimit) {
*target++ = buffer[0];
@ -2786,7 +2786,7 @@ getTrailByte:
}
if(targetUniChar < (missingCharMarker-1/*0xfffe*/)){
if(args->offsets){
args->offsets[myTarget - args->target]= mySource - args->source - (mySourceChar <= 0xff ? 1 : 2);
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
*(myTarget++)=(UChar)targetUniChar;
}
@ -2795,13 +2795,13 @@ getTrailByte:
targetUniChar-=0x0010000;
*myTarget = (UChar)(0xd800+(UChar)(targetUniChar>>10));
if(args->offsets){
args->offsets[myTarget - args->target]= mySource - args->source - (mySourceChar <= 0xff ? 1 : 2);
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
++myTarget;
if(myTarget< args->targetLimit){
*myTarget = (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff));
if(args->offsets){
args->offsets[myTarget - args->target]= mySource - args->source - (mySourceChar <= 0xff ? 1 : 2);
args->offsets[myTarget - args->target] = (int32_t)(mySource - args->source - (mySourceChar <= 0xff ? 1 : 2));
}
++myTarget;
}else{

View File

@ -1066,7 +1066,7 @@ ucnv_swap(const UDataSwapper *ds,
ds->swapArray32(ds, &inStaticData->codepage, 4,
&outStaticData->codepage, pErrorCode);
ds->swapInvChars(ds, inStaticData->name, uprv_strlen(inStaticData->name),
ds->swapInvChars(ds, inStaticData->name, (int32_t)uprv_strlen(inStaticData->name),
outStaticData->name, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
udata_printError(ds, "ucnv_swap(): error swapping converter name\n");
@ -1167,7 +1167,7 @@ ucnv_swap(const UDataSwapper *ds,
*/
/* swap the base name, between the header and the extension data */
ds->swapInvChars(ds, inMBCSHeader+1, uprv_strlen((const char *)(inMBCSHeader+1)),
ds->swapInvChars(ds, inMBCSHeader+1, (int32_t)uprv_strlen((const char *)(inMBCSHeader+1)),
outMBCSHeader+1, pErrorCode);
} else {
/* normal file with base table data */

View File

@ -44,13 +44,13 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
char overflow[4];
source=pArgs->source;
length=pArgs->sourceLimit-source;
length=(int32_t)(pArgs->sourceLimit-source);
if(length<=0) {
/* no input, nothing to do */
return;
}
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
if(targetCapacity<=0) {
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
return;
@ -210,7 +210,7 @@ _UTF16BEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
(char **)&target, pArgs->targetLimit,
&offsets, sourceIndex,
pErrorCode);
targetCapacity=pArgs->targetLimit-(char *)target;
targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
}
if(U_SUCCESS(*pErrorCode) && source<pArgs->sourceLimit && targetCapacity==0) {
@ -236,13 +236,13 @@ _UTF16BEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
cnv=pArgs->converter;
source=(const uint8_t *)pArgs->source;
length=(const uint8_t *)pArgs->sourceLimit-source;
length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
if(length<=0 && cnv->toUnicodeStatus==0) {
/* no input, nothing to do */
return;
}
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
if(targetCapacity<=0) {
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
return;
@ -586,13 +586,13 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
char overflow[4];
source=pArgs->source;
length=pArgs->sourceLimit-source;
length=(int32_t)(pArgs->sourceLimit-source);
if(length<=0) {
/* no input, nothing to do */
return;
}
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
if(targetCapacity<=0) {
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
return;
@ -752,7 +752,7 @@ _UTF16LEFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
(char **)&target, pArgs->targetLimit,
&offsets, sourceIndex,
pErrorCode);
targetCapacity=pArgs->targetLimit-(char *)target;
targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
}
if(U_SUCCESS(*pErrorCode) && source<pArgs->sourceLimit && targetCapacity==0) {
@ -778,13 +778,13 @@ _UTF16LEToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
cnv=pArgs->converter;
source=(const uint8_t *)pArgs->source;
length=(const uint8_t *)pArgs->sourceLimit-source;
length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
if(length<=0 && cnv->toUnicodeStatus==0) {
/* no input, nothing to do */
return;
}
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
if(targetCapacity<=0) {
*pErrorCode=U_BUFFER_OVERFLOW_ERROR;
return;
@ -1206,10 +1206,10 @@ _UTF16ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
++source;
if(state==1) {
state=8; /* detect UTF-16BE */
offsetDelta=source-pArgs->source;
offsetDelta=(int32_t)(source-pArgs->source);
} else if(state==5) {
state=9; /* detect UTF-16LE */
offsetDelta=source-pArgs->source;
offsetDelta=(int32_t)(source-pArgs->source);
}
} else {
/* switch to UTF-16BE and pass the previous bytes */

View File

@ -1019,14 +1019,14 @@ _UTF32ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
++source;
if(state==4) {
state=8; /* detect UTF-32BE */
offsetDelta=source-pArgs->source;
offsetDelta=(int32_t)(source-pArgs->source);
} else if(state==8) {
state=9; /* detect UTF-32LE */
offsetDelta=source-pArgs->source;
offsetDelta=(int32_t)(source-pArgs->source);
}
} else {
/* switch to UTF-32BE and pass the previous bytes */
int32_t count=source-pArgs->source; /* number of bytes from this buffer */
int32_t count=(int32_t)(source-pArgs->source); /* number of bytes from this buffer */
/* reset the source */
source=pArgs->source;

View File

@ -259,8 +259,8 @@ directMode:
* In Direct Mode, only the sourceIndex is used.
*/
byteIndex=0;
length=sourceLimit-source;
targetCapacity=targetLimit-target;
length=(int32_t)(sourceLimit-source);
targetCapacity=(int32_t)(targetLimit-target);
if(length>targetCapacity) {
length=targetCapacity;
}
@ -482,8 +482,8 @@ _UTF7FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
if(inDirectMode) {
directMode:
length=sourceLimit-source;
targetCapacity=targetLimit-target;
length=(int32_t)(sourceLimit-source);
targetCapacity=(int32_t)(targetLimit-target);
if(length>targetCapacity) {
length=targetCapacity;
}
@ -917,8 +917,8 @@ directMode:
* In Direct Mode, only the sourceIndex is used.
*/
byteIndex=0;
length=sourceLimit-source;
targetCapacity=targetLimit-target;
length=(int32_t)(sourceLimit-source);
targetCapacity=(int32_t)(targetLimit-target);
if(length>targetCapacity) {
length=targetCapacity;
}
@ -1167,8 +1167,8 @@ _IMAPFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
if(inDirectMode) {
directMode:
length=sourceLimit-source;
targetCapacity=targetLimit-target;
length=(int32_t)(sourceLimit-source);
targetCapacity=(int32_t)(targetLimit-target);
if(length>targetCapacity) {
length=targetCapacity;
}

View File

@ -401,7 +401,7 @@ U_ALIGN_CODE(16)
source=pArgs->source;
sourceLimit=pArgs->sourceLimit;
target=(uint8_t *)pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
offsets=pArgs->offsets;
/* get the converter state from UConverter */
@ -423,7 +423,7 @@ U_ALIGN_CODE(16)
fastSingle:
/* fast loop for single-byte differences */
/* use only one loop counter variable, targetCapacity, not also source */
diff=sourceLimit-source;
diff=(int32_t)(sourceLimit-source);
if(targetCapacity>diff) {
targetCapacity=diff;
}
@ -450,7 +450,7 @@ fastSingle:
}
}
/* restore real values */
targetCapacity=(const uint8_t *)pArgs->targetLimit-target;
targetCapacity=(int32_t)((const uint8_t *)pArgs->targetLimit-target);
sourceIndex=nextSourceIndex; /* wrong if offsets==NULL but does not matter */
/* regular loop for all cases */
@ -650,7 +650,7 @@ _Bocu1FromUnicode(UConverterFromUnicodeArgs *pArgs,
source=pArgs->source;
sourceLimit=pArgs->sourceLimit;
target=(uint8_t *)pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
/* get the converter state from UConverter */
c=cnv->fromUChar32;
@ -667,7 +667,7 @@ _Bocu1FromUnicode(UConverterFromUnicodeArgs *pArgs,
fastSingle:
/* fast loop for single-byte differences */
/* use only one loop counter variable, targetCapacity, not also source */
diff=sourceLimit-source;
diff=(int32_t)(sourceLimit-source);
if(targetCapacity>diff) {
targetCapacity=diff;
}
@ -690,7 +690,7 @@ fastSingle:
--targetCapacity;
}
/* restore real values */
targetCapacity=(const uint8_t *)pArgs->targetLimit-target;
targetCapacity=(int32_t)((const uint8_t *)pArgs->targetLimit-target);
/* regular loop for all cases */
while(source<sourceLimit) {
@ -978,8 +978,8 @@ _Bocu1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
fastSingle:
/* fast loop for single-byte differences */
/* use count as the only loop counter variable */
diff=sourceLimit-source;
count=pArgs->targetLimit-target;
diff=(int32_t)(sourceLimit-source);
count=(int32_t)(pArgs->targetLimit-target);
if(count>diff) {
count=diff;
}
@ -1195,8 +1195,8 @@ U_ALIGN_CODE(16)
fastSingle:
/* fast loop for single-byte differences */
/* use count as the only loop counter variable */
diff=sourceLimit-source;
count=pArgs->targetLimit-target;
diff=(int32_t)(sourceLimit-source);
count=(int32_t)(pArgs->targetLimit-target);
if(count>diff) {
count=diff;
}

View File

@ -42,7 +42,7 @@ _Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
/* set up the local pointers */
source=(const uint8_t *)pArgs->source;
target=pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
offsets=pArgs->offsets;
sourceIndex=0;
@ -51,7 +51,7 @@ _Latin1ToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
* since the conversion here is 1:1 UChar:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=(const uint8_t *)pArgs->sourceLimit-source;
length=(int32_t)((const uint8_t *)pArgs->sourceLimit-source);
if(length<=targetCapacity) {
targetCapacity=length;
} else {
@ -163,7 +163,7 @@ _Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
source=pArgs->source;
sourceLimit=pArgs->sourceLimit;
target=oldTarget=(uint8_t *)pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
offsets=pArgs->offsets;
if(cnv->sharedData==&_Latin1Data) {
@ -182,7 +182,7 @@ _Latin1FromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
* since the conversion here is 1:1 UChar:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=sourceLimit-source;
length=(int32_t)(sourceLimit-source);
if(length<targetCapacity) {
targetCapacity=length;
}
@ -396,7 +396,7 @@ _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
source=(const uint8_t *)pArgs->source;
sourceLimit=(const uint8_t *)pArgs->sourceLimit;
target=oldTarget=pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
offsets=pArgs->offsets;
/* sourceIndex=-1 if the current character began in the previous buffer */
@ -406,7 +406,7 @@ _ASCIIToUnicodeWithOffsets(UConverterToUnicodeArgs *pArgs,
* since the conversion here is 1:1 UChar:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=sourceLimit-source;
length=(int32_t)(sourceLimit-source);
if(length<targetCapacity) {
targetCapacity=length;
}

View File

@ -1411,7 +1411,7 @@ ucnv_MBCSSingleToBMPWithOffsets(UConverterToUnicodeArgs *pArgs,
source=(const uint8_t *)pArgs->source;
sourceLimit=(const uint8_t *)pArgs->sourceLimit;
target=pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
offsets=pArgs->offsets;
if((cnv->options&UCNV_OPTION_SWAP_LFNL)!=0) {
@ -1428,7 +1428,7 @@ ucnv_MBCSSingleToBMPWithOffsets(UConverterToUnicodeArgs *pArgs,
* since the conversion here is 1:1 UChar:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=sourceLimit-source;
length=(int32_t)(sourceLimit-source);
if(length<targetCapacity) {
targetCapacity=length;
}
@ -1578,8 +1578,8 @@ unrolled:
}
/* recalculate the targetCapacity after an extension mapping */
targetCapacity=pArgs->targetLimit-target;
length=sourceLimit-source;
targetCapacity=(int32_t)(pArgs->targetLimit-target);
length=(int32_t)(sourceLimit-source);
if(length<targetCapacity) {
targetCapacity=length;
}
@ -2531,7 +2531,7 @@ ucnv_MBCSDoubleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
source=pArgs->source;
sourceLimit=pArgs->sourceLimit;
target=(uint8_t *)pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
offsets=pArgs->offsets;
table=cnv->sharedData->mbcs.fromUnicodeTable;
@ -2650,7 +2650,7 @@ unassigned:
/* a mapping was written to the target, continue */
/* recalculate the targetCapacity after an extension mapping */
targetCapacity=pArgs->targetLimit-(char *)target;
targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
/* normal end of conversion: prepare for a new character */
sourceIndex=nextSourceIndex;
@ -2736,7 +2736,7 @@ ucnv_MBCSSingleFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
source=pArgs->source;
sourceLimit=pArgs->sourceLimit;
target=(uint8_t *)pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
offsets=pArgs->offsets;
table=cnv->sharedData->mbcs.fromUnicodeTable;
@ -2855,7 +2855,7 @@ unassigned:
/* a mapping was written to the target, continue */
/* recalculate the targetCapacity after an extension mapping */
targetCapacity=pArgs->targetLimit-(char *)target;
targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
/* normal end of conversion: prepare for a new character */
sourceIndex=nextSourceIndex;
@ -2906,7 +2906,7 @@ ucnv_MBCSSingleFromBMPWithOffsets(UConverterFromUnicodeArgs *pArgs,
source=pArgs->source;
sourceLimit=pArgs->sourceLimit;
target=(uint8_t *)pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
offsets=pArgs->offsets;
table=cnv->sharedData->mbcs.fromUnicodeTable;
@ -2935,7 +2935,7 @@ ucnv_MBCSSingleFromBMPWithOffsets(UConverterFromUnicodeArgs *pArgs,
* since the conversion here is 1:1 UChar:uint8_t, we need only one counter
* for the minimum of the sourceLength and targetCapacity
*/
length=sourceLimit-source;
length=(int32_t)(sourceLimit-source);
if(length<targetCapacity) {
targetCapacity=length;
}
@ -3086,8 +3086,8 @@ getTrail:
/* a mapping was written to the target, continue */
/* recalculate the targetCapacity after an extension mapping */
targetCapacity=pArgs->targetLimit-(char *)target;
length=sourceLimit-source;
targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
length=(int32_t)(sourceLimit-source);
if(length<targetCapacity) {
targetCapacity=length;
}
@ -3177,7 +3177,7 @@ ucnv_MBCSFromUnicodeWithOffsets(UConverterFromUnicodeArgs *pArgs,
source=pArgs->source;
sourceLimit=pArgs->sourceLimit;
target=(uint8_t *)pArgs->target;
targetCapacity=pArgs->targetLimit-pArgs->target;
targetCapacity=(int32_t)(pArgs->targetLimit-pArgs->target);
offsets=pArgs->offsets;
table=cnv->sharedData->mbcs.fromUnicodeTable;
@ -3475,7 +3475,7 @@ unassigned:
/* a mapping was written to the target, continue */
/* recalculate the targetCapacity after an extension mapping */
targetCapacity=pArgs->targetLimit-(char *)target;
targetCapacity=(int32_t)(pArgs->targetLimit-(char *)target);
/* normal end of conversion: prepare for a new character */
if(offsets!=NULL) {

View File

@ -534,7 +534,7 @@ static void udata_pathiter_init(UDataPathIterator *iter, const char *path, const
* Get an upper bound of possible string size, and make sure that the buffer
* is big enough (sum of length of each piece, 2 extra delimiters, + trailing NULL) */
{
int32_t maxPathLen = (int32_t)uprv_strlen(iter->path) + uprv_strlen(item) + uprv_strlen(iter->suffix) + iter->packageStubLen + 3;
int32_t maxPathLen = (int32_t)(uprv_strlen(iter->path) + uprv_strlen(item) + uprv_strlen(iter->suffix) + iter->packageStubLen + 3);
iter->pathBuffer = iter->pathBufferA;
if (maxPathLen >= U_DATA_PATHITER_BUFSIZ) {
iter->pathBuffer = (char *)uprv_malloc(maxPathLen);

View File

@ -698,7 +698,7 @@ uidna_IDNToASCII( const UChar *src, int32_t srcLength,
labelStart = delimiter;
if(remainingLen >0 ){
remainingLen = srcLength - (delimiter - src);
remainingLen = (int32_t)(srcLength - (delimiter - src));
}
}
@ -784,7 +784,7 @@ uidna_IDNToUnicode( const UChar* src, int32_t srcLength,
labelStart = delimiter;
if(remainingLen >0 ){
remainingLen = srcLength - (delimiter - src);
remainingLen = (int32_t)(srcLength - (delimiter - src));
}
}

View File

@ -552,7 +552,7 @@ locale_getKeywordsStart(const char *localeID) {
static int32_t locale_canonKeywordName(char *buf, const char *keywordName, UErrorCode *status)
{
int32_t i;
int32_t keywordNameLen = uprv_strlen(keywordName);
int32_t keywordNameLen = (int32_t)uprv_strlen(keywordName);
if(keywordNameLen >= ULOC_KEYWORD_BUFFER_LEN) {
/* keyword name too long for internal buffer */
@ -660,10 +660,10 @@ _getKeywords(const char *localeID,
while(*(pos - i - 1) == ' ') {
i++;
}
keywordList[numKeywords].valueLen = pos - equalSign - i;
keywordList[numKeywords].valueLen = (int32_t)(pos - equalSign - i);
pos++;
} else {
i = uprv_strlen(equalSign);
i = (int32_t)uprv_strlen(equalSign);
while(equalSign[i-1] == ' ') {
i--;
}
@ -699,9 +699,9 @@ _getKeywords(const char *localeID,
return 0;
}
uprv_strcpy(keywordList[numKeywords].keyword, addKeyword);
keywordList[numKeywords].keywordLen = uprv_strlen(addKeyword);
keywordList[numKeywords].keywordLen = (int32_t)uprv_strlen(addKeyword);
keywordList[numKeywords].valueStart = addValue;
keywordList[numKeywords].valueLen = uprv_strlen(addValue);
keywordList[numKeywords].valueLen = (int32_t)uprv_strlen(addValue);
++numKeywords;
}
} else {
@ -833,9 +833,9 @@ uloc_getKeywordValue(const char* localeID,
startSearchHere--;
}
uprv_strncpy(buffer, nextSeparator, startSearchHere - nextSeparator);
result = u_terminateChars(buffer, bufferCapacity, startSearchHere - nextSeparator, status);
result = u_terminateChars(buffer, bufferCapacity, (int32_t)(startSearchHere - nextSeparator), status);
} else if(!startSearchHere && (int32_t)uprv_strlen(nextSeparator) < bufferCapacity) { /* last item in string */
i = uprv_strlen(nextSeparator);
i = (int32_t)uprv_strlen(nextSeparator);
while(nextSeparator[i - 1] == ' ') {
i--;
}
@ -845,9 +845,9 @@ uloc_getKeywordValue(const char* localeID,
/* give a bigger buffer, please */
*status = U_BUFFER_OVERFLOW_ERROR;
if(startSearchHere) {
result = startSearchHere - nextSeparator;
result = (int32_t)(startSearchHere - nextSeparator);
} else {
result = uprv_strlen(nextSeparator);
result = (int32_t)uprv_strlen(nextSeparator);
}
}
return result;
@ -886,7 +886,7 @@ uloc_setKeywordValue(const char* keywordName,
keywordValue = NULL;
}
if(keywordValue) {
keywordValueLen = uprv_strlen(keywordValue);
keywordValueLen = (int32_t)uprv_strlen(keywordValue);
} else {
keywordValueLen = 0;
}
@ -896,7 +896,7 @@ uloc_setKeywordValue(const char* keywordName,
}
startSearchHere = (char*)locale_getKeywordsStart(buffer);
if(bufferCapacity>1) {
bufLen = uprv_strlen(buffer);
bufLen = (int32_t)uprv_strlen(buffer);
} else {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return 0;
@ -965,10 +965,10 @@ uloc_setKeywordValue(const char* keywordName,
/* we actually found the keyword. Change the value */
if (nextSeparator) {
keywordAtEnd = 0;
foundValueLen = nextSeparator - nextEqualsign;
foundValueLen = (int32_t)(nextSeparator - nextEqualsign);
} else {
keywordAtEnd = 1;
foundValueLen = uprv_strlen(nextEqualsign);
foundValueLen = (int32_t)uprv_strlen(nextEqualsign);
}
if(keywordValue) { /* adding a value - not removing */
if(foundValueLen == keywordValueLen) {
@ -1001,11 +1001,11 @@ uloc_setKeywordValue(const char* keywordName,
if(keywordAtEnd) {
/* zero out the ';' or '@' just before startSearchhere */
keywordStart[-1] = 0;
return (keywordStart-buffer)-1; /* (string length without keyword) minus separator */
return (int32_t)((keywordStart-buffer)-1); /* (string length without keyword) minus separator */
} else {
uprv_memmove(keywordStart, nextSeparator+1, bufLen-((nextSeparator+1)-buffer));
keywordStart[bufLen-((nextSeparator+1)-buffer)]=0;
return bufLen-((nextSeparator+1)-keywordStart);
return (int32_t)(bufLen-((nextSeparator+1)-keywordStart));
}
}
} else if(rc<0){ /* end match keyword */
@ -1355,7 +1355,7 @@ _deleteVariant(char* variants, int32_t variantsLen,
return delta;
}
++p;
variantsLen -= p - variants;
variantsLen -= (int32_t)(p - variants);
variants = p;
}
}
@ -1393,7 +1393,7 @@ uloc_kw_nextKeyword(UEnumeration* en,
const char* result = ((UKeywordsContext *)en->context)->current;
int32_t len = 0;
if(*result) {
len = uprv_strlen(((UKeywordsContext *)en->context)->current);
len = (int32_t)uprv_strlen(((UKeywordsContext *)en->context)->current);
((UKeywordsContext *)en->context)->current += len+1;
} else {
result = NULL;
@ -1663,7 +1663,7 @@ _canonicalize(const char* localeID,
/* Look up the ID in the canonicalization map */
for (j=0; j<(int32_t)(sizeof(CANONICALIZE_MAP)/sizeof(CANONICALIZE_MAP[0])); j++) {
const char* id = CANONICALIZE_MAP[j].id;
int32_t n = uprv_strlen(id);
int32_t n = (int32_t)uprv_strlen(id);
if (len == n && uprv_strncmp(name, id, n) == 0) {
if (n == 0 && localeID != NULL) {
break; /* Don't remap "" if keywords present */
@ -2870,7 +2870,7 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult
const char *t;
int32_t res;
int32_t i;
int32_t l = uprv_strlen(httpAcceptLanguage);
int32_t l = (int32_t)uprv_strlen(httpAcceptLanguage);
int32_t jSize;
j = smallBuffer;
@ -2914,7 +2914,7 @@ uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult
/* eat spaces prior to semi */
for(t=(paramEnd-1);(paramEnd>s)&&isspace(*t);t--)
;
j[n].locale = uprv_strndup(s,(t+1)-s);
j[n].locale = uprv_strndup(s,(int32_t)((t+1)-s));
uloc_canonicalize(j[n].locale,tmp,sizeof(tmp)/sizeof(tmp[0]),status);
if(strcmp(j[n].locale,tmp)) {
uprv_free(j[n].locale);
@ -3012,7 +3012,7 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable,
#if defined(ULOC_DEBUG)
fprintf(stderr," %s\n", l);
#endif
len = uprv_strlen(l);
len = (int32_t)uprv_strlen(l);
if(!uprv_strcmp(acceptList[i], l)) {
if(outResult) {
*outResult = ULOC_ACCEPT_VALID;
@ -3052,7 +3052,7 @@ uloc_acceptLanguage(char *result, int32_t resultAvailable,
#if defined(ULOC_DEBUG)
fprintf(stderr," %s\n", l);
#endif
len = uprv_strlen(l);
len = (int32_t)uprv_strlen(l);
if(!uprv_strcmp(fallbackList[i], l)) {
if(outResult) {
*outResult = ULOC_ACCEPT_FALLBACK;

View File

@ -221,7 +221,7 @@ umtx_lock(UMTX *mutex)
}
/* This handles gGlobalMutex too, but only if there is no pMutexLockFn */
else if (pMutexLockFn == NULL) { /* see comments above */
int i = ((CRITICAL_SECTION*)*mutex) - &gMutexes[0];
size_t i = ((CRITICAL_SECTION*)*mutex) - &gMutexes[0];
U_ASSERT(i >= 0 && i < MAX_MUTEXES);
++gRecursionCountPool[i];
@ -263,7 +263,7 @@ umtx_unlock(UMTX* mutex)
}
/* This handles gGlobalMutex too, but only if there is no pMutexLockFn */
else if (pMutexLockFn == NULL) { /* see comments above */
int i = ((CRITICAL_SECTION*)*mutex) - &gMutexes[0];
size_t i = ((CRITICAL_SECTION*)*mutex) - &gMutexes[0];
U_ASSERT(i >= 0 && i < MAX_MUTEXES);
--gRecursionCountPool[i];

View File

@ -302,7 +302,7 @@ UnicodeString::UnicodeString(const char *src, int32_t length, EInvariant)
// treat as an empty string
} else {
if(length<0) {
length=uprv_strlen(src);
length=(int32_t)uprv_strlen(src);
}
if(cloneArrayIfNeeded(length, length, FALSE)) {
u_charsToUChars(src, getArrayStart(), length);
@ -759,7 +759,7 @@ UnicodeString::indexOf(const UChar *srcChars,
if(match == NULL) {
return -1;
} else {
return match - fArray;
return (int32_t)(match - fArray);
}
}
@ -776,7 +776,7 @@ UnicodeString::doIndexOf(UChar c,
if(match == NULL) {
return -1;
} else {
return match - fArray;
return (int32_t)(match - fArray);
}
}
@ -792,7 +792,7 @@ UnicodeString::doIndexOf(UChar32 c,
if(match == NULL) {
return -1;
} else {
return match - fArray;
return (int32_t)(match - fArray);
}
}
@ -820,7 +820,7 @@ UnicodeString::lastIndexOf(const UChar *srcChars,
if(match == NULL) {
return -1;
} else {
return match - fArray;
return (int32_t)(match - fArray);
}
}
@ -841,7 +841,7 @@ UnicodeString::doLastIndexOf(UChar c,
if(match == NULL) {
return -1;
} else {
return match - fArray;
return (int32_t)(match - fArray);
}
}
@ -857,7 +857,7 @@ UnicodeString::doLastIndexOf(UChar32 c,
if(match == NULL) {
return -1;
} else {
return match - fArray;
return (int32_t)(match - fArray);
}
}

View File

@ -267,7 +267,7 @@ UnicodeString::doCodepageCreate(const char *codepageData,
return;
}
if(dataLength == -1) {
dataLength = uprv_strlen(codepageData);
dataLength = (int32_t)uprv_strlen(codepageData);
}
UErrorCode status = U_ZERO_ERROR;

View File

@ -2153,7 +2153,7 @@ _composePart(UChar *stackBuffer, UChar *&buffer, int32_t &bufferCapacity, int32_
/* decompose [prevStarter..src[ */
length=_decompose(buffer, bufferCapacity,
prevStarter, src-prevStarter,
prevStarter, (int32_t)(src-prevStarter),
compat, nx,
trailCC);
if(length>bufferCapacity) {
@ -2162,7 +2162,7 @@ _composePart(UChar *stackBuffer, UChar *&buffer, int32_t &bufferCapacity, int32_
return NULL;
}
length=_decompose(buffer, bufferCapacity,
prevStarter, src-prevStarter,
prevStarter, (int32_t)(src-prevStarter),
compat, nx,
trailCC);
}
@ -2174,7 +2174,7 @@ _composePart(UChar *stackBuffer, UChar *&buffer, int32_t &bufferCapacity, int32_
}
/* return with a pointer to the recomposition and its length */
length=recomposeLimit-buffer;
length=(int32_t)(recomposeLimit-buffer);
return buffer;
}

View File

@ -613,7 +613,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
*/
++len; /* count the terminating NUL */
if(parent != NULL && parent->fResPath != NULL) {
capacity = uprv_strlen(parent->fResPath) + 1;
capacity = (int32_t)uprv_strlen(parent->fResPath) + 1;
} else {
capacity = 0;
}
@ -684,7 +684,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
/* we need to make keyPath from parent's fResPath and
* current key, if there is a key associated
*/
len = uprv_strlen(key) + 1;
len = (int32_t)(uprv_strlen(key) + 1);
if(len > capacity) {
capacity = len;
if(chAlias == stackAlias) {
@ -793,7 +793,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
ures_appendResPath(resB, parent->fResPath, parent->fResPathLen);
}
if(key != NULL) {
ures_appendResPath(resB, key, uprv_strlen(key));
ures_appendResPath(resB, key, (int32_t)uprv_strlen(key));
ures_appendResPath(resB, RES_PATH_SEPARATOR_S, 1);
} else {
char buf[256];
@ -1221,7 +1221,7 @@ ures_findResource(const char* path, UResourceBundle *fillIn, UErrorCode *status)
return result;
}
length = uprv_strlen(path)+1;
length = (int32_t)(uprv_strlen(path)+1);
pathToResource = (char *)uprv_malloc(length*sizeof(char));
/* test for NULL */
if(pathToResource == NULL) {
@ -1916,7 +1916,7 @@ ures_loc_nextLocale(UEnumeration* en,
int32_t len = 0;
if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status))) {
result = ures_getKey(k);
len = uprv_strlen(result);
len = (int32_t)uprv_strlen(result);
}
if (resultLength) {
*resultLength = len;
@ -2266,7 +2266,7 @@ ures_getFunctionalEquivalent(char *result, int32_t resultCapacity,
ures_close(&bund1);
ures_close(&bund2);
length = uprv_strlen(found);
length = (int32_t)uprv_strlen(found);
if(U_SUCCESS(*status)) {
int32_t copyLength = uprv_min(length, resultCapacity);
@ -2355,7 +2355,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
}
}
if(k && *k) {
int32_t kLen = uprv_strlen(k);
int32_t kLen = (int32_t)uprv_strlen(k);
if(!uprv_strcmp(k,DEFAULT_TAG)) {
continue; /* don't need 'default'. */
}

View File

@ -145,7 +145,7 @@ u_uastrcpy(UChar *ucs1,
ucs1,
MAX_STRLEN,
s2,
uprv_strlen(s2),
(int32_t)uprv_strlen(s2),
&err);
u_releaseDefaultConverter(cnv);
if(U_FAILURE(err)) {

View File

@ -990,7 +990,7 @@ U_CAPI int32_t U_EXPORT2
u_strlen(const UChar *s)
{
#if U_SIZEOF_WCHAR_T == U_SIZEOF_UCHAR
return uprv_wcslen(s);
return (int32_t)uprv_wcslen(s);
#else
const UChar *t = s;
while(*t != 0) {

View File

@ -101,7 +101,7 @@ u_strFromUTF32(UChar *dest,
}
}
reqLength += pDest - dest;
reqLength += (int32_t)(pDest - dest);
if(pDestLength){
*pDestLength = reqLength;
}
@ -175,7 +175,7 @@ u_strToUTF32(UChar32 *dest,
}
}
reqLength+=(pDest - (uint32_t *)dest);
reqLength+=(int32_t)(pDest - (uint32_t *)dest);
if(pDestLength){
*pDestLength = reqLength;
}
@ -212,7 +212,7 @@ u_strFromUTF8(UChar *dest,
}
if(srcLength == -1){
srcLength = uprv_strlen((char*)pSrc);
srcLength = (int32_t)uprv_strlen((char*)pSrc);
}
while((index < srcLength)&&(pDest<pDestLimit)){
@ -252,7 +252,7 @@ u_strFromUTF8(UChar *dest,
}
}
reqLength+=(pDest - dest);
reqLength+=(int32_t)(pDest - dest);
if(pDestLength){
*pDestLength = reqLength;