From d1afd5979db232a83080f76a42776a746c0aa772 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Fri, 17 Aug 2001 00:24:58 +0000 Subject: [PATCH] ICU-900 Fixed some compiler warnings X-SVN-Rev: 5492 --- icu4c/source/common/putil.c | 5 +++- icu4c/source/common/ucnv2022.c | 51 ++++++++++++++++++++++++++-------- icu4c/source/common/uscript.c | 32 ++++++++++----------- 3 files changed, 59 insertions(+), 29 deletions(-) diff --git a/icu4c/source/common/putil.c b/icu4c/source/common/putil.c index a070cc83b21..20235bea8fa 100644 --- a/icu4c/source/common/putil.c +++ b/icu4c/source/common/putil.c @@ -1757,6 +1757,9 @@ _localeToDefaultCharmapTable [] = { "sk", "ibm-912" }, #endif +U_CAPI const char * +uprv_defaultCodePageForLocale(const char *locale); + U_CAPI const char * uprv_defaultCodePageForLocale(const char *locale) { @@ -2146,7 +2149,7 @@ const char* uprv_getDefaultCodepage() /* * These maps for ASCII to/from EBCDIC are from * "UTF-EBCDIC - EBCDIC-Friendly Unicode (or UCS) Transformation Format" - * at http:/*www.unicode.org/unicode/reports/tr16/ + * at http://www.unicode.org/unicode/reports/tr16/ * (which should reflect codepage 1047) * but modified to explicitly exclude the variant * control and graphical characters that are in ASCII-based diff --git a/icu4c/source/common/ucnv2022.c b/icu4c/source/common/ucnv2022.c index 756622a073a..07541a3cd94 100644 --- a/icu4c/source/common/ucnv2022.c +++ b/icu4c/source/common/ucnv2022.c @@ -795,7 +795,32 @@ CONCAT_ESCAPE_EX(UConverterFromUnicodeArgs* args, int32_t** offsets, const char* strToAppend, int len, - UErrorCode* err){ + UErrorCode* err); + +U_INLINE void +MBCS_FROM_UCHAR32_ISO2022(UConverterSharedData* sharedData, + UChar32 c, + uint32_t* value, + UBool useFallback, + int* length, + int outputType); + +U_INLINE void +MBCS_SINGLE_FROM_UCHAR32(UConverterSharedData* sharedData, + UChar32 c, + uint32_t* retval, + UBool useFallback); + +U_INLINE void +CONCAT_ESCAPE_EX(UConverterFromUnicodeArgs* args, + const UChar* source, + unsigned char** target, + const unsigned char* targetLimit, + int32_t** offsets, + const char* strToAppend, + int len, + UErrorCode* err) +{ unsigned char* myTarget = *target; int32_t* myOffsets = *offsets; @@ -825,7 +850,8 @@ MBCS_FROM_UCHAR32_ISO2022(UConverterSharedData* sharedData, uint32_t* value, UBool useFallback, int* length, - int outputType) { + int outputType) +{ const uint16_t *table=sharedData->table->mbcs.fromUnicodeTable; uint32_t stage2Entry; @@ -880,7 +906,8 @@ U_INLINE void MBCS_SINGLE_FROM_UCHAR32(UConverterSharedData* sharedData, UChar32 c, uint32_t* retval, - UBool useFallback) { + UBool useFallback) +{ const uint16_t *table; int32_t value; /* BMP-only codepages are stored without stage 1 entries for supplementary code points */ @@ -2674,7 +2701,7 @@ getTrail: CONCAT_ESCAPE_EX(args,source, &target, targetLimit, &offsets, escSeq,len,err); *plane=lPlane; *isEscapeAppended=TRUE; - *isShiftAppended=FALSE; + *isShiftAppended=FALSE; } /* Append Shift Sequences */ @@ -2686,14 +2713,14 @@ getTrail: *isShiftAppended=TRUE; } }else if(*currentState!=ASCII1){ - int temp =*currentState+*plane-1; - if(*plane ==1 && *isShiftAppended){ - temp=0; - } + int temp =*currentState+*plane-1; + if(*plane ==1 && *isShiftAppended){ + temp=0; + } len =shiftSeqCharsLenCN[temp]; escSeq = shiftSeqCharsCN[temp]; CONCAT_ESCAPE_EX(args,source, &target, targetLimit, &offsets, escSeq,len,err); - *isShiftAppended=TRUE; + *isShiftAppended=TRUE; } initIterState = *currentState; @@ -3122,13 +3149,13 @@ UConverter_toUnicode_ISO_2022_CN_OFFSETS_LOGIC(UConverterToUnicodeArgs *args, else if(targetUniChar > missingCharMarker){ /* disassemble the surrogate pair and write to output*/ targetUniChar-=0x0010000; - *(myTarget++) = (UChar)(0xd800+(UChar)(targetUniChar>>10)); - if(args->offsets){ + *(myTarget++) = (UChar)(0xd800+(UChar)(targetUniChar>>10)); + if(args->offsets){ args->offsets[myTarget - args->target]= mySource - args->source - 2 +(myData->currentType==ASCII); } if(myTarget< args->targetLimit){ - *(myTarget)++ = (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff)); + *(myTarget)++ = (UChar)(0xdc00+(UChar)(targetUniChar&0x3ff)); if(args->offsets){ args->offsets[myTarget - args->target]= mySource - args->source - 2 +(myData->currentType==ASCII); diff --git a/icu4c/source/common/uscript.c b/icu4c/source/common/uscript.c index 011fbefc8b6..1af3ea7965f 100644 --- a/icu4c/source/common/uscript.c +++ b/icu4c/source/common/uscript.c @@ -68,12 +68,12 @@ static const char* scriptAbbr[]= { "Cans", /* U_UCAS */ "Cher", /* U_CHEROKEE */ "Cyrl", /* U_CYRILLIC */ - /* "Cyrs", /* U_CYRILLIC */ + /* "Cyrs", */ /* U_CYRILLIC */ "Deva", /* U_DEVANAGARI */ "Dsrt", /* U_DESERET */ "Ethi", /* U_ETHIOPIC */ - /* "Geoa", /* U_GEORGIAN */ - /* "Geon", /* U_GEORGIAN */ + /* "Geoa", */ /* U_GEORGIAN */ + /* "Geon", */ /* U_GEORGIAN */ "Geor", /* U_GEORGIAN */ "Goth", /* U_GOTHIC */ "Grek", /* U_GREEK */ @@ -88,9 +88,9 @@ static const char* scriptAbbr[]= { "Khmr", /* U_KHMER */ "Knda", /* U_KANNADA */ "Lao", /* U_LAO */ - /*"Laoo", /* U_LAO */ - /*"Latf", /* U_LATIN */ - /*"Latg", /* U_LATIN */ + /*"Laoo", */ /* U_LAO */ + /*"Latf", */ /* U_LATIN */ + /*"Latg", */ /* U_LATIN */ "Latn", /* U_LATIN */ "Mlym", /* U_MALAYALAM */ "Mong", /* U_MONGOLIAN */ @@ -102,9 +102,9 @@ static const char* scriptAbbr[]= { "Runr", /* U_RUNIC */ "Sinh", /* U_SINHALA */ "Syrc", /* U_SYRIAC */ - /* "Syre", /* U_SYRIAC */ - /* "Syrj", /* U_SYRIAC */ - /* "Syrn", /* U_SYRIAC */ + /* "Syre", */ /* U_SYRIAC */ + /* "Syrj", */ /* U_SYRIAC */ + /* "Syrn", */ /* U_SYRIAC */ "Taml", /* U_TAMIL */ "Telu", /* U_TELUGU */ "Thaa", /* U_THANA */ @@ -313,23 +313,23 @@ findCodeIndex(const UScriptCode unsorted[], const UScriptCode target, int size){ U_CAPI UScriptCode uchar_getScriptCode(const char* nameOrAbbrOrLocale, UErrorCode* err){ UScriptCode code = U_INVALID_SCRIPT_CODE; - int index=0; + int strIndex=0; /* check arguments */ if(U_FAILURE(*err)){ return code; } /* try the Names array first */ - index = findStringIndex(scriptNames, nameOrAbbrOrLocale, U_SCRIPT_NAMES_ARRAY_SIZE); + strIndex = findStringIndex(scriptNames, nameOrAbbrOrLocale, U_SCRIPT_NAMES_ARRAY_SIZE); - if(index>=0 && index < U_SCRIPT_NAMES_ARRAY_SIZE){ - code = (UScriptCode) scriptNameCodes[index]; + if(strIndex>=0 && strIndex < U_SCRIPT_NAMES_ARRAY_SIZE){ + code = (UScriptCode) scriptNameCodes[strIndex]; } /* we did not find in names array so try abbr array*/ if(code ==U_INVALID_SCRIPT_CODE){ - index = findStringIndex(scriptAbbr, nameOrAbbrOrLocale, U_SCRIPT_ABBR_ARRAY_SIZE); - if(index>=0 && index < U_SCRIPT_NAMES_ARRAY_SIZE){ - code = (UScriptCode) scriptAbbrCodes[index]; + strIndex = findStringIndex(scriptAbbr, nameOrAbbrOrLocale, U_SCRIPT_ABBR_ARRAY_SIZE); + if(strIndex>=0 && strIndex < U_SCRIPT_NAMES_ARRAY_SIZE){ + code = (UScriptCode) scriptAbbrCodes[strIndex]; } } /* we still haven't found it try locale */