1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +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

@@ -25,7 +25,7 @@ U_NAMESPACE_BEGIN
******************************************************************
*/
const UChar ICUServiceKey::PREFIX_DELIMITER = 0x002F; /* '/' */
const char16_t ICUServiceKey::PREFIX_DELIMITER = 0x002F; /* '/' */
ICUServiceKey::ICUServiceKey(const UnicodeString& id)
: _id(id) {
@@ -144,7 +144,7 @@ SimpleFactory::create(const ICUServiceKey& key, const ICUService* service, UErro
return service->cloneInstance(_instance);
}
}
return NULL;
return nullptr;
}
void
@@ -243,7 +243,7 @@ public:
CacheEntry* unref() {
if ((--refcount) == 0) {
delete this;
return NULL;
return nullptr;
}
return this;
}
@@ -294,14 +294,14 @@ StringPair::create(const UnicodeString& displayName,
{
if (U_SUCCESS(status)) {
StringPair* sp = new StringPair(displayName, id);
if (sp == NULL || sp->isBogus()) {
if (sp == nullptr || sp->isBogus()) {
status = U_MEMORY_ALLOCATION_ERROR;
delete sp;
return NULL;
return nullptr;
}
return sp;
}
return NULL;
return nullptr;
}
UBool
@@ -332,20 +332,20 @@ static UMutex lock;
ICUService::ICUService()
: name()
, timestamp(0)
, factories(NULL)
, serviceCache(NULL)
, idCache(NULL)
, dnCache(NULL)
, factories(nullptr)
, serviceCache(nullptr)
, idCache(nullptr)
, dnCache(nullptr)
{
}
ICUService::ICUService(const UnicodeString& newName)
: name(newName)
, timestamp(0)
, factories(NULL)
, serviceCache(NULL)
, idCache(NULL)
, dnCache(NULL)
, factories(nullptr)
, serviceCache(nullptr)
, idCache(nullptr)
, dnCache(nullptr)
{
}
@@ -355,20 +355,20 @@ ICUService::~ICUService()
Mutex mutex(&lock);
clearCaches();
delete factories;
factories = NULL;
factories = nullptr;
}
}
UObject*
ICUService::get(const UnicodeString& descriptor, UErrorCode& status) const
{
return get(descriptor, NULL, status);
return get(descriptor, nullptr, status);
}
UObject*
ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UErrorCode& status) const
{
UObject* result = NULL;
UObject* result = nullptr;
ICUServiceKey* key = createKey(&descriptor, status);
if (key) {
result = getKey(*key, actualReturn, status);
@@ -380,7 +380,7 @@ ICUService::get(const UnicodeString& descriptor, UnicodeString* actualReturn, UE
UObject*
ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const
{
return getKey(key, NULL, status);
return getKey(key, nullptr, status);
}
// this is a vector that subclasses of ICUService can override to further customize the result object
@@ -389,7 +389,7 @@ ICUService::getKey(ICUServiceKey& key, UErrorCode& status) const
UObject*
ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, UErrorCode& status) const
{
return getKey(key, actualReturn, NULL, status);
return getKey(key, actualReturn, nullptr, status);
}
// make it possible to call reentrantly on systems that don't have reentrant mutexes.
@@ -417,7 +417,7 @@ UObject*
ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUServiceFactory* factory, UErrorCode& status) const
{
if (U_FAILURE(status)) {
return NULL;
return nullptr;
}
if (isDefault()) {
@@ -426,7 +426,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
ICUService* ncthis = (ICUService*)this; // cast away semantic const
CacheEntry* result = NULL;
CacheEntry* result = nullptr;
{
// The factory list can't be modified until we're done,
// otherwise we might update the cache with an invalid result.
@@ -437,17 +437,17 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
// if factory is not null, we're calling from within the mutex,
// and since some unix machines don't have reentrant mutexes we
// need to make sure not to try to lock it again.
XMutex mutex(&lock, factory != NULL);
XMutex mutex(&lock, factory != nullptr);
if (serviceCache == NULL) {
if (serviceCache == nullptr) {
ncthis->serviceCache = new Hashtable(status);
if (ncthis->serviceCache == NULL) {
if (ncthis->serviceCache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
return nullptr;
}
if (U_FAILURE(status)) {
delete serviceCache;
return NULL;
return nullptr;
}
serviceCache->setValueDeleter(cacheDeleter);
}
@@ -460,7 +460,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
int32_t limit = factories->size();
UBool cacheResult = true;
if (factory != NULL) {
if (factory != nullptr) {
for (int32_t i = 0; i < limit; ++i) {
if (factory == (const ICUServiceFactory*)factories->elementAt(i)) {
startIndex = i + 1;
@@ -470,7 +470,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
if (startIndex == 0) {
// throw new InternalError("Factory " + factory + "not registered with service: " + this);
status = U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
return nullptr;
}
cacheResult = false;
}
@@ -479,7 +479,7 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
currentDescriptor.remove();
key.currentDescriptor(currentDescriptor);
result = (CacheEntry*)serviceCache->get(currentDescriptor);
if (result != NULL) {
if (result != nullptr) {
break;
}
@@ -493,13 +493,13 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
ICUServiceFactory* f = (ICUServiceFactory*)factories->elementAt(index++);
LocalPointer<UObject> service(f->create(key, this, status));
if (U_FAILURE(status)) {
return NULL;
return nullptr;
}
if (service.isValid()) {
result = new CacheEntry(currentDescriptor, service.getAlias());
if (result == NULL) {
if (result == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
return nullptr;
}
service.orphan(); // result now owns service.
@@ -513,32 +513,32 @@ ICUService::getKey(ICUServiceKey& key, UnicodeString* actualReturn, const ICUSer
// fallback to the one that succeeded, we want to hit the
// cache the first time next goaround.
if (cacheDescriptorList.isNull()) {
cacheDescriptorList.adoptInsteadAndCheckErrorCode(new UVector(uprv_deleteUObject, NULL, 5, status), status);
cacheDescriptorList.adoptInsteadAndCheckErrorCode(new UVector(uprv_deleteUObject, nullptr, 5, status), status);
if (U_FAILURE(status)) {
return NULL;
return nullptr;
}
}
LocalPointer<UnicodeString> idToCache(new UnicodeString(currentDescriptor), status);
if (U_FAILURE(status)) {
return NULL;
return nullptr;
}
if (idToCache->isBogus()) {
status = U_MEMORY_ALLOCATION_ERROR;
return NULL;
return nullptr;
}
cacheDescriptorList->adoptElement(idToCache.orphan(), status);
if (U_FAILURE(status)) {
return NULL;
return nullptr;
}
} while (key.fallback());
outerEnd:
if (result != NULL) {
if (result != nullptr) {
if (putInCache && cacheResult) {
serviceCache->put(result->actualDescriptor, result, status);
if (U_FAILURE(status)) {
return NULL;
return nullptr;
}
if (cacheDescriptorList.isValid()) {
@@ -547,7 +547,7 @@ outerEnd:
serviceCache->put(*desc, result, status);
if (U_FAILURE(status)) {
return NULL;
return nullptr;
}
result->ref();
@@ -556,9 +556,9 @@ outerEnd:
}
}
if (actualReturn != NULL) {
if (actualReturn != nullptr) {
// strip null prefix
if (result->actualDescriptor.indexOf((UChar)0x2f) == 0) { // U+002f=slash (/)
if (result->actualDescriptor.indexOf((char16_t)0x2f) == 0) { // U+002f=slash (/)
actualReturn->remove();
actualReturn->append(result->actualDescriptor,
1,
@@ -570,7 +570,7 @@ outerEnd:
if (actualReturn->isBogus()) {
status = U_MEMORY_ALLOCATION_ERROR;
delete result;
return NULL;
return nullptr;
}
}
@@ -588,12 +588,12 @@ outerEnd:
UObject*
ICUService::handleDefault(const ICUServiceKey& /* key */, UnicodeString* /* actualIDReturn */, UErrorCode& /* status */) const
{
return NULL;
return nullptr;
}
UVector&
ICUService::getVisibleIDs(UVector& result, UErrorCode& status) const {
return getVisibleIDs(result, NULL, status);
return getVisibleIDs(result, nullptr, status);
}
UVector&
@@ -609,17 +609,17 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
{
Mutex mutex(&lock);
const Hashtable* map = getVisibleIDMap(status);
if (map != NULL) {
if (map != nullptr) {
ICUServiceKey* fallbackKey = createKey(matchID, status);
for (int32_t pos = UHASH_FIRST; U_SUCCESS(status); ) {
const UHashElement* e = map->nextElement(pos);
if (e == NULL) {
if (e == nullptr) {
break;
}
const UnicodeString* id = (const UnicodeString*)e->key.pointer;
if (fallbackKey != NULL) {
if (fallbackKey != nullptr) {
if (!fallbackKey->isFallbackOf(*id)) {
continue;
}
@@ -640,23 +640,23 @@ ICUService::getVisibleIDs(UVector& result, const UnicodeString* matchID, UErrorC
const Hashtable*
ICUService::getVisibleIDMap(UErrorCode& status) const {
if (U_FAILURE(status)) return NULL;
if (U_FAILURE(status)) return nullptr;
// must only be called when lock is already held
ICUService* ncthis = (ICUService*)this; // cast away semantic const
if (idCache == NULL) {
if (idCache == nullptr) {
ncthis->idCache = new Hashtable(status);
if (idCache == NULL) {
if (idCache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
} else if (factories != NULL) {
} else if (factories != nullptr) {
for (int32_t pos = factories->size(); --pos >= 0;) {
ICUServiceFactory* f = (ICUServiceFactory*)factories->elementAt(pos);
f->updateVisibleIDs(*idCache, status);
}
if (U_FAILURE(status)) {
delete idCache;
ncthis->idCache = NULL;
ncthis->idCache = nullptr;
}
}
}
@@ -678,9 +678,9 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
UErrorCode status = U_ZERO_ERROR;
Mutex mutex(&lock);
const Hashtable* map = getVisibleIDMap(status);
if (map != NULL) {
if (map != nullptr) {
ICUServiceFactory* f = (ICUServiceFactory*)map->get(id);
if (f != NULL) {
if (f != nullptr) {
f->getDisplayName(id, locale, result);
return result;
}
@@ -688,11 +688,11 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
// fallback
status = U_ZERO_ERROR;
ICUServiceKey* fallbackKey = createKey(&id, status);
while (fallbackKey != NULL && fallbackKey->fallback()) {
while (fallbackKey != nullptr && fallbackKey->fallback()) {
UnicodeString us;
fallbackKey->currentID(us);
f = (ICUServiceFactory*)map->get(us);
if (f != NULL) {
if (f != nullptr) {
f->getDisplayName(id, locale, result);
delete fallbackKey;
return result;
@@ -708,14 +708,14 @@ ICUService::getDisplayName(const UnicodeString& id, UnicodeString& result, const
UVector&
ICUService::getDisplayNames(UVector& result, UErrorCode& status) const
{
return getDisplayNames(result, Locale::getDefault(), NULL, status);
return getDisplayNames(result, Locale::getDefault(), nullptr, status);
}
UVector&
ICUService::getDisplayNames(UVector& result, const Locale& locale, UErrorCode& status) const
{
return getDisplayNames(result, locale, NULL, status);
return getDisplayNames(result, locale, nullptr, status);
}
UVector&
@@ -730,25 +730,25 @@ ICUService::getDisplayNames(UVector& result,
ICUService* ncthis = (ICUService*)this; // cast away semantic const
Mutex mutex(&lock);
if (dnCache != NULL && dnCache->locale != locale) {
if (dnCache != nullptr && dnCache->locale != locale) {
delete dnCache;
ncthis->dnCache = NULL;
ncthis->dnCache = nullptr;
}
if (dnCache == NULL) {
if (dnCache == nullptr) {
const Hashtable* m = getVisibleIDMap(status);
if (U_FAILURE(status)) {
return result;
}
ncthis->dnCache = new DNCache(locale);
if (dnCache == NULL) {
if (dnCache == nullptr) {
status = U_MEMORY_ALLOCATION_ERROR;
return result;
}
int32_t pos = UHASH_FIRST;
const UHashElement* entry = NULL;
while ((entry = m->nextElement(pos)) != NULL) {
const UHashElement* entry = nullptr;
while ((entry = m->nextElement(pos)) != nullptr) {
const UnicodeString* id = (const UnicodeString*)entry->key.pointer;
ICUServiceFactory* f = (ICUServiceFactory*)entry->value.pointer;
UnicodeString dname;
@@ -762,7 +762,7 @@ ICUService::getDisplayNames(UVector& result,
}
}
delete dnCache;
ncthis->dnCache = NULL;
ncthis->dnCache = nullptr;
return result;
}
}
@@ -774,10 +774,10 @@ ICUService::getDisplayNames(UVector& result,
* at the next position, which in this case will be 0.
*/
int32_t pos = UHASH_FIRST;
const UHashElement *entry = NULL;
while ((entry = dnCache->cache.nextElement(pos)) != NULL) {
const UHashElement *entry = nullptr;
while ((entry = dnCache->cache.nextElement(pos)) != nullptr) {
const UnicodeString* id = (const UnicodeString*)entry->value.pointer;
if (matchKey != NULL && !matchKey->isFallbackOf(*id)) {
if (matchKey != nullptr && !matchKey->isFallbackOf(*id)) {
continue;
}
const UnicodeString* dn = (const UnicodeString*)entry->key.pointer;
@@ -803,30 +803,30 @@ URegistryKey
ICUService::registerInstance(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status)
{
ICUServiceKey* key = createKey(&id, status);
if (key != NULL) {
if (key != nullptr) {
UnicodeString canonicalID;
key->canonicalID(canonicalID);
delete key;
ICUServiceFactory* f = createSimpleFactory(objToAdopt, canonicalID, visible, status);
if (f != NULL) {
if (f != nullptr) {
return registerFactory(f, status);
}
}
delete objToAdopt;
return NULL;
return nullptr;
}
ICUServiceFactory*
ICUService::createSimpleFactory(UObject* objToAdopt, const UnicodeString& id, UBool visible, UErrorCode& status)
{
if (U_SUCCESS(status)) {
if ((objToAdopt != NULL) && (!id.isBogus())) {
if ((objToAdopt != nullptr) && (!id.isBogus())) {
return new SimpleFactory(objToAdopt, id, visible);
}
status = U_ILLEGAL_ARGUMENT_ERROR;
}
return NULL;
return nullptr;
}
URegistryKey
@@ -865,7 +865,7 @@ ICUService::unregister(URegistryKey rkey, UErrorCode& status)
{
ICUServiceFactory *factory = (ICUServiceFactory*)rkey;
UBool result = false;
if (factory != NULL && factories != NULL) {
if (factory != nullptr && factories != nullptr) {
Mutex mutex(&lock);
if (factories->removeElement(factory)) {
@@ -896,7 +896,7 @@ ICUService::reset()
void
ICUService::reInitializeFactories()
{
if (factories != NULL) {
if (factories != nullptr) {
factories->removeAllElements();
}
}
@@ -910,7 +910,7 @@ ICUService::isDefault() const
ICUServiceKey*
ICUService::createKey(const UnicodeString* id, UErrorCode& status) const
{
return (U_FAILURE(status) || id == NULL) ? NULL : new ICUServiceKey(*id);
return (U_FAILURE(status) || id == nullptr) ? nullptr : new ICUServiceKey(*id);
}
void
@@ -919,29 +919,29 @@ ICUService::clearCaches()
// callers synchronize before use
++timestamp;
delete dnCache;
dnCache = NULL;
dnCache = nullptr;
delete idCache;
idCache = NULL;
delete serviceCache; serviceCache = NULL;
idCache = nullptr;
delete serviceCache; serviceCache = nullptr;
}
void
ICUService::clearServiceCache()
{
// callers synchronize before use
delete serviceCache; serviceCache = NULL;
delete serviceCache; serviceCache = nullptr;
}
UBool
ICUService::acceptsListener(const EventListener& l) const
{
return dynamic_cast<const ServiceListener*>(&l) != NULL;
return dynamic_cast<const ServiceListener*>(&l) != nullptr;
}
void
ICUService::notifyListener(EventListener& l) const
{
((ServiceListener&)l).serviceChanged(*this);
(static_cast<ServiceListener&>(l)).serviceChanged(*this);
}
UnicodeString&
@@ -953,7 +953,7 @@ ICUService::getName(UnicodeString& result) const
int32_t
ICUService::countFactories() const
{
return factories == NULL ? 0 : factories->size();
return factories == nullptr ? 0 : factories->size();
}
int32_t