ICU-9139 UCONFIG_NO_CONVERSION=1 bug fix
X-SVN-Rev: 31561
This commit is contained in:
parent
66325c9f16
commit
1c360497c7
@ -221,7 +221,6 @@ DateIntervalInfo::initializeData(const Locale& locale, UErrorCode& err)
|
||||
}
|
||||
const char *locName = locale.getName();
|
||||
char parentLocale[ULOC_FULLNAME_CAPACITY];
|
||||
int32_t locNameLen;
|
||||
uprv_strcpy(parentLocale, locName);
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
Hashtable skeletonSet(FALSE, status);
|
||||
@ -335,19 +334,20 @@ DateIntervalInfo::initializeData(const Locale& locale, UErrorCode& err)
|
||||
// Find the name of the appropriate parent locale (from %%Parent if present, else
|
||||
// uloc_getParent on the actual locale name)
|
||||
// (It would be nice to have a ures function that did this...)
|
||||
int32_t locNameLen;
|
||||
const UChar * parentUName = ures_getStringByKey(rb, "%%Parent", &locNameLen, &status);
|
||||
if (U_SUCCESS(status) && status != U_USING_FALLBACK_WARNING) {
|
||||
u_austrncpy(parentLocale, parentUName, ULOC_FULLNAME_CAPACITY); // Should work on EBCDIC too?
|
||||
if (U_SUCCESS(status) && status != U_USING_FALLBACK_WARNING && locNameLen < ULOC_FULLNAME_CAPACITY) {
|
||||
u_UCharsToChars(parentUName, parentLocale, locNameLen + 1);
|
||||
} else {
|
||||
status = U_ZERO_ERROR;
|
||||
// Get the actual name of the current locale being used
|
||||
const char *curLocaleName=ures_getLocaleByType(rb, ULOC_ACTUAL_LOCALE, &status);
|
||||
if ( U_FAILURE(status) ) {
|
||||
curLocaleName = parentLocale;
|
||||
status = U_ZERO_ERROR;
|
||||
}
|
||||
locNameLen = uloc_getParent(curLocaleName, parentLocale, ULOC_FULLNAME_CAPACITY, &status);
|
||||
// Get the actual name of the current locale being used
|
||||
const char *curLocaleName=ures_getLocaleByType(rb, ULOC_ACTUAL_LOCALE, &status);
|
||||
if ( U_FAILURE(status) ) {
|
||||
curLocaleName = parentLocale;
|
||||
status = U_ZERO_ERROR;
|
||||
}
|
||||
uloc_getParent(curLocaleName, parentLocale, ULOC_FULLNAME_CAPACITY, &status);
|
||||
if (U_FAILURE(err) || err == U_STRING_NOT_TERMINATED_WARNING) {
|
||||
parentLocale[0] = 0; // just fallback to root, will cause us to stop
|
||||
status = U_ZERO_ERROR;
|
||||
}
|
||||
|
@ -608,7 +608,6 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale, UErrorCode& err) {
|
||||
|
||||
// add available formats
|
||||
UBool firstTimeThrough = TRUE;
|
||||
char parentLocale[ULOC_FULLNAME_CAPACITY];
|
||||
err = U_ZERO_ERROR;
|
||||
initHashtable(err);
|
||||
while (TRUE) {
|
||||
@ -663,14 +662,15 @@ DateTimePatternGenerator::addCLDRData(const Locale& locale, UErrorCode& err) {
|
||||
// uloc_getParent on the actual locale name)
|
||||
// (It would be nice to have a ures function that did this...)
|
||||
err = U_ZERO_ERROR;
|
||||
char parentLocale[ULOC_FULLNAME_CAPACITY];
|
||||
int32_t locNameLen;
|
||||
const UChar * parentUName = ures_getStringByKey(rb, "%%Parent", &locNameLen, &err);
|
||||
if (U_SUCCESS(err) && err != U_USING_FALLBACK_WARNING) {
|
||||
u_austrncpy(parentLocale, parentUName, ULOC_FULLNAME_CAPACITY); // Should work on EBCDIC too?
|
||||
if (U_SUCCESS(err) && err != U_USING_FALLBACK_WARNING && locNameLen < ULOC_FULLNAME_CAPACITY) {
|
||||
u_UCharsToChars(parentUName, parentLocale, locNameLen + 1);
|
||||
} else {
|
||||
err = U_ZERO_ERROR;
|
||||
locNameLen = uloc_getParent(curLocaleName, parentLocale, ULOC_FULLNAME_CAPACITY, &err);
|
||||
if ( U_FAILURE(err) ) {
|
||||
uloc_getParent(curLocaleName, parentLocale, ULOC_FULLNAME_CAPACITY, &err);
|
||||
if (U_FAILURE(err) || err == U_STRING_NOT_TERMINATED_WARNING) {
|
||||
// just fallback to root, since we are not already there
|
||||
parentLocale[0] = 0;
|
||||
err = U_ZERO_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user