From 96ce0be9de3597e8c23629b959366ccfd7c1c23b Mon Sep 17 00:00:00 2001 From: Ram Viswanadha Date: Thu, 2 Aug 2001 16:44:21 +0000 Subject: [PATCH] ICU-899 Change U_INVALID_CODE to U_INVALID_SCRIPT_CODE and fix testing for error code X-SVN-Rev: 5422 --- icu4c/source/common/unicode/uscript.h | 2 +- icu4c/source/common/uscript.c | 12 ++++++------ icu4c/source/test/cintltst/cucdtst.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/icu4c/source/common/unicode/uscript.h b/icu4c/source/common/unicode/uscript.h index bd63325cf83..3831a74f6aa 100644 --- a/icu4c/source/common/unicode/uscript.h +++ b/icu4c/source/common/unicode/uscript.h @@ -20,7 +20,7 @@ #include "cstring.h" typedef enum UScriptCode { - U_INVALID_CODE = -1, + U_INVALID_SCRIPT_CODE = -1, U_COMMON = 0 , /* Zyyy */ U_INHERITED = 1, /* Qaai */ U_ARABIC = 2, /* Arab */ diff --git a/icu4c/source/common/uscript.c b/icu4c/source/common/uscript.c index ea480ae3da3..011fbefc8b6 100644 --- a/icu4c/source/common/uscript.c +++ b/icu4c/source/common/uscript.c @@ -312,7 +312,7 @@ findCodeIndex(const UScriptCode unsorted[], const UScriptCode target, int size){ U_CAPI UScriptCode uchar_getScriptCode(const char* nameOrAbbrOrLocale, UErrorCode* err){ - UScriptCode code = U_INVALID_CODE; + UScriptCode code = U_INVALID_SCRIPT_CODE; int index=0; /* check arguments */ @@ -326,21 +326,21 @@ uchar_getScriptCode(const char* nameOrAbbrOrLocale, UErrorCode* err){ code = (UScriptCode) scriptNameCodes[index]; } /* we did not find in names array so try abbr array*/ - if(code ==U_INVALID_CODE){ + 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]; } } /* we still haven't found it try locale */ - if(code==U_INVALID_CODE){ + if(code==U_INVALID_SCRIPT_CODE){ UResourceBundle* resB = ures_open(u_getDataDirectory(),nameOrAbbrOrLocale,err); - if(*err==U_ZERO_ERROR){ + if(U_SUCCESS(*err)&& *err != U_USING_DEFAULT_ERROR){ int32_t len=0; UResourceBundle* resD = ures_getByKey(resB,"LocaleScript",NULL,err); int index =0; const UChar* name = ures_getStringByIndex(resD,0,&len,err); - if(U_SUCCESS(*err)){ + if(U_SUCCESS(*err) ){ char cName[50] = {'\0'}; u_UCharsToChars(name,cName,len); index = findStringIndex(scriptNames, cName, U_SCRIPT_NAMES_ARRAY_SIZE); @@ -387,6 +387,6 @@ uchar_scriptCodeName(UScriptCode code){ if(code>=0 && code