aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/icu/common/unames.cpp
diff options
context:
space:
mode:
authormcheshkov <mcheshkov@yandex-team.ru>2022-02-10 16:46:16 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:16 +0300
commit1312621288956f199a5bd5342b0133d4395fa725 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/libs/icu/common/unames.cpp
parente9d19cec64684c9c1e6b0c98297e5b895cf904fe (diff)
downloadydb-1312621288956f199a5bd5342b0133d4395fa725.tar.gz
Restoring authorship annotation for <mcheshkov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/icu/common/unames.cpp')
-rw-r--r--contrib/libs/icu/common/unames.cpp88
1 files changed, 44 insertions, 44 deletions
diff --git a/contrib/libs/icu/common/unames.cpp b/contrib/libs/icu/common/unames.cpp
index 8edf868c41..5776058f95 100644
--- a/contrib/libs/icu/common/unames.cpp
+++ b/contrib/libs/icu/common/unames.cpp
@@ -1,4 +1,4 @@
-// © 2016 and later: Unicode, Inc. and others.
+// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
@@ -8,7 +8,7 @@
*
******************************************************************************
* file name: unames.c
-* encoding: UTF-8
+* encoding: UTF-8
* tab size: 8 (not used)
* indentation:4
*
@@ -212,13 +212,13 @@ isDataLoaded(UErrorCode *pErrorCode) {
return U_SUCCESS(*pErrorCode);
}
-#define WRITE_CHAR(buffer, bufferLength, bufferPos, c) UPRV_BLOCK_MACRO_BEGIN { \
+#define WRITE_CHAR(buffer, bufferLength, bufferPos, c) UPRV_BLOCK_MACRO_BEGIN { \
if((bufferLength)>0) { \
*(buffer)++=c; \
--(bufferLength); \
} \
++(bufferPos); \
-} UPRV_BLOCK_MACRO_END
+} UPRV_BLOCK_MACRO_END
#define U_ISO_COMMENT U_CHAR_NAME_CHOICE_COUNT
@@ -466,7 +466,7 @@ static uint16_t getExtName(uint32_t code, char *buffer, uint16_t bufferLength) {
buffer[--i] = (v < 10 ? '0' + v : 'A' + v - 10);
}
buffer += ndigits;
- length += static_cast<uint16_t>(ndigits);
+ length += static_cast<uint16_t>(ndigits);
WRITE_CHAR(buffer, bufferLength, length, '>');
return length;
@@ -1519,15 +1519,15 @@ U_CAPI UChar32 U_EXPORT2
u_charFromName(UCharNameChoice nameChoice,
const char *name,
UErrorCode *pErrorCode) {
- char upper[120] = {0};
- char lower[120] = {0};
+ char upper[120] = {0};
+ char lower[120] = {0};
FindName findName;
AlgorithmicRange *algRange;
uint32_t *p;
uint32_t i;
UChar32 cp = 0;
char c0;
- static constexpr UChar32 error = 0xffff; /* Undefined, but use this for backwards compatibility. */
+ static constexpr UChar32 error = 0xffff; /* Undefined, but use this for backwards compatibility. */
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return error;
@@ -1561,45 +1561,45 @@ u_charFromName(UCharNameChoice nameChoice,
/* try extended names first */
if (lower[0] == '<') {
- if (nameChoice == U_EXTENDED_CHAR_NAME && lower[--i] == '>') {
+ if (nameChoice == U_EXTENDED_CHAR_NAME && lower[--i] == '>') {
// Parse a string like "<category-HHHH>" where HHHH is a hex code point.
- uint32_t limit = i;
- while (i >= 3 && lower[--i] != '-') {}
-
- // There should be 1 to 8 hex digits.
- int32_t hexLength = limit - (i + 1);
- if (i >= 2 && lower[i] == '-' && 1 <= hexLength && hexLength <= 8) {
- uint32_t cIdx;
-
- lower[i] = 0;
-
- for (++i; i < limit; ++i) {
- if (lower[i] >= '0' && lower[i] <= '9') {
- cp = (cp << 4) + lower[i] - '0';
- } else if (lower[i] >= 'a' && lower[i] <= 'f') {
- cp = (cp << 4) + lower[i] - 'a' + 10;
- } else {
- *pErrorCode = U_ILLEGAL_CHAR_FOUND;
- return error;
+ uint32_t limit = i;
+ while (i >= 3 && lower[--i] != '-') {}
+
+ // There should be 1 to 8 hex digits.
+ int32_t hexLength = limit - (i + 1);
+ if (i >= 2 && lower[i] == '-' && 1 <= hexLength && hexLength <= 8) {
+ uint32_t cIdx;
+
+ lower[i] = 0;
+
+ for (++i; i < limit; ++i) {
+ if (lower[i] >= '0' && lower[i] <= '9') {
+ cp = (cp << 4) + lower[i] - '0';
+ } else if (lower[i] >= 'a' && lower[i] <= 'f') {
+ cp = (cp << 4) + lower[i] - 'a' + 10;
+ } else {
+ *pErrorCode = U_ILLEGAL_CHAR_FOUND;
+ return error;
+ }
+ // Prevent signed-integer overflow and out-of-range code points.
+ if (cp > UCHAR_MAX_VALUE) {
+ *pErrorCode = U_ILLEGAL_CHAR_FOUND;
+ return error;
}
- // Prevent signed-integer overflow and out-of-range code points.
- if (cp > UCHAR_MAX_VALUE) {
- *pErrorCode = U_ILLEGAL_CHAR_FOUND;
- return error;
- }
- }
-
- /* Now validate the category name.
- We could use a binary search, or a trie, if
- we really wanted to. */
- uint8_t cat = getCharCat(cp);
- for (lower[i] = 0, cIdx = 0; cIdx < UPRV_LENGTHOF(charCatNames); ++cIdx) {
-
- if (!uprv_strcmp(lower + 1, charCatNames[cIdx])) {
- if (cat == cIdx) {
- return cp;
+ }
+
+ /* Now validate the category name.
+ We could use a binary search, or a trie, if
+ we really wanted to. */
+ uint8_t cat = getCharCat(cp);
+ for (lower[i] = 0, cIdx = 0; cIdx < UPRV_LENGTHOF(charCatNames); ++cIdx) {
+
+ if (!uprv_strcmp(lower + 1, charCatNames[cIdx])) {
+ if (cat == cIdx) {
+ return cp;
}
- break;
+ break;
}
}
}