ICU-1948 move %%CollationBin under CollationElements table

X-SVN-Rev: 8890
This commit is contained in:
Vladimir Weinstein 2002-06-14 05:59:49 +00:00
parent cd14071b07
commit 9e2dca1c4e
2 changed files with 8 additions and 6 deletions

View File

@ -257,9 +257,8 @@ ucol_open( const char *loc,
UCollator *result = NULL;
UResourceBundle *b = ures_open(NULL, loc, status);
/* first take on tailoring version: */
/* get CollationElements -> Version */
UResourceBundle *binary = ures_getByKey(b, "%%CollationBin", NULL, status);
UResourceBundle *collElem = ures_getByKey(b, "CollationElements", NULL, status);
UResourceBundle *binary = ures_getByKey(collElem, "%%CollationBin", NULL, status);
if(*status == U_MISSING_RESOURCE_ERROR) { /* if we don't find tailoring, we'll fallback to UCA */
*status = U_USING_DEFAULT_ERROR;
@ -298,6 +297,7 @@ ucol_open( const char *loc,
} else { /* There is another error, and we're just gonna clean up */
clean:
ures_close(b);
ures_close(collElem);
ures_close(binary);
return NULL;
}
@ -306,6 +306,7 @@ clean:
}
result->requestedLocale = (char *)uprv_malloc((uprv_strlen(loc)+1)*sizeof(char));
uprv_strcpy(result->requestedLocale, loc);
ures_close(collElem);
return result;
}

View File

@ -631,7 +631,7 @@ static void TestBinaryCollationData(){
if(U_SUCCESS(status)){
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
CONFIRM_INT_EQ(ures_getType(coll), RES_TABLE);
binColl=ures_getByKey(teRes, "%%CollationBin", binColl, &status);
binColl=ures_getByKey(coll, "%%CollationBin", binColl, &status);
if(U_SUCCESS(status)){
CONFIRM_ErrorCode(status, U_ZERO_ERROR);
CONFIRM_INT_EQ(ures_getType(binColl), RES_BINARY);
@ -711,7 +711,8 @@ static void TestAPI() {
log_err("ERROR: ures_getNextResource() failed \n");
}
key=ures_getKey(teFillin);
if(strcmp(key, "%%CollationBin") != 0){
/*if(strcmp(key, "%%CollationBin") != 0){*/
if(strcmp(key, "CollationElements") != 0){
log_err("ERROR: ures_getNextResource() failed\n");
}
@ -910,7 +911,7 @@ static void TestErrorConditions(){
/*Test ures_getBinary(0 status != U_ILLEGAL_ARGUMENT_ERROR*/
status=U_ZERO_ERROR;
coll = ures_getByKey(teRes, "CollationElements", coll, &status);
binColl=ures_getByKey(teRes, "%%CollationBin", binColl, &status);
binColl=ures_getByKey(coll, "%%CollationBin", binColl, &status);
status=U_ILLEGAL_ARGUMENT_ERROR;
binResult=(uint8_t*)ures_getBinary(binColl, &len, &status);