ICU-1499 If I try to get a string on an int resource, return an error.

X-SVN-Rev: 7598
This commit is contained in:
George Rhoten 2002-02-08 00:52:08 +00:00
parent 9b2bcc3bd0
commit b5ff7eab60

View file

@ -940,13 +940,22 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
if(RES_GET_TYPE(resB->fRes) == RES_TABLE) {
int32_t t=0;
res = res_getTableItemByKey(&(resB->fResData), resB->fRes, &t, &key);
if(res == RES_BOGUS) {
key = inKey;
if(resB->fHasFallback == TRUE) {
const ResourceData *rd = getFallbackData(resB, &key, &realData, &res, status);
if(U_SUCCESS(*status)) {
return res_getString(rd, res, len);
switch (RES_GET_TYPE(res)) {
case RES_STRING:
case RES_TABLE:
case RES_ARRAY:
return res_getString(rd, res, len);
default:
*status = U_RESOURCE_TYPE_MISMATCH;
}
} else {
*status = U_MISSING_RESOURCE_ERROR;
}
@ -954,7 +963,14 @@ U_CAPI const UChar* U_EXPORT2 ures_getStringByKey(const UResourceBundle *resB, c
*status = U_MISSING_RESOURCE_ERROR;
}
} else {
return res_getString(&(resB->fResData), res, len);
switch (RES_GET_TYPE(res)) {
case RES_STRING:
case RES_TABLE:
case RES_ARRAY:
return res_getString(&(resB->fResData), res, len);
default:
*status = U_RESOURCE_TYPE_MISMATCH;
}
}
}
#if 0