You've already forked godot
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:
310
thirdparty/icu4c/common/unistr.cpp
vendored
310
thirdparty/icu4c/common/unistr.cpp
vendored
@@ -44,7 +44,7 @@ void
|
||||
print(const UnicodeString& s,
|
||||
const char *name)
|
||||
{
|
||||
UChar c;
|
||||
char16_t c;
|
||||
cout << name << ":|";
|
||||
for(int i = 0; i < s.length(); ++i) {
|
||||
c = s[i];
|
||||
@@ -57,11 +57,11 @@ print(const UnicodeString& s,
|
||||
}
|
||||
|
||||
void
|
||||
print(const UChar *s,
|
||||
print(const char16_t *s,
|
||||
int32_t len,
|
||||
const char *name)
|
||||
{
|
||||
UChar c;
|
||||
char16_t c;
|
||||
cout << name << ":|";
|
||||
for(int i = 0; i < len; ++i) {
|
||||
c = s[i];
|
||||
@@ -80,17 +80,17 @@ print(const UChar *s,
|
||||
// need to copy areas that may overlap
|
||||
static
|
||||
inline void
|
||||
us_arrayCopy(const UChar *src, int32_t srcStart,
|
||||
UChar *dst, int32_t dstStart, int32_t count)
|
||||
us_arrayCopy(const char16_t *src, int32_t srcStart,
|
||||
char16_t *dst, int32_t dstStart, int32_t count)
|
||||
{
|
||||
if(count>0) {
|
||||
uprv_memmove(dst+dstStart, src+srcStart, (size_t)count*sizeof(*src));
|
||||
}
|
||||
}
|
||||
|
||||
// u_unescapeAt() callback to get a UChar from a UnicodeString
|
||||
// u_unescapeAt() callback to get a char16_t from a UnicodeString
|
||||
U_CDECL_BEGIN
|
||||
static UChar U_CALLCONV
|
||||
static char16_t U_CALLCONV
|
||||
UnicodeString_charAt(int32_t offset, void *context) {
|
||||
return ((icu::UnicodeString*) context)->charAt(offset);
|
||||
}
|
||||
@@ -159,8 +159,8 @@ UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) {
|
||||
capacity = length;
|
||||
}
|
||||
if(allocate(capacity)) {
|
||||
UChar *array = getArrayStart();
|
||||
UChar unit = (UChar)c;
|
||||
char16_t *array = getArrayStart();
|
||||
char16_t unit = (char16_t)c;
|
||||
for(int32_t i = 0; i < length; ++i) {
|
||||
array[i] = unit;
|
||||
}
|
||||
@@ -177,9 +177,9 @@ UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) {
|
||||
capacity = length;
|
||||
}
|
||||
if(allocate(capacity)) {
|
||||
UChar *array = getArrayStart();
|
||||
UChar lead = U16_LEAD(c);
|
||||
UChar trail = U16_TRAIL(c);
|
||||
char16_t *array = getArrayStart();
|
||||
char16_t lead = U16_LEAD(c);
|
||||
char16_t trail = U16_TRAIL(c);
|
||||
for(int32_t i = 0; i < length; i += 2) {
|
||||
array[i] = lead;
|
||||
array[i + 1] = trail;
|
||||
@@ -189,7 +189,7 @@ UnicodeString::UnicodeString(int32_t capacity, UChar32 c, int32_t count) {
|
||||
}
|
||||
}
|
||||
|
||||
UnicodeString::UnicodeString(UChar ch) {
|
||||
UnicodeString::UnicodeString(char16_t ch) {
|
||||
fUnion.fFields.fLengthAndFlags = kLength1 | kShortString;
|
||||
fUnion.fStackFields.fBuffer[0] = ch;
|
||||
}
|
||||
@@ -206,12 +206,12 @@ UnicodeString::UnicodeString(UChar32 ch) {
|
||||
}
|
||||
}
|
||||
|
||||
UnicodeString::UnicodeString(const UChar *text) {
|
||||
UnicodeString::UnicodeString(const char16_t *text) {
|
||||
fUnion.fFields.fLengthAndFlags = kShortString;
|
||||
doAppend(text, 0, -1);
|
||||
}
|
||||
|
||||
UnicodeString::UnicodeString(const UChar *text,
|
||||
UnicodeString::UnicodeString(const char16_t *text,
|
||||
int32_t textLength) {
|
||||
fUnion.fFields.fLengthAndFlags = kShortString;
|
||||
doAppend(text, 0, textLength);
|
||||
@@ -221,8 +221,8 @@ UnicodeString::UnicodeString(UBool isTerminated,
|
||||
ConstChar16Ptr textPtr,
|
||||
int32_t textLength) {
|
||||
fUnion.fFields.fLengthAndFlags = kReadonlyAlias;
|
||||
const UChar *text = textPtr;
|
||||
if(text == NULL) {
|
||||
const char16_t *text = textPtr;
|
||||
if(text == nullptr) {
|
||||
// treat as an empty string, do not alias
|
||||
setToEmpty();
|
||||
} else if(textLength < -1 ||
|
||||
@@ -235,16 +235,16 @@ UnicodeString::UnicodeString(UBool isTerminated,
|
||||
// text is terminated, or else it would have failed the above test
|
||||
textLength = u_strlen(text);
|
||||
}
|
||||
setArray(const_cast<UChar *>(text), textLength,
|
||||
setArray(const_cast<char16_t *>(text), textLength,
|
||||
isTerminated ? textLength + 1 : textLength);
|
||||
}
|
||||
}
|
||||
|
||||
UnicodeString::UnicodeString(UChar *buff,
|
||||
UnicodeString::UnicodeString(char16_t *buff,
|
||||
int32_t buffLength,
|
||||
int32_t buffCapacity) {
|
||||
fUnion.fFields.fLengthAndFlags = kWritableAlias;
|
||||
if(buff == NULL) {
|
||||
if(buff == nullptr) {
|
||||
// treat as an empty string, do not alias
|
||||
setToEmpty();
|
||||
} else if(buffLength < -1 || buffCapacity < 0 || buffLength > buffCapacity) {
|
||||
@@ -252,7 +252,7 @@ UnicodeString::UnicodeString(UChar *buff,
|
||||
} else {
|
||||
if(buffLength == -1) {
|
||||
// fLength = u_strlen(buff); but do not look beyond buffCapacity
|
||||
const UChar *p = buff, *limit = buff + buffCapacity;
|
||||
const char16_t *p = buff, *limit = buff + buffCapacity;
|
||||
while(p != limit && *p != 0) {
|
||||
++p;
|
||||
}
|
||||
@@ -264,7 +264,7 @@ UnicodeString::UnicodeString(UChar *buff,
|
||||
|
||||
UnicodeString::UnicodeString(const char *src, int32_t length, EInvariant) {
|
||||
fUnion.fFields.fLengthAndFlags = kShortString;
|
||||
if(src==NULL) {
|
||||
if(src==nullptr) {
|
||||
// treat as an empty string
|
||||
} else {
|
||||
if(length<0) {
|
||||
@@ -308,7 +308,7 @@ UnicodeString::UnicodeString(const UnicodeString& that) {
|
||||
copyFrom(that);
|
||||
}
|
||||
|
||||
UnicodeString::UnicodeString(UnicodeString &&src) U_NOEXCEPT {
|
||||
UnicodeString::UnicodeString(UnicodeString &&src) noexcept {
|
||||
copyFieldsFrom(src, true);
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ UnicodeString::UnicodeString(const UnicodeString& that,
|
||||
// Replaceable base class clone() default implementation, does not clone
|
||||
Replaceable *
|
||||
Replaceable::clone() const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// UnicodeString overrides clone() with a real implementation
|
||||
@@ -380,13 +380,13 @@ UnicodeString::allocate(int32_t capacity) {
|
||||
// Round up to a multiple of 16.
|
||||
numBytes = (numBytes + 15) & ~15;
|
||||
int32_t *array = (int32_t *) uprv_malloc(numBytes);
|
||||
if(array != NULL) {
|
||||
if(array != nullptr) {
|
||||
// set initial refCount and point behind the refCount
|
||||
*array++ = 1;
|
||||
numBytes -= sizeof(int32_t);
|
||||
|
||||
// have fArray point to the first UChar
|
||||
fUnion.fFields.fArray = (UChar *)array;
|
||||
// have fArray point to the first char16_t
|
||||
fUnion.fFields.fArray = (char16_t *)array;
|
||||
fUnion.fFields.fCapacity = (int32_t)(numBytes / U_SIZEOF_UCHAR);
|
||||
fUnion.fFields.fLengthAndFlags = kLongString;
|
||||
return true;
|
||||
@@ -460,13 +460,13 @@ UnicodeString UnicodeString::fromUTF32(const UChar32 *utf32, int32_t length) {
|
||||
capacity = length + (length >> 4) + 4;
|
||||
}
|
||||
do {
|
||||
UChar *utf16 = result.getBuffer(capacity);
|
||||
char16_t *utf16 = result.getBuffer(capacity);
|
||||
int32_t length16;
|
||||
UErrorCode errorCode = U_ZERO_ERROR;
|
||||
u_strFromUTF32WithSub(utf16, result.getCapacity(), &length16,
|
||||
utf32, length,
|
||||
0xfffd, // Substitution character.
|
||||
NULL, // Don't care about number of substitutions.
|
||||
nullptr, // Don't care about number of substitutions.
|
||||
&errorCode);
|
||||
result.releaseBuffer(length16);
|
||||
if(errorCode == U_BUFFER_OVERFLOW_ERROR) {
|
||||
@@ -527,7 +527,7 @@ UnicodeString::copyFrom(const UnicodeString &src, UBool fastCopy) {
|
||||
case kLongString:
|
||||
// src uses a refCounted string buffer, use that buffer with refCount
|
||||
// src is const, use a cast - we don't actually change it
|
||||
((UnicodeString &)src).addRef();
|
||||
const_cast<UnicodeString &>(src).addRef();
|
||||
// copy all fields, share the reference-counted buffer
|
||||
fUnion.fFields.fArray = src.fUnion.fFields.fArray;
|
||||
fUnion.fFields.fCapacity = src.fUnion.fFields.fCapacity;
|
||||
@@ -572,7 +572,7 @@ UnicodeString::copyFrom(const UnicodeString &src, UBool fastCopy) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
UnicodeString &UnicodeString::operator=(UnicodeString &&src) U_NOEXCEPT {
|
||||
UnicodeString &UnicodeString::operator=(UnicodeString &&src) noexcept {
|
||||
// No explicit check for self move assignment, consistent with standard library.
|
||||
// Self move assignment causes no crash nor leak but might make the object bogus.
|
||||
releaseArray();
|
||||
@@ -581,7 +581,7 @@ UnicodeString &UnicodeString::operator=(UnicodeString &&src) U_NOEXCEPT {
|
||||
}
|
||||
|
||||
// Same as move assignment except without memory management.
|
||||
void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NOEXCEPT {
|
||||
void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) noexcept {
|
||||
int16_t lengthAndFlags = fUnion.fFields.fLengthAndFlags = src.fUnion.fFields.fLengthAndFlags;
|
||||
if(lengthAndFlags & kUsingStackBuffer) {
|
||||
// Short string using the stack buffer, copy the contents.
|
||||
@@ -601,13 +601,13 @@ void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NO
|
||||
if(setSrcToBogus) {
|
||||
// Set src to bogus without releasing any memory.
|
||||
src.fUnion.fFields.fLengthAndFlags = kIsBogus;
|
||||
src.fUnion.fFields.fArray = NULL;
|
||||
src.fUnion.fFields.fArray = nullptr;
|
||||
src.fUnion.fFields.fCapacity = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UnicodeString::swap(UnicodeString &other) U_NOEXCEPT {
|
||||
void UnicodeString::swap(UnicodeString &other) noexcept {
|
||||
UnicodeString temp; // Empty short string: Known not to need releaseArray().
|
||||
// Copy fields without resetting source values in between.
|
||||
temp.copyFieldsFrom(*this, false);
|
||||
@@ -626,7 +626,7 @@ UnicodeString UnicodeString::unescape() const {
|
||||
if (result.isBogus()) {
|
||||
return result;
|
||||
}
|
||||
const UChar *array = getBuffer();
|
||||
const char16_t *array = getBuffer();
|
||||
int32_t len = length();
|
||||
int32_t prev = 0;
|
||||
for (int32_t i=0;;) {
|
||||
@@ -662,10 +662,52 @@ UnicodeString::doEquals(const UnicodeString &text, int32_t len) const {
|
||||
return uprv_memcmp(getArrayStart(), text.getArrayStart(), len * U_SIZEOF_UCHAR) == 0;
|
||||
}
|
||||
|
||||
UBool
|
||||
UnicodeString::doEqualsSubstring( int32_t start,
|
||||
int32_t length,
|
||||
const char16_t *srcChars,
|
||||
int32_t srcStart,
|
||||
int32_t srcLength) const
|
||||
{
|
||||
// compare illegal string values
|
||||
if(isBogus()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// pin indices to legal values
|
||||
pinIndices(start, length);
|
||||
|
||||
if(srcChars == nullptr) {
|
||||
// treat const char16_t *srcChars==nullptr as an empty string
|
||||
return length == 0 ? true : false;
|
||||
}
|
||||
|
||||
// get the correct pointer
|
||||
const char16_t *chars = getArrayStart();
|
||||
|
||||
chars += start;
|
||||
srcChars += srcStart;
|
||||
|
||||
// get the srcLength if necessary
|
||||
if(srcLength < 0) {
|
||||
srcLength = u_strlen(srcChars + srcStart);
|
||||
}
|
||||
|
||||
if (length != srcLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(length == 0 || chars == srcChars) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return u_memcmp(chars, srcChars, srcLength) == 0;
|
||||
}
|
||||
|
||||
int8_t
|
||||
UnicodeString::doCompare( int32_t start,
|
||||
int32_t length,
|
||||
const UChar *srcChars,
|
||||
const char16_t *srcChars,
|
||||
int32_t srcStart,
|
||||
int32_t srcLength) const
|
||||
{
|
||||
@@ -677,13 +719,13 @@ UnicodeString::doCompare( int32_t start,
|
||||
// pin indices to legal values
|
||||
pinIndices(start, length);
|
||||
|
||||
if(srcChars == NULL) {
|
||||
// treat const UChar *srcChars==NULL as an empty string
|
||||
if(srcChars == nullptr) {
|
||||
// treat const char16_t *srcChars==nullptr as an empty string
|
||||
return length == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// get the correct pointer
|
||||
const UChar *chars = getArrayStart();
|
||||
const char16_t *chars = getArrayStart();
|
||||
|
||||
chars += start;
|
||||
srcChars += srcStart;
|
||||
@@ -723,12 +765,12 @@ UnicodeString::doCompare( int32_t start,
|
||||
|
||||
# if U_IS_BIG_ENDIAN
|
||||
// big-endian: byte comparison works
|
||||
result = uprv_memcmp(chars, srcChars, minLength * sizeof(UChar));
|
||||
result = uprv_memcmp(chars, srcChars, minLength * sizeof(char16_t));
|
||||
if(result != 0) {
|
||||
return (int8_t)(result >> 15 | 1);
|
||||
}
|
||||
# else
|
||||
// little-endian: compare UChar units
|
||||
// little-endian: compare char16_t units
|
||||
do {
|
||||
result = ((int32_t)*(chars++) - (int32_t)*(srcChars++));
|
||||
if(result != 0) {
|
||||
@@ -744,12 +786,12 @@ UnicodeString::doCompare( int32_t start,
|
||||
int8_t
|
||||
UnicodeString::doCompareCodePointOrder(int32_t start,
|
||||
int32_t length,
|
||||
const UChar *srcChars,
|
||||
const char16_t *srcChars,
|
||||
int32_t srcStart,
|
||||
int32_t srcLength) const
|
||||
{
|
||||
// compare illegal string values
|
||||
// treat const UChar *srcChars==NULL as an empty string
|
||||
// treat const char16_t *srcChars==nullptr as an empty string
|
||||
if(isBogus()) {
|
||||
return -1;
|
||||
}
|
||||
@@ -757,11 +799,11 @@ UnicodeString::doCompareCodePointOrder(int32_t start,
|
||||
// pin indices to legal values
|
||||
pinIndices(start, length);
|
||||
|
||||
if(srcChars == NULL) {
|
||||
if(srcChars == nullptr) {
|
||||
srcStart = srcLength = 0;
|
||||
}
|
||||
|
||||
int32_t diff = uprv_strCompare(getArrayStart() + start, length, (srcChars!=NULL)?(srcChars + srcStart):NULL, srcLength, false, true);
|
||||
int32_t diff = uprv_strCompare(getArrayStart() + start, length, (srcChars!=nullptr)?(srcChars + srcStart):nullptr, srcLength, false, true);
|
||||
/* translate the 32-bit result into an 8-bit one */
|
||||
if(diff!=0) {
|
||||
return (int8_t)(diff >> 15 | 1);
|
||||
@@ -775,7 +817,7 @@ UnicodeString::getLength() const {
|
||||
return length();
|
||||
}
|
||||
|
||||
UChar
|
||||
char16_t
|
||||
UnicodeString::getCharAt(int32_t offset) const {
|
||||
return charAt(offset);
|
||||
}
|
||||
@@ -790,7 +832,7 @@ UnicodeString::char32At(int32_t offset) const
|
||||
{
|
||||
int32_t len = length();
|
||||
if((uint32_t)offset < (uint32_t)len) {
|
||||
const UChar *array = getArrayStart();
|
||||
const char16_t *array = getArrayStart();
|
||||
UChar32 c;
|
||||
U16_GET(array, 0, offset, len, c);
|
||||
return c;
|
||||
@@ -802,7 +844,7 @@ UnicodeString::char32At(int32_t offset) const
|
||||
int32_t
|
||||
UnicodeString::getChar32Start(int32_t offset) const {
|
||||
if((uint32_t)offset < (uint32_t)length()) {
|
||||
const UChar *array = getArrayStart();
|
||||
const char16_t *array = getArrayStart();
|
||||
U16_SET_CP_START(array, 0, offset);
|
||||
return offset;
|
||||
} else {
|
||||
@@ -814,7 +856,7 @@ int32_t
|
||||
UnicodeString::getChar32Limit(int32_t offset) const {
|
||||
int32_t len = length();
|
||||
if((uint32_t)offset < (uint32_t)len) {
|
||||
const UChar *array = getArrayStart();
|
||||
const char16_t *array = getArrayStart();
|
||||
U16_SET_CP_LIMIT(array, 0, offset, len);
|
||||
return offset;
|
||||
} else {
|
||||
@@ -825,14 +867,14 @@ UnicodeString::getChar32Limit(int32_t offset) const {
|
||||
int32_t
|
||||
UnicodeString::countChar32(int32_t start, int32_t length) const {
|
||||
pinIndices(start, length);
|
||||
// if(isBogus()) then fArray==0 and start==0 - u_countChar32() checks for NULL
|
||||
// if(isBogus()) then fArray==0 and start==0 - u_countChar32() checks for nullptr
|
||||
return u_countChar32(getArrayStart()+start, length);
|
||||
}
|
||||
|
||||
UBool
|
||||
UnicodeString::hasMoreChar32Than(int32_t start, int32_t length, int32_t number) const {
|
||||
pinIndices(start, length);
|
||||
// if(isBogus()) then fArray==0 and start==0 - u_strHasMoreChar32Than() checks for NULL
|
||||
// if(isBogus()) then fArray==0 and start==0 - u_strHasMoreChar32Than() checks for nullptr
|
||||
return u_strHasMoreChar32Than(getArrayStart()+start, length, number);
|
||||
}
|
||||
|
||||
@@ -846,7 +888,7 @@ UnicodeString::moveIndex32(int32_t index, int32_t delta) const {
|
||||
index=len;
|
||||
}
|
||||
|
||||
const UChar *array = getArrayStart();
|
||||
const char16_t *array = getArrayStart();
|
||||
if(delta>0) {
|
||||
U16_FWD_N(array, index, len, delta);
|
||||
} else {
|
||||
@@ -859,14 +901,14 @@ UnicodeString::moveIndex32(int32_t index, int32_t delta) const {
|
||||
void
|
||||
UnicodeString::doExtract(int32_t start,
|
||||
int32_t length,
|
||||
UChar *dst,
|
||||
char16_t *dst,
|
||||
int32_t dstStart) const
|
||||
{
|
||||
// pin indices to legal values
|
||||
pinIndices(start, length);
|
||||
|
||||
// do not copy anything if we alias dst itself
|
||||
const UChar *array = getArrayStart();
|
||||
const char16_t *array = getArrayStart();
|
||||
if(array + start != dst + dstStart) {
|
||||
us_arrayCopy(array, start, dst, dstStart, length);
|
||||
}
|
||||
@@ -880,7 +922,7 @@ UnicodeString::extract(Char16Ptr dest, int32_t destCapacity,
|
||||
if(isBogus() || destCapacity<0 || (destCapacity>0 && dest==0)) {
|
||||
errorCode=U_ILLEGAL_ARGUMENT_ERROR;
|
||||
} else {
|
||||
const UChar *array = getArrayStart();
|
||||
const char16_t *array = getArrayStart();
|
||||
if(len>0 && len<=destCapacity && array!=dest) {
|
||||
u_memcpy(dest, array, len);
|
||||
}
|
||||
@@ -899,7 +941,7 @@ UnicodeString::extract(int32_t start,
|
||||
enum EInvariant) const
|
||||
{
|
||||
// if the arguments are illegal, then do nothing
|
||||
if(targetCapacity < 0 || (targetCapacity > 0 && target == NULL)) {
|
||||
if(targetCapacity < 0 || (targetCapacity > 0 && target == nullptr)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -916,9 +958,9 @@ UnicodeString::extract(int32_t start,
|
||||
UnicodeString
|
||||
UnicodeString::tempSubString(int32_t start, int32_t len) const {
|
||||
pinIndices(start, len);
|
||||
const UChar *array = getBuffer(); // not getArrayStart() to check kIsBogus & kOpenGetBuffer
|
||||
if(array==NULL) {
|
||||
array=fUnion.fStackFields.fBuffer; // anything not NULL because that would make an empty string
|
||||
const char16_t *array = getBuffer(); // not getArrayStart() to check kIsBogus & kOpenGetBuffer
|
||||
if(array==nullptr) {
|
||||
array=fUnion.fStackFields.fBuffer; // anything not nullptr because that would make an empty string
|
||||
len=-2; // bogus result string
|
||||
}
|
||||
return UnicodeString(false, array + start, len);
|
||||
@@ -933,7 +975,7 @@ UnicodeString::toUTF8(int32_t start, int32_t len,
|
||||
u_strToUTF8WithSub(target, capacity, &length8,
|
||||
getBuffer() + start, len,
|
||||
0xFFFD, // Standard substitution character.
|
||||
NULL, // Don't care about number of substitutions.
|
||||
nullptr, // Don't care about number of substitutions.
|
||||
&errorCode);
|
||||
return length8;
|
||||
}
|
||||
@@ -982,17 +1024,17 @@ UnicodeString::toUTF8(ByteSink &sink) const {
|
||||
u_strToUTF8WithSub(utf8, capacity, &length8,
|
||||
getBuffer(), length16,
|
||||
0xFFFD, // Standard substitution character.
|
||||
NULL, // Don't care about number of substitutions.
|
||||
nullptr, // Don't care about number of substitutions.
|
||||
&errorCode);
|
||||
if(errorCode == U_BUFFER_OVERFLOW_ERROR) {
|
||||
utf8 = (char *)uprv_malloc(length8);
|
||||
if(utf8 != NULL) {
|
||||
if(utf8 != nullptr) {
|
||||
utf8IsOwned = true;
|
||||
errorCode = U_ZERO_ERROR;
|
||||
u_strToUTF8WithSub(utf8, length8, &length8,
|
||||
getBuffer(), length16,
|
||||
0xFFFD, // Standard substitution character.
|
||||
NULL, // Don't care about number of substitutions.
|
||||
nullptr, // Don't care about number of substitutions.
|
||||
&errorCode);
|
||||
} else {
|
||||
errorCode = U_MEMORY_ALLOCATION_ERROR;
|
||||
@@ -1016,14 +1058,14 @@ UnicodeString::toUTF32(UChar32 *utf32, int32_t capacity, UErrorCode &errorCode)
|
||||
u_strToUTF32WithSub(utf32, capacity, &length32,
|
||||
getBuffer(), length(),
|
||||
0xfffd, // Substitution character.
|
||||
NULL, // Don't care about number of substitutions.
|
||||
nullptr, // Don't care about number of substitutions.
|
||||
&errorCode);
|
||||
}
|
||||
return length32;
|
||||
}
|
||||
|
||||
int32_t
|
||||
UnicodeString::indexOf(const UChar *srcChars,
|
||||
UnicodeString::indexOf(const char16_t *srcChars,
|
||||
int32_t srcStart,
|
||||
int32_t srcLength,
|
||||
int32_t start,
|
||||
@@ -1042,9 +1084,9 @@ UnicodeString::indexOf(const UChar *srcChars,
|
||||
pinIndices(start, length);
|
||||
|
||||
// find the first occurrence of the substring
|
||||
const UChar *array = getArrayStart();
|
||||
const UChar *match = u_strFindFirst(array + start, length, srcChars + srcStart, srcLength);
|
||||
if(match == NULL) {
|
||||
const char16_t *array = getArrayStart();
|
||||
const char16_t *match = u_strFindFirst(array + start, length, srcChars + srcStart, srcLength);
|
||||
if(match == nullptr) {
|
||||
return -1;
|
||||
} else {
|
||||
return (int32_t)(match - array);
|
||||
@@ -1052,7 +1094,7 @@ UnicodeString::indexOf(const UChar *srcChars,
|
||||
}
|
||||
|
||||
int32_t
|
||||
UnicodeString::doIndexOf(UChar c,
|
||||
UnicodeString::doIndexOf(char16_t c,
|
||||
int32_t start,
|
||||
int32_t length) const
|
||||
{
|
||||
@@ -1060,9 +1102,9 @@ UnicodeString::doIndexOf(UChar c,
|
||||
pinIndices(start, length);
|
||||
|
||||
// find the first occurrence of c
|
||||
const UChar *array = getArrayStart();
|
||||
const UChar *match = u_memchr(array + start, c, length);
|
||||
if(match == NULL) {
|
||||
const char16_t *array = getArrayStart();
|
||||
const char16_t *match = u_memchr(array + start, c, length);
|
||||
if(match == nullptr) {
|
||||
return -1;
|
||||
} else {
|
||||
return (int32_t)(match - array);
|
||||
@@ -1077,9 +1119,9 @@ UnicodeString::doIndexOf(UChar32 c,
|
||||
pinIndices(start, length);
|
||||
|
||||
// find the first occurrence of c
|
||||
const UChar *array = getArrayStart();
|
||||
const UChar *match = u_memchr32(array + start, c, length);
|
||||
if(match == NULL) {
|
||||
const char16_t *array = getArrayStart();
|
||||
const char16_t *match = u_memchr32(array + start, c, length);
|
||||
if(match == nullptr) {
|
||||
return -1;
|
||||
} else {
|
||||
return (int32_t)(match - array);
|
||||
@@ -1087,7 +1129,7 @@ UnicodeString::doIndexOf(UChar32 c,
|
||||
}
|
||||
|
||||
int32_t
|
||||
UnicodeString::lastIndexOf(const UChar *srcChars,
|
||||
UnicodeString::lastIndexOf(const char16_t *srcChars,
|
||||
int32_t srcStart,
|
||||
int32_t srcLength,
|
||||
int32_t start,
|
||||
@@ -1106,9 +1148,9 @@ UnicodeString::lastIndexOf(const UChar *srcChars,
|
||||
pinIndices(start, length);
|
||||
|
||||
// find the last occurrence of the substring
|
||||
const UChar *array = getArrayStart();
|
||||
const UChar *match = u_strFindLast(array + start, length, srcChars + srcStart, srcLength);
|
||||
if(match == NULL) {
|
||||
const char16_t *array = getArrayStart();
|
||||
const char16_t *match = u_strFindLast(array + start, length, srcChars + srcStart, srcLength);
|
||||
if(match == nullptr) {
|
||||
return -1;
|
||||
} else {
|
||||
return (int32_t)(match - array);
|
||||
@@ -1116,7 +1158,7 @@ UnicodeString::lastIndexOf(const UChar *srcChars,
|
||||
}
|
||||
|
||||
int32_t
|
||||
UnicodeString::doLastIndexOf(UChar c,
|
||||
UnicodeString::doLastIndexOf(char16_t c,
|
||||
int32_t start,
|
||||
int32_t length) const
|
||||
{
|
||||
@@ -1128,9 +1170,9 @@ UnicodeString::doLastIndexOf(UChar c,
|
||||
pinIndices(start, length);
|
||||
|
||||
// find the last occurrence of c
|
||||
const UChar *array = getArrayStart();
|
||||
const UChar *match = u_memrchr(array + start, c, length);
|
||||
if(match == NULL) {
|
||||
const char16_t *array = getArrayStart();
|
||||
const char16_t *match = u_memrchr(array + start, c, length);
|
||||
if(match == nullptr) {
|
||||
return -1;
|
||||
} else {
|
||||
return (int32_t)(match - array);
|
||||
@@ -1145,9 +1187,9 @@ UnicodeString::doLastIndexOf(UChar32 c,
|
||||
pinIndices(start, length);
|
||||
|
||||
// find the last occurrence of c
|
||||
const UChar *array = getArrayStart();
|
||||
const UChar *match = u_memrchr32(array + start, c, length);
|
||||
if(match == NULL) {
|
||||
const char16_t *array = getArrayStart();
|
||||
const char16_t *match = u_memrchr32(array + start, c, length);
|
||||
if(match == nullptr) {
|
||||
return -1;
|
||||
} else {
|
||||
return (int32_t)(match - array);
|
||||
@@ -1220,7 +1262,7 @@ UnicodeString::getTerminatedBuffer() {
|
||||
if(!isWritable()) {
|
||||
return nullptr;
|
||||
}
|
||||
UChar *array = getArrayStart();
|
||||
char16_t *array = getArrayStart();
|
||||
int32_t len = length();
|
||||
if(len < getCapacity()) {
|
||||
if(fUnion.fFields.fLengthAndFlags & kBufferIsReadonly) {
|
||||
@@ -1234,7 +1276,7 @@ UnicodeString::getTerminatedBuffer() {
|
||||
} else if(((fUnion.fFields.fLengthAndFlags & kRefCounted) == 0 || refCount() == 1)) {
|
||||
// kRefCounted: Do not write the NUL if the buffer is shared.
|
||||
// That is mostly safe, except when the length of one copy was modified
|
||||
// without copy-on-write, e.g., via truncate(newLength) or remove(void).
|
||||
// without copy-on-write, e.g., via truncate(newLength) or remove().
|
||||
// Then the NUL would be written into the middle of another copy's string.
|
||||
|
||||
// Otherwise, the buffer is fully writable and it is anyway safe to write the NUL.
|
||||
@@ -1264,8 +1306,8 @@ UnicodeString::setTo(UBool isTerminated,
|
||||
return *this;
|
||||
}
|
||||
|
||||
const UChar *text = textPtr;
|
||||
if(text == NULL) {
|
||||
const char16_t *text = textPtr;
|
||||
if(text == nullptr) {
|
||||
// treat as an empty string, do not alias
|
||||
releaseArray();
|
||||
setToEmpty();
|
||||
@@ -1287,13 +1329,13 @@ UnicodeString::setTo(UBool isTerminated,
|
||||
textLength = u_strlen(text);
|
||||
}
|
||||
fUnion.fFields.fLengthAndFlags = kReadonlyAlias;
|
||||
setArray((UChar *)text, textLength, isTerminated ? textLength + 1 : textLength);
|
||||
setArray((char16_t *)text, textLength, isTerminated ? textLength + 1 : textLength);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// setTo() analogous to the writable-aliasing constructor with the same signature
|
||||
UnicodeString &
|
||||
UnicodeString::setTo(UChar *buffer,
|
||||
UnicodeString::setTo(char16_t *buffer,
|
||||
int32_t buffLength,
|
||||
int32_t buffCapacity) {
|
||||
if(fUnion.fFields.fLengthAndFlags & kOpenGetBuffer) {
|
||||
@@ -1301,7 +1343,7 @@ UnicodeString::setTo(UChar *buffer,
|
||||
return *this;
|
||||
}
|
||||
|
||||
if(buffer == NULL) {
|
||||
if(buffer == nullptr) {
|
||||
// treat as an empty string, do not alias
|
||||
releaseArray();
|
||||
setToEmpty();
|
||||
@@ -1313,7 +1355,7 @@ UnicodeString::setTo(UChar *buffer,
|
||||
return *this;
|
||||
} else if(buffLength == -1) {
|
||||
// buffLength = u_strlen(buff); but do not look beyond buffCapacity
|
||||
const UChar *p = buffer, *limit = buffer + buffCapacity;
|
||||
const char16_t *p = buffer, *limit = buffer + buffCapacity;
|
||||
while(p != limit && *p != 0) {
|
||||
++p;
|
||||
}
|
||||
@@ -1337,13 +1379,13 @@ UnicodeString &UnicodeString::setToUTF8(StringPiece utf8) {
|
||||
} else {
|
||||
capacity = length + 1; // +1 for the terminating NUL.
|
||||
}
|
||||
UChar *utf16 = getBuffer(capacity);
|
||||
char16_t *utf16 = getBuffer(capacity);
|
||||
int32_t length16;
|
||||
UErrorCode errorCode = U_ZERO_ERROR;
|
||||
u_strFromUTF8WithSub(utf16, getCapacity(), &length16,
|
||||
utf8.data(), length,
|
||||
0xfffd, // Substitution character.
|
||||
NULL, // Don't care about number of substitutions.
|
||||
nullptr, // Don't care about number of substitutions.
|
||||
&errorCode);
|
||||
releaseBuffer(length16);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
@@ -1354,7 +1396,7 @@ UnicodeString &UnicodeString::setToUTF8(StringPiece utf8) {
|
||||
|
||||
UnicodeString&
|
||||
UnicodeString::setCharAt(int32_t offset,
|
||||
UChar c)
|
||||
char16_t c)
|
||||
{
|
||||
int32_t len = length();
|
||||
if(cloneArrayIfNeeded() && len > 0) {
|
||||
@@ -1373,7 +1415,7 @@ UnicodeString&
|
||||
UnicodeString::replace(int32_t start,
|
||||
int32_t _length,
|
||||
UChar32 srcChar) {
|
||||
UChar buffer[U16_MAX_LENGTH];
|
||||
char16_t buffer[U16_MAX_LENGTH];
|
||||
int32_t count = 0;
|
||||
UBool isError = false;
|
||||
U16_APPEND(buffer, count, U16_MAX_LENGTH, srcChar, isError);
|
||||
@@ -1385,7 +1427,7 @@ UnicodeString::replace(int32_t start,
|
||||
|
||||
UnicodeString&
|
||||
UnicodeString::append(UChar32 srcChar) {
|
||||
UChar buffer[U16_MAX_LENGTH];
|
||||
char16_t buffer[U16_MAX_LENGTH];
|
||||
int32_t _length = 0;
|
||||
UBool isError = false;
|
||||
U16_APPEND(buffer, _length, U16_MAX_LENGTH, srcChar, isError);
|
||||
@@ -1412,7 +1454,7 @@ UnicodeString::doReplace( int32_t start,
|
||||
UnicodeString&
|
||||
UnicodeString::doReplace(int32_t start,
|
||||
int32_t length,
|
||||
const UChar *srcChars,
|
||||
const char16_t *srcChars,
|
||||
int32_t srcStart,
|
||||
int32_t srcLength)
|
||||
{
|
||||
@@ -1471,7 +1513,7 @@ UnicodeString::doReplace(int32_t start,
|
||||
newLength += srcLength;
|
||||
|
||||
// Check for insertion into ourself
|
||||
const UChar *oldArray = getArrayStart();
|
||||
const char16_t *oldArray = getArrayStart();
|
||||
if (isBufferWritable() &&
|
||||
oldArray < srcChars + srcLength &&
|
||||
srcChars < oldArray + oldLength) {
|
||||
@@ -1486,7 +1528,7 @@ UnicodeString::doReplace(int32_t start,
|
||||
|
||||
// cloneArrayIfNeeded(doCopyArray=false) may change fArray but will not copy the current contents;
|
||||
// therefore we need to keep the current fArray
|
||||
UChar oldStackBuffer[US_STACKBUF_SIZE];
|
||||
char16_t oldStackBuffer[US_STACKBUF_SIZE];
|
||||
if((fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) && (newLength > US_STACKBUF_SIZE)) {
|
||||
// copy the stack buffer contents because it will be overwritten with
|
||||
// fUnion.fFields values
|
||||
@@ -1504,7 +1546,7 @@ UnicodeString::doReplace(int32_t start,
|
||||
|
||||
// now do the replace
|
||||
|
||||
UChar *newArray = getArrayStart();
|
||||
char16_t *newArray = getArrayStart();
|
||||
if(newArray != oldArray) {
|
||||
// if fArray changed, then we need to copy everything except what will change
|
||||
us_arrayCopy(oldArray, 0, newArray, 0, start);
|
||||
@@ -1547,8 +1589,8 @@ UnicodeString::doAppend(const UnicodeString& src, int32_t srcStart, int32_t srcL
|
||||
}
|
||||
|
||||
UnicodeString&
|
||||
UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLength) {
|
||||
if(!isWritable() || srcLength == 0 || srcChars == NULL) {
|
||||
UnicodeString::doAppend(const char16_t *srcChars, int32_t srcStart, int32_t srcLength) {
|
||||
if(!isWritable() || srcLength == 0 || srcChars == nullptr) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -1571,7 +1613,7 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng
|
||||
}
|
||||
|
||||
// Check for append onto ourself
|
||||
const UChar* oldArray = getArrayStart();
|
||||
const char16_t* oldArray = getArrayStart();
|
||||
if (isBufferWritable() &&
|
||||
oldArray < srcChars + srcLength &&
|
||||
srcChars < oldArray + oldLength) {
|
||||
@@ -1587,9 +1629,9 @@ UnicodeString::doAppend(const UChar *srcChars, int32_t srcStart, int32_t srcLeng
|
||||
// optimize append() onto a large-enough, owned string
|
||||
if((newLength <= getCapacity() && isBufferWritable()) ||
|
||||
cloneArrayIfNeeded(newLength, getGrowCapacity(newLength))) {
|
||||
UChar *newArray = getArrayStart();
|
||||
char16_t *newArray = getArrayStart();
|
||||
// Do not copy characters when
|
||||
// UChar *buffer=str.getAppendBuffer(...);
|
||||
// char16_t *buffer=str.getAppendBuffer(...);
|
||||
// is followed by
|
||||
// str.append(buffer, length);
|
||||
// or
|
||||
@@ -1621,9 +1663,9 @@ UnicodeString::copy(int32_t start, int32_t limit, int32_t dest) {
|
||||
if (limit <= start) {
|
||||
return; // Nothing to do; avoid bogus malloc call
|
||||
}
|
||||
UChar* text = (UChar*) uprv_malloc( sizeof(UChar) * (limit - start) );
|
||||
char16_t* text = (char16_t*) uprv_malloc( sizeof(char16_t) * (limit - start) );
|
||||
// Check to make sure text is not null.
|
||||
if (text != NULL) {
|
||||
if (text != nullptr) {
|
||||
extractBetween(start, limit, text, 0);
|
||||
insert(dest, text, 0, limit - start);
|
||||
uprv_free(text);
|
||||
@@ -1659,9 +1701,9 @@ UnicodeString::doReverse(int32_t start, int32_t length) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
UChar *left = getArrayStart() + start;
|
||||
UChar *right = left + length - 1; // -1 for inclusive boundary (length>=2)
|
||||
UChar swap;
|
||||
char16_t *left = getArrayStart() + start;
|
||||
char16_t *right = left + length - 1; // -1 for inclusive boundary (length>=2)
|
||||
char16_t swap;
|
||||
UBool hasSupplementary = false;
|
||||
|
||||
// Before the loop we know left<right because length>=2.
|
||||
@@ -1676,7 +1718,7 @@ UnicodeString::doReverse(int32_t start, int32_t length) {
|
||||
|
||||
/* if there are supplementary code points in the reversed range, then re-swap their surrogates */
|
||||
if(hasSupplementary) {
|
||||
UChar swap2;
|
||||
char16_t swap2;
|
||||
|
||||
left = getArrayStart() + start;
|
||||
right = left + length - 1; // -1 so that we can look at *(left+1) if left<right
|
||||
@@ -1695,14 +1737,14 @@ UnicodeString::doReverse(int32_t start, int32_t length) {
|
||||
|
||||
UBool
|
||||
UnicodeString::padLeading(int32_t targetLength,
|
||||
UChar padChar)
|
||||
char16_t padChar)
|
||||
{
|
||||
int32_t oldLength = length();
|
||||
if(oldLength >= targetLength || !cloneArrayIfNeeded(targetLength)) {
|
||||
return false;
|
||||
} else {
|
||||
// move contents up by padding width
|
||||
UChar *array = getArrayStart();
|
||||
char16_t *array = getArrayStart();
|
||||
int32_t start = targetLength - oldLength;
|
||||
us_arrayCopy(array, 0, array, start, oldLength);
|
||||
|
||||
@@ -1717,14 +1759,14 @@ UnicodeString::padLeading(int32_t targetLength,
|
||||
|
||||
UBool
|
||||
UnicodeString::padTrailing(int32_t targetLength,
|
||||
UChar padChar)
|
||||
char16_t padChar)
|
||||
{
|
||||
int32_t oldLength = length();
|
||||
if(oldLength >= targetLength || !cloneArrayIfNeeded(targetLength)) {
|
||||
return false;
|
||||
} else {
|
||||
// fill in padding character
|
||||
UChar *array = getArrayStart();
|
||||
char16_t *array = getArrayStart();
|
||||
int32_t length = targetLength;
|
||||
while(--length >= oldLength) {
|
||||
array[length] = padChar;
|
||||
@@ -1741,7 +1783,7 @@ int32_t
|
||||
UnicodeString::doHashCode() const
|
||||
{
|
||||
/* Delegate hash computation to uhash. This makes UnicodeString
|
||||
* hashing consistent with UChar* hashing. */
|
||||
* hashing consistent with char16_t* hashing. */
|
||||
int32_t hashCode = ustr_hashUCharsN(getArrayStart(), length());
|
||||
if (hashCode == kInvalidHashCode) {
|
||||
hashCode = kEmptyHashCode;
|
||||
@@ -1771,7 +1813,7 @@ UnicodeString::releaseBuffer(int32_t newLength) {
|
||||
int32_t capacity=getCapacity();
|
||||
if(newLength==-1) {
|
||||
// the new length is the string length, capped by fCapacity
|
||||
const UChar *array=getArrayStart(), *p=array, *limit=array+capacity;
|
||||
const char16_t *array=getArrayStart(), *p=array, *limit=array+capacity;
|
||||
while(p<limit && *p!=0) {
|
||||
++p;
|
||||
}
|
||||
@@ -1826,8 +1868,8 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
|
||||
}
|
||||
|
||||
// save old values
|
||||
UChar oldStackBuffer[US_STACKBUF_SIZE];
|
||||
UChar *oldArray;
|
||||
char16_t oldStackBuffer[US_STACKBUF_SIZE];
|
||||
char16_t *oldArray;
|
||||
int32_t oldLength = length();
|
||||
int16_t flags = fUnion.fFields.fLengthAndFlags;
|
||||
|
||||
@@ -1839,11 +1881,11 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
|
||||
us_arrayCopy(fUnion.fStackFields.fBuffer, 0, oldStackBuffer, 0, oldLength);
|
||||
oldArray = oldStackBuffer;
|
||||
} else {
|
||||
oldArray = NULL; // no need to copy from the stack buffer to itself
|
||||
oldArray = nullptr; // no need to copy from the stack buffer to itself
|
||||
}
|
||||
} else {
|
||||
oldArray = fUnion.fFields.fArray;
|
||||
U_ASSERT(oldArray!=NULL); /* when stack buffer is not used, oldArray must have a non-NULL reference */
|
||||
U_ASSERT(oldArray!=nullptr); /* when stack buffer is not used, oldArray must have a non-nullptr reference */
|
||||
}
|
||||
|
||||
// allocate a new array
|
||||
@@ -1858,7 +1900,7 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
|
||||
if(newCapacity < minLength) {
|
||||
minLength = newCapacity;
|
||||
}
|
||||
if(oldArray != NULL) {
|
||||
if(oldArray != nullptr) {
|
||||
us_arrayCopy(oldArray, 0, getArrayStart(), 0, minLength);
|
||||
}
|
||||
setLength(minLength);
|
||||
@@ -1901,13 +1943,13 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
|
||||
UnicodeStringAppendable::~UnicodeStringAppendable() {}
|
||||
|
||||
UBool
|
||||
UnicodeStringAppendable::appendCodeUnit(UChar c) {
|
||||
UnicodeStringAppendable::appendCodeUnit(char16_t c) {
|
||||
return str.doAppend(&c, 0, 1).isWritable();
|
||||
}
|
||||
|
||||
UBool
|
||||
UnicodeStringAppendable::appendCodePoint(UChar32 c) {
|
||||
UChar buffer[U16_MAX_LENGTH];
|
||||
char16_t buffer[U16_MAX_LENGTH];
|
||||
int32_t cLength = 0;
|
||||
UBool isError = false;
|
||||
U16_APPEND(buffer, cLength, U16_MAX_LENGTH, c, isError);
|
||||
@@ -1915,7 +1957,7 @@ UnicodeStringAppendable::appendCodePoint(UChar32 c) {
|
||||
}
|
||||
|
||||
UBool
|
||||
UnicodeStringAppendable::appendString(const UChar *s, int32_t length) {
|
||||
UnicodeStringAppendable::appendString(const char16_t *s, int32_t length) {
|
||||
return str.doAppend(s, 0, length).isWritable();
|
||||
}
|
||||
|
||||
@@ -1924,14 +1966,14 @@ UnicodeStringAppendable::reserveAppendCapacity(int32_t appendCapacity) {
|
||||
return str.cloneArrayIfNeeded(str.length() + appendCapacity);
|
||||
}
|
||||
|
||||
UChar *
|
||||
char16_t *
|
||||
UnicodeStringAppendable::getAppendBuffer(int32_t minCapacity,
|
||||
int32_t desiredCapacityHint,
|
||||
UChar *scratch, int32_t scratchCapacity,
|
||||
char16_t *scratch, int32_t scratchCapacity,
|
||||
int32_t *resultCapacity) {
|
||||
if(minCapacity < 1 || scratchCapacity < minCapacity) {
|
||||
*resultCapacity = 0;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
int32_t oldLength = str.length();
|
||||
if(minCapacity <= (kMaxCapacity - oldLength) &&
|
||||
@@ -1951,7 +1993,7 @@ U_NAMESPACE_USE
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
uhash_hashUnicodeString(const UElement key) {
|
||||
const UnicodeString *str = (const UnicodeString*) key.pointer;
|
||||
return (str == NULL) ? 0 : str->hashCode();
|
||||
return (str == nullptr) ? 0 : str->hashCode();
|
||||
}
|
||||
|
||||
// Moved here from uhash_us.cpp so that using a UVector of UnicodeString*
|
||||
@@ -1963,7 +2005,7 @@ uhash_compareUnicodeString(const UElement key1, const UElement key2) {
|
||||
if (str1 == str2) {
|
||||
return true;
|
||||
}
|
||||
if (str1 == NULL || str2 == NULL) {
|
||||
if (str1 == nullptr || str2 == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return *str1 == *str2;
|
||||
@@ -1980,7 +2022,7 @@ This makes sure that static library dependencies are kept to a minimum.
|
||||
#if defined(__clang__) || U_GCC_MAJOR_MINOR >= 1100
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-function"
|
||||
static void uprv_UnicodeStringDummy(void) {
|
||||
static void uprv_UnicodeStringDummy() {
|
||||
delete [] (new UnicodeString[2]);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
Reference in New Issue
Block a user