1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Update HarfBuzz, ICU and FreeType

HarfBuzz: Update to version 7.3.0
ICU4C: Update to version 73.1
FreeType: Update to version 2.13.0
This commit is contained in:
bruvzg
2023-05-23 03:05:01 +03:00
parent d5c1b9f883
commit b64df2bf74
810 changed files with 32198 additions and 11081 deletions

View File

@@ -44,7 +44,7 @@ U_CDECL_BEGIN
/*
Static cache for already opened StringPrep profiles
*/
static UHashtable *SHARED_DATA_HASHTABLE = NULL;
static UHashtable *SHARED_DATA_HASHTABLE = nullptr;
static icu::UInitOnce gSharedDataInitOnce {};
static UMutex usprepMutex;
@@ -137,8 +137,8 @@ usprep_unload(UStringPrepProfile* data){
static int32_t
usprep_internal_flushCache(UBool noRefCount){
UStringPrepProfile *profile = NULL;
UStringPrepKey *key = NULL;
UStringPrepProfile *profile = nullptr;
UStringPrepKey *key = nullptr;
int32_t pos = UHASH_FIRST;
int32_t deletedNum = 0;
const UHashElement *e;
@@ -148,32 +148,32 @@ usprep_internal_flushCache(UBool noRefCount){
* return 0
*/
umtx_lock(&usprepMutex);
if (SHARED_DATA_HASHTABLE == NULL) {
if (SHARED_DATA_HASHTABLE == nullptr) {
umtx_unlock(&usprepMutex);
return 0;
}
/*creates an enumeration to iterate through every element in the table */
while ((e = uhash_nextElement(SHARED_DATA_HASHTABLE, &pos)) != NULL)
while ((e = uhash_nextElement(SHARED_DATA_HASHTABLE, &pos)) != nullptr)
{
profile = (UStringPrepProfile *) e->value.pointer;
key = (UStringPrepKey *) e->key.pointer;
if ((noRefCount== false && profile->refCount == 0) ||
noRefCount== true) {
noRefCount) {
deletedNum++;
uhash_removeElement(SHARED_DATA_HASHTABLE, e);
/* unload the data */
usprep_unload(profile);
if(key->name != NULL) {
if(key->name != nullptr) {
uprv_free(key->name);
key->name=NULL;
key->name=nullptr;
}
if(key->path != NULL) {
if(key->path != nullptr) {
uprv_free(key->path);
key->path=NULL;
key->path=nullptr;
}
uprv_free(profile);
uprv_free(key);
@@ -192,16 +192,16 @@ usprep_flushCache(){
}
*/
static UBool U_CALLCONV usprep_cleanup(void){
if (SHARED_DATA_HASHTABLE != NULL) {
static UBool U_CALLCONV usprep_cleanup(){
if (SHARED_DATA_HASHTABLE != nullptr) {
usprep_internal_flushCache(true);
if (SHARED_DATA_HASHTABLE != NULL && uhash_count(SHARED_DATA_HASHTABLE) == 0) {
if (SHARED_DATA_HASHTABLE != nullptr && uhash_count(SHARED_DATA_HASHTABLE) == 0) {
uhash_close(SHARED_DATA_HASHTABLE);
SHARED_DATA_HASHTABLE = NULL;
SHARED_DATA_HASHTABLE = nullptr;
}
}
gSharedDataInitOnce.reset();
return (SHARED_DATA_HASHTABLE == NULL);
return (SHARED_DATA_HASHTABLE == nullptr);
}
U_CDECL_END
@@ -209,9 +209,9 @@ U_CDECL_END
/** Initializes the cache for resources */
static void U_CALLCONV
createCache(UErrorCode &status) {
SHARED_DATA_HASHTABLE = uhash_open(hashEntry, compareEntries, NULL, &status);
SHARED_DATA_HASHTABLE = uhash_open(hashEntry, compareEntries, nullptr, &status);
if (U_FAILURE(status)) {
SHARED_DATA_HASHTABLE = NULL;
SHARED_DATA_HASHTABLE = nullptr;
}
ucln_common_registerCleanup(UCLN_COMMON_USPREP, usprep_cleanup);
}
@@ -230,18 +230,18 @@ loadData(UStringPrepProfile* profile,
/* load Unicode SPREP data from file */
UTrie _sprepTrie={ 0,0,0,0,0,0,0 };
UDataMemory *dataMemory;
const int32_t *p=NULL;
const int32_t *p=nullptr;
const uint8_t *pb;
UVersionInfo normUnicodeVersion;
int32_t normUniVer, sprepUniVer, normCorrVer;
if(errorCode==NULL || U_FAILURE(*errorCode)) {
if(errorCode==nullptr || U_FAILURE(*errorCode)) {
return 0;
}
/* open the data outside the mutex block */
//TODO: change the path
dataMemory=udata_openChoice(path, type, name, isSPrepAcceptable, NULL, errorCode);
dataMemory=udata_openChoice(path, type, name, isSPrepAcceptable, nullptr, errorCode);
if(U_FAILURE(*errorCode)) {
return false;
}
@@ -259,9 +259,9 @@ loadData(UStringPrepProfile* profile,
/* in the mutex block, set the data for this process */
umtx_lock(&usprepMutex);
if(profile->sprepData==NULL) {
if(profile->sprepData==nullptr) {
profile->sprepData=dataMemory;
dataMemory=NULL;
dataMemory=nullptr;
uprv_memcpy(&profile->indexes, p, sizeof(profile->indexes));
uprv_memcpy(&profile->sprepTrie, &_sprepTrie, sizeof(UTrie));
} else {
@@ -293,8 +293,8 @@ loadData(UStringPrepProfile* profile,
profile->isDataLoaded = true;
/* if a different thread set it first, then close the extra data */
if(dataMemory!=NULL) {
udata_close(dataMemory); /* NULL if it was set correctly */
if(dataMemory!=nullptr) {
udata_close(dataMemory); /* nullptr if it was set correctly */
}
@@ -306,12 +306,12 @@ usprep_getProfile(const char* path,
const char* name,
UErrorCode *status){
UStringPrepProfile* profile = NULL;
UStringPrepProfile* profile = nullptr;
initCache(status);
if(U_FAILURE(*status)){
return NULL;
return nullptr;
}
UStringPrepKey stackKey;
@@ -326,22 +326,22 @@ usprep_getProfile(const char* path,
/* fetch the data from the cache */
umtx_lock(&usprepMutex);
profile = (UStringPrepProfile*) (uhash_get(SHARED_DATA_HASHTABLE,&stackKey));
if(profile != NULL) {
if(profile != nullptr) {
profile->refCount++;
}
umtx_unlock(&usprepMutex);
if(profile == NULL) {
if(profile == nullptr) {
/* else load the data and put the data in the cache */
LocalMemory<UStringPrepProfile> newProfile;
if(newProfile.allocateInsteadAndReset() == NULL) {
if(newProfile.allocateInsteadAndReset() == nullptr) {
*status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
return nullptr;
}
/* load the data */
if(!loadData(newProfile.getAlias(), path, name, _SPREP_DATA_TYPE, status) || U_FAILURE(*status) ){
return NULL;
return nullptr;
}
/* get the options */
@@ -351,20 +351,20 @@ usprep_getProfile(const char* path,
LocalMemory<UStringPrepKey> key;
LocalMemory<char> keyName;
LocalMemory<char> keyPath;
if( key.allocateInsteadAndReset() == NULL ||
keyName.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(name)+1)) == NULL ||
(path != NULL &&
keyPath.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(path)+1)) == NULL)
if( key.allocateInsteadAndReset() == nullptr ||
keyName.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(name)+1)) == nullptr ||
(path != nullptr &&
keyPath.allocateInsteadAndCopy(static_cast<int32_t>(uprv_strlen(path)+1)) == nullptr)
) {
*status = U_MEMORY_ALLOCATION_ERROR;
usprep_unload(newProfile.getAlias());
return NULL;
return nullptr;
}
umtx_lock(&usprepMutex);
// If another thread already inserted the same key/value, refcount and cleanup our thread data
profile = (UStringPrepProfile*) (uhash_get(SHARED_DATA_HASHTABLE,&stackKey));
if(profile != NULL) {
if(profile != nullptr) {
profile->refCount++;
usprep_unload(newProfile.getAlias());
}
@@ -372,7 +372,7 @@ usprep_getProfile(const char* path,
/* initialize the key members */
key->name = keyName.orphan();
uprv_strcpy(key->name, name);
if(path != NULL){
if(path != nullptr){
key->path = keyPath.orphan();
uprv_strcpy(key->path, path);
}
@@ -393,8 +393,8 @@ usprep_open(const char* path,
const char* name,
UErrorCode* status){
if(status == NULL || U_FAILURE(*status)){
return NULL;
if(status == nullptr || U_FAILURE(*status)){
return nullptr;
}
/* initialize the profile struct members */
@@ -404,20 +404,20 @@ usprep_open(const char* path,
U_CAPI UStringPrepProfile* U_EXPORT2
usprep_openByType(UStringPrepProfileType type,
UErrorCode* status) {
if(status == NULL || U_FAILURE(*status)){
return NULL;
if(status == nullptr || U_FAILURE(*status)){
return nullptr;
}
int32_t index = (int32_t)type;
if (index < 0 || index >= UPRV_LENGTHOF(PROFILE_NAMES)) {
*status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
return nullptr;
}
return usprep_open(NULL, PROFILE_NAMES[index], status);
return usprep_open(nullptr, PROFILE_NAMES[index], status);
}
U_CAPI void U_EXPORT2
usprep_close(UStringPrepProfile* profile){
if(profile==NULL){
if(profile==nullptr){
return;
}
@@ -431,11 +431,11 @@ usprep_close(UStringPrepProfile* profile){
}
U_CFUNC void
uprv_syntaxError(const UChar* rules,
uprv_syntaxError(const char16_t* rules,
int32_t pos,
int32_t rulesLen,
UParseError* parseError){
if(parseError == NULL){
if(parseError == nullptr){
return;
}
parseError->offset = pos;
@@ -502,11 +502,11 @@ getValues(uint16_t trieWord, int16_t& value, UBool& isIndex){
return type;
}
// TODO: change to writing to UnicodeString not UChar *
// TODO: change to writing to UnicodeString not char16_t *
static int32_t
usprep_map( const UStringPrepProfile* profile,
const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
const char16_t* src, int32_t srcLength,
char16_t* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status ){
@@ -581,7 +581,7 @@ usprep_map( const UStringPrepProfile* profile,
//copy the code point into destination
if(ch <= 0xFFFF){
if(destIndex < destCapacity ){
dest[destIndex] = (UChar)ch;
dest[destIndex] = (char16_t)ch;
}
destIndex++;
}else{
@@ -637,8 +637,8 @@ usprep_map( const UStringPrepProfile* profile,
*/
U_CAPI int32_t U_EXPORT2
usprep_prepare( const UStringPrepProfile* profile,
const UChar* src, int32_t srcLength,
UChar* dest, int32_t destCapacity,
const char16_t* src, int32_t srcLength,
char16_t* dest, int32_t destCapacity,
int32_t options,
UParseError* parseError,
UErrorCode* status ){
@@ -649,9 +649,9 @@ usprep_prepare( const UStringPrepProfile* profile,
}
//check arguments
if(profile==NULL ||
(src==NULL ? srcLength!=0 : srcLength<-1) ||
(dest==NULL ? destCapacity!=0 : destCapacity<0)) {
if(profile==nullptr ||
(src==nullptr ? srcLength!=0 : srcLength<-1) ||
(dest==nullptr ? destCapacity!=0 : destCapacity<0)) {
*status=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
@@ -662,8 +662,8 @@ usprep_prepare( const UStringPrepProfile* profile,
}
// map
UnicodeString s1;
UChar *b1 = s1.getBuffer(srcLength);
if(b1==NULL){
char16_t *b1 = s1.getBuffer(srcLength);
if(b1==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -675,7 +675,7 @@ usprep_prepare( const UStringPrepProfile* profile,
// redo processing of string
/* we do not have enough room so grow the buffer*/
b1 = s1.getBuffer(b1Len);
if(b1==NULL){
if(b1==nullptr){
*status = U_MEMORY_ALLOCATION_ERROR;
return 0;
}
@@ -706,7 +706,7 @@ usprep_prepare( const UStringPrepProfile* profile,
}
// Prohibit and checkBiDi in one pass
const UChar *b2 = s2.getBuffer();
const char16_t *b2 = s2.getBuffer();
int32_t b2Len = s2.length();
UCharDirection direction=U_CHAR_DIRECTION_COUNT, firstCharDir=U_CHAR_DIRECTION_COUNT;
UBool leftToRight=false, rightToLeft=false;
@@ -746,16 +746,16 @@ usprep_prepare( const UStringPrepProfile* profile,
}
}
}
if(profile->checkBiDi == true){
if(profile->checkBiDi){
// satisfy 2
if( leftToRight == true && rightToLeft == true){
if( leftToRight && rightToLeft){
*status = U_STRINGPREP_CHECK_BIDI_ERROR;
uprv_syntaxError(b2,(rtlPos>ltrPos) ? rtlPos : ltrPos, b2Len, parseError);
return 0;
}
//satisfy 3
if( rightToLeft == true &&
if( rightToLeft &&
!((firstCharDir == U_RIGHT_TO_LEFT || firstCharDir == U_RIGHT_TO_LEFT_ARABIC) &&
(direction == U_RIGHT_TO_LEFT || direction == U_RIGHT_TO_LEFT_ARABIC))
){
@@ -787,7 +787,7 @@ usprep_swap(const UDataSwapper *ds,
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
if(pErrorCode==nullptr || U_FAILURE(*pErrorCode)) {
return 0;
}
@@ -809,7 +809,7 @@ usprep_swap(const UDataSwapper *ds,
}
inBytes=(const uint8_t *)inData+headerSize;
outBytes=(uint8_t *)outData+headerSize;
outBytes= (outData == nullptr ) ? nullptr : (uint8_t *)outData+headerSize;
inIndexes=(const int32_t *)inBytes;