summaryrefslogtreecommitdiff
path: root/thirdparty/icu4c/common/unistr.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-10-31 14:25:37 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-10-31 14:25:37 +0100
commitd43364e3cc3903385750241278caf312869b7cab (patch)
treee0d17f8d7a25552c7752ad1e0fc1c526f1c4c747 /thirdparty/icu4c/common/unistr.cpp
parenta7f67d4a79106f9a72d5f266e05d7f0c6c71f276 (diff)
parent4e44a271f0cfd00f5d278fd3001f1750cf934e42 (diff)
Merge pull request #67968 from bruvzg/icu72.1
ICU: Update to version 72.1
Diffstat (limited to 'thirdparty/icu4c/common/unistr.cpp')
-rw-r--r--thirdparty/icu4c/common/unistr.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/thirdparty/icu4c/common/unistr.cpp b/thirdparty/icu4c/common/unistr.cpp
index c18665928d..4125d19472 100644
--- a/thirdparty/icu4c/common/unistr.cpp
+++ b/thirdparty/icu4c/common/unistr.cpp
@@ -197,7 +197,7 @@ UnicodeString::UnicodeString(UChar ch) {
UnicodeString::UnicodeString(UChar32 ch) {
fUnion.fFields.fLengthAndFlags = kShortString;
int32_t i = 0;
- UBool isError = FALSE;
+ UBool isError = false;
U16_APPEND(fUnion.fStackFields.fBuffer, i, US_STACKBUF_SIZE, ch, isError);
// We test isError so that the compiler does not complain that we don't.
// If isError then i==0 which is what we want anyway.
@@ -270,7 +270,7 @@ UnicodeString::UnicodeString(const char *src, int32_t length, EInvariant) {
if(length<0) {
length=(int32_t)uprv_strlen(src);
}
- if(cloneArrayIfNeeded(length, length, FALSE)) {
+ if(cloneArrayIfNeeded(length, length, false)) {
u_charsToUChars(src, getArrayStart(), length);
setLength(length);
} else {
@@ -309,7 +309,7 @@ UnicodeString::UnicodeString(const UnicodeString& that) {
}
UnicodeString::UnicodeString(UnicodeString &&src) U_NOEXCEPT {
- copyFieldsFrom(src, TRUE);
+ copyFieldsFrom(src, true);
}
UnicodeString::UnicodeString(const UnicodeString& that,
@@ -370,7 +370,7 @@ UBool
UnicodeString::allocate(int32_t capacity) {
if(capacity <= US_STACKBUF_SIZE) {
fUnion.fFields.fLengthAndFlags = kShortString;
- return TRUE;
+ return true;
}
if(capacity <= kMaxCapacity) {
++capacity; // for the NUL
@@ -389,13 +389,13 @@ UnicodeString::allocate(int32_t capacity) {
fUnion.fFields.fArray = (UChar *)array;
fUnion.fFields.fCapacity = (int32_t)(numBytes / U_SIZEOF_UCHAR);
fUnion.fFields.fLengthAndFlags = kLongString;
- return TRUE;
+ return true;
}
}
fUnion.fFields.fLengthAndFlags = kIsBogus;
fUnion.fFields.fArray = 0;
fUnion.fFields.fCapacity = 0;
- return FALSE;
+ return false;
}
//========================================
@@ -476,7 +476,7 @@ UnicodeString UnicodeString::fromUTF32(const UChar32 *utf32, int32_t length) {
result.setToBogus();
}
break;
- } while(TRUE);
+ } while(true);
return result;
}
@@ -491,7 +491,7 @@ UnicodeString::operator=(const UnicodeString &src) {
UnicodeString &
UnicodeString::fastCopyFrom(const UnicodeString &src) {
- return copyFrom(src, TRUE);
+ return copyFrom(src, true);
}
UnicodeString &
@@ -576,7 +576,7 @@ UnicodeString &UnicodeString::operator=(UnicodeString &&src) U_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();
- copyFieldsFrom(src, TRUE);
+ copyFieldsFrom(src, true);
return *this;
}
@@ -610,9 +610,9 @@ void UnicodeString::copyFieldsFrom(UnicodeString &src, UBool setSrcToBogus) U_NO
void UnicodeString::swap(UnicodeString &other) U_NOEXCEPT {
UnicodeString temp; // Empty short string: Known not to need releaseArray().
// Copy fields without resetting source values in between.
- temp.copyFieldsFrom(*this, FALSE);
- this->copyFieldsFrom(other, FALSE);
- other.copyFieldsFrom(temp, FALSE);
+ temp.copyFieldsFrom(*this, false);
+ this->copyFieldsFrom(other, false);
+ other.copyFieldsFrom(temp, false);
// Set temp to an empty string so that other's memory is not released twice.
temp.fUnion.fFields.fLengthAndFlags = kShortString;
}
@@ -761,7 +761,7 @@ UnicodeString::doCompareCodePointOrder(int32_t start,
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!=NULL)?(srcChars + srcStart):NULL, srcLength, false, true);
/* translate the 32-bit result into an 8-bit one */
if(diff!=0) {
return (int8_t)(diff >> 15 | 1);
@@ -921,7 +921,7 @@ UnicodeString::tempSubString(int32_t start, int32_t len) const {
array=fUnion.fStackFields.fBuffer; // anything not NULL because that would make an empty string
len=-2; // bogus result string
}
- return UnicodeString(FALSE, array + start, len);
+ return UnicodeString(false, array + start, len);
}
int32_t
@@ -972,7 +972,7 @@ UnicodeString::toUTF8(ByteSink &sink) const {
if(length16 != 0) {
char stackBuffer[1024];
int32_t capacity = (int32_t)sizeof(stackBuffer);
- UBool utf8IsOwned = FALSE;
+ UBool utf8IsOwned = false;
char *utf8 = sink.GetAppendBuffer(length16 < capacity ? length16 : capacity,
3*length16,
stackBuffer, capacity,
@@ -987,7 +987,7 @@ UnicodeString::toUTF8(ByteSink &sink) const {
if(errorCode == U_BUFFER_OVERFLOW_ERROR) {
utf8 = (char *)uprv_malloc(length8);
if(utf8 != NULL) {
- utf8IsOwned = TRUE;
+ utf8IsOwned = true;
errorCode = U_ZERO_ERROR;
u_strToUTF8WithSub(utf8, length8, &length8,
getBuffer(), length16,
@@ -1225,7 +1225,7 @@ UnicodeString::getTerminatedBuffer() {
if(len < getCapacity()) {
if(fUnion.fFields.fLengthAndFlags & kBufferIsReadonly) {
// If len<capacity on a read-only alias, then array[len] is
- // either the original NUL (if constructed with (TRUE, s, length))
+ // either the original NUL (if constructed with (true, s, length))
// or one of the original string contents characters (if later truncated),
// therefore we can assume that array[len] is initialized memory.
if(array[len] == 0) {
@@ -1375,7 +1375,7 @@ UnicodeString::replace(int32_t start,
UChar32 srcChar) {
UChar buffer[U16_MAX_LENGTH];
int32_t count = 0;
- UBool isError = FALSE;
+ UBool isError = false;
U16_APPEND(buffer, count, U16_MAX_LENGTH, srcChar, isError);
// We test isError so that the compiler does not complain that we don't.
// If isError (srcChar is not a valid code point) then count==0 which means
@@ -1387,7 +1387,7 @@ UnicodeString&
UnicodeString::append(UChar32 srcChar) {
UChar buffer[U16_MAX_LENGTH];
int32_t _length = 0;
- UBool isError = FALSE;
+ UBool isError = false;
U16_APPEND(buffer, _length, U16_MAX_LENGTH, srcChar, isError);
// We test isError so that the compiler does not complain that we don't.
// If isError then _length==0 which turns the doAppend() into a no-op anyway.
@@ -1484,7 +1484,7 @@ UnicodeString::doReplace(int32_t start,
return doReplace(start, length, copy.getArrayStart(), 0, srcLength);
}
- // cloneArrayIfNeeded(doCopyArray=FALSE) may change fArray but will not copy the current contents;
+ // 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];
if((fUnion.fFields.fLengthAndFlags&kUsingStackBuffer) && (newLength > US_STACKBUF_SIZE)) {
@@ -1497,7 +1497,7 @@ UnicodeString::doReplace(int32_t start,
// clone our array and allocate a bigger array if needed
int32_t *bufferToDelete = 0;
if(!cloneArrayIfNeeded(newLength, getGrowCapacity(newLength),
- FALSE, &bufferToDelete)
+ false, &bufferToDelete)
) {
return *this;
}
@@ -1637,14 +1637,14 @@ UnicodeString::copy(int32_t start, int32_t limit, int32_t dest) {
* so we implement this function here.
*/
UBool Replaceable::hasMetaData() const {
- return TRUE;
+ return true;
}
/**
* Replaceable API
*/
UBool UnicodeString::hasMetaData() const {
- return FALSE;
+ return false;
}
UnicodeString&
@@ -1662,7 +1662,7 @@ UnicodeString::doReverse(int32_t start, int32_t length) {
UChar *left = getArrayStart() + start;
UChar *right = left + length - 1; // -1 for inclusive boundary (length>=2)
UChar swap;
- UBool hasSupplementary = FALSE;
+ UBool hasSupplementary = false;
// Before the loop we know left<right because length>=2.
do {
@@ -1699,7 +1699,7 @@ UnicodeString::padLeading(int32_t targetLength,
{
int32_t oldLength = length();
if(oldLength >= targetLength || !cloneArrayIfNeeded(targetLength)) {
- return FALSE;
+ return false;
} else {
// move contents up by padding width
UChar *array = getArrayStart();
@@ -1711,7 +1711,7 @@ UnicodeString::padLeading(int32_t targetLength,
array[start] = padChar;
}
setLength(targetLength);
- return TRUE;
+ return true;
}
}
@@ -1721,7 +1721,7 @@ UnicodeString::padTrailing(int32_t targetLength,
{
int32_t oldLength = length();
if(oldLength >= targetLength || !cloneArrayIfNeeded(targetLength)) {
- return FALSE;
+ return false;
} else {
// fill in padding character
UChar *array = getArrayStart();
@@ -1730,7 +1730,7 @@ UnicodeString::padTrailing(int32_t targetLength,
array[length] = padChar;
}
setLength(targetLength);
- return TRUE;
+ return true;
}
}
@@ -1800,10 +1800,10 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
}
// while a getBuffer(minCapacity) is "open",
- // prevent any modifications of the string by returning FALSE here
+ // prevent any modifications of the string by returning false here
// if the string is bogus, then only an assignment or similar can revive it
if(!isWritable()) {
- return FALSE;
+ return false;
}
/*
@@ -1811,7 +1811,7 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
* the buffer is read-only, or
* the buffer is refCounted (shared), and refCount>1, or
* the buffer is too small.
- * Return FALSE if memory could not be allocated.
+ * Return false if memory could not be allocated.
*/
if(forceClone ||
fUnion.fFields.fLengthAndFlags & kBufferIsReadonly ||
@@ -1890,10 +1890,10 @@ UnicodeString::cloneArrayIfNeeded(int32_t newCapacity,
}
fUnion.fFields.fLengthAndFlags = flags;
setToBogus();
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
// UnicodeStringAppendable ------------------------------------------------- ***
@@ -1909,7 +1909,7 @@ UBool
UnicodeStringAppendable::appendCodePoint(UChar32 c) {
UChar buffer[U16_MAX_LENGTH];
int32_t cLength = 0;
- UBool isError = FALSE;
+ UBool isError = false;
U16_APPEND(buffer, cLength, U16_MAX_LENGTH, c, isError);
return !isError && str.doAppend(buffer, 0, cLength).isWritable();
}
@@ -1961,10 +1961,10 @@ uhash_compareUnicodeString(const UElement key1, const UElement key2) {
const UnicodeString *str1 = (const UnicodeString*) key1.pointer;
const UnicodeString *str2 = (const UnicodeString*) key2.pointer;
if (str1 == str2) {
- return TRUE;
+ return true;
}
if (str1 == NULL || str2 == NULL) {
- return FALSE;
+ return false;
}
return *str1 == *str2;
}