ICU-11389 more reversion

X-SVN-Rev: 36766
This commit is contained in:
Steven R. Loomis 2014-11-20 05:20:36 +00:00
parent 0cb2ffd0bf
commit eb262cc17c

View file

@ -132,23 +132,22 @@ void Region::loadRegionData(UErrorCode &status) {
while ( ures_hasNext(regionCodes.getAlias()) ) {
UnicodeString regionID = ures_getNextUnicodeString(regionCodes.getAlias(), NULL, &status);
LocalPointer<Region> r(new Region, status);
if(U_FAILURE(status)) return;
Region *r = new Region();
r->idStr = regionID;
r->idStr.extract(0,r->idStr.length(),r->id,sizeof(r->id),US_INV);
r->type = URGN_TERRITORY; // Only temporary - figure out the real type later once the aliases are known.
uhash_put(regionIDMap,(void *)&(r->idStr),(void *)r,&status);
Formattable result;
UErrorCode ps = U_ZERO_ERROR;
df->parse(r->idStr,result,ps);
if ( U_SUCCESS(ps) ) {
r->code = result.getLong(); // Convert string to number
uhash_iput(numericCodeMap,r->code,(void *)r.getAlias(),&status);
uhash_iput(numericCodeMap,r->code,(void *)r,&status);
r->type = URGN_SUBCONTINENT;
} else {
r->code = -1;
}
uhash_put(regionIDMap,(void *)&(r->idStr),(void *)r.orphan(),&status);
}
@ -168,12 +167,6 @@ void Region::loadRegionData(UErrorCode &status) {
} else {
if ( aliasFromRegion == NULL ) { // Deprecated region code not in the master codes list - so need to create a deprecated region for it.
aliasFromRegion = new Region();
if ( aliasFromRegion == NULL ) {
if ( U_SUCCESS(status) ) {
status = U_MEMORY_ALLOCATION_ERROR;
}
return;
}
aliasFromRegion->idStr.setTo(*aliasFromStr);
aliasFromRegion->idStr.extract(0,aliasFromRegion->idStr.length(),aliasFromRegion->id,sizeof(aliasFromRegion->id),US_INV);
uhash_put(regionIDMap,(void *)&(aliasFromRegion->idStr),(void *)aliasFromRegion,&status);