diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/charset | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/charset')
-rw-r--r-- | library/cpp/charset/ci_string.cpp | 2 | ||||
-rw-r--r-- | library/cpp/charset/codepage.cpp | 24 | ||||
-rw-r--r-- | library/cpp/charset/codepage.h | 12 | ||||
-rw-r--r-- | library/cpp/charset/codepage_ut.cpp | 18 | ||||
-rw-r--r-- | library/cpp/charset/cp_encrec.cpp | 2 | ||||
-rw-r--r-- | library/cpp/charset/generated/cp_data.cpp | 52 | ||||
-rw-r--r-- | library/cpp/charset/generated/encrec_data.cpp | 52 | ||||
-rw-r--r-- | library/cpp/charset/iconv_ut.cpp | 4 | ||||
-rw-r--r-- | library/cpp/charset/recyr.hh | 4 | ||||
-rw-r--r-- | library/cpp/charset/recyr_int.hh | 2 | ||||
-rw-r--r-- | library/cpp/charset/wide.h | 10 | ||||
-rw-r--r-- | library/cpp/charset/wide_ut.cpp | 12 |
12 files changed, 97 insertions, 97 deletions
diff --git a/library/cpp/charset/ci_string.cpp b/library/cpp/charset/ci_string.cpp index 6097e40131..24b53c8efc 100644 --- a/library/cpp/charset/ci_string.cpp +++ b/library/cpp/charset/ci_string.cpp @@ -36,6 +36,6 @@ size_t TCiString::hashVal(const char* s, size_t len, const CodePage& cp) { } template <> -void Out<TCiString>(IOutputStream& o, const TCiString& p) { +void Out<TCiString>(IOutputStream& o, const TCiString& p) { o.Write(p.data(), p.size()); } diff --git a/library/cpp/charset/codepage.cpp b/library/cpp/charset/codepage.cpp index 0431bef31b..3e5fe09f85 100644 --- a/library/cpp/charset/codepage.cpp +++ b/library/cpp/charset/codepage.cpp @@ -4,7 +4,7 @@ #include "codepage.h" #include <util/string/cast.h> -#include <util/string/subst.h> +#include <util/string/subst.h> #include <util/string/util.h> #include <util/system/hi_lo.h> #include <util/system/yassert.h> @@ -90,7 +90,7 @@ static const CodePage UNSUPPORTED_CODEPAGE = { "unsupported", }, {}, - nullptr, + nullptr, }; static const CodePage UNKNOWN_CODEPAGE = { @@ -99,15 +99,15 @@ static const CodePage UNKNOWN_CODEPAGE = { "unknown", }, {}, - nullptr, + nullptr, }; void NCodepagePrivate::TCodepagesMap::SetData(const CodePage* cp) { - Y_ASSERT(cp); + Y_ASSERT(cp); int code = static_cast<int>(cp->CPEnum) + DataShift; - Y_ASSERT(code >= 0 && code < DataSize); - Y_ASSERT(Data[code] == nullptr); + Y_ASSERT(code >= 0 && code < DataSize); + Y_ASSERT(Data[code] == nullptr); Data[code] = cp; } @@ -138,7 +138,7 @@ private: if (Data.find(name.c_str()) == Data.end()) { Data.insert(TData::value_type(Pool.Append(name.data(), name.size() + 1), code)); } else { - Y_ASSERT(Data.find(name.c_str())->second == code); + Y_ASSERT(Data.find(name.c_str())->second == code); } } @@ -172,7 +172,7 @@ public: AddName(ToString(static_cast<int>(i)), e); - for (size_t j = 0; (name = page->Names[j]) != nullptr && name[0]; ++j) { + for (size_t j = 0; (name = page->Names[j]) != nullptr && name[0]; ++j) { AddName(name, e); AddName(xPrefix + name, e); @@ -199,7 +199,7 @@ ECharset CharsetByName(TStringBuf name) { ECharset CharsetByNameOrDie(TStringBuf name) { ECharset result = CharsetByName(name); if (result == CODES_UNKNOWN) - ythrow yexception() << "CharsetByNameOrDie: unknown charset '" << name << "'"; + ythrow yexception() << "CharsetByNameOrDie: unknown charset '" << name << "'"; return result; } @@ -280,7 +280,7 @@ void DoDecodeUnknownPlane(TxChar* str, TxChar*& ee, const ECharset enc) { *s = Lo8(Lo16(*s)); } } else { - Y_ASSERT(!SingleByteCodepage(enc)); + Y_ASSERT(!SingleByteCodepage(enc)); TxChar* s = str; TxChar* d = str; @@ -295,10 +295,10 @@ void DoDecodeUnknownPlane(TxChar* str, TxChar*& ee, const ECharset enc) { } else { if (!buf.empty()) { if (RecodeToUnicode(enc, buf.data(), d, buf.size(), e - d, read, written) == RECODE_OK) { - Y_ASSERT(read == buf.size()); + Y_ASSERT(read == buf.size()); d += written; } else { // just copying broken symbols - Y_ASSERT(buf.size() <= static_cast<size_t>(e - d)); + Y_ASSERT(buf.size() <= static_cast<size_t>(e - d)); Copy(buf.data(), buf.size(), d); d += buf.size(); } diff --git a/library/cpp/charset/codepage.h b/library/cpp/charset/codepage.h index 30a02a4610..9e73fbd615 100644 --- a/library/cpp/charset/codepage.h +++ b/library/cpp/charset/codepage.h @@ -85,7 +85,7 @@ struct CodePage { static void Initialize(); inline bool SingleByteCodepage() const { - return DefaultChar != nullptr; + return DefaultChar != nullptr; } inline bool NativeCodepage() const { return SingleByteCodepage() || CPEnum == CODES_UTF8; @@ -103,7 +103,7 @@ namespace NCodepagePrivate { private: inline const CodePage* GetPrivate(ECharset e) const { - Y_ASSERT(e + DataShift >= 0 && e + DataShift < DataSize); + Y_ASSERT(e + DataShift >= 0 && e + DataShift < DataSize); return Data[e + DataShift]; } @@ -115,7 +115,7 @@ namespace NCodepagePrivate { inline const CodePage* Get(ECharset e) const { const CodePage* res = GetPrivate(e); if (!res->SingleByteCodepage()) { - ythrow yexception() << "CodePage (" << (int)e << ") structure can only be used for single byte encodings"; + ythrow yexception() << "CodePage (" << (int)e << ") structure can only be used for single byte encodings"; } return res; @@ -170,7 +170,7 @@ inline const char* NameByCharsetSafe(ECharset e) { if (CODES_UNKNOWN < e && e < CODES_MAX) return ::NCodepagePrivate::TCodepagesMap::Instance().NameByCharset(e); else - ythrow yexception() << "unknown encoding: " << (int)e; + ythrow yexception() << "unknown encoding: " << (int)e; } inline const char* NameByCodePage(const CodePage* CP) { @@ -180,7 +180,7 @@ inline const char* NameByCodePage(const CodePage* CP) { inline const CodePage* CodePageByName(const char* name) { ECharset code = CharsetByName(name); if (code == CODES_UNKNOWN) - return nullptr; + return nullptr; return CodePageByCharset(code); } @@ -204,7 +204,7 @@ struct Encoder { char code = Code(ch); if (code == 0 && ch != 0) code = DefaultChar[NUnicode::CharType(ch)]; - Y_ASSERT(code != 0 || ch == 0); + Y_ASSERT(code != 0 || ch == 0); return code; } diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp index c3ac3ac478..250e11bbf1 100644 --- a/library/cpp/charset/codepage_ut.cpp +++ b/library/cpp/charset/codepage_ut.cpp @@ -151,7 +151,7 @@ void TCodepageTest::TestUTF() { //"\xed\xbe\x80", //"\xed\xbf\xbf", }; - for (size_t i = 0; i < Y_ARRAY_SIZE(badStrings); ++i) { + for (size_t i = 0; i < Y_ARRAY_SIZE(badStrings); ++i) { wchar32 rune; const ui8* p = (const ui8*)badStrings[i]; size_t len; @@ -169,15 +169,15 @@ void TCodepageTest::TestBrokenMultibyte() { size_t nwritten = 0; size_t nread = 0; - RECODE_RESULT res = RecodeToUnicode(cp, sampletext, recodeResult, Y_ARRAY_SIZE(sampletext), Y_ARRAY_SIZE(recodeResult), nread, nwritten); + RECODE_RESULT res = RecodeToUnicode(cp, sampletext, recodeResult, Y_ARRAY_SIZE(sampletext), Y_ARRAY_SIZE(recodeResult), nread, nwritten); UNIT_ASSERT(res == RECODE_OK); UNIT_ASSERT(nread == 1); UNIT_ASSERT(nwritten == 0); const char bigSample[] = {'\xC3', '\x87', '\xC3', '\x8E', '\xC2', '\xB0', '\xC3', '\x85', '\xC3', '\x85', '\xC3', '\xB8'}; - res = RecodeToUnicode(cp, bigSample, recodeResult, Y_ARRAY_SIZE(bigSample), Y_ARRAY_SIZE(recodeResult), nread, nwritten); + res = RecodeToUnicode(cp, bigSample, recodeResult, Y_ARRAY_SIZE(bigSample), Y_ARRAY_SIZE(recodeResult), nread, nwritten); UNIT_ASSERT(res == RECODE_OK); - UNIT_ASSERT(nread == Y_ARRAY_SIZE(bigSample)); + UNIT_ASSERT(nread == Y_ARRAY_SIZE(bigSample)); } void TCodepageTest::TestUTFFromUnknownPlane() { @@ -191,7 +191,7 @@ void TCodepageTest::TestUTFFromUnknownPlane() { size_t readchars = 0; size_t writtenbytes = 0; - size_t samplelen = Y_ARRAY_SIZE(sampletext); + size_t samplelen = Y_ARRAY_SIZE(sampletext); RECODE_RESULT res = RecodeFromUnicode(CODES_UTF8, sampletext, bytebuffer, samplelen, BUFFER_SIZE, readchars, writtenbytes); @@ -291,11 +291,11 @@ static void TestSurrogates(const char* str, const wchar16* wide, size_t wideSize void TCodepageTest::TestSurrogatePairs() { const char* utf8NonBMP = "\xf4\x80\x89\x84\xf4\x80\x89\x87\xf4\x80\x88\xba"; wchar16 wNonBMPDummy[] = {0xDBC0, 0xDE44, 0xDBC0, 0xDE47, 0xDBC0, 0xDE3A}; - TestSurrogates(utf8NonBMP, wNonBMPDummy, Y_ARRAY_SIZE(wNonBMPDummy)); + TestSurrogates(utf8NonBMP, wNonBMPDummy, Y_ARRAY_SIZE(wNonBMPDummy)); const char* utf8NonBMP2 = "ab\xf4\x80\x89\x87n"; wchar16 wNonBMPDummy2[] = {'a', 'b', 0xDBC0, 0xDE47, 'n'}; - TestSurrogates(utf8NonBMP2, wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2)); + TestSurrogates(utf8NonBMP2, wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2)); } void TCodepageTest::TestEncodingHints() { @@ -329,7 +329,7 @@ void TCodepageTest::TestEncodingHints() { void TCodepageTest::TestToLower() { TTempBuf buf; char* data = buf.Data(); - const size_t n = Y_ARRAY_SIZE(yandexUpperCase); // including NTS + const size_t n = Y_ARRAY_SIZE(yandexUpperCase); // including NTS memcpy(data, yandexUpperCase, n); ToLower(data, n - 1); UNIT_ASSERT(strcmp(data, yandexLowerCase) == 0); @@ -338,7 +338,7 @@ void TCodepageTest::TestToLower() { void TCodepageTest::TestToUpper() { TTempBuf buf; char* data = buf.Data(); - const size_t n = Y_ARRAY_SIZE(yandexLowerCase); // including NTS + const size_t n = Y_ARRAY_SIZE(yandexLowerCase); // including NTS memcpy(data, yandexLowerCase, n); ToUpper(data, n - 1); UNIT_ASSERT(strcmp(data, yandexUpperCase) == 0); diff --git a/library/cpp/charset/cp_encrec.cpp b/library/cpp/charset/cp_encrec.cpp index e4570cd628..d3c7a9db66 100644 --- a/library/cpp/charset/cp_encrec.cpp +++ b/library/cpp/charset/cp_encrec.cpp @@ -16,7 +16,7 @@ void Encoder::Tr(const wchar32* in, char* out) const { void Recoder::Create(const CodePage& source, const Encoder* wideTarget) { for (size_t i = 0; i != 256; ++i) { Table[i] = wideTarget->Tr(source.unicode[i]); - Y_ASSERT(Table[i] != 0 || i == 0); + Y_ASSERT(Table[i] != 0 || i == 0); } } diff --git a/library/cpp/charset/generated/cp_data.cpp b/library/cpp/charset/generated/cp_data.cpp index 202362c596..ebe37f1a15 100644 --- a/library/cpp/charset/generated/cp_data.cpp +++ b/library/cpp/charset/generated/cp_data.cpp @@ -126,28 +126,28 @@ static const CodePage CODES_BIG5_CODE_PAGE = { CODES_BIG5, {"BIG5", "BIGFIVE", "CN-BIG5", "CSBIG5",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_BIG5_HKSCS_CODE_PAGE = { CODES_BIG5_HKSCS, {"BIG5-HKSCS", "BIG5-HKSCS:2004",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_BIG5_HKSCS_1999_CODE_PAGE = { CODES_BIG5_HKSCS_1999, {"BIG5-HKSCS:1999",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_BIG5_HKSCS_2001_CODE_PAGE = { CODES_BIG5_HKSCS_2001, {"BIG5-HKSCS:2001",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_CP1046_CODE_PAGE = { @@ -1274,70 +1274,70 @@ static const CodePage CODES_CP932_CODE_PAGE = { CODES_CP932, {"CP932",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_CP936_CODE_PAGE = { CODES_CP936, {"CP936",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_CP949_CODE_PAGE = { CODES_CP949, {"CP949", "UHC",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_CP950_CODE_PAGE = { CODES_CP950, {"CP950",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_EUC_CN_CODE_PAGE = { CODES_EUC_CN, {"EUC-CN", "CN-GB", "GB2312", "CSGB2312",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_EUC_JP_CODE_PAGE = { CODES_EUC_JP, {"EUC-JP", "EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE", "CSEUCPKDFMTJAPANESE",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_EUC_KR_CODE_PAGE = { CODES_EUC_KR, {"EUC-KR", "ISO-IR-149", "KOREAN", "KSC_5601", "KS_C_5601-1987", "KS_C_5601-1989", "CSEUCKR", "CSKSC56011987",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_EUC_TW_CODE_PAGE = { CODES_EUC_TW, {"EUC-TW", "CSEUCTW",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_GB18030_CODE_PAGE = { CODES_GB18030, {"GB18030",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_GBK_CODE_PAGE = { CODES_GBK, {"GBK",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_GEO_ITA_CODE_PAGE = { @@ -1464,7 +1464,7 @@ static const CodePage CODES_HZ_CODE_PAGE = { CODES_HZ, {"HZ", "HZ-GB-2312",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_IBM855_CODE_PAGE = { @@ -1711,42 +1711,42 @@ static const CodePage CODES_ISO_2022_CN_CODE_PAGE = { CODES_ISO_2022_CN, {"ISO-2022-CN", "CSISO2022CN",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_ISO_2022_CN_EXT_CODE_PAGE = { CODES_ISO_2022_CN_EXT, {"ISO-2022-CN-EXT",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_ISO_2022_JP_CODE_PAGE = { CODES_ISO_2022_JP, {"ISO-2022-JP", "CPISO2022JP",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_ISO_2022_JP_1_CODE_PAGE = { CODES_ISO_2022_JP_1, {"ISO-2022-JP-1",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_ISO_2022_JP_2_CODE_PAGE = { CODES_ISO_2022_JP_2, {"ISO-2022-JP-2", "CPISO2022JP2",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_ISO_2022_KR_CODE_PAGE = { CODES_ISO_2022_KR, {"ISO-2022-KR", "CSISO2022KR",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_ISO_8859_13_CODE_PAGE = { @@ -2193,7 +2193,7 @@ static const CodePage CODES_JOHAB_CODE_PAGE = { CODES_JOHAB, {"JOHAB", "CP1361",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_KAZWIN_CODE_PAGE = { @@ -3080,7 +3080,7 @@ static const CodePage CODES_SHIFT_JIS_CODE_PAGE = { CODES_SHIFT_JIS, {"SHIFT_JIS", "MS_KANJI", "SJIS", "CSSHIFTJIS",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_TATWIN_CODE_PAGE = { @@ -3287,21 +3287,21 @@ static const CodePage CODES_UTF8_CODE_PAGE = { CODES_UTF8, {"utf-8",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_UTF_16BE_CODE_PAGE = { CODES_UTF_16BE, {"UTF-16BE",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_UTF_16LE_CODE_PAGE = { CODES_UTF_16LE, {"UTF-16LE", "UTF-16",}, {}, - nullptr, + nullptr, }; // generated from multibyte.txt static const CodePage CODES_VISCII_CODE_PAGE = { diff --git a/library/cpp/charset/generated/encrec_data.cpp b/library/cpp/charset/generated/encrec_data.cpp index ca59f8ddef..3eb7fd3f2f 100644 --- a/library/cpp/charset/generated/encrec_data.cpp +++ b/library/cpp/charset/generated/encrec_data.cpp @@ -8302,10 +8302,10 @@ const Encoder* const NCodepagePrivate::TCodePageData::EncodeTo[] = { &encoder_07, &encoder_08, &encoder_09, - nullptr, - nullptr, + nullptr, + nullptr, &encoder_12, - nullptr, + nullptr, &encoder_14, &encoder_15, &encoder_16, @@ -8382,29 +8382,29 @@ const Encoder* const NCodepagePrivate::TCodePageData::EncodeTo[] = { &encoder_87, &encoder_88, &encoder_89, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, }; const struct Encoder &WideCharToYandex = encoder_09; diff --git a/library/cpp/charset/iconv_ut.cpp b/library/cpp/charset/iconv_ut.cpp index e8c56f6d49..c60c97307d 100644 --- a/library/cpp/charset/iconv_ut.cpp +++ b/library/cpp/charset/iconv_ut.cpp @@ -76,11 +76,11 @@ public: void TestSurrogatePairs() { const char* utf8NonBMP = "\xf4\x80\x89\x84\xf4\x80\x89\x87\xf4\x80\x88\xba"; wchar16 wNonBMPDummy[] = {0xDBC0, 0xDE44, 0xDBC0, 0xDE47, 0xDBC0, 0xDE3A}; - TestSurrogates(utf8NonBMP, wNonBMPDummy, Y_ARRAY_SIZE(wNonBMPDummy)); + TestSurrogates(utf8NonBMP, wNonBMPDummy, Y_ARRAY_SIZE(wNonBMPDummy)); const char* utf8NonBMP2 = "ab\xf4\x80\x89\x87n"; wchar16 wNonBMPDummy2[] = {'a', 'b', 0xDBC0, 0xDE47, 'n'}; - TestSurrogates(utf8NonBMP2, wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2)); + TestSurrogates(utf8NonBMP2, wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2)); } }; diff --git a/library/cpp/charset/recyr.hh b/library/cpp/charset/recyr.hh index 5ec8734bcf..5c560d770a 100644 --- a/library/cpp/charset/recyr.hh +++ b/library/cpp/charset/recyr.hh @@ -47,7 +47,7 @@ inline RECODE_RESULT RecodeFromUnicode(ECharset to, const TCharType* in, char* o } inline RECODE_RESULT RecodeFromUnicode(ECharset theEncoding, const wchar16* chars, size_t length, - char* bytes, size_t size, size_t* read = nullptr, size_t* written = nullptr) { + char* bytes, size_t size, size_t* read = nullptr, size_t* written = nullptr) { size_t w = 0, r = 0; RECODE_RESULT rc = ::RecodeFromUnicode(theEncoding, chars, bytes, length, size, r, w); if (read) @@ -122,7 +122,7 @@ inline bool Recode(ECharset from, ECharset to, const TStringBuf& in, TString& ou size_t inRead = 0; size_t outWritten = 0; const RECODE_RESULT res = Recode(from, to, in.data(), out.begin(), inSize, outSize, inRead, outWritten); - Y_ENSURE(RECODE_OK == res, "Recode failed. "); + Y_ENSURE(RECODE_OK == res, "Recode failed. "); if (outWritten > outSize) ythrow yexception() << "Recode overrun the buffer: size=" << outSize << " need=" << outWritten; diff --git a/library/cpp/charset/recyr_int.hh b/library/cpp/charset/recyr_int.hh index 353af53305..1ea917b70f 100644 --- a/library/cpp/charset/recyr_int.hh +++ b/library/cpp/charset/recyr_int.hh @@ -49,7 +49,7 @@ namespace NCodepagePrivate { inline RECODE_RESULT _recodeFromUTF8(ECharset to, const char* in, char* out, size_t in_size, size_t out_size, size_t& in_readed, size_t& out_writed) { if (to == CODES_UTF8) return _recodeCopy(in, out, in_size, out_size, in_readed, out_writed); - Y_ASSERT(CODES_UNKNOWN < to && to < CODES_MAX); + Y_ASSERT(CODES_UNKNOWN < to && to < CODES_MAX); const Encoder* enc = &EncoderByCharset(to); const unsigned char* in_start = (const unsigned char*)in; diff --git a/library/cpp/charset/wide.h b/library/cpp/charset/wide.h index 32d30e849e..6f17efabd9 100644 --- a/library/cpp/charset/wide.h +++ b/library/cpp/charset/wide.h @@ -18,7 +18,7 @@ //! @note @c dest buffer must fit at least @c len number of characters template <typename TCharType> inline size_t WideToChar(const TCharType* text, size_t len, char* dest, ECharset enc) { - Y_ASSERT(SingleByteCodepage(enc)); + Y_ASSERT(SingleByteCodepage(enc)); const char* start = dest; @@ -57,21 +57,21 @@ namespace NDetail { template <typename TCharType> inline TBasicStringBuf<TCharType> RecodeSingleByteChar(const TStringBuf src, TCharType* dst, const CodePage& cp) { - Y_ASSERT(cp.SingleByteCodepage()); + Y_ASSERT(cp.SingleByteCodepage()); ::CharToWide(src.data(), src.size(), dst, cp); return TBasicStringBuf<TCharType>(dst, src.size()); } template <typename TCharType> inline TStringBuf RecodeSingleByteChar(const TBasicStringBuf<TCharType> src, char* dst, const CodePage& cp) { - Y_ASSERT(cp.SingleByteCodepage()); + Y_ASSERT(cp.SingleByteCodepage()); ::WideToChar(src.data(), src.size(), dst, cp.CPEnum); return TStringBuf(dst, src.size()); } template <typename TCharType> inline TBasicStringBuf<TCharType> RecodeMultiByteChar(const TStringBuf src, TCharType* dst, ECharset encoding) { - Y_ASSERT(!NCodepagePrivate::NativeCodepage(encoding)); + Y_ASSERT(!NCodepagePrivate::NativeCodepage(encoding)); size_t read = 0; size_t written = 0; ::NICONVPrivate::RecodeToUnicode(encoding, src.data(), dst, src.size(), src.size(), read, written); @@ -80,7 +80,7 @@ namespace NDetail { template <typename TCharType> inline TStringBuf RecodeMultiByteChar(const TBasicStringBuf<TCharType> src, char* dst, ECharset encoding) { - Y_ASSERT(!NCodepagePrivate::NativeCodepage(encoding)); + Y_ASSERT(!NCodepagePrivate::NativeCodepage(encoding)); size_t read = 0; size_t written = 0; ::NICONVPrivate::RecodeFromUnicode(encoding, src.data(), dst, src.size(), src.size() * 3, read, written); diff --git a/library/cpp/charset/wide_ut.cpp b/library/cpp/charset/wide_ut.cpp index 78947d51ba..4acd822ea0 100644 --- a/library/cpp/charset/wide_ut.cpp +++ b/library/cpp/charset/wide_ut.cpp @@ -211,17 +211,17 @@ void TConversionTest::TestYandexEncoding() { const char* utf8NonBMP2 = "ab\xf4\x80\x89\x87n"; wchar16 wNonBMPDummy2[] = {'a', 'b', 0xDBC0, 0xDE47, 'n'}; - TestSurrogates(utf8NonBMP2, wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2), CODES_UTF8); + TestSurrogates(utf8NonBMP2, wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2), CODES_UTF8); { const char* yandexNonBMP2 = "ab?n"; - UNIT_ASSERT(yandexNonBMP2 == WideToChar(wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2), CODES_YANDEX)); + UNIT_ASSERT(yandexNonBMP2 == WideToChar(wNonBMPDummy2, Y_ARRAY_SIZE(wNonBMPDummy2), CODES_YANDEX)); TString temp; - temp.resize(Y_ARRAY_SIZE(wNonBMPDummy2)); + temp.resize(Y_ARRAY_SIZE(wNonBMPDummy2)); size_t read = 0; size_t written = 0; - RecodeFromUnicode(CODES_YANDEX, wNonBMPDummy2, temp.begin(), Y_ARRAY_SIZE(wNonBMPDummy2), temp.size(), read, written); + RecodeFromUnicode(CODES_YANDEX, wNonBMPDummy2, temp.begin(), Y_ARRAY_SIZE(wNonBMPDummy2), temp.size(), read, written); temp.remove(written); UNIT_ASSERT(yandexNonBMP2 == temp); @@ -337,7 +337,7 @@ void TConversionTest::TestRecodeAppend() { } template <> -void Out<RECODE_RESULT>(IOutputStream& out, RECODE_RESULT val) { +void Out<RECODE_RESULT>(IOutputStream& out, RECODE_RESULT val) { out << int(val); } @@ -390,7 +390,7 @@ void TConversionTest::TestUnicodeLimit() { continue; const CodePage* page = CodePageByCharset(code); - Y_ASSERT(page); + Y_ASSERT(page); for (int c = 0; c < 256; ++c) { UNIT_ASSERT(page->unicode[c] < 1 << 16); |