ICU-9669 ures_getStringByKeyWithFallback() to work correctly when returning UChar* with embedded nulls.

X-SVN-Rev: 32889
This commit is contained in:
Travis Keep 2012-11-26 21:06:37 +00:00
parent 29e8c542e3
commit 02197c648e

View File

@ -1670,13 +1670,20 @@ ures_getStringByKeyWithFallback(const UResourceBundle *resB,
const UChar* retVal = NULL;
ures_initStackObject(&stack);
ures_getByKeyWithFallback(resB, inKey, &stack, status);
retVal = ures_getString(&stack, len, status);
int32_t length;
retVal = ures_getString(&stack, &length, status);
ures_close(&stack);
if ( retVal != NULL && u_strlen(retVal) == 3 && retVal[0] == EMPTY_SET && retVal[1] == EMPTY_SET && retVal[2] == EMPTY_SET ) {
if (U_FAILURE(*status)) {
return NULL;
}
if (length == 3 && retVal[0] == EMPTY_SET && retVal[1] == EMPTY_SET && retVal[2] == EMPTY_SET ) {
retVal = NULL;
*len = 0;
length = 0;
*status = U_MISSING_RESOURCE_ERROR;
}
if (len != NULL) {
*len = length;
}
return retVal;
}