ICU-2091 do not propagate local error codes - a "script not found" condition must not result in a "file not found" error
X-SVN-Rev: 9656
This commit is contained in:
parent
190aa6f5de
commit
39b343fc08
@ -346,17 +346,20 @@ UnicodeSet* UnicodePropertySet::createFromPattern(const UnicodeString& pattern,
|
||||
// No equals seen; parse short format \p{Cf}
|
||||
UnicodeString shortName = munge(pattern, pos, close);
|
||||
|
||||
// Do not propagate error codes from just not finding the name.
|
||||
UErrorCode localErrorCode = U_ZERO_ERROR;
|
||||
|
||||
// First try general category
|
||||
set = createCategorySet(shortName, status);
|
||||
set = createCategorySet(shortName, localErrorCode);
|
||||
|
||||
// If this fails, try script
|
||||
if (set == NULL && U_SUCCESS(status)) {
|
||||
set = createScriptSet(shortName, status);
|
||||
if (set == NULL) {
|
||||
set = createScriptSet(shortName, localErrorCode);
|
||||
}
|
||||
|
||||
// If this fails, try binary property
|
||||
if (set == NULL && U_SUCCESS(status)) {
|
||||
set = createBinaryPropertySet(shortName, status);
|
||||
if (set == NULL) {
|
||||
set = createBinaryPropertySet(shortName, localErrorCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -214,15 +214,17 @@ uscript_getCode(const char* nameOrAbbrOrLocale,
|
||||
|
||||
/* we still haven't found it try locale */
|
||||
if(code==USCRIPT_INVALID_CODE){
|
||||
UResourceBundle* resB = ures_open(u_getDataDirectory(),nameOrAbbrOrLocale,err);
|
||||
if(U_SUCCESS(*err)&& *err != U_USING_DEFAULT_ERROR){
|
||||
UResourceBundle* resD = ures_getByKey(resB,kLocaleScript,NULL,err);
|
||||
/* Do not propagate error codes from just not finding a locale bundle. */
|
||||
UErrorCode localErrorCode = U_ZERO_ERROR;
|
||||
UResourceBundle* resB = ures_open(u_getDataDirectory(),nameOrAbbrOrLocale,&localErrorCode);
|
||||
if(U_SUCCESS(localErrorCode)&& localErrorCode != U_USING_DEFAULT_ERROR){
|
||||
UResourceBundle* resD = ures_getByKey(resB,kLocaleScript,NULL,&localErrorCode);
|
||||
int index =0;
|
||||
if(U_SUCCESS(*err) ){
|
||||
if(U_SUCCESS(localErrorCode) ){
|
||||
len =0;
|
||||
while(ures_hasNext(resD)){
|
||||
const UChar* name = ures_getNextString(resD,&len,NULL,err);
|
||||
if(U_SUCCESS(*err)){
|
||||
const UChar* name = ures_getNextString(resD,&len,NULL,&localErrorCode);
|
||||
if(U_SUCCESS(localErrorCode)){
|
||||
char cName[50] = {'\0'};
|
||||
u_UCharsToChars(name,cName,len);
|
||||
index = findStringIndex(scriptAbbr, cName, ARRAY_SIZE(scriptAbbr));
|
||||
|
Loading…
Reference in New Issue
Block a user