diff options
author | romankoshelev <romankoshelev@yandex-team.com> | 2023-08-14 19:51:50 +0300 |
---|---|---|
committer | romankoshelev <romankoshelev@yandex-team.com> | 2023-08-15 01:24:11 +0300 |
commit | cfcd865e05c0d0525ea27d1e153a043b32a85138 (patch) | |
tree | 68d3b3b25271e8a4998505897a269ff7ce119b76 /contrib/libs/icu/common/unistr_case.cpp | |
parent | ccb790c507bd5e8ffe2ef9886ce5ee0a7ce22a15 (diff) | |
download | ydb-cfcd865e05c0d0525ea27d1e153a043b32a85138.tar.gz |
Update ICU to 73.2
Diffstat (limited to 'contrib/libs/icu/common/unistr_case.cpp')
-rw-r--r-- | contrib/libs/icu/common/unistr_case.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/contrib/libs/icu/common/unistr_case.cpp b/contrib/libs/icu/common/unistr_case.cpp index 2138d60c01..57f307c203 100644 --- a/contrib/libs/icu/common/unistr_case.cpp +++ b/contrib/libs/icu/common/unistr_case.cpp @@ -41,13 +41,13 @@ U_NAMESPACE_BEGIN int8_t UnicodeString::doCaseCompare(int32_t start, int32_t length, - const UChar *srcChars, + const char16_t *srcChars, int32_t srcStart, int32_t srcLength, uint32_t options) 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; } @@ -55,12 +55,12 @@ UnicodeString::doCaseCompare(int32_t start, // pin indices to legal values pinIndices(start, length); - if(srcChars == NULL) { + if(srcChars == nullptr) { srcStart = srcLength = 0; } // get the correct pointer - const UChar *chars = getArrayStart(); + const char16_t *chars = getArrayStart(); chars += start; if(srcStart!=0) { @@ -98,8 +98,8 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER return *this; } - UChar oldBuffer[2 * US_STACKBUF_SIZE]; - UChar *oldArray; + char16_t oldBuffer[2 * US_STACKBUF_SIZE]; + char16_t *oldArray; int32_t oldLength = length(); int32_t newLength; UBool writable = isBufferWritable(); @@ -115,7 +115,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER if (writable ? oldLength <= UPRV_LENGTHOF(oldBuffer) : oldLength < US_STACKBUF_SIZE) { // Short string: Copy the contents into a temporary buffer and // case-map back into the current array, or into the stack buffer. - UChar *buffer = getArrayStart(); + char16_t *buffer = getArrayStart(); int32_t capacity; oldArray = oldBuffer; u_memcpy(oldBuffer, buffer, oldLength); @@ -123,7 +123,7 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER capacity = getCapacity(); } else { // Switch from the read-only alias or shared heap buffer to the stack buffer. - if (!cloneArrayIfNeeded(US_STACKBUF_SIZE, US_STACKBUF_SIZE, /* doCopyArray= */ FALSE)) { + if (!cloneArrayIfNeeded(US_STACKBUF_SIZE, US_STACKBUF_SIZE, /* doCopyArray= */ false)) { return *this; } U_ASSERT(fUnion.fFields.fLengthAndFlags & kUsingStackBuffer); @@ -132,13 +132,13 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER } #if !UCONFIG_NO_BREAK_ITERATION if (iter != nullptr) { - oldString.setTo(FALSE, oldArray, oldLength); + oldString.setTo(false, oldArray, oldLength); iter->setText(oldString); } #endif newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR buffer, capacity, - oldArray, oldLength, NULL, errorCode); + oldArray, oldLength, nullptr, errorCode); if (U_SUCCESS(errorCode)) { setLength(newLength); return *this; @@ -155,10 +155,10 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER // and often does not change its length. oldArray = getArrayStart(); Edits edits; - UChar replacementChars[200]; + char16_t replacementChars[200]; #if !UCONFIG_NO_BREAK_ITERATION if (iter != nullptr) { - oldString.setTo(FALSE, oldArray, oldLength); + oldString.setTo(false, oldArray, oldLength); iter->setText(oldString); } #endif @@ -194,14 +194,14 @@ UnicodeString::caseMap(int32_t caseLocale, uint32_t options, UCASEMAP_BREAK_ITER // and deletes the old array itself after it is done. // In addition, we are forcing cloneArrayIfNeeded() to always allocate a new array. int32_t *bufferToDelete = 0; - if (!cloneArrayIfNeeded(newLength, newLength, FALSE, &bufferToDelete, TRUE)) { + if (!cloneArrayIfNeeded(newLength, newLength, false, &bufferToDelete, true)) { return *this; } errorCode = U_ZERO_ERROR; // No need to iter->setText() again: The case mapper restarts via iter->first(). newLength = stringCaseMapper(caseLocale, options, UCASEMAP_BREAK_ITERATOR getArrayStart(), getCapacity(), - oldArray, oldLength, NULL, errorCode); + oldArray, oldLength, nullptr, errorCode); if (bufferToDelete) { uprv_free(bufferToDelete); } @@ -225,7 +225,7 @@ U_CAPI int32_t U_EXPORT2 uhash_hashCaselessUnicodeString(const UElement key) { U_NAMESPACE_USE const UnicodeString *str = (const UnicodeString*) key.pointer; - if (str == NULL) { + if (str == nullptr) { return 0; } // Inefficient; a better way would be to have a hash function in @@ -241,10 +241,10 @@ uhash_compareCaselessUnicodeString(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; + if (str1 == nullptr || str2 == nullptr) { + return false; } return str1->caseCompare(*str2, U_FOLD_CASE_DEFAULT) == 0; } |