ICU-3222 fix compiler warnings

X-SVN-Rev: 13985
This commit is contained in:
Markus Scherer 2003-12-04 00:34:51 +00:00
parent a944df48d8
commit b4e7245d1e
7 changed files with 40 additions and 26 deletions

View file

@ -234,7 +234,7 @@ EnumToOffset::swap(const UDataSwapper *ds,
if(length>=0) {
if(length<(pos+size)) {
if(length<sizeof(PropertyAliases)) {
if(length<(int32_t)sizeof(PropertyAliases)) {
udata_printError(ds, "upname_swap(EnumToOffset): too few bytes (%d after header)\n"
" for pnames.icu EnumToOffset{%d..%d} at %d\n",
length, tempMap->enumStart, tempMap->enumLimit, pos);
@ -278,7 +278,7 @@ NonContiguousEnumToOffset::swap(const UDataSwapper *ds,
if(length>=0) {
if(length<(pos+size)) {
if(length<sizeof(PropertyAliases)) {
if(length<(int32_t)sizeof(PropertyAliases)) {
udata_printError(ds, "upname_swap(NonContiguousEnumToOffset): too few bytes (%d after header)\n"
" for pnames.icu NonContiguousEnumToOffset[%d] at %d\n",
length, tempMap->count, pos);
@ -355,7 +355,7 @@ NameToEnum::swap(const UDataSwapper *ds,
if(length>=0) {
if(length<(pos+size)) {
if(length<sizeof(PropertyAliases)) {
if(length<(int32_t)sizeof(PropertyAliases)) {
udata_printError(ds, "upname_swap(NameToEnum): too few bytes (%d after header)\n"
" for pnames.icu NameToEnum[%d] at %d\n",
length, tempMap->count, pos);
@ -484,7 +484,7 @@ PropertyAliases::swap(const UDataSwapper *ds,
outAliases=(PropertyAliases *)outBytes;
/* read the input PropertyAliases - all 16-bit values */
for(i=0; i<sizeof(PropertyAliases)/2; ++i) {
for(i=0; i<(int32_t)sizeof(PropertyAliases)/2; ++i) {
((uint16_t *)&aliases)[i]=ds->readUInt16(((const uint16_t *)inBytes)[i]);
}
@ -622,7 +622,7 @@ upname_swap(const UDataSwapper *ds,
if(length>=0) {
length-=headerSize;
if(length<sizeof(PropertyAliases)) {
if(length<(int32_t)sizeof(PropertyAliases)) {
udata_printError(ds, "upname_swap(): too few bytes (%d after header) for pnames.icu\n",
length);
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;

View file

@ -793,6 +793,11 @@ _fromUnicodeWithCallback(UConverterFromUnicodeArgs *pArgs, UErrorCode *err) {
if(cnv->preFromULength>=0) {
/* normal mode */
realSource=NULL;
/* avoid compiler warnings - not otherwise necessary, and the values do not matter */
realSourceLimit=NULL;
realFlush=FALSE;
realSourceIndex=0;
} else {
/*
* Previous m:n conversion stored source units from a partial match
@ -1183,6 +1188,11 @@ _toUnicodeWithCallback(UConverterToUnicodeArgs *pArgs, UErrorCode *err) {
if(cnv->preToULength>=0) {
/* normal mode */
realSource=NULL;
/* avoid compiler warnings - not otherwise necessary, and the values do not matter */
realSourceLimit=NULL;
realFlush=FALSE;
realSourceIndex=0;
} else {
/*
* Previous m:n conversion stored source units from a partial match

View file

@ -1583,7 +1583,7 @@ UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
myData=(UConverterDataISO2022*)(args->converter->extraInfo);
currentState = &myData->toUnicodeCurrentState;
toUnicodeStatus = &args->converter->toUnicodeStatus;
while(mySource< args->sourceLimit){
while(mySource< mySourceLimit){
targetUniChar = missingCharMarker;
@ -1620,7 +1620,7 @@ UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
if(*toUnicodeStatus== 0x00){
mySource--;
changeState_2022(args->converter,&(mySource),
args->sourceLimit, ISO_2022_JP, err);
mySourceLimit, ISO_2022_JP, err);
/*Invalid or illegal escape sequence */
if(U_SUCCESS(*err)){
continue;
@ -1769,7 +1769,7 @@ UConverter_fromUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterFromUnicodeArgs* args
UBool useFallback;
int32_t length =0;
if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)){
if ((args->converter == NULL) || (args->targetLimit < args->target) || (sourceLimit < args->source)){
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@ -1923,7 +1923,7 @@ UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(UConverterToUnicodeArgs *args
do{
/*Find the end of the buffer e.g : Next Escape Seq | end of Buffer*/
mySourceLimit = getEndOfBuffer_2022(&(args->source), args->sourceLimit, args->flush);
mySourceLimit = getEndOfBuffer_2022(&(args->source), mySourceLimit, args->flush);
if (args->converter->mode == UCNV_SO) /*Already doing some conversion*/{
saveThis = args->converter;
@ -1941,19 +1941,19 @@ UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(UConverterToUnicodeArgs *args
/*-Done with buffer with entire buffer
-Error while converting
*/
if (U_FAILURE(*err) || (args->source == args->sourceLimit))
if (U_FAILURE(*err) || (args->source == mySourceLimit))
return;
sourceStart = args->source;
changeState_2022(args->converter,
&(args->source),
args->sourceLimit,
mySourceLimit,
ISO_2022_KR,
err);
/* args->source = sourceStart; */
}while(args->source < args->sourceLimit);
}while(args->source < mySourceLimit);
/* return*/
}
@ -1971,7 +1971,7 @@ UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UBool useFallback;
if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)){
if ((args->converter == NULL) || (args->targetLimit < args->target) || (mySourceLimit < args->source)){
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@ -1984,7 +1984,7 @@ UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC_IBM(args,err);
return;
}
while(mySource< args->sourceLimit){
while(mySource< mySourceLimit){
targetUniChar = missingCharMarker;
@ -2016,7 +2016,7 @@ UConverter_toUnicode_ISO_2022_KR_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
mySource--;
changeState_2022(args->converter,&(mySource),
args->sourceLimit, ISO_2022_KR, err);
mySourceLimit, ISO_2022_KR, err);
/*}*/
if(U_FAILURE(*err)){
args->target = myTarget;

View file

@ -1123,6 +1123,9 @@ ucnv_swap(const UDataSwapper *ds,
/* calculate the length of the MBCS data */
if(extOffset==0) {
size=(int32_t)(mbcsHeader.offsetFromUBytes+mbcsHeader.fromUBytesLength);
/* avoid compiler warnings - not otherwise necessary, and the value does not matter */
inExtIndexes=NULL;
} else {
/* there is extension data after the base data, see ucnv_ext.h */
if(length>=0 && length<(extOffset+UCNV_EXT_INDEXES_MIN_LENGTH*4)) {

View file

@ -382,7 +382,7 @@ ucnv_extContinueMatchToU(UConverter *cnv,
cnv->preToULength=0;
} else {
/* the match did not use all of preToU[] - keep the rest for replay */
int32_t length=cnv->preToULength-match;
length=cnv->preToULength-match;
uprv_memmove(cnv->preToU, cnv->preToU+match, length);
cnv->preToULength=(int8_t)-length;
}

View file

@ -150,12 +150,12 @@ UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args,
UChar mySourceChar = 0x0000;
UConverterDataHZ* myData=(UConverterDataHZ*)(args->converter->extraInfo);
if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)){
if ((args->converter == NULL) || (args->targetLimit < args->target) || (mySourceLimit < args->source)){
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
while(mySource< args->sourceLimit){
while(mySource< mySourceLimit){
if(myTarget < args->targetLimit){
@ -288,11 +288,11 @@ static void
UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
UErrorCode * err){
const UChar *mySource = args->source;
unsigned char *myTarget = (unsigned char *) args->target;
char *myTarget = args->target;
int32_t* offsets = args->offsets;
int32_t mySourceIndex = 0;
int32_t myTargetIndex = 0;
int32_t targetLength = (int32_t)(args->targetLimit - args->target);
int32_t targetLength = (int32_t)(args->targetLimit - myTarget);
int32_t mySourceLength = (int32_t)(args->sourceLimit - args->source);
int32_t length=0;
uint32_t targetUniChar = 0x0000;
@ -304,7 +304,7 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
int len =0;
const char* escSeq=NULL;
if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)){
if ((args->converter == NULL) || (args->targetLimit < myTarget) || (args->sourceLimit < args->source)){
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@ -316,7 +316,7 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
targetUniChar = missingCharMarker;
if (myTargetIndex < targetLength){
c=mySourceChar = (UChar) args->source[mySourceIndex++];
c=mySourceChar = (UChar) mySource[mySourceIndex++];
oldIsTargetUCharDBCS = isTargetUCharDBCS;
@ -358,12 +358,12 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
if(isTargetUCharDBCS){
if( myTargetIndex <targetLength){
args->target[myTargetIndex++] =(char) ((targetUniChar >> 8) -0x80);
myTarget[myTargetIndex++] =(char) ((targetUniChar >> 8) -0x80);
if(offsets){
*(offsets++) = mySourceIndex-1;
}
if(myTargetIndex < targetLength){
args->target[myTargetIndex++] =(char) ((targetUniChar & 0x00FF) -0x80);
myTarget[myTargetIndex++] =(char) ((targetUniChar & 0x00FF) -0x80);
if(offsets){
*(offsets++) = mySourceIndex-1;
}
@ -379,7 +379,7 @@ UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args,
}else{
if( myTargetIndex <targetLength){
args->target[myTargetIndex++] = (char) (targetUniChar );
myTarget[myTargetIndex++] = (char) (targetUniChar );
if(offsets){
*(offsets++) = mySourceIndex-1;
}

View file

@ -1009,7 +1009,7 @@ _MBCSLoad(UConverterSharedData *sharedData,
for(i=0; i<256; ++i) {
state[i]=MBCS_ENTRY_FINAL(0, MBCS_STATE_ILLEGAL, 0);
}
mbcsTable->stateTable=newStateTable;
mbcsTable->stateTable=(const int32_t (*)[256])newStateTable;
mbcsTable->countStates=(uint8_t)(count+1);
mbcsTable->stateTableOwned=TRUE;
@ -3296,6 +3296,7 @@ getTrail:
if(value<=0xff) {
if(value==0 && MBCS_FROM_U_IS_ROUNDTRIP(stage2Entry, c)==0) {
/* no mapping, leave value==0 */
length=0;
} else if(prevLength<=1) {
length=1;
} else {