diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
commit | baa58daefa91fde4b4769facdbd2903763b9c6a8 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/charset | |
parent | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (diff) | |
download | ydb-baa58daefa91fde4b4769facdbd2903763b9c6a8.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/charset')
-rw-r--r-- | util/charset/utf8.cpp | 22 | ||||
-rw-r--r-- | util/charset/utf8.h | 6 | ||||
-rw-r--r-- | util/charset/utf8_ut.cpp | 8 |
3 files changed, 18 insertions, 18 deletions
diff --git a/util/charset/utf8.cpp b/util/charset/utf8.cpp index a18a84dad1..efe3a52f61 100644 --- a/util/charset/utf8.cpp +++ b/util/charset/utf8.cpp @@ -55,19 +55,19 @@ namespace { // before each iteration (including the first one) variable 'cNew' contains unwritten symbol while (true) { size_t cNewLen; - Y_ASSERT((writePtr - newString.data()) + destSpace == newString.size()); + Y_ASSERT((writePtr - newString.data()) + destSpace == newString.size()); if (RECODE_EOOUTPUT == SafeWriteUTF8Char(cNew, cNewLen, (unsigned char*)writePtr, destSpace)) { - destSpace += newString.size(); - newString.resize(newString.size() * 2); - writePtr = newString.begin() + (newString.size() - destSpace); + destSpace += newString.size(); + newString.resize(newString.size() * 2); + writePtr = newString.begin() + (newString.size() - destSpace); continue; } destSpace -= cNewLen; writePtr += cNewLen; p += cLen; if (p == end) { - newString.resize(newString.size() - destSpace); + newString.resize(newString.size() - destSpace); return true; } wchar32 c = 0; @@ -135,14 +135,14 @@ bool ToLowerUTF8Impl(const char* beg, size_t n, TString& newString) { TString ToLowerUTF8(const TString& s) { TString newString; - bool changed = ToLowerUTF8Impl(s.data(), s.size(), newString); + bool changed = ToLowerUTF8Impl(s.data(), s.size(), newString); return changed ? newString : s; } TString ToLowerUTF8(TStringBuf s) { TString newString; - bool changed = ToLowerUTF8Impl(s.data(), s.size(), newString); - return changed ? newString : TString(s.data(), s.size()); + bool changed = ToLowerUTF8Impl(s.data(), s.size(), newString); + return changed ? newString : TString(s.data(), s.size()); } TString ToLowerUTF8(const char* s) { @@ -155,14 +155,14 @@ bool ToUpperUTF8Impl(const char* beg, size_t n, TString& newString) { TString ToUpperUTF8(const TString& s) { TString newString; - bool changed = ToUpperUTF8Impl(s.data(), s.size(), newString); + bool changed = ToUpperUTF8Impl(s.data(), s.size(), newString); return changed ? newString : s; } TString ToUpperUTF8(TStringBuf s) { TString newString; - bool changed = ToUpperUTF8Impl(s.data(), s.size(), newString); - return changed ? newString : TString(s.data(), s.size()); + bool changed = ToUpperUTF8Impl(s.data(), s.size(), newString); + return changed ? newString : TString(s.data(), s.size()); } TString ToUpperUTF8(const char* s) { diff --git a/util/charset/utf8.h b/util/charset/utf8.h index c4708be9be..5039b46ae9 100644 --- a/util/charset/utf8.h +++ b/util/charset/utf8.h @@ -133,7 +133,7 @@ inline bool GetNumberOfUTF8Chars(const char* text, size_t len, size_t& number) { inline size_t GetNumberOfUTF8Chars(TStringBuf text) { size_t number; - if (!GetNumberOfUTF8Chars(text.data(), text.size(), number)) { + if (!GetNumberOfUTF8Chars(text.data(), text.size(), number)) { ythrow yexception() << "GetNumberOfUTF8Chars failed on invalid utf-8 " << TString(text.substr(0, 50)).Quote(); } return number; @@ -356,7 +356,7 @@ enum EUTF8Detect { EUTF8Detect UTF8Detect(const char* s, size_t len); inline EUTF8Detect UTF8Detect(const TStringBuf input) { - return UTF8Detect(input.data(), input.size()); + return UTF8Detect(input.data(), input.size()); } inline bool IsUtf(const char* input, size_t len) { @@ -364,7 +364,7 @@ inline bool IsUtf(const char* input, size_t len) { } inline bool IsUtf(const TStringBuf input) { - return IsUtf(input.data(), input.size()); + return IsUtf(input.data(), input.size()); } //! returns true, if result is not the same as input, and put it in newString diff --git a/util/charset/utf8_ut.cpp b/util/charset/utf8_ut.cpp index 8f8e6996c5..9e68881cca 100644 --- a/util/charset/utf8_ut.cpp +++ b/util/charset/utf8_ut.cpp @@ -21,8 +21,8 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) { TString s = "привет!"; TString q = "ПРИВЕТ!"; TString tmp; - UNIT_ASSERT(ToLowerUTF8Impl(s.data(), s.size(), tmp) == false); - UNIT_ASSERT(ToLowerUTF8Impl(q.data(), q.size(), tmp) == true); + UNIT_ASSERT(ToLowerUTF8Impl(s.data(), s.size(), tmp) == false); + UNIT_ASSERT(ToLowerUTF8Impl(q.data(), q.size(), tmp) == true); } { @@ -61,8 +61,8 @@ Y_UNIT_TEST_SUITE(TUtfUtilTest) { TString s = "ПРИВЕТ!"; TString q = "привет!"; TString tmp; - UNIT_ASSERT(ToUpperUTF8Impl(s.data(), s.size(), tmp) == false); - UNIT_ASSERT(ToUpperUTF8Impl(q.data(), q.size(), tmp) == true); + UNIT_ASSERT(ToUpperUTF8Impl(s.data(), s.size(), tmp) == false); + UNIT_ASSERT(ToUpperUTF8Impl(q.data(), q.size(), tmp) == true); } { |