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
/*
******************************************************************************
@ -8,7 +8,7 @@
*
******************************************************************************
* file name: uspoof_conf.cpp
* encoding: US-ASCII
* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@ -76,6 +76,10 @@ SPUString::~SPUString() {
SPUStringPool::SPUStringPool(UErrorCode &status) : fVec(NULL), fHash(NULL) {
fVec = new UVector(status);
if (fVec == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
fHash = uhash_open(uhash_hashUnicodeString, // key hash function
uhash_compareUnicodeString, // Key Comparator
NULL, // Value Comparator
@ -136,6 +140,10 @@ SPUString *SPUStringPool::addString(UnicodeString *src, UErrorCode &status) {
delete src;
} else {
hashedString = new SPUString(src);
if (hashedString == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uhash_put(fHash, src, hashedString, &status);
fVec->addElement(hashedString, status);
}
@ -160,11 +168,32 @@ ConfusabledataBuilder::ConfusabledataBuilder(SpoofImpl *spImpl, UErrorCode &stat
if (U_FAILURE(status)) {
return;
}
fTable = uhash_open(uhash_hashLong, uhash_compareLong, NULL, &status);
fKeySet = new UnicodeSet();
fKeyVec = new UVector(status);
fValueVec = new UVector(status);
fTable = uhash_open(uhash_hashLong, uhash_compareLong, NULL, &status);
fKeySet = new UnicodeSet();
if (fKeySet == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
fKeyVec = new UVector(status);
if (fKeyVec == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
fValueVec = new UVector(status);
if (fValueVec == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
stringPool = new SPUStringPool(status);
if (stringPool == NULL) {
status = U_MEMORY_ALLOCATION_ERROR;
return;
}
}
@ -396,6 +425,7 @@ void ConfusabledataBuilder::outputData(UErrorCode &status) {
for (i=0; i<numKeys; i++) {
int32_t key = fKeyVec->elementAti(i);
UChar32 codePoint = ConfusableDataUtils::keyToCodePoint(key);
(void)previousCodePoint; // Suppress unused variable warning.
// strictly greater because there can be only one entry per code point
U_ASSERT(codePoint > previousCodePoint);
keys[i] = key;