ICU-535 Fixed compiler warnings

X-SVN-Rev: 3557
This commit is contained in:
Ram Viswanadha 2001-02-03 03:15:29 +00:00
parent 229f67d2bc
commit de43f54b4c
2 changed files with 22 additions and 41 deletions

View File

@ -1532,12 +1532,14 @@ U_CFUNC void UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeA
UChar32 targetUniChar = 0x0000;
UChar mySourceChar = 0x0000;
UConverterDataISO2022* myData=(UConverterDataISO2022*)(args->converter->extraInfo);
StateEnum* currentState = &myData->toUnicodeCurrentState;
int plane = 0; /*dummy variable*/
/*Arguments Check*/
if (U_FAILURE(*err))
return;
if ((args->converter == NULL) || (args->targetLimit < args->target) || (args->sourceLimit < args->source)){
if ((args->converter == NULL) || (myTarget < args->target) || (mySource < args->source)){
*err = U_ILLEGAL_ARGUMENT_ERROR;
return;
}
@ -1548,14 +1550,6 @@ U_CFUNC void UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeA
mySourceChar= (unsigned char) *mySource++;
if(args->converter->mode==UCNV_SI){
/* if there are no escape sequences in the first buffer then they
* are assumed to be ASCII according to RFC-1554
*/
myData->toUnicodeCurrentState = ASCII;
}
/*consume the escape sequence*/
if(myData->key!=0 || mySourceChar== ESC_2022){
if(args->converter->toUnicodeStatus == 0x00){
@ -1573,7 +1567,7 @@ U_CFUNC void UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeA
}
else if(mySourceChar<=SPACE){
if(args->converter->toUnicodeStatus == 0x00){
myData->toUnicodeCurrentState = ASCII;
*currentState = ASCII;
}
else
@ -1581,25 +1575,23 @@ U_CFUNC void UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeA
}
switch(myConverterType[myData->toUnicodeCurrentState]){
switch(myConverterType[*currentState]){
case ASCII1:
if(args->converter->toUnicodeStatus == 0x00 && mySourceChar < 0x7F){
targetUniChar = (UChar) mySourceChar;
break;
}
else{
goto SAVE_STATE;
}
break;
goto SAVE_STATE;
case SBCS:
if(args->converter->toUnicodeStatus == 0x00){
targetUniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP(myData->currentConverter->sharedData, mySourceChar);
break;
}
else{
goto SAVE_STATE;
}
break;
goto SAVE_STATE;
case DBCS:
if(args->converter->toUnicodeStatus == 0x00){
args->converter->toUnicodeStatus = (UChar) mySourceChar;
@ -1620,12 +1612,11 @@ U_CFUNC void UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeA
case LATIN1:
if(args->converter->fromUnicodeStatus == 0x00 && mySourceChar < 0x100){
targetUniChar = (UChar) mySourceChar;
break;
}
else{
goto SAVE_STATE;
}
break;
goto SAVE_STATE;
case INVALID_STATE:
*err = U_ILLEGAL_ESCAPE_SEQUENCE;
goto END_LOOP;
@ -1636,7 +1627,7 @@ U_CFUNC void UConverter_toUnicode_ISO_2022_JP_OFFSETS_LOGIC(UConverterToUnicodeA
if(targetUniChar < 0xfffe){
if(args->offsets){
args->offsets[myTarget - args->target]= mySource - args->source - 2
+(myConverterType[myData->toUnicodeCurrentState] < SBCS);
+(myConverterType[*currentState] < SBCS);
}
*(myTarget++)=(UChar)targetUniChar;
@ -1653,7 +1644,7 @@ SAVE_STATE:
UConverterCallbackReason reason;
int32_t currentOffset ;
int32_t saveIndex = myTarget - args->target;
if(myConverterType[myData->toUnicodeCurrentState] > SBCS){
if(myConverterType[*currentState] > SBCS){
currentOffset= mySource - args->source - 2;
args->converter->invalidCharBuffer[args->converter->invalidCharLength++] = tempBuf[0];

View File

@ -138,7 +138,6 @@ static void _HZOpen(UConverter *cnv, const char *name,const char *locale,uint32_
((UConverterDataHZ*)cnv->extraInfo)->targetIndex = 0;
((UConverterDataHZ*)cnv->extraInfo)->sourceIndex = 0;
((UConverterDataHZ*)cnv->extraInfo)->isTargetUCharDBCS = FALSE;
//ucnv_setSubstChars(cnv,"\x7E\x7D\x1A", 3, errorCode);
}
@ -197,8 +196,6 @@ U_CFUNC void UConverter_toUnicode_HZ_OFFSETS_LOGIC(UConverterToUnicodeArgs *args
const char *mySource = ( char *) args->source;
UChar *myTarget = args->target;
char *tempLimit = &tempBuf[3];
int32_t mySourceIndex = 0;
int32_t myTargetIndex = 0;
const char *mySourceLimit = args->sourceLimit;
UChar32 targetUniChar = 0x0000;
UChar mySourceChar = 0x0000;
@ -415,7 +412,7 @@ U_CFUNC void UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs
UConverterCallbackReason reason;
UBool isEscapeAppended =FALSE;
int len =0;
char* escSeq=NULL;
const char* escSeq=NULL;
/*Arguments Check*/
if (U_FAILURE(*err))
@ -450,19 +447,13 @@ U_CFUNC void UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs
}
/* only DBCS or SBCS characters are expected*/
if(length > 2 || length==0){
reason =UCNV_ILLEGAL;
*err =U_INVALID_CHAR_FOUND;
goto CALLBACK;
}
/* DB haracters with high bit set to 1 are expected */
if(((targetUniChar & 0x8080) != 0x8080)&& length==2){
if(length > 2 || length==0 ||(((targetUniChar & 0x8080) != 0x8080)&& length==2)){
reason =UCNV_ILLEGAL;
*err =U_INVALID_CHAR_FOUND;
goto CALLBACK;
}
if (targetUniChar != missingCharMarker){
myConverterData->isTargetUCharDBCS = isTargetUCharDBCS = (UBool)(targetUniChar>0x00FF);
if(oldIsTargetUCharDBCS != isTargetUCharDBCS || !myConverterData->isEscapeAppended ){
@ -509,7 +500,7 @@ U_CFUNC void UConverter_fromUnicode_HZ_OFFSETS_LOGIC (UConverterFromUnicodeArgs
/* write the offsets */
if(offsets){
int i = mySourceIndex-1;
int len = 2 - (targetUniChar < 0x00FF);
len = 2 - (targetUniChar < 0x00FF);
while(len-->0){
*(offsets++) = i;
}
@ -595,7 +586,6 @@ getTrail:
}
}
isTargetUCharDBCS=myConverterData->isTargetUCharDBCS;
//myConverterData->isShiftAppended =FALSE;
args->source = saveSource;
args->target = saveTarget;
args->offsets = saveOffsets;