diff options
author | aosipenko <aosipenko@yandex-team.ru> | 2022-02-10 16:48:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:08 +0300 |
commit | 948fd24d47d4b3b7815aaef1686aea00ef3f4288 (patch) | |
tree | 8ad4c39c2a5f8b341bc02e3b0c5e8f26c40373cb /library/cpp | |
parent | d2eb4aae699fa2f6901bf32d22eec019c8f29838 (diff) | |
download | ydb-948fd24d47d4b3b7815aaef1686aea00ef3f4288.tar.gz |
Restoring authorship annotation for <aosipenko@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
46 files changed, 380 insertions, 380 deletions
diff --git a/library/cpp/archive/yarchive.cpp b/library/cpp/archive/yarchive.cpp index 1becc3e5da..b750ac1c81 100644 --- a/library/cpp/archive/yarchive.cpp +++ b/library/cpp/archive/yarchive.cpp @@ -310,7 +310,7 @@ public: ythrow yexception() << "incorrect index"; } - + inline bool Has(const TStringBuf key) const { return Dict_.contains(key); } @@ -378,9 +378,9 @@ TString TArchiveReader::KeyByIndex(size_t n) const { } bool TArchiveReader::Has(const TStringBuf key) const { - return Impl_->Has(key); -} - + return Impl_->Has(key); +} + TAutoPtr<IInputStream> TArchiveReader::ObjectByKey(const TStringBuf key) const { return Impl_->ObjectByKey(key); } diff --git a/library/cpp/blockcodecs/core/stream.cpp b/library/cpp/blockcodecs/core/stream.cpp index 4f7db3c32b..bf1a9043a8 100644 --- a/library/cpp/blockcodecs/core/stream.cpp +++ b/library/cpp/blockcodecs/core/stream.cpp @@ -172,7 +172,7 @@ size_t TDecodedInput::DoUnboundedNext(const void** ptr) { const size_t payload = sizeof(TCodecID) + sizeof(TBlockLen); char buf[32]; - S_->LoadOrFail(buf, payload); + S_->LoadOrFail(buf, payload); TMemoryInput in(buf, payload); diff --git a/library/cpp/charset/codepage.cpp b/library/cpp/charset/codepage.cpp index 0431bef31b..5616dfcd3a 100644 --- a/library/cpp/charset/codepage.cpp +++ b/library/cpp/charset/codepage.cpp @@ -146,16 +146,16 @@ private: AddNameWithCheck(name, code); TString temp = name; - RemoveAll(temp, '-'); - RemoveAll(temp, '_'); + RemoveAll(temp, '-'); + RemoveAll(temp, '_'); AddNameWithCheck(temp, code); temp = name; - SubstGlobal(temp, '-', '_'); + SubstGlobal(temp, '-', '_'); AddNameWithCheck(temp, code); temp = name; - SubstGlobal(temp, '_', '-'); + SubstGlobal(temp, '_', '-'); AddNameWithCheck(temp, code); } diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp index c3ac3ac478..11ae010b6e 100644 --- a/library/cpp/charset/codepage_ut.cpp +++ b/library/cpp/charset/codepage_ut.cpp @@ -12,21 +12,21 @@ #endif namespace { - const char yandexUpperCase[] = + const char yandexUpperCase[] = "\x81\x82\x83\x84\x85\x86\x87" "\x8E" "\xA1\xA2\xA3\xA4\xA5\xA6" "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF" - "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF" - "\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF"; + "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF" + "\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF"; - const char yandexLowerCase[] = + const char yandexLowerCase[] = "\x91\x92\x93\x94\x95\x96\x97" "\x9E" "\xB1\xB2\xB3\xB4\xB5\xB6" "\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF" - "\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF" - "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; + "\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF" + "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; } class TCodepageTest: public TTestBase { @@ -163,7 +163,7 @@ void TCodepageTest::TestUTF() { void TCodepageTest::TestBrokenMultibyte() { const ECharset cp = CODES_EUC_JP; - const char sampletext[] = {'\xe3'}; + const char sampletext[] = {'\xe3'}; wchar32 recodeResult[100]; size_t nwritten = 0; @@ -332,7 +332,7 @@ void TCodepageTest::TestToLower() { const size_t n = Y_ARRAY_SIZE(yandexUpperCase); // including NTS memcpy(data, yandexUpperCase, n); ToLower(data, n - 1); - UNIT_ASSERT(strcmp(data, yandexLowerCase) == 0); + UNIT_ASSERT(strcmp(data, yandexLowerCase) == 0); } void TCodepageTest::TestToUpper() { @@ -341,7 +341,7 @@ void TCodepageTest::TestToUpper() { const size_t n = Y_ARRAY_SIZE(yandexLowerCase); // including NTS memcpy(data, yandexLowerCase, n); ToUpper(data, n - 1); - UNIT_ASSERT(strcmp(data, yandexUpperCase) == 0); + UNIT_ASSERT(strcmp(data, yandexUpperCase) == 0); } static void TestCanEncodeEmpty() { diff --git a/library/cpp/charset/generated/encrec_data.cpp b/library/cpp/charset/generated/encrec_data.cpp index ca59f8ddef..26a5066d3c 100644 --- a/library/cpp/charset/generated/encrec_data.cpp +++ b/library/cpp/charset/generated/encrec_data.cpp @@ -614,8 +614,8 @@ static const char PP_35[257] = "\000\000\000\000"; #define P35 (char*)PP_35 static const char PP_36[257] = - "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" + "\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8410,8 +8410,8 @@ const Encoder* const NCodepagePrivate::TCodePageData::EncodeTo[] = { const struct Encoder &WideCharToYandex = encoder_09; const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8425,8 +8425,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351" "\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373" "\374\375\376\377"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8440,8 +8440,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\374\373\347\370\375\371\367\372\336\300\301\326\304\305\324\303\325\310" "\311\312\313\314\315\316\317\337\320\321\322\323\306\302\334\333\307\330" "\335\331\327\332"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8455,8 +8455,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\260\260\260\260\260\260\260\260\360\361\362\363\364\365\366\367\370\371" "\372\373\374\375\376\377\250\270\256\276\257\277\254\274\260\075\055\075" "\267\044\260\240"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8470,8 +8470,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\254\274\246\266\267\250\270\377\340\341\342\343\344\345\346\347\350\351" "\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373" "\374\375\376\044"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8485,8 +8485,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371" "\372\373\374\375\376\377\267\270\266\343\276\266\275\277\266\266\266\266" "\352\247\274\266"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8500,8 +8500,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\246\125\125\125\203\131\246\220\210\141\211\141\221\141\266\212\213\214" "\215\230\151\151\231\232\266\156\157\262\233\157\222\075\266\234\165\235" "\223\171\266\171"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8515,8 +8515,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\260\260\260\260\260\260\260\260\260\260\260\260\260\260\260\260\260\260" "\260\260\260\260\260\260\260\260\260\260\260\260\260\260\260\260\260\260" "\260\260\260\260"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8530,8 +8530,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\122\125\125\125\203\131\124\220\162\141\211\141\221\154\225\212\143\214" "\226\230\145\151\231\144\266\261\156\262\233\157\222\075\162\165\165\165" "\223\171\164\140"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8545,8 +8545,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\122\125\125\125\203\131\124\220\162\141\211\141\221\154\225\212\143\214" "\226\230\145\151\231\144\266\261\156\262\233\157\222\075\162\165\165\165" "\223\171\164\140"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8562,8 +8562,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\374\375\376\377"},}, {{},}, {{},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -8593,8 +8593,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9744,8 +9744,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_to_yandex[] = { }; const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9759,8 +9759,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351" "\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373" "\374\375\376\377"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9774,8 +9774,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\373\375\377\371\370\374\340\361\301\302\327\307\304\305\326\332\311\312" "\313\314\315\316\317\320\322\323\324\325\306\310\303\336\333\335\337\331" "\330\334\300\321"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9789,8 +9789,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251" "\252\253\254\255\256\257\340\341\342\343\344\345\346\347\350\351\352\353" "\354\355\356\357"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9804,8 +9804,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\230\231\232\233\234\235\236\237\340\341\342\343\344\345\346\347\350\351" "\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373" "\374\375\376\337"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9819,8 +9819,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331" "\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353" "\354\355\356\357"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9834,8 +9834,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9849,8 +9849,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9864,8 +9864,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9879,8 +9879,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9896,8 +9896,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\374\375\376\377"},}, {{},}, {{},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" @@ -9927,8 +9927,8 @@ const Recoder NCodepagePrivate::TCodePageData::rcdr_from_yandex[] = { "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077\077" "\077\077\077\077"},}, -{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" - "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" +{{"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021" + "\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043" "\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065" "\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107" "\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131" diff --git a/library/cpp/charset/wide_ut.cpp b/library/cpp/charset/wide_ut.cpp index 78947d51ba..218a329041 100644 --- a/library/cpp/charset/wide_ut.cpp +++ b/library/cpp/charset/wide_ut.cpp @@ -1,6 +1,6 @@ #include "wide.h" #include "codepage.h" -#include "recyr.hh" +#include "recyr.hh" #include <library/cpp/testing/unittest/registar.h> @@ -12,25 +12,25 @@ namespace { //! three UTF8 encoded russian letters (A, B, V) - const char yandexCyrillicAlphabet[] = - "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF" // A - P - "\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF" // R - YA - "\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF" // a - p - "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; // r - ya + const char yandexCyrillicAlphabet[] = + "\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF" // A - P + "\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF" // R - YA + "\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF" // a - p + "\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; // r - ya const wchar16 wideCyrillicAlphabet[] = { 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F, 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, 0x00}; - const char utf8CyrillicAlphabet[] = - "\xd0\x90\xd0\x91\xd0\x92\xd0\x93\xd0\x94\xd0\x95\xd0\x96\xd0\x97" - "\xd0\x98\xd0\x99\xd0\x9a\xd0\x9b\xd0\x9c\xd0\x9d\xd0\x9e\xd0\x9f" - "\xd0\xa0\xd0\xa1\xd0\xa2\xd0\xa3\xd0\xa4\xd0\xa5\xd0\xa6\xd0\xa7" - "\xd0\xa8\xd0\xa9\xd0\xaa\xd0\xab\xd0\xac\xd0\xad\xd0\xae\xd0\xaf" - "\xd0\xb0\xd0\xb1\xd0\xb2\xd0\xb3\xd0\xb4\xd0\xb5\xd0\xb6\xd0\xb7" - "\xd0\xb8\xd0\xb9\xd0\xba\xd0\xbb\xd0\xbc\xd0\xbd\xd0\xbe\xd0\xbf" - "\xd1\x80\xd1\x81\xd1\x82\xd1\x83\xd1\x84\xd1\x85\xd1\x86\xd1\x87" - "\xd1\x88\xd1\x89\xd1\x8a\xd1\x8b\xd1\x8c\xd1\x8d\xd1\x8e\xd1\x8f"; + const char utf8CyrillicAlphabet[] = + "\xd0\x90\xd0\x91\xd0\x92\xd0\x93\xd0\x94\xd0\x95\xd0\x96\xd0\x97" + "\xd0\x98\xd0\x99\xd0\x9a\xd0\x9b\xd0\x9c\xd0\x9d\xd0\x9e\xd0\x9f" + "\xd0\xa0\xd0\xa1\xd0\xa2\xd0\xa3\xd0\xa4\xd0\xa5\xd0\xa6\xd0\xa7" + "\xd0\xa8\xd0\xa9\xd0\xaa\xd0\xab\xd0\xac\xd0\xad\xd0\xae\xd0\xaf" + "\xd0\xb0\xd0\xb1\xd0\xb2\xd0\xb3\xd0\xb4\xd0\xb5\xd0\xb6\xd0\xb7" + "\xd0\xb8\xd0\xb9\xd0\xba\xd0\xbb\xd0\xbc\xd0\xbd\xd0\xbe\xd0\xbf" + "\xd1\x80\xd1\x81\xd1\x82\xd1\x83\xd1\x84\xd1\x85\xd1\x86\xd1\x87" + "\xd1\x88\xd1\x89\xd1\x8a\xd1\x8b\xd1\x8c\xd1\x8d\xd1\x8e\xd1\x8f"; TString CreateYandexText() { const int len = 256; @@ -69,31 +69,31 @@ namespace { } TString CreateUTF8Text() { - char text[] = { - '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', - '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', - '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', - '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', - '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', - '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', - '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', - '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', - '\xcc', '\x81', '\xc3', '\x84', '\xc3', '\x96', '\xc3', '\x9c', '\xc4', '\x84', '\xc4', '\x86', '\xc4', '\x98', '\xc5', '\x81', - '\xc3', '\xa0', '\xc3', '\xa2', '\xc3', '\xa7', '\xc3', '\xa8', '\xc3', '\xa9', '\xc3', '\xaa', '\xd2', '\x90', '\xc2', '\xad', - '\xc3', '\x9f', '\xc3', '\xa4', '\xc3', '\xb6', '\xc3', '\xbc', '\xc4', '\x85', '\xc4', '\x87', '\xc4', '\x99', '\xc5', '\x82', - '\xc3', '\xab', '\xc3', '\xae', '\xc3', '\xaf', '\xc3', '\xb4', '\xc3', '\xb9', '\xc3', '\xbb', '\xd2', '\x91', '\xe9', '\x8b', - '\x8f', '\xc2', '\xa0', '\xc5', '\x83', '\xc3', '\x93', '\xc5', '\x9a', '\xc5', '\xbb', '\xc5', '\xb9', '\xd1', '\xac', '\xc2', - '\xa7', '\xd0', '\x81', '\xd1', '\xa2', '\xd1', '\xb2', '\xd1', '\xb4', '\xd0', '\x8e', '\xd0', '\x86', '\xd0', '\x84', '\xd0', - '\x87', '\xc2', '\xb0', '\xc5', '\x84', '\xc3', '\xb3', '\xc5', '\x9b', '\xc5', '\xbc', '\xc5', '\xba', '\xd1', '\xad', '\xe2', - '\x84', '\x96', '\xd1', '\x91', '\xd1', '\xa3', '\xd1', '\xb3', '\xd1', '\xb5', '\xd1', '\x9e', '\xd1', '\x96', '\xd1', '\x94', - '\xd1', '\x97', '\xd0', '\x90', '\xd0', '\x91', '\xd0', '\x92', '\xd0', '\x93', '\xd0', '\x94', '\xd0', '\x95', '\xd0', '\x96', - '\xd0', '\x97', '\xd0', '\x98', '\xd0', '\x99', '\xd0', '\x9a', '\xd0', '\x9b', '\xd0', '\x9c', '\xd0', '\x9d', '\xd0', '\x9e', - '\xd0', '\x9f', '\xd0', '\xa0', '\xd0', '\xa1', '\xd0', '\xa2', '\xd0', '\xa3', '\xd0', '\xa4', '\xd0', '\xa5', '\xd0', '\xa6', - '\xd0', '\xa7', '\xd0', '\xa8', '\xd0', '\xa9', '\xd0', '\xaa', '\xd0', '\xab', '\xd0', '\xac', '\xd0', '\xad', '\xd0', '\xae', - '\xd0', '\xaf', '\xd0', '\xb0', '\xd0', '\xb1', '\xd0', '\xb2', '\xd0', '\xb3', '\xd0', '\xb4', '\xd0', '\xb5', '\xd0', '\xb6', - '\xd0', '\xb7', '\xd0', '\xb8', '\xd0', '\xb9', '\xd0', '\xba', '\xd0', '\xbb', '\xd0', '\xbc', '\xd0', '\xbd', '\xd0', '\xbe', - '\xd0', '\xbf', '\xd1', '\x80', '\xd1', '\x81', '\xd1', '\x82', '\xd1', '\x83', '\xd1', '\x84', '\xd1', '\x85', '\xd1', '\x86', - '\xd1', '\x87', '\xd1', '\x88', '\xd1', '\x89', '\xd1', '\x8a', '\xd1', '\x8b', '\xd1', '\x8c', '\xd1', '\x8d', '\xd1', '\x8e', + char text[] = { + '\x00', '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08', '\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', + '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17', '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', + '\x20', '\x21', '\x22', '\x23', '\x24', '\x25', '\x26', '\x27', '\x28', '\x29', '\x2a', '\x2b', '\x2c', '\x2d', '\x2e', '\x2f', + '\x30', '\x31', '\x32', '\x33', '\x34', '\x35', '\x36', '\x37', '\x38', '\x39', '\x3a', '\x3b', '\x3c', '\x3d', '\x3e', '\x3f', + '\x40', '\x41', '\x42', '\x43', '\x44', '\x45', '\x46', '\x47', '\x48', '\x49', '\x4a', '\x4b', '\x4c', '\x4d', '\x4e', '\x4f', + '\x50', '\x51', '\x52', '\x53', '\x54', '\x55', '\x56', '\x57', '\x58', '\x59', '\x5a', '\x5b', '\x5c', '\x5d', '\x5e', '\x5f', + '\x60', '\x61', '\x62', '\x63', '\x64', '\x65', '\x66', '\x67', '\x68', '\x69', '\x6a', '\x6b', '\x6c', '\x6d', '\x6e', '\x6f', + '\x70', '\x71', '\x72', '\x73', '\x74', '\x75', '\x76', '\x77', '\x78', '\x79', '\x7a', '\x7b', '\x7c', '\x7d', '\x7e', '\x7f', + '\xcc', '\x81', '\xc3', '\x84', '\xc3', '\x96', '\xc3', '\x9c', '\xc4', '\x84', '\xc4', '\x86', '\xc4', '\x98', '\xc5', '\x81', + '\xc3', '\xa0', '\xc3', '\xa2', '\xc3', '\xa7', '\xc3', '\xa8', '\xc3', '\xa9', '\xc3', '\xaa', '\xd2', '\x90', '\xc2', '\xad', + '\xc3', '\x9f', '\xc3', '\xa4', '\xc3', '\xb6', '\xc3', '\xbc', '\xc4', '\x85', '\xc4', '\x87', '\xc4', '\x99', '\xc5', '\x82', + '\xc3', '\xab', '\xc3', '\xae', '\xc3', '\xaf', '\xc3', '\xb4', '\xc3', '\xb9', '\xc3', '\xbb', '\xd2', '\x91', '\xe9', '\x8b', + '\x8f', '\xc2', '\xa0', '\xc5', '\x83', '\xc3', '\x93', '\xc5', '\x9a', '\xc5', '\xbb', '\xc5', '\xb9', '\xd1', '\xac', '\xc2', + '\xa7', '\xd0', '\x81', '\xd1', '\xa2', '\xd1', '\xb2', '\xd1', '\xb4', '\xd0', '\x8e', '\xd0', '\x86', '\xd0', '\x84', '\xd0', + '\x87', '\xc2', '\xb0', '\xc5', '\x84', '\xc3', '\xb3', '\xc5', '\x9b', '\xc5', '\xbc', '\xc5', '\xba', '\xd1', '\xad', '\xe2', + '\x84', '\x96', '\xd1', '\x91', '\xd1', '\xa3', '\xd1', '\xb3', '\xd1', '\xb5', '\xd1', '\x9e', '\xd1', '\x96', '\xd1', '\x94', + '\xd1', '\x97', '\xd0', '\x90', '\xd0', '\x91', '\xd0', '\x92', '\xd0', '\x93', '\xd0', '\x94', '\xd0', '\x95', '\xd0', '\x96', + '\xd0', '\x97', '\xd0', '\x98', '\xd0', '\x99', '\xd0', '\x9a', '\xd0', '\x9b', '\xd0', '\x9c', '\xd0', '\x9d', '\xd0', '\x9e', + '\xd0', '\x9f', '\xd0', '\xa0', '\xd0', '\xa1', '\xd0', '\xa2', '\xd0', '\xa3', '\xd0', '\xa4', '\xd0', '\xa5', '\xd0', '\xa6', + '\xd0', '\xa7', '\xd0', '\xa8', '\xd0', '\xa9', '\xd0', '\xaa', '\xd0', '\xab', '\xd0', '\xac', '\xd0', '\xad', '\xd0', '\xae', + '\xd0', '\xaf', '\xd0', '\xb0', '\xd0', '\xb1', '\xd0', '\xb2', '\xd0', '\xb3', '\xd0', '\xb4', '\xd0', '\xb5', '\xd0', '\xb6', + '\xd0', '\xb7', '\xd0', '\xb8', '\xd0', '\xb9', '\xd0', '\xba', '\xd0', '\xbb', '\xd0', '\xbc', '\xd0', '\xbd', '\xd0', '\xbe', + '\xd0', '\xbf', '\xd1', '\x80', '\xd1', '\x81', '\xd1', '\x82', '\xd1', '\x83', '\xd1', '\x84', '\xd1', '\x85', '\xd1', '\x86', + '\xd1', '\x87', '\xd1', '\x88', '\xd1', '\x89', '\xd1', '\x8a', '\xd1', '\x8b', '\xd1', '\x8c', '\xd1', '\x8d', '\xd1', '\x8e', '\xd1', '\x8f'}; return TString(text, Y_ARRAY_SIZE(text)); } @@ -206,7 +206,7 @@ static void TestSurrogates(const char* str, const wchar16* wide, size_t wideSize void TConversionTest::TestYandexEncoding() { TUtf16String w = UTF8ToWide(utf8CyrillicAlphabet, strlen(utf8CyrillicAlphabet), csYandex); UNIT_ASSERT(w == wideCyrillicAlphabet); - w = UTF8ToWide(yandexCyrillicAlphabet, strlen(yandexCyrillicAlphabet), csYandex); + w = UTF8ToWide(yandexCyrillicAlphabet, strlen(yandexCyrillicAlphabet), csYandex); UNIT_ASSERT(w == wideCyrillicAlphabet); const char* utf8NonBMP2 = "ab\xf4\x80\x89\x87n"; diff --git a/library/cpp/containers/compact_vector/compact_vector.h b/library/cpp/containers/compact_vector/compact_vector.h index dbe7473f0c..51282f52fd 100644 --- a/library/cpp/containers/compact_vector/compact_vector.h +++ b/library/cpp/containers/compact_vector/compact_vector.h @@ -59,7 +59,7 @@ public: } catch (...) { } } - if (Ptr) + if (Ptr) free(Header()); } @@ -120,7 +120,7 @@ public: } size_t Size() const { - return Ptr ? Header()->Size : 0; + return Ptr ? Header()->Size : 0; } size_t size() const { @@ -136,7 +136,7 @@ public: } size_t Capacity() const { - return Ptr ? Header()->Capacity : 0; + return Ptr ? Header()->Capacity : 0; } void PushBack(const T& elem) { diff --git a/library/cpp/containers/comptrie/comptrie_builder.inl b/library/cpp/containers/comptrie/comptrie_builder.inl index f273fa6571..51a6f976d0 100644 --- a/library/cpp/containers/comptrie/comptrie_builder.inl +++ b/library/cpp/containers/comptrie/comptrie_builder.inl @@ -160,8 +160,8 @@ public: return 0; size_t median = (from + to) / 2; - size_t leftsize = (size_t)MeasureRange(builder, from, median); - size_t rightsize = (size_t)MeasureRange(builder, median + 1, to); + size_t leftsize = (size_t)MeasureRange(builder, from, median); + size_t rightsize = (size_t)MeasureRange(builder, median + 1, to); return builder->ArcMeasure(&(*this)[median], leftsize, rightsize); } @@ -825,7 +825,7 @@ void TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::NodeLinkTo(TNode* th template <class T, class D, class S> size_t TCompactTrieBuilder<T, D, S>::TCompactTrieBuilderImpl::NodeMeasureSubtree(TNode* thiz) const { - return (size_t)thiz->Subtree()->Measure(this); + return (size_t)thiz->Subtree()->Measure(this); } template <class T, class D, class S> diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h index 40ec1e52b3..63e3e50304 100644 --- a/library/cpp/containers/comptrie/comptrie_trie.h +++ b/library/cpp/containers/comptrie/comptrie_trie.h @@ -655,7 +655,7 @@ typename TCompactTrie<T, D, S>::TData TCompactTrie<T, D, S>::TConstIterator::Get template <class T, class D, class S> void TCompactTrie<T, D, S>::TConstIterator::GetValue(typename TCompactTrie<T, D, S>::TData& data) const { const char* ptr = GetValuePtr(); - if (ptr) { + if (ptr) { Packer.UnpackLeaf(ptr, data); } else { data = typename TCompactTrie<T, D, S>::TData(); diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp index 74bee09b5d..969518fa1f 100644 --- a/library/cpp/containers/comptrie/comptrie_ut.cpp +++ b/library/cpp/containers/comptrie/comptrie_ut.cpp @@ -340,13 +340,13 @@ static bool LexicographicStep(TString& s) { template <class T> void TCompactTrieTest::CheckUpperBound(const char* data, size_t datalen) { TCompactTrie<T> trie(data, datalen); - typedef typename TCompactTrie<T>::TKey TKey; - typedef typename TCompactTrie<T>::TData TData; + typedef typename TCompactTrie<T>::TKey TKey; + typedef typename TCompactTrie<T>::TData TData; TString key; do { const TKey wideKey = MakeWideKey<T>(key); - typename TCompactTrie<T>::TConstIterator it = trie.UpperBound(wideKey); + typename TCompactTrie<T>::TConstIterator it = trie.UpperBound(wideKey); UNIT_ASSERT_C(it == trie.End() || it.GetKey() >= wideKey, "key=" + key); TData data; const bool found = trie.Find(wideKey, &data); @@ -454,7 +454,7 @@ void TCompactTrieTest::CheckIterator(const char* data, size_t datalen) { std::reverse(items.begin(), items.end()); typename TCompactTrie<T>::TConstIterator revIt = trie.End(); typename TCompactTrie<T>::TConstIterator const begin = trie.Begin(); - typename TCompactTrie<T>::TConstIterator emptyIt; + typename TCompactTrie<T>::TConstIterator emptyIt; size_t pos = 0; while (revIt != begin) { revIt--; @@ -465,11 +465,11 @@ void TCompactTrieTest::CheckIterator(const char* data, size_t datalen) { revIt = begin; UNIT_ASSERT(revIt == trie.Begin()); UNIT_ASSERT(!revIt.IsEmpty()); - UNIT_ASSERT(revIt != emptyIt); + UNIT_ASSERT(revIt != emptyIt); UNIT_ASSERT(revIt != trie.End()); ++revIt; // Call a method that uses Skipper. - revIt = emptyIt; - UNIT_ASSERT(revIt == emptyIt); + revIt = emptyIt; + UNIT_ASSERT(revIt == emptyIt); UNIT_ASSERT(revIt.IsEmpty()); UNIT_ASSERT(revIt != trie.End()); // Checking the move assignment operator. diff --git a/library/cpp/deprecated/kmp/kmp_ut.cpp b/library/cpp/deprecated/kmp/kmp_ut.cpp index c2eda83c57..cc46b96c00 100644 --- a/library/cpp/deprecated/kmp/kmp_ut.cpp +++ b/library/cpp/deprecated/kmp/kmp_ut.cpp @@ -29,7 +29,7 @@ public: UNIT_ASSERT_EQUAL(FindAll("a", "aba"), ans); ans = {0}; UNIT_ASSERT_EQUAL(FindAll("aba", "aba"), ans); - ans.clear(); + ans.clear(); UNIT_ASSERT_EQUAL(FindAll("abad", "aba"), ans); ans = {0, 2}; UNIT_ASSERT_EQUAL(FindAll("ab", "abab"), ans); diff --git a/library/cpp/deprecated/mapped_file/mapped_file.cpp b/library/cpp/deprecated/mapped_file/mapped_file.cpp index b0e4511299..db995c67ee 100644 --- a/library/cpp/deprecated/mapped_file/mapped_file.cpp +++ b/library/cpp/deprecated/mapped_file/mapped_file.cpp @@ -23,7 +23,7 @@ TMappedFile::TMappedFile(const TFile& file, TFileMap::EOpenMode om, const char* void TMappedFile::precharge(size_t off, size_t size) const { if (!Map_) return; - + Map_->Precharge(off, size); } diff --git a/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp b/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp index afbd5b3358..057a5f6bc6 100644 --- a/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp +++ b/library/cpp/deprecated/mapped_file/ut/mapped_file_ut.cpp @@ -8,10 +8,10 @@ Y_UNIT_TEST_SUITE(TMappedFileTest) { Y_UNIT_TEST(TestFileMapEmpty) { TFile file(FileName_, CreateAlways | WrOnly); file.Close(); - + TMappedFile map; map.init(FileName_); - map.getData(0); + map.getData(0); NFs::Remove(FileName_); } diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp index 2fa5cfd070..10e6f741e4 100644 --- a/library/cpp/getopt/small/modchooser.cpp +++ b/library/cpp/getopt/small/modchooser.cpp @@ -189,7 +189,7 @@ int TModChooser::Run(const int argc, const char** argv) const { return 0; } if (!SvnRevisionOptionDisabled && modeName == "--svnrevision") { - NLastGetopt::PrintVersionAndExit(nullptr); + NLastGetopt::PrintVersionAndExit(nullptr); } auto modeIter = Modes.find(modeName); diff --git a/library/cpp/getopt/small/opt.cpp b/library/cpp/getopt/small/opt.cpp index 744501765c..ee44f7c77d 100644 --- a/library/cpp/getopt/small/opt.cpp +++ b/library/cpp/getopt/small/opt.cpp @@ -25,7 +25,7 @@ void Opt::Init(int argc, char* argv[], const char* optString, const Ion* longOpt Opts_.Reset(new TOptsNoDefault(optString)); for (const Ion* o = longOptions; o != nullptr && o->name != nullptr; ++o) { TOpt* opt; - if ((unsigned)o->val < 0x80 && isalnum(o->val)) { + if ((unsigned)o->val < 0x80 && isalnum(o->val)) { opt = &Opts_->CharOption(char(o->val)); opt->AddLongName(o->name); } else { @@ -73,7 +73,7 @@ int Opt::Get(int* longOptionIndex) { return 1; } else { const Ion* ion = (const Ion*)OptsParser_->CurOpt()->UserValue(); - if (longOptionIndex) { + if (longOptionIndex) { *longOptionIndex = int(ion - Ions_); } char c = OptsParser_->CurOpt()->GetCharOr0(); diff --git a/library/cpp/getopt/small/posix_getopt.cpp b/library/cpp/getopt/small/posix_getopt.cpp index bd06f3499f..5ccf6e76cb 100644 --- a/library/cpp/getopt/small/posix_getopt.cpp +++ b/library/cpp/getopt/small/posix_getopt.cpp @@ -27,7 +27,7 @@ namespace NLastGetopt { for (const struct option* o = longopts; o != nullptr && o->name != nullptr; ++o) { TOpt* opt; - if ((unsigned)o->val < 0x80 && isalnum(o->val)) { + if ((unsigned)o->val < 0x80 && isalnum(o->val)) { opt = &Opts->CharOption(char(o->val)); opt->AddLongName(o->name); } else { @@ -49,9 +49,9 @@ namespace NLastGetopt { } else { optarg = (char*)OptsParser->CurVal(); optind = (int)OptsParser->Pos_; - if (longindex && OptsParser->CurOpt()) + if (longindex && OptsParser->CurOpt()) *longindex = (int)Opts->IndexOf(OptsParser->CurOpt()); - return OptsParser->CurOpt() ? OptsParser->CurOpt()->GetCharOr0() : 1; + return OptsParser->CurOpt() ? OptsParser->CurOpt()->GetCharOr0() : 1; } } catch (const NLastGetopt::TException&) { return '?'; diff --git a/library/cpp/http/fetch/http_digest.h b/library/cpp/http/fetch/http_digest.h index 3b1872d70b..62cda1a29f 100644 --- a/library/cpp/http/fetch/http_digest.h +++ b/library/cpp/http/fetch/http_digest.h @@ -43,5 +43,5 @@ public: return (!User_); } - const char* getHeaderInstruction() const; + const char* getHeaderInstruction() const; }; diff --git a/library/cpp/http/fetch/httpfetcher.h b/library/cpp/http/fetch/httpfetcher.h index 7fc251afd2..fa7e7ab1c5 100644 --- a/library/cpp/http/fetch/httpfetcher.h +++ b/library/cpp/http/fetch/httpfetcher.h @@ -36,16 +36,16 @@ public: static int TerminateNow; THttpFetcher() - : THttpParser<TCheck>() - , TAlloc() - , TWriter() - , TAgent() + : THttpParser<TCheck>() + , TAlloc() + , TWriter() + , TAgent() { } - + virtual ~THttpFetcher() { } - + int Fetch(THttpHeader* header, const char* path, const char* const* headers, int persistent, bool head_request = false) { int ret = 0; int fetcherr = 0; diff --git a/library/cpp/http/fetch/httpfsm.rl6 b/library/cpp/http/fetch/httpfsm.rl6 index eab0328b18..35a6f972bb 100644 --- a/library/cpp/http/fetch/httpfsm.rl6 +++ b/library/cpp/http/fetch/httpfsm.rl6 @@ -11,10 +11,10 @@ #include <library/cpp/http/fetch/httpheader.h> #include <library/cpp/http/fetch/httpfsm.h> -#ifdef _MSC_VER -#pragma warning(disable: 4702) // unreachable code -#endif - +#ifdef _MSC_VER +#pragma warning(disable: 4702) // unreachable code +#endif + #define c(i) I = i; #define m(i) I = std::max(I, (long)i); diff --git a/library/cpp/http/io/stream.cpp b/library/cpp/http/io/stream.cpp index 6689be684f..8a1319bc10 100644 --- a/library/cpp/http/io/stream.cpp +++ b/library/cpp/http/io/stream.cpp @@ -284,7 +284,7 @@ private: inline void BuildInputChain() { TParsedHeaders p; - + size_t pos = FirstLine_.rfind(' '); // In HTTP/1.1 Keep-Alive is turned on by default if (pos != TString::npos && strcmp(FirstLine_.c_str() + pos + 1, "HTTP/1.1") == 0) { @@ -321,7 +321,7 @@ private: p.KeepAlive = true; } else if (stricmp(header.Value().data(), "close") == 0) { p.KeepAlive = false; - } + } } [[fallthrough]]; HEADERCMP(header, "expect") { @@ -536,7 +536,7 @@ public: if (*c == '\n') { Line_.append(b, c); - if (!Line_.empty() && Line_.back() == '\r') { + if (!Line_.empty() && Line_.back() == '\r') { Line_.pop_back(); } @@ -906,7 +906,7 @@ void THttpOutput::DoFinish() { } const THttpHeaders& THttpOutput::SentHeaders() const noexcept { - return Impl_->SentHeaders(); + return Impl_->SentHeaders(); } void THttpOutput::EnableCompression(bool enable) { diff --git a/library/cpp/http/misc/httpdate.h b/library/cpp/http/misc/httpdate.h index 04876f38fe..16907280d2 100644 --- a/library/cpp/http/misc/httpdate.h +++ b/library/cpp/http/misc/httpdate.h @@ -7,7 +7,7 @@ #define BAD_DATE ((time_t)-1) -inline time_t parse_http_date(const TStringBuf& datestring) { +inline time_t parse_http_date(const TStringBuf& datestring) { try { return TInstant::ParseHttpDeprecated(datestring).TimeT(); } catch (const TDateTimeParseException&) { diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h index 16e59c4d78..08f10a2717 100644 --- a/library/cpp/http/misc/httpreqdata.h +++ b/library/cpp/http/misc/httpreqdata.h @@ -28,7 +28,7 @@ public: } const TString& ServerName() const { - return Host; + return Host; } NAddr::IRemoteAddrPtr ServerAddress() const { @@ -36,7 +36,7 @@ public: } const TString& ServerPort() const { - return Port; + return Port; } const char* ScriptName() const { @@ -96,7 +96,7 @@ private: size_t SearchLength; // length of Search TStringBuf OrigSearch; THttpHeadersContainer HeadersIn_; - mutable char AddrData[INET6_ADDRSTRLEN]; + mutable char AddrData[INET6_ADDRSTRLEN]; SOCKET Socket; ui64 BeginTime; mutable TString CurPage; diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp index 128583bdd7..d63d86e26f 100644 --- a/library/cpp/http/server/http.cpp +++ b/library/cpp/http/server/http.cpp @@ -172,11 +172,11 @@ public: ErrorCode = WSAGetLastError(); } - int GetErrorCode() const { + int GetErrorCode() const { return ErrorCode; } - const char* GetError() const { + const char* GetError() const { return LastSystemErrorText(ErrorCode); } @@ -213,7 +213,7 @@ public: void Wait() { Cb_->OnWait(); TGuard<TMutex> g(StopMutex); - if (ListenThread) { + if (ListenThread) { ListenThread->Join(); ListenThread.Reset(nullptr); } @@ -223,7 +223,7 @@ public: Shutdown(); TGuard<TMutex> g(StopMutex); - if (ListenThread) { + if (ListenThread) { ListenThread->Join(); ListenThread.Reset(nullptr); } @@ -560,7 +560,7 @@ TClientConnection::TClientConnection(const TSocket& s, THttpServer::TImpl* serv, const TDuration& clientTimeout = HttpServ_->Options().ClientTimeout; if (clientTimeout != TDuration::Zero()) { - SetSocketTimeout(Socket_, (long)clientTimeout.Seconds(), clientTimeout.MilliSecondsOfSecond()); + SetSocketTimeout(Socket_, (long)clientTimeout.Seconds(), clientTimeout.MilliSecondsOfSecond()); } HttpServ_->IncreaseConnections(); @@ -738,7 +738,7 @@ void TClientRequest::ProcessFailRequest(int failstate) { // Skipping spaces before url... size_t start = 3; - while (str[start] == ' ') { + while (str[start] == ' ') { ++start; } diff --git a/library/cpp/json/writer/json_value.cpp b/library/cpp/json/writer/json_value.cpp index c61e8d1dc4..38ae9cd4e6 100644 --- a/library/cpp/json/writer/json_value.cpp +++ b/library/cpp/json/writer/json_value.cpp @@ -73,7 +73,7 @@ namespace NJson { TJsonValue::TJsonValue(const EJsonValueType type) { SetType(type); } - + TJsonValue::TJsonValue(TJsonValue&& vval) noexcept : Type(JSON_UNDEFINED) { diff --git a/library/cpp/json/writer/json_value.h b/library/cpp/json/writer/json_value.h index 3f0f50bc4c..0b18f1ab3e 100644 --- a/library/cpp/json/writer/json_value.h +++ b/library/cpp/json/writer/json_value.h @@ -203,7 +203,7 @@ namespace NJson { TString String; TMapType* Map; TArray* Array; - + TValueUnion() noexcept { Zero(*this); } diff --git a/library/cpp/logger/system.cpp b/library/cpp/logger/system.cpp index 42233f63d2..2c223b4463 100644 --- a/library/cpp/logger/system.cpp +++ b/library/cpp/logger/system.cpp @@ -55,7 +55,7 @@ TSysLogBackend::~TSysLogBackend() { void TSysLogBackend::WriteData(const TLogRecord& rec) { #if defined(_unix_) syslog(ELogPriority2SyslogPriority(rec.Priority), "%.*s", (int)rec.Len, rec.Data); -#else +#else Y_UNUSED(rec); #endif } diff --git a/library/cpp/mime/types/mime.cpp b/library/cpp/mime/types/mime.cpp index 706d776b24..3fa0cd9ada 100644 --- a/library/cpp/mime/types/mime.cpp +++ b/library/cpp/mime/types/mime.cpp @@ -9,49 +9,49 @@ #include <cctype> /* - * MIME types + * MIME types */ -class TMimeTypes { +class TMimeTypes { // Constructor -public: - TMimeTypes(); - +public: + TMimeTypes(); + // Methods -public: - const char* StrByExt(const char* ext) const; +public: + const char* StrByExt(const char* ext) const; MimeTypes MimeByStr(const char* str) const; - MimeTypes MimeByStr(const TStringBuf& str) const; - const char* StrByMime(MimeTypes mime) const; - + MimeTypes MimeByStr(const TStringBuf& str) const; + const char* StrByMime(MimeTypes mime) const; + // Constants -public: +public: static const size_t MAX_EXT_LEN = 11; // max length of supported extensions - + // Helper methods -private: - void SetContentTypes(); - void SetExt(); - +private: + void SetContentTypes(); + void SetExt(); + // Types -private: - struct TRecord { - MimeTypes Mime; - const char* ContentType; - const char* Ext; - }; - +private: + struct TRecord { + MimeTypes Mime; + const char* ContentType; + const char* Ext; + }; + typedef THashMap<const char*, int> TRecordHash; - + // Fields -private: - static const TRecord Records[]; - TRecordHash ContentTypes; - TRecordHash Ext; -}; - -const TMimeTypes::TRecord TMimeTypes::Records[] = { +private: + static const TRecord Records[]; + TRecordHash ContentTypes; + TRecordHash Ext; +}; + +const TMimeTypes::TRecord TMimeTypes::Records[] = { {MIME_UNKNOWN, nullptr, nullptr}, {MIME_TEXT, "text/plain\0", "asc\0txt\0"}, {MIME_HTML, "text/html\0", "html\0htm\0shtml\0"}, @@ -86,7 +86,7 @@ const TMimeTypes::TRecord TMimeTypes::Records[] = { {MIME_TEX, "application/x-tex\0application/x-latex\0text/x-tex\0", "tex\0"}, {MIME_JSON, "application/json\0", "json\0"}, {MIME_APK, "application/vnd.android.package-archive\0", "apk\0"}, - {MIME_CSS, "text/css\0", "css\0"}, + {MIME_CSS, "text/css\0", "css\0"}, {MIME_IMAGE_WEBP, "image/webp\0", "webp\0"}, {MIME_DJVU, "image/vnd.djvu\0image/x-djvu\0", "djvu\0djv\0"}, {MIME_CHM, "application/x-chm\0application/vnd.ms-htmlhelp\0", "chm\0"}, @@ -100,70 +100,70 @@ const TMimeTypes::TRecord TMimeTypes::Records[] = { {MIME_TTF, "font/ttf\0", "ttf\0"}, {MIME_WEBMANIFEST, "application/manifest+json\0", "webmanifest\0"}, {MIME_MAX, nullptr, nullptr}, - - // Additional records + + // Additional records {MIME_HTML, "application/xhtml+xml\0", "xhtml\0"}, -}; - -TMimeTypes::TMimeTypes() +}; + +TMimeTypes::TMimeTypes() : ContentTypes() , Ext() -{ - SetContentTypes(); - SetExt(); -} - -void TMimeTypes::SetContentTypes() { +{ + SetContentTypes(); + SetExt(); +} + +void TMimeTypes::SetContentTypes() { for (int i = 0; i < (int)Y_ARRAY_SIZE(Records); ++i) { - const TRecord& record(Records[i]); - assert(i == record.Mime || i > MIME_MAX || record.Mime == MIME_UNKNOWN); - if (!record.ContentType) - continue; - for (const char* type = record.ContentType; *type; type += strlen(type) + 1) { - assert(ContentTypes.find(type) == ContentTypes.end()); - ContentTypes[type] = i; - } - } -} - -void TMimeTypes::SetExt() { + const TRecord& record(Records[i]); + assert(i == record.Mime || i > MIME_MAX || record.Mime == MIME_UNKNOWN); + if (!record.ContentType) + continue; + for (const char* type = record.ContentType; *type; type += strlen(type) + 1) { + assert(ContentTypes.find(type) == ContentTypes.end()); + ContentTypes[type] = i; + } + } +} + +void TMimeTypes::SetExt() { for (int i = 0; i < (int)Y_ARRAY_SIZE(Records); ++i) { - const TRecord& record(Records[i]); - if (!record.Ext) - continue; - for (const char* ext = record.Ext; *ext; ext += strlen(ext) + 1) { - assert(strlen(ext) <= MAX_EXT_LEN); - assert(Ext.find(ext) == Ext.end()); - Ext[ext] = i; - } - } -} - -const char* TMimeTypes::StrByExt(const char* ext) const { - TRecordHash::const_iterator it = Ext.find(ext); - if (it == Ext.end()) + const TRecord& record(Records[i]); + if (!record.Ext) + continue; + for (const char* ext = record.Ext; *ext; ext += strlen(ext) + 1) { + assert(strlen(ext) <= MAX_EXT_LEN); + assert(Ext.find(ext) == Ext.end()); + Ext[ext] = i; + } + } +} + +const char* TMimeTypes::StrByExt(const char* ext) const { + TRecordHash::const_iterator it = Ext.find(ext); + if (it == Ext.end()) return nullptr; - return Records[it->second].ContentType; -} - -MimeTypes TMimeTypes::MimeByStr(const char* str) const { - TRecordHash::const_iterator it = ContentTypes.find(str); - if (it == ContentTypes.end()) - return MIME_UNKNOWN; - return Records[it->second].Mime; -} - -MimeTypes TMimeTypes::MimeByStr(const TStringBuf& str) const { - TRecordHash::const_iterator it = ContentTypes.find(str); - if (it == ContentTypes.end()) - return MIME_UNKNOWN; - return Records[it->second].Mime; -} - -const char* TMimeTypes::StrByMime(MimeTypes mime) const { - return Records[mime].ContentType; -} - + return Records[it->second].ContentType; +} + +MimeTypes TMimeTypes::MimeByStr(const char* str) const { + TRecordHash::const_iterator it = ContentTypes.find(str); + if (it == ContentTypes.end()) + return MIME_UNKNOWN; + return Records[it->second].Mime; +} + +MimeTypes TMimeTypes::MimeByStr(const TStringBuf& str) const { + TRecordHash::const_iterator it = ContentTypes.find(str); + if (it == ContentTypes.end()) + return MIME_UNKNOWN; + return Records[it->second].Mime; +} + +const char* TMimeTypes::StrByMime(MimeTypes mime) const { + return Records[mime].ContentType; +} + const char* mimetypeByExt(const char* fname, const char* check_ext) { const char* ext_p; if (fname == nullptr || *fname == 0 || @@ -171,7 +171,7 @@ const char* mimetypeByExt(const char* fname, const char* check_ext) { return nullptr; } - char ext[TMimeTypes::MAX_EXT_LEN + 1]; + char ext[TMimeTypes::MAX_EXT_LEN + 1]; size_t i; ext_p++; for (i = 0; i < TMimeTypes::MAX_EXT_LEN && ext_p[i]; i++) @@ -185,23 +185,23 @@ const char* mimetypeByExt(const char* fname, const char* check_ext) { return nullptr; } - return Singleton<TMimeTypes>()->StrByExt(ext); -} - -MimeTypes mimeByStr(const char* mimeStr) { - return Singleton<TMimeTypes>()->MimeByStr(mimeStr); + return Singleton<TMimeTypes>()->StrByExt(ext); } -MimeTypes mimeByStr(const TStringBuf& mimeStr) { - return Singleton<TMimeTypes>()->MimeByStr(mimeStr); -} - -const char* strByMime(MimeTypes mime) { - if (mime < 0 || mime > MIME_MAX) +MimeTypes mimeByStr(const char* mimeStr) { + return Singleton<TMimeTypes>()->MimeByStr(mimeStr); +} + +MimeTypes mimeByStr(const TStringBuf& mimeStr) { + return Singleton<TMimeTypes>()->MimeByStr(mimeStr); +} + +const char* strByMime(MimeTypes mime) { + if (mime < 0 || mime > MIME_MAX) return nullptr; // index may contain documents with invalid MIME (ex. 255) - return Singleton<TMimeTypes>()->StrByMime(mime); -} - + return Singleton<TMimeTypes>()->StrByMime(mime); +} + const char* MimeNames[MIME_MAX] = { "unknown", // MIME_UNKNOWN // 0 "text", // MIME_TEXT // 1 @@ -237,7 +237,7 @@ const char* MimeNames[MIME_MAX] = { "tex", // MIME_TEX // 31 "json", // MIME_JSON // 32 "apk", // MIME_APK // 33 - "css", // MIME_CSS // 34 + "css", // MIME_CSS // 34 "webp", // MIME_IMAGE_WEBP // 35 "djvu", // MIME_DJVU // 36 "chm", // MIME_CHM // 37 diff --git a/library/cpp/mime/types/mime.h b/library/cpp/mime/types/mime.h index 05da389ea9..e9ba5a92db 100644 --- a/library/cpp/mime/types/mime.h +++ b/library/cpp/mime/types/mime.h @@ -45,7 +45,7 @@ enum MimeTypes { MIME_TEX = 31, MIME_JSON = 32, MIME_APK = 33, - MIME_CSS = 34, + MIME_CSS = 34, MIME_IMAGE_WEBP = 35, MIME_DJVU = 36, MIME_CHM = 37, @@ -65,8 +65,8 @@ extern const char* MimeNames[MIME_MAX]; const char* mimetypeByExt(const char* fname, const char* check_ext = nullptr); MimeTypes mimeByStr(const char* mimeStr); -MimeTypes mimeByStr(const TStringBuf& mimeStr); -const char* strByMime(MimeTypes mime); +MimeTypes mimeByStr(const TStringBuf& mimeStr); +const char* strByMime(MimeTypes mime); // autogenerated with GENERATE_ENUM_SERIALIZATION const TString& ToString(MimeTypes x); diff --git a/library/cpp/packers/packers.h b/library/cpp/packers/packers.h index 1bde1b59aa..d947722c98 100644 --- a/library/cpp/packers/packers.h +++ b/library/cpp/packers/packers.h @@ -42,7 +42,7 @@ public: } size_t MeasureLeaf(const T& data) const { Y_UNUSED(data); - return sizeof(T); + return sizeof(T); } size_t SkipLeaf(const char*) const { return sizeof(T); diff --git a/library/cpp/regex/pcre/regexp.cpp b/library/cpp/regex/pcre/regexp.cpp index 575c09cee4..d13d532572 100644 --- a/library/cpp/regex/pcre/regexp.cpp +++ b/library/cpp/regex/pcre/regexp.cpp @@ -1,7 +1,7 @@ #include "regexp.h" #include <util/generic/string.h> -#include <util/string/ascii.h> +#include <util/string/ascii.h> #include <util/system/defaults.h> #include <cstdlib> @@ -154,7 +154,7 @@ public: const size_t ERRBUF_SIZE = 100; char errbuf[ERRBUF_SIZE]; regerror(rc, &Preg, errbuf, ERRBUF_SIZE); - Error = "Error: regular expression " + re + " is wrong: " + errbuf; + Error = "Error: regular expression " + re + " is wrong: " + errbuf; ythrow yexception() << "RegExp " << re << ": " << Error.data(); } } @@ -192,7 +192,7 @@ private: }; bool TRegExBase::IsCompiled() const { - return Impl && Impl->IsCompiled(); + return Impl && Impl->IsCompiled(); } TRegExBase::TRegExBase(const char* re, int cflags) { @@ -202,9 +202,9 @@ TRegExBase::TRegExBase(const char* re, int cflags) { } TRegExBase::TRegExBase(const TString& re, int cflags) { - Compile(re, cflags); -} - + Compile(re, cflags); +} + TRegExBase::~TRegExBase() { } @@ -236,10 +236,10 @@ TRegExMatch::TRegExMatch(const char* re, int cflags) } TRegExMatch::TRegExMatch(const TString& re, int cflags) - : TRegExBase(re, cflags) -{ -} - + : TRegExBase(re, cflags) +{ +} + bool TRegExMatch::Match(const char* str) const { return Exec(str, nullptr, 0, 0) == 0; } @@ -294,7 +294,7 @@ int TRegExSubst::ParseReplacement(const char* repl) { pos2 = pos1; if (pos1) { pos2 = pos1 + 1; - while (IsAsciiDigit(*pos2)) + while (IsAsciiDigit(*pos2)) pos2++; if (pos2 > pos1 + 1) { Brfs[i].Refer = atol(TString(Replacement, pos1 + 1 - Replacement, pos2 - (pos1 + 1)).data()); diff --git a/library/cpp/scheme/ya.make b/library/cpp/scheme/ya.make index bac08ba5a4..da4e9d2ee2 100644 --- a/library/cpp/scheme/ya.make +++ b/library/cpp/scheme/ya.make @@ -4,9 +4,9 @@ OWNER(velavokr) SRCS( scheme.cpp - scheme_cast.h - scimpl.h - scimpl_defs.h + scheme_cast.h + scimpl.h + scimpl_defs.h scimpl_private.cpp scimpl_protobuf.cpp scimpl_select.rl6 diff --git a/library/cpp/streams/bzip2/bzip2.cpp b/library/cpp/streams/bzip2/bzip2.cpp index bccc5c6807..cba78c4ad6 100644 --- a/library/cpp/streams/bzip2/bzip2.cpp +++ b/library/cpp/streams/bzip2/bzip2.cpp @@ -190,7 +190,7 @@ void TBZipCompress::DoWrite(const void* buf, size_t size) { } void TBZipCompress::DoFlush() { - if (Impl_) { + if (Impl_) { Impl_->Flush(); } } @@ -198,7 +198,7 @@ void TBZipCompress::DoFlush() { void TBZipCompress::DoFinish() { THolder<TImpl> impl(Impl_.Release()); - if (impl) { + if (impl) { impl->Finish(); } } diff --git a/library/cpp/streams/lzma/lzma.cpp b/library/cpp/streams/lzma/lzma.cpp index f1942fa546..900a5b884b 100644 --- a/library/cpp/streams/lzma/lzma.cpp +++ b/library/cpp/streams/lzma/lzma.cpp @@ -497,7 +497,7 @@ void TLzmaCompress::DoWrite(const void* buf, size_t len) { void TLzmaCompress::DoFinish() { THolder<TImpl> impl(Impl_.Release()); - if (impl) { + if (impl) { impl->Finish(); } } diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h index 8a240bfed8..859b6698c8 100644 --- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h +++ b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h @@ -154,12 +154,12 @@ namespace NLevenshtein { /// Calculates substrings to be replaced for str1->str2 transformation struct TReplacement { int CorrectOffset, CorrectLength, MisspelledOffset, MisspelledLength; - TReplacement() - : CorrectOffset(0) - , CorrectLength(0) - , MisspelledOffset(0) - , MisspelledLength(0) - { + TReplacement() + : CorrectOffset(0) + , CorrectLength(0) + , MisspelledOffset(0) + , MisspelledLength(0) + { } TReplacement(int correctOffset, int correctLength, int misspelledOffset, int misspelledLength) : CorrectOffset(correctOffset) diff --git a/library/cpp/testing/common/env.cpp b/library/cpp/testing/common/env.cpp index fa3a47fe16..2da27631e3 100644 --- a/library/cpp/testing/common/env.cpp +++ b/library/cpp/testing/common/env.cpp @@ -2,7 +2,7 @@ #include <build/scripts/c_templates/svnversion.h> -#include <util/folder/dirut.h> +#include <util/folder/dirut.h> #include <util/folder/path.h> #include <util/generic/singleton.h> #include <util/stream/file.h> @@ -48,21 +48,21 @@ TString GetArcadiaTestsData() { TString path = NPrivate::GetCwd(); const char pathsep = GetDirectorySeparator(); - while (!path.empty()) { + while (!path.empty()) { TString dataDir = path + "/arcadia_tests_data"; if (IsDir(dataDir)) { - return dataDir; + return dataDir; } - + size_t pos = path.find_last_of(pathsep); if (pos == TString::npos) { - pos = 0; + pos = 0; } - path.erase(pos); - } - + path.erase(pos); + } + return {}; -} +} TString GetWorkPath() { TString workPath = NPrivate::GetTestEnv().WorkPath; diff --git a/library/cpp/testing/common/env.h b/library/cpp/testing/common/env.h index 7b89aa1bed..8256fc8656 100644 --- a/library/cpp/testing/common/env.h +++ b/library/cpp/testing/common/env.h @@ -1,12 +1,12 @@ #pragma once - + #include <unordered_map> #include <util/folder/path.h> #include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/system/src_location.h> - + // @brief return full path to arcadia root TString ArcadiaSourceRoot(); diff --git a/library/cpp/testing/unittest/checks.cpp b/library/cpp/testing/unittest/checks.cpp index c5712ae9d2..2fbbde6ceb 100644 --- a/library/cpp/testing/unittest/checks.cpp +++ b/library/cpp/testing/unittest/checks.cpp @@ -1,31 +1,31 @@ #include <util/generic/string.h> #include <util/string/type.h> - + bool CheckExceptionMessage(const char* msg, TString& err) { - static const char* badMsg[] = { + static const char* badMsg[] = { // Операция успешно завершена [cp1251] "\xce\xef\xe5\xf0\xe0\xf6\xe8\xff\x20\xf3\xf1\xef\xe5\xf8\xed\xee\x20\xe7\xe0\xe2\xe5\xf0\xf8\xe5\xed\xe0", - "The operation completed successfully", + "The operation completed successfully", "No error"}; - - err.clear(); - + + err.clear(); + if (msg == nullptr) { - err = "Error message is null"; - return false; - } - - if (IsSpace(msg)) { - err = "Error message is empty"; - return false; - } - + err = "Error message is null"; + return false; + } + + if (IsSpace(msg)) { + err = "Error message is empty"; + return false; + } + for (auto& i : badMsg) { if (strstr(msg, i) != nullptr) { err = "Invalid error message: " + TString(msg); - return false; - } - } - - return true; -} + return false; + } + } + + return true; +} diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a0092..d8db81d556 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -7,7 +7,7 @@ #include <util/generic/intrlist.h> #include <util/generic/map.h> #include <util/generic/ptr.h> -#include <util/generic/set.h> +#include <util/generic/set.h> #include <util/generic/typetraits.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> @@ -86,19 +86,19 @@ namespace NUnitTest { }; struct TTest { - const TUnit* unit; - const char* name; + const TUnit* unit; + const char* name; }; struct TError { - const TTest* test; - const char* msg; + const TTest* test; + const char* msg; TString BackTrace; TTestContext* Context; }; struct TFinish { - const TTest* test; + const TTest* test; TTestContext* Context; bool Success; }; @@ -790,7 +790,7 @@ public: \ } inline TString Name() const noexcept override { - return T::StaticName(); + return T::StaticName(); } }; diff --git a/library/cpp/testing/unittest/tests_data.cpp b/library/cpp/testing/unittest/tests_data.cpp index b51cbc4b87..8aa7d6eaa7 100644 --- a/library/cpp/testing/unittest/tests_data.cpp +++ b/library/cpp/testing/unittest/tests_data.cpp @@ -1,8 +1,8 @@ -#include "tests_data.h" +#include "tests_data.h" #include "registar.h" - + #include <library/cpp/testing/common/network.h> - + #include <util/system/env.h> #include <util/system/mutex.h> diff --git a/library/cpp/testing/unittest/tests_data.h b/library/cpp/testing/unittest/tests_data.h index 6536bc1ae6..4643a77e38 100644 --- a/library/cpp/testing/unittest/tests_data.h +++ b/library/cpp/testing/unittest/tests_data.h @@ -1,12 +1,12 @@ #pragma once - + #include <library/cpp/testing/common/env.h> #include <util/generic/noncopyable.h> #include <util/generic/ptr.h> #include <util/generic/string.h> #include <util/network/sock.h> - + class TInet6StreamSocket; // set two options: SO_REUSEADDR and SO_REUSEPORT, both are required for diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index 305bc6b40f..d9fc967886 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -83,7 +83,7 @@ private: inline void TraceSubtestFinished(const char* className, const char* subtestName, const char* status, const TString comment, const TTestContext* context) { const TInstant now = TInstant::Now(); - NJson::TJsonValue event; + NJson::TJsonValue event; event.InsertValue("class", className); event.InsertValue("subtest", subtestName); event.InsertValue("status", status); @@ -116,7 +116,7 @@ private: } void OnBeforeTest(const TTest* test) override { - NJson::TJsonValue event; + NJson::TJsonValue event; event.InsertValue("class", test->unit->name); event.InsertValue("subtest", test->name); Trace("subtest-started", event); @@ -128,13 +128,13 @@ private: } void OnUnitStart(const TUnit* unit) override { - NJson::TJsonValue event; + NJson::TJsonValue event; event.InsertValue("class", unit->name); Trace("test-started", event); } void OnUnitStop(const TUnit* unit) override { - NJson::TJsonValue event; + NJson::TJsonValue event; event.InsertValue("class", unit->name); Trace("test-finished", event); } @@ -417,7 +417,7 @@ private: fprintf(stderr, ", err: %s%u%s", LightRedColor().data(), FailTests(), OldColor().data()); fprintf(stderr, "\n"); - + if (ShowFails) { for (size_t i = 0; i < Fails.size(); ++i) { printf("%s", Fails[i].data()); @@ -567,16 +567,16 @@ private: IOutputStream& Stream_; }; -#ifdef _win_ -class TWinEnvironment { -public: - TWinEnvironment() +#ifdef _win_ +class TWinEnvironment { +public: + TWinEnvironment() : OutputCP(GetConsoleOutputCP()) - { - setmode(fileno(stdout), _O_BINARY); - SetConsoleOutputCP(CP_UTF8); - - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + { + setmode(fileno(stdout), _O_BINARY); + SetConsoleOutputCP(CP_UTF8); + + _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); if (!IsDebuggerPresent()) { _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); @@ -586,20 +586,20 @@ public: } } ~TWinEnvironment() { - if (!IsDebuggerPresent()) { - _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); - } - - SetConsoleOutputCP(OutputCP); // restore original output CP at program exit - } - -private: - UINT OutputCP; // original codepage -}; -static const TWinEnvironment Instance; -#endif // _win_ - + if (!IsDebuggerPresent()) { + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + } + + SetConsoleOutputCP(OutputCP); // restore original output CP at program exit + } + +private: + UINT OutputCP; // original codepage +}; +static const TWinEnvironment Instance; +#endif // _win_ + static int DoList(bool verbose, IOutputStream& stream) { TEnumeratingProcessor eproc(verbose, stream); TTestFactory::Instance().SetProcessor(&eproc); diff --git a/library/cpp/testing/unittest/ya.make b/library/cpp/testing/unittest/ya.make index aaa4f2ba85..bdc71c13cc 100644 --- a/library/cpp/testing/unittest/ya.make +++ b/library/cpp/testing/unittest/ya.make @@ -18,10 +18,10 @@ PEERDIR( SRCS( gtest.cpp - checks.cpp + checks.cpp plugin.cpp registar.cpp - tests_data.cpp + tests_data.cpp utmain.cpp ) diff --git a/library/cpp/unicode/normalization/normalization.h b/library/cpp/unicode/normalization/normalization.h index 4f5f57881c..4acef5f0eb 100644 --- a/library/cpp/unicode/normalization/normalization.h +++ b/library/cpp/unicode/normalization/normalization.h @@ -84,9 +84,9 @@ namespace NUnicode { class TComposition { private: struct TRawData { - wchar32 Lead; - wchar32 Tail; - wchar32 Comp; + wchar32 Lead; + wchar32 Tail; + wchar32 Comp; }; static const TRawData RawData[]; diff --git a/library/cpp/uri/encodefsm.rl6 b/library/cpp/uri/encodefsm.rl6 index 6a323aa85a..b184fb2e9c 100644 --- a/library/cpp/uri/encodefsm.rl6 +++ b/library/cpp/uri/encodefsm.rl6 @@ -1,9 +1,9 @@ #include <library/cpp/uri/encode.h> -#ifdef __clang__ - #pragma clang diagnostic ignored "-Wunused-variable" -#endif - +#ifdef __clang__ + #pragma clang diagnostic ignored "-Wunused-variable" +#endif + namespace NUri { namespace NEncode { diff --git a/library/cpp/uri/parsefsm.rl6 b/library/cpp/uri/parsefsm.rl6 index 7097723650..70c4833c32 100644 --- a/library/cpp/uri/parsefsm.rl6 +++ b/library/cpp/uri/parsefsm.rl6 @@ -1,9 +1,9 @@ #include <library/cpp/uri/parse.h> -#ifdef __clang__ - #pragma clang diagnostic ignored "-Wunused-variable" -#endif - +#ifdef __clang__ + #pragma clang diagnostic ignored "-Wunused-variable" +#endif + %%{ machine TParser; diff --git a/library/cpp/uri/ya.make b/library/cpp/uri/ya.make index 8fc808a6af..9bc5dc3d3c 100644 --- a/library/cpp/uri/ya.make +++ b/library/cpp/uri/ya.make @@ -9,7 +9,7 @@ SRCS( assign.cpp common.cpp encode.cpp - http_url.h + http_url.h location.cpp other.cpp parse.cpp |