You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +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:
54
thirdparty/icu4c/common/locutil.cpp
vendored
54
thirdparty/icu4c/common/locutil.cpp
vendored
@@ -22,11 +22,11 @@
|
||||
|
||||
// see LocaleUtility::getAvailableLocaleNames
|
||||
static icu::UInitOnce LocaleUtilityInitOnce {};
|
||||
static icu::Hashtable * LocaleUtility_cache = NULL;
|
||||
static icu::Hashtable * LocaleUtility_cache = nullptr;
|
||||
|
||||
#define UNDERSCORE_CHAR ((UChar)0x005f)
|
||||
#define AT_SIGN_CHAR ((UChar)64)
|
||||
#define PERIOD_CHAR ((UChar)46)
|
||||
#define UNDERSCORE_CHAR ((char16_t)0x005f)
|
||||
#define AT_SIGN_CHAR ((char16_t)64)
|
||||
#define PERIOD_CHAR ((char16_t)46)
|
||||
|
||||
/*
|
||||
******************************************************************
|
||||
@@ -36,10 +36,10 @@ static icu::Hashtable * LocaleUtility_cache = NULL;
|
||||
* Release all static memory held by Locale Utility.
|
||||
*/
|
||||
U_CDECL_BEGIN
|
||||
static UBool U_CALLCONV service_cleanup(void) {
|
||||
static UBool U_CALLCONV service_cleanup() {
|
||||
if (LocaleUtility_cache) {
|
||||
delete LocaleUtility_cache;
|
||||
LocaleUtility_cache = NULL;
|
||||
LocaleUtility_cache = nullptr;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -47,15 +47,15 @@ static UBool U_CALLCONV service_cleanup(void) {
|
||||
|
||||
static void U_CALLCONV locale_utility_init(UErrorCode &status) {
|
||||
using namespace icu;
|
||||
U_ASSERT(LocaleUtility_cache == NULL);
|
||||
U_ASSERT(LocaleUtility_cache == nullptr);
|
||||
ucln_common_registerCleanup(UCLN_COMMON_SERVICE, service_cleanup);
|
||||
LocaleUtility_cache = new Hashtable(status);
|
||||
if (U_FAILURE(status)) {
|
||||
delete LocaleUtility_cache;
|
||||
LocaleUtility_cache = NULL;
|
||||
LocaleUtility_cache = nullptr;
|
||||
return;
|
||||
}
|
||||
if (LocaleUtility_cache == NULL) {
|
||||
if (LocaleUtility_cache == nullptr) {
|
||||
status = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ U_NAMESPACE_BEGIN
|
||||
UnicodeString&
|
||||
LocaleUtility::canonicalLocaleString(const UnicodeString* id, UnicodeString& result)
|
||||
{
|
||||
if (id == NULL) {
|
||||
if (id == nullptr) {
|
||||
result.setToBogus();
|
||||
} else {
|
||||
// Fix case only (no other changes) up to the first '@' or '.' or
|
||||
@@ -94,14 +94,14 @@ LocaleUtility::canonicalLocaleString(const UnicodeString* id, UnicodeString& res
|
||||
n = end;
|
||||
}
|
||||
for (; i < n; ++i) {
|
||||
UChar c = result.charAt(i);
|
||||
char16_t c = result.charAt(i);
|
||||
if (c >= 0x0041 && c <= 0x005a) {
|
||||
c += 0x20;
|
||||
result.setCharAt(i, c);
|
||||
}
|
||||
}
|
||||
for (n = end; i < n; ++i) {
|
||||
UChar c = result.charAt(i);
|
||||
char16_t c = result.charAt(i);
|
||||
if (c >= 0x0061 && c <= 0x007a) {
|
||||
c -= 0x20;
|
||||
result.setCharAt(i, c);
|
||||
@@ -112,7 +112,7 @@ LocaleUtility::canonicalLocaleString(const UnicodeString* id, UnicodeString& res
|
||||
|
||||
#if 0
|
||||
// This code does a proper full level 2 canonicalization of id.
|
||||
// It's nasty to go from UChar to char to char to UChar -- but
|
||||
// It's nasty to go from char16_t to char to char to char16_t -- but
|
||||
// that's what you have to do to use the uloc_canonicalize
|
||||
// function on UnicodeStrings.
|
||||
|
||||
@@ -172,7 +172,7 @@ LocaleUtility::initLocaleFromName(const UnicodeString& id, Locale& result)
|
||||
int32_t prev, i;
|
||||
prev = 0;
|
||||
for(;;) {
|
||||
i = id.indexOf((UChar)0x40, prev);
|
||||
i = id.indexOf((char16_t)0x40, prev);
|
||||
if(i < 0) {
|
||||
// no @ between prev and the rest of the string
|
||||
id.extract(prev, INT32_MAX, buffer + prev, BUFLEN - prev, US_INV);
|
||||
@@ -214,45 +214,45 @@ LocaleUtility::getAvailableLocaleNames(const UnicodeString& bundleID)
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
umtx_initOnce(LocaleUtilityInitOnce, locale_utility_init, status);
|
||||
Hashtable *cache = LocaleUtility_cache;
|
||||
if (cache == NULL) {
|
||||
if (cache == nullptr) {
|
||||
// Catastrophic failure.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Hashtable* htp;
|
||||
umtx_lock(NULL);
|
||||
umtx_lock(nullptr);
|
||||
htp = (Hashtable*) cache->get(bundleID);
|
||||
umtx_unlock(NULL);
|
||||
umtx_unlock(nullptr);
|
||||
|
||||
if (htp == NULL) {
|
||||
if (htp == nullptr) {
|
||||
htp = new Hashtable(status);
|
||||
if (htp && U_SUCCESS(status)) {
|
||||
CharString cbundleID;
|
||||
cbundleID.appendInvariantChars(bundleID, status);
|
||||
const char* path = cbundleID.isEmpty() ? NULL : cbundleID.data();
|
||||
const char* path = cbundleID.isEmpty() ? nullptr : cbundleID.data();
|
||||
icu::LocalUEnumerationPointer uenum(ures_openAvailableLocales(path, &status));
|
||||
for (;;) {
|
||||
const UChar* id = uenum_unext(uenum.getAlias(), NULL, &status);
|
||||
if (id == NULL) {
|
||||
const char16_t* id = uenum_unext(uenum.getAlias(), nullptr, &status);
|
||||
if (id == nullptr) {
|
||||
break;
|
||||
}
|
||||
htp->put(UnicodeString(id), (void*)htp, status);
|
||||
}
|
||||
if (U_FAILURE(status)) {
|
||||
delete htp;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
umtx_lock(NULL);
|
||||
umtx_lock(nullptr);
|
||||
Hashtable *t = static_cast<Hashtable *>(cache->get(bundleID));
|
||||
if (t != NULL) {
|
||||
if (t != nullptr) {
|
||||
// Another thread raced through this code, creating the cache entry first.
|
||||
// Discard ours and return theirs.
|
||||
umtx_unlock(NULL);
|
||||
umtx_unlock(nullptr);
|
||||
delete htp;
|
||||
htp = t;
|
||||
} else {
|
||||
cache->put(bundleID, (void*)htp, status);
|
||||
umtx_unlock(NULL);
|
||||
umtx_unlock(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user