You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +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:
64
thirdparty/icu4c/common/unisetspan.cpp
vendored
64
thirdparty/icu4c/common/unisetspan.cpp
vendored
@@ -70,7 +70,7 @@ public:
|
||||
capacity=(int32_t)sizeof(staticList);
|
||||
} else {
|
||||
UBool *l=(UBool *)uprv_malloc(maxLength);
|
||||
if(l!=NULL) {
|
||||
if(l!=nullptr) {
|
||||
list=l;
|
||||
capacity=maxLength;
|
||||
}
|
||||
@@ -165,10 +165,10 @@ private:
|
||||
|
||||
// Get the number of UTF-8 bytes for a UTF-16 (sub)string.
|
||||
static int32_t
|
||||
getUTF8Length(const UChar *s, int32_t length) {
|
||||
getUTF8Length(const char16_t *s, int32_t length) {
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
int32_t length8=0;
|
||||
u_strToUTF8(NULL, 0, &length8, s, length, &errorCode);
|
||||
u_strToUTF8(nullptr, 0, &length8, s, length, &errorCode);
|
||||
if(U_SUCCESS(errorCode) || errorCode==U_BUFFER_OVERFLOW_ERROR) {
|
||||
return length8;
|
||||
} else {
|
||||
@@ -180,7 +180,7 @@ getUTF8Length(const UChar *s, int32_t length) {
|
||||
|
||||
// Append the UTF-8 version of the string to t and return the appended UTF-8 length.
|
||||
static int32_t
|
||||
appendUTF8(const UChar *s, int32_t length, uint8_t *t, int32_t capacity) {
|
||||
appendUTF8(const char16_t *s, int32_t length, uint8_t *t, int32_t capacity) {
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
int32_t length8=0;
|
||||
u_strToUTF8((char *)t, capacity, &length8, s, length, &errorCode);
|
||||
@@ -204,8 +204,8 @@ makeSpanLengthByte(int32_t spanLength) {
|
||||
UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
|
||||
const UVector &setStrings,
|
||||
uint32_t which)
|
||||
: spanSet(0, 0x10ffff), pSpanNotSet(NULL), strings(setStrings),
|
||||
utf8Lengths(NULL), spanLengths(NULL), utf8(NULL),
|
||||
: spanSet(0, 0x10ffff), pSpanNotSet(nullptr), strings(setStrings),
|
||||
utf8Lengths(nullptr), spanLengths(nullptr), utf8(nullptr),
|
||||
utf8Length(0),
|
||||
maxLength16(0), maxLength8(0),
|
||||
all((UBool)(which==ALL)) {
|
||||
@@ -229,7 +229,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
|
||||
UBool someRelevant=false;
|
||||
for(i=0; i<stringsLength; ++i) {
|
||||
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
|
||||
const UChar *s16=string.getBuffer();
|
||||
const char16_t *s16=string.getBuffer();
|
||||
int32_t length16=string.length();
|
||||
if (length16==0) {
|
||||
continue; // skip the empty string
|
||||
@@ -283,7 +283,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
|
||||
utf8Lengths=staticLengths;
|
||||
} else {
|
||||
utf8Lengths=(int32_t *)uprv_malloc(allocSize);
|
||||
if(utf8Lengths==NULL) {
|
||||
if(utf8Lengths==nullptr) {
|
||||
maxLength16=maxLength8=0; // Prevent usage by making needsStringSpanUTF16/8() return false.
|
||||
return; // Out of memory.
|
||||
}
|
||||
@@ -312,7 +312,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
|
||||
|
||||
for(i=0; i<stringsLength; ++i) {
|
||||
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
|
||||
const UChar *s16=string.getBuffer();
|
||||
const char16_t *s16=string.getBuffer();
|
||||
int32_t length16=string.length();
|
||||
spanLength=spanSet.span(s16, length16, USET_SPAN_CONTAINED);
|
||||
if(spanLength<length16 && length16>0) { // Relevant string.
|
||||
@@ -395,8 +395,8 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSet &set,
|
||||
// Copy constructor. Assumes which==ALL for a frozen set.
|
||||
UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStringSpan,
|
||||
const UVector &newParentSetStrings)
|
||||
: spanSet(otherStringSpan.spanSet), pSpanNotSet(NULL), strings(newParentSetStrings),
|
||||
utf8Lengths(NULL), spanLengths(NULL), utf8(NULL),
|
||||
: spanSet(otherStringSpan.spanSet), pSpanNotSet(nullptr), strings(newParentSetStrings),
|
||||
utf8Lengths(nullptr), spanLengths(nullptr), utf8(nullptr),
|
||||
utf8Length(otherStringSpan.utf8Length),
|
||||
maxLength16(otherStringSpan.maxLength16), maxLength8(otherStringSpan.maxLength8),
|
||||
all(true) {
|
||||
@@ -414,7 +414,7 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStri
|
||||
utf8Lengths=staticLengths;
|
||||
} else {
|
||||
utf8Lengths=(int32_t *)uprv_malloc(allocSize);
|
||||
if(utf8Lengths==NULL) {
|
||||
if(utf8Lengths==nullptr) {
|
||||
maxLength16=maxLength8=0; // Prevent usage by making needsStringSpanUTF16/8() return false.
|
||||
return; // Out of memory.
|
||||
}
|
||||
@@ -426,21 +426,21 @@ UnicodeSetStringSpan::UnicodeSetStringSpan(const UnicodeSetStringSpan &otherStri
|
||||
}
|
||||
|
||||
UnicodeSetStringSpan::~UnicodeSetStringSpan() {
|
||||
if(pSpanNotSet!=NULL && pSpanNotSet!=&spanSet) {
|
||||
if(pSpanNotSet!=nullptr && pSpanNotSet!=&spanSet) {
|
||||
delete pSpanNotSet;
|
||||
}
|
||||
if(utf8Lengths!=NULL && utf8Lengths!=staticLengths) {
|
||||
if(utf8Lengths!=nullptr && utf8Lengths!=staticLengths) {
|
||||
uprv_free(utf8Lengths);
|
||||
}
|
||||
}
|
||||
|
||||
void UnicodeSetStringSpan::addToSpanNotSet(UChar32 c) {
|
||||
if(pSpanNotSet==NULL || pSpanNotSet==&spanSet) {
|
||||
if(pSpanNotSet==nullptr || pSpanNotSet==&spanSet) {
|
||||
if(spanSet.contains(c)) {
|
||||
return; // Nothing to do.
|
||||
}
|
||||
UnicodeSet *newSet=spanSet.cloneAsThawed();
|
||||
if(newSet==NULL) {
|
||||
if(newSet==nullptr) {
|
||||
return; // Out of memory.
|
||||
} else {
|
||||
pSpanNotSet=newSet;
|
||||
@@ -451,7 +451,7 @@ void UnicodeSetStringSpan::addToSpanNotSet(UChar32 c) {
|
||||
|
||||
// Compare strings without any argument checks. Requires length>0.
|
||||
static inline UBool
|
||||
matches16(const UChar *s, const UChar *t, int32_t length) {
|
||||
matches16(const char16_t *s, const char16_t *t, int32_t length) {
|
||||
do {
|
||||
if(*s++!=*t++) {
|
||||
return false;
|
||||
@@ -474,7 +474,7 @@ matches8(const uint8_t *s, const uint8_t *t, int32_t length) {
|
||||
// at code point boundaries.
|
||||
// That is, each edge of a match must not be in the middle of a surrogate pair.
|
||||
static inline UBool
|
||||
matches16CPB(const UChar *s, int32_t start, int32_t limit, const UChar *t, int32_t length) {
|
||||
matches16CPB(const char16_t *s, int32_t start, int32_t limit, const char16_t *t, int32_t length) {
|
||||
s+=start;
|
||||
limit-=start;
|
||||
return matches16(s, t, length) &&
|
||||
@@ -485,8 +485,8 @@ matches16CPB(const UChar *s, int32_t start, int32_t limit, const UChar *t, int32
|
||||
// Does the set contain the next code point?
|
||||
// If so, return its length; otherwise return its negative length.
|
||||
static inline int32_t
|
||||
spanOne(const UnicodeSet &set, const UChar *s, int32_t length) {
|
||||
UChar c=*s, c2;
|
||||
spanOne(const UnicodeSet &set, const char16_t *s, int32_t length) {
|
||||
char16_t c=*s, c2;
|
||||
if(c>=0xd800 && c<=0xdbff && length>=2 && U16_IS_TRAIL(c2=s[1])) {
|
||||
return set.contains(U16_GET_SUPPLEMENTARY(c, c2)) ? 2 : -2;
|
||||
}
|
||||
@@ -494,8 +494,8 @@ spanOne(const UnicodeSet &set, const UChar *s, int32_t length) {
|
||||
}
|
||||
|
||||
static inline int32_t
|
||||
spanOneBack(const UnicodeSet &set, const UChar *s, int32_t length) {
|
||||
UChar c=s[length-1], c2;
|
||||
spanOneBack(const UnicodeSet &set, const char16_t *s, int32_t length) {
|
||||
char16_t c=s[length-1], c2;
|
||||
if(c>=0xdc00 && c<=0xdfff && length>=2 && U16_IS_LEAD(c2=s[length-2])) {
|
||||
return set.contains(U16_GET_SUPPLEMENTARY(c2, c)) ? 2 : -2;
|
||||
}
|
||||
@@ -634,7 +634,7 @@ spanOneBackUTF8(const UnicodeSet &set, const uint8_t *s, int32_t length) {
|
||||
* Stop if spanLength==0, otherwise continue the loop.
|
||||
*/
|
||||
|
||||
int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondition spanCondition) const {
|
||||
int32_t UnicodeSetStringSpan::span(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const {
|
||||
if(spanCondition==USET_SPAN_NOT_CONTAINED) {
|
||||
return spanNot(s, length);
|
||||
}
|
||||
@@ -659,7 +659,7 @@ int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondi
|
||||
continue; // Irrelevant string. (Also the empty string.)
|
||||
}
|
||||
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
|
||||
const UChar *s16=string.getBuffer();
|
||||
const char16_t *s16=string.getBuffer();
|
||||
int32_t length16=string.length();
|
||||
U_ASSERT(length>0);
|
||||
|
||||
@@ -699,7 +699,7 @@ int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondi
|
||||
// to find the match from the earliest start.
|
||||
|
||||
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
|
||||
const UChar *s16=string.getBuffer();
|
||||
const char16_t *s16=string.getBuffer();
|
||||
int32_t length16=string.length();
|
||||
if (length16==0) {
|
||||
continue; // skip the empty string
|
||||
@@ -798,7 +798,7 @@ int32_t UnicodeSetStringSpan::span(const UChar *s, int32_t length, USetSpanCondi
|
||||
}
|
||||
}
|
||||
|
||||
int32_t UnicodeSetStringSpan::spanBack(const UChar *s, int32_t length, USetSpanCondition spanCondition) const {
|
||||
int32_t UnicodeSetStringSpan::spanBack(const char16_t *s, int32_t length, USetSpanCondition spanCondition) const {
|
||||
if(spanCondition==USET_SPAN_NOT_CONTAINED) {
|
||||
return spanNotBack(s, length);
|
||||
}
|
||||
@@ -827,7 +827,7 @@ int32_t UnicodeSetStringSpan::spanBack(const UChar *s, int32_t length, USetSpanC
|
||||
continue; // Irrelevant string. (Also the empty string.)
|
||||
}
|
||||
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
|
||||
const UChar *s16=string.getBuffer();
|
||||
const char16_t *s16=string.getBuffer();
|
||||
int32_t length16=string.length();
|
||||
U_ASSERT(length>0);
|
||||
|
||||
@@ -869,7 +869,7 @@ int32_t UnicodeSetStringSpan::spanBack(const UChar *s, int32_t length, USetSpanC
|
||||
// to find the match from the latest end.
|
||||
|
||||
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
|
||||
const UChar *s16=string.getBuffer();
|
||||
const char16_t *s16=string.getBuffer();
|
||||
int32_t length16=string.length();
|
||||
if (length16==0) {
|
||||
continue; // skip the empty string
|
||||
@@ -1346,7 +1346,7 @@ int32_t UnicodeSetStringSpan::spanBackUTF8(const uint8_t *s, int32_t length, USe
|
||||
* when there is not actually a match for such a set string.
|
||||
*/
|
||||
|
||||
int32_t UnicodeSetStringSpan::spanNot(const UChar *s, int32_t length) const {
|
||||
int32_t UnicodeSetStringSpan::spanNot(const char16_t *s, int32_t length) const {
|
||||
int32_t pos=0, rest=length;
|
||||
int32_t i, stringsLength=strings.size();
|
||||
do {
|
||||
@@ -1372,7 +1372,7 @@ int32_t UnicodeSetStringSpan::spanNot(const UChar *s, int32_t length) const {
|
||||
continue; // Irrelevant string. (Also the empty string.)
|
||||
}
|
||||
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
|
||||
const UChar *s16=string.getBuffer();
|
||||
const char16_t *s16=string.getBuffer();
|
||||
int32_t length16=string.length();
|
||||
U_ASSERT(length>0);
|
||||
if(length16<=rest && matches16CPB(s, pos, length, s16, length16)) {
|
||||
@@ -1389,7 +1389,7 @@ int32_t UnicodeSetStringSpan::spanNot(const UChar *s, int32_t length) const {
|
||||
return length; // Reached the end of the string.
|
||||
}
|
||||
|
||||
int32_t UnicodeSetStringSpan::spanNotBack(const UChar *s, int32_t length) const {
|
||||
int32_t UnicodeSetStringSpan::spanNotBack(const char16_t *s, int32_t length) const {
|
||||
int32_t pos=length;
|
||||
int32_t i, stringsLength=strings.size();
|
||||
do {
|
||||
@@ -1416,7 +1416,7 @@ int32_t UnicodeSetStringSpan::spanNotBack(const UChar *s, int32_t length) const
|
||||
continue; // Irrelevant string. (Also the empty string.)
|
||||
}
|
||||
const UnicodeString &string=*(const UnicodeString *)strings.elementAt(i);
|
||||
const UChar *s16=string.getBuffer();
|
||||
const char16_t *s16=string.getBuffer();
|
||||
int32_t length16=string.length();
|
||||
U_ASSERT(length>0);
|
||||
if(length16<=pos && matches16CPB(s, pos-length16, length, s16, length16)) {
|
||||
|
||||
Reference in New Issue
Block a user