From 8503dd41b13c6a527eb259ef08ce5e76a8669f34 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Thu, 24 Aug 2006 17:59:01 +0000 Subject: [PATCH] ICU-4707 Fix some compiler warnings. X-SVN-Rev: 20152 --- icu4c/source/common/ucnvisci.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/icu4c/source/common/ucnvisci.c b/icu4c/source/common/ucnvisci.c index eb49d60ba9..61fab3905c 100644 --- a/icu4c/source/common/ucnvisci.c +++ b/icu4c/source/common/ucnvisci.c @@ -120,7 +120,14 @@ typedef struct{ char name[30]; }UConverterDataISCII; -static const uint16_t lookupInitialData[][3]={ +typedef struct LookupDataStruct +{ + UniLang uniLang; + MaskEnum maskEnum; + ISCIILang isciiLang; +} LookupDataStruct; + +static const LookupDataStruct lookupInitialData[]={ { DEVANAGARI, DEV_MASK, DEV }, { BENGALI, BNG_MASK, BNG }, { GURMUKHI, PNJ_MASK, PNJ }, @@ -148,10 +155,10 @@ _ISCIIOpen(UConverter *cnv, const char *name,const char *locale,uint32_t options /* initialize state variables */ converterData->currentDeltaFromUnicode=converterData->currentDeltaToUnicode= converterData->defDeltaToUnicode= - (uint16_t)(lookupInitialData[options & UCNV_OPTIONS_VERSION_MASK][0] * DELTA); + (uint16_t)(lookupInitialData[options & UCNV_OPTIONS_VERSION_MASK].uniLang * DELTA); converterData->currentMaskFromUnicode = converterData->currentMaskToUnicode = - converterData->defMaskToUnicode=lookupInitialData[options & UCNV_OPTIONS_VERSION_MASK][1]; + converterData->defMaskToUnicode=lookupInitialData[options & UCNV_OPTIONS_VERSION_MASK].maskEnum; converterData->isFirstBuffer=TRUE; uprv_strcpy(converterData->name,"ISCII,version="); @@ -200,7 +207,7 @@ _ISCIIReset(UConverter *cnv, UConverterResetChoice choice){ if(choice!=UCNV_RESET_TO_UNICODE) { cnv->fromUChar32=0x0000; data->contextCharFromUnicode=0x00; - data->currentMaskFromUnicode=data->defDeltaToUnicode; + data->currentMaskFromUnicode=data->defMaskToUnicode; data->currentDeltaFromUnicode=data->defDeltaToUnicode; data->isFirstBuffer=TRUE; data->resetToDefaultToUnicode=FALSE; @@ -845,7 +852,7 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args, } if(sourceChar == LF){ targetByteUnit = ATR<<8; - targetByteUnit += (uint8_t) lookupInitialData[range][2]; + targetByteUnit += (uint8_t) lookupInitialData[range].isciiLang; args->converter->fromUnicodeStatus=sourceChar; /* now append ATR and language code */ WRITE_TO_TARGET_FROM_U(args,offsets,source,target,targetLimit,targetByteUnit,err); @@ -891,7 +898,7 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args, /* Now are we in the same block as the previous? */ if(newDelta!= converterData->currentDeltaFromUnicode || converterData->isFirstBuffer){ converterData->currentDeltaFromUnicode = newDelta; - converterData->currentMaskFromUnicode = lookupInitialData[range][1]; + converterData->currentMaskFromUnicode = lookupInitialData[range].maskEnum; deltaChanged =TRUE; converterData->isFirstBuffer=FALSE; } @@ -917,7 +924,7 @@ UConverter_fromUnicode_ISCII_OFFSETS_LOGIC (UConverterFromUnicodeArgs * args, */ uint16_t temp=0; temp =(uint16_t)(ATR<<8); - temp += (uint16_t)((uint8_t) lookupInitialData[range][2]); + temp += (uint16_t)((uint8_t) lookupInitialData[range].isciiLang); /* reset */ deltaChanged=FALSE; /* now append ATR and language code */ @@ -1359,7 +1366,7 @@ _ISCIIGetUnicodeSet(const UConverter *cnv, scripts, we add all roundtrippable characters to this set. */ sa->addRange(sa->set, 0, ASCII_END); for (script = DEVANAGARI; script <= MALAYALAM; script++) { - mask = (uint8_t)(lookupInitialData[script][1]); + mask = (uint8_t)(lookupInitialData[script].maskEnum); for (idx = 0; idx < DELTA; idx++) { if (validityTable[idx] & mask) { sa->add(sa->set, idx + (script * DELTA) + INDIC_BLOCK_BEGIN);