Issue #1971 - Part 2: Update ICU source to 63.2.

This commit is contained in:
Job Bautista 2022-07-24 21:03:27 +08:00 committed by roytam1
commit 1e69214382
3160 changed files with 275815 additions and 234203 deletions

View file

@ -1,4 +1,4 @@
// Copyright (C) 2016 and later: Unicode, Inc. and others.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@ -367,7 +367,12 @@ static UResourceDataEntry *init_entry(const char *localeID, const char *path, UE
/* this is the actual loading */
res_load(&(r->fData), r->fPath, r->fName, status);
if (U_FAILURE(*status)) {
if (U_FAILURE(*status)) {
/* if we failed to load due to an out-of-memory error, exit early. */
if (*status == U_MEMORY_ALLOCATION_ERROR) {
uprv_free(r);
return NULL;
}
/* we have no such entry in dll, so it will always use fallback */
*status = U_USING_FALLBACK_WARNING;
r->fBogus = U_USING_FALLBACK_WARNING;
@ -537,6 +542,11 @@ loadParentsExceptRoot(UResourceDataEntry *&t1,
UErrorCode usrStatus = U_ZERO_ERROR;
if (usingUSRData) { // This code inserts user override data into the inheritance chain.
u2 = init_entry(name, usrDataPath, &usrStatus);
// If we failed due to out-of-memory, report that to the caller and exit early.
if (usrStatus == U_MEMORY_ALLOCATION_ERROR) {
*status = usrStatus;
return FALSE;
}
}
if (usingUSRData && U_SUCCESS(usrStatus) && u2->fBogus == U_ZERO_ERROR) {
@ -642,21 +652,32 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
/* We're going to skip all the locales that do not have any data */
r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
// If we failed due to out-of-memory, report the failure and exit early.
if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
*status = intStatus;
goto finishUnlock;
}
if(r != NULL) { /* if there is one real locale, we can look for parents. */
t1 = r;
hasRealData = TRUE;
if ( usingUSRData ) { /* This code inserts user override data into the inheritance chain */
UErrorCode usrStatus = U_ZERO_ERROR;
UResourceDataEntry *u1 = init_entry(t1->fName, usrDataPath, &usrStatus);
if ( u1 != NULL ) {
if(u1->fBogus == U_ZERO_ERROR) {
u1->fParent = t1;
r = u1;
} else {
/* the USR override data wasn't found, set it to be deleted */
u1->fCountExisting = 0;
}
}
// If we failed due to out-of-memory, report the failure and exit early.
if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
*status = intStatus;
goto finishUnlock;
}
if ( u1 != NULL ) {
if(u1->fBogus == U_ZERO_ERROR) {
u1->fParent = t1;
r = u1;
} else {
/* the USR override data wasn't found, set it to be deleted */
u1->fCountExisting = 0;
}
}
}
if (hasChopped && !isRoot) {
if (!loadParentsExceptRoot(t1, name, UPRV_LENGTHOF(name), usingUSRData, usrDataPath, status)) {
@ -671,6 +692,11 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
/* insert default locale */
uprv_strcpy(name, uloc_getDefault());
r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
// If we failed due to out-of-memory, report the failure and exit early.
if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
*status = intStatus;
goto finishUnlock;
}
intStatus = U_USING_DEFAULT_WARNING;
if(r != NULL) { /* the default locale exists */
t1 = r;
@ -690,6 +716,11 @@ static UResourceDataEntry *entryOpen(const char* path, const char* localeID,
if(r == NULL) {
uprv_strcpy(name, kRootLocaleName);
r = findFirstExisting(path, name, &isRoot, &hasChopped, &isDefault, &intStatus);
// If we failed due to out-of-memory, report the failure and exit early.
if (intStatus == U_MEMORY_ALLOCATION_ERROR) {
*status = intStatus;
goto finishUnlock;
}
if(r != NULL) {
t1 = r;
intStatus = U_USING_DEFAULT_WARNING;
@ -1083,6 +1114,7 @@ static UResourceBundle *init_resb_result(const ResourceData *rdata, Resource r,
pathBuf = (char *)uprv_malloc((uprv_strlen(keyPath)+1)*sizeof(char));
if(pathBuf == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
ures_close(mainRes);
return NULL;
}
}
@ -2420,7 +2452,7 @@ ures_loc_nextLocale(UEnumeration* en,
UResourceBundle *k = NULL;
const char *result = NULL;
int32_t len = 0;
if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status))) {
if(ures_hasNext(res) && (k = ures_getNextResource(res, &ctx->curr, status)) != 0) {
result = ures_getKey(k);
len = (int32_t)uprv_strlen(result);
}
@ -2842,7 +2874,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
valuesBuf[0]=0;
valuesBuf[1]=0;
while((locale = uenum_next(locs, &locLen, status))) {
while((locale = uenum_next(locs, &locLen, status)) != 0) {
UResourceBundle *bund = NULL;
UResourceBundle *subPtr = NULL;
UErrorCode subStatus = U_ZERO_ERROR; /* don't fail if a bundle is unopenable */
@ -2867,7 +2899,7 @@ ures_getKeywordValues(const char *path, const char *keyword, UErrorCode *status)
continue;
}
while((subPtr = ures_getNextResource(&item,&subItem,&subStatus))
while((subPtr = ures_getNextResource(&item,&subItem,&subStatus)) != 0
&& U_SUCCESS(subStatus)) {
const char *k;
int32_t i;