diff options
author | den <den@yandex-team.ru> | 2022-02-10 16:49:43 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:43 +0300 |
commit | 0beaf5069375bfa9589dbf4c281fbfcc7b11f71d (patch) | |
tree | 2a9075fe9636ba84e8db3369d5d39589cccac932 | |
parent | 64b907678a38848c4af3d0270ccee688c5d7752c (diff) | |
download | ydb-0beaf5069375bfa9589dbf4c281fbfcc7b11f71d.tar.gz |
Restoring authorship annotation for <den@yandex-team.ru>. Commit 1 of 2.
-rw-r--r-- | library/cpp/cgiparam/cgiparam.cpp | 4 | ||||
-rw-r--r-- | library/cpp/http/misc/httpcodes.cpp | 2 | ||||
-rw-r--r-- | library/cpp/string_utils/base64/base64.cpp | 2 | ||||
-rw-r--r-- | library/cpp/string_utils/base64/base64_ut.cpp | 4 | ||||
-rw-r--r-- | library/cpp/string_utils/quote/quote.cpp | 26 | ||||
-rw-r--r-- | util/datetime/parser.rl6 | 110 | ||||
-rw-r--r-- | util/datetime/parser_ut.cpp | 22 | ||||
-rw-r--r-- | util/digest/numeric.h | 6 | ||||
-rw-r--r-- | util/folder/dirut.h | 4 | ||||
-rw-r--r-- | util/network/socket.h | 2 |
10 files changed, 91 insertions, 91 deletions
diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp index f3277b8e4b..8035a69121 100644 --- a/library/cpp/cgiparam/cgiparam.cpp +++ b/library/cpp/cgiparam/cgiparam.cpp @@ -109,8 +109,8 @@ struct TAddEscaped { void TCgiParameters::Scan(const TStringBuf query, bool form) { Flush(); form ? ScanAdd(query) : ScanAddAll(query); -} - +} + void TCgiParameters::ScanAdd(const TStringBuf query) { TAddEscaped f = {this}; diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp index ad8c80ac1e..2570ad019c 100644 --- a/library/cpp/http/misc/httpcodes.cpp +++ b/library/cpp/http/misc/httpcodes.cpp @@ -29,7 +29,7 @@ TStringBuf HttpCodeStrEx(int code) noexcept { return TStringBuf("208 Already reported"); case HTTP_IM_USED: return TStringBuf("226 IM used"); - + case HTTP_MULTIPLE_CHOICES: return TStringBuf("300 Multiple choices"); case HTTP_MOVED_PERMANENTLY: diff --git a/library/cpp/string_utils/base64/base64.cpp b/library/cpp/string_utils/base64/base64.cpp index 05c201f0de..10469773b6 100644 --- a/library/cpp/string_utils/base64/base64.cpp +++ b/library/cpp/string_utils/base64/base64.cpp @@ -130,7 +130,7 @@ static inline char* Base64EncodeImpl(char* outstr, const unsigned char* instr, s if (idx + 1 < len) { *outstr++ = base64_etab[GetBase64EncodedIndex1(instr[idx], instr[idx + 1])]; *outstr++ = base64_etab[GetBase64EncodedIndex2(instr[idx + 1], '\0')]; - } else { + } else { *outstr++ = base64_etab[GetBase64EncodedIndex1(instr[idx], '\0')]; *outstr++ = pad; } diff --git a/library/cpp/string_utils/base64/base64_ut.cpp b/library/cpp/string_utils/base64/base64_ut.cpp index bcc1e65879..5512d896e8 100644 --- a/library/cpp/string_utils/base64/base64_ut.cpp +++ b/library/cpp/string_utils/base64/base64_ut.cpp @@ -8,7 +8,7 @@ #include <contrib/libs/base64/ssse3/libbase64.h> #include <library/cpp/testing/unittest/registar.h> - + #include <util/generic/vector.h> #include <util/random/fast.h> #include <util/system/cpu_id.h> @@ -202,7 +202,7 @@ Y_UNIT_TEST_SUITE(TBase64) { UNIT_ASSERT_VALUES_EQUAL(Base64Encode("12"), "MTI="); UNIT_ASSERT_VALUES_EQUAL(Base64Encode("1"), "MQ=="); } - + Y_UNIT_TEST(TestIntoString) { { TString str; diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp index e523350b80..a685267d98 100644 --- a/library/cpp/string_utils/quote/quote.cpp +++ b/library/cpp/string_utils/quote/quote.cpp @@ -72,45 +72,45 @@ static inline const char* FixZero(const char* s) noexcept { return s ? s : ""; } -// we escape: +// we escape: // '\"', '|', '(', ')', -// '%', '&', '+', ',', +// '%', '&', '+', ',', // '#', '<', '=', '>', -// '[', '\\',']', '?', +// '[', '\\',']', '?', // ':', '{', '}', -// all below ' ' (0x20) and above '~' (0x7E). +// all below ' ' (0x20) and above '~' (0x7E). // ' ' converted to '+' -static const bool chars_to_url_escape[256] = { +static const bool chars_to_url_escape[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //0 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //1 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, //2 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, //3 - + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //4 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, //5 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //6 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, //7 - + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //8 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //9 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //A 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //B - + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //C 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //D 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //E 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //F -}; - +}; + template <class It1, class It2, class It3> static inline It1 Escape(It1 to, It2 from, It3 end, const bool* escape_map = chars_to_url_escape) { while (from != end) { if (escape_map[(unsigned char)*from]) { - *to++ = '%'; + *to++ = '%'; *to++ = d2x((unsigned char)*from >> 4); *to++ = d2x((unsigned char)*from & 0xF); - } else { + } else { *to++ = (*from == ' ' ? '+' : *from); } @@ -121,7 +121,7 @@ static inline It1 Escape(It1 to, It2 from, It3 end, const bool* escape_map = cha return to; } - + template <class It1, class It2, class It3, class FromHex> static inline It1 Unescape(It1 to, It2 from, It3 end, FromHex fromHex) { (void)fromHex; diff --git a/util/datetime/parser.rl6 b/util/datetime/parser.rl6 index 931f09eae1..d2df0a674b 100644 --- a/util/datetime/parser.rl6 +++ b/util/datetime/parser.rl6 @@ -4,55 +4,55 @@ #include <cctype> #include <ctime> #include <numeric> - + #include <util/datetime/parser.h> #include <util/generic/ymath.h> - + %%{ - + machine DateTimeParserCommon; - + sp = ' '; -action clear_int { +action clear_int { I = 0; Dc = 0; -} - -action update_int { +} + +action update_int { I = I * 10 + (fc - '0'); ++Dc; -} - +} + int = (digit+) >clear_int $update_int; - -int1 = digit - >clear_int - $update_int; - -int2 = (digit digit) + +int1 = digit >clear_int - $update_int; + $update_int; +int2 = (digit digit) + >clear_int + $update_int; + int3 = (digit digit digit) >clear_int $update_int; -int4 = (digit digit digit digit) - >clear_int - $update_int; - -int12 = (digit digit?) - >clear_int - $update_int; +int4 = (digit digit digit digit) + >clear_int + $update_int; + +int12 = (digit digit?) + >clear_int + $update_int; int24 = ( digit digit ( digit digit )? ) - >clear_int - $update_int; - + >clear_int + $update_int; + # According to both RFC2822 and RFC2616 dates MUST be case-sensitive, # but Andrey fomichev@ wants relaxed parser @@ -97,7 +97,7 @@ ws0 = (space*); dow_spec = ( wkday ',' )?; day = int12 %set_day; -year = int24 %set_year; +year = int24 %set_year; # actually it must be from 0 to 23 hour = int2 %set_hour; @@ -107,39 +107,39 @@ min = int2 %set_minute; # actually it must be from 0 to 59 sec = int2 %set_second; - + sec_spec = ( ':' . sec )?; -# so called "military zone offset". I hardly believe someone uses it now, but we MUST respect RFc822 -action set_mil_offset { +# so called "military zone offset". I hardly believe someone uses it now, but we MUST respect RFc822 +action set_mil_offset { char c = (char)toupper(fc); - if (c == 'Z') + if (c == 'Z') DateTimeFields.ZoneOffsetMinutes = 0; - else { - if (c <= 'M') { - // ['A'..'M'] \ 'J' - if (c < 'J') + else { + if (c <= 'M') { + // ['A'..'M'] \ 'J' + if (c < 'J') DateTimeFields.ZoneOffsetMinutes = (i32)TDuration::Hours(c - 'A' + 1).Minutes(); - else + else DateTimeFields.ZoneOffsetMinutes = (i32)TDuration::Hours(c - 'A').Minutes(); - } else { - // ['N'..'Y'] + } else { + // ['N'..'Y'] DateTimeFields.ZoneOffsetMinutes = -(i32)TDuration::Hours(c - 'N' + 1).Minutes(); - } - } -} - -action set_digit_offset { + } + } +} + +action set_digit_offset { DateTimeFields.ZoneOffsetMinutes = Sign * (i32)(TDuration::Hours(I / 100) + TDuration::Minutes(I % 100)).Minutes(); -} - -mil_zone = /[A-IK-Za-ik-z]/ $set_mil_offset; - +} + +mil_zone = /[A-IK-Za-ik-z]/ $set_mil_offset; + # actions % were replaced with @ (when the script was migrated to ragel 5.24) # because ragel 5.24 does not call to the % action if it be called at the very end of string. # it is a bug in ragel 5 because ragel 6.2 works correctly with % at the end of string. # see http://www.complang.org/ragel/ChangeLog. - + zone = 'UT' @{ DateTimeFields.ZoneOffsetMinutes = 0; } | 'GMT' @{ DateTimeFields.ZoneOffsetMinutes = 0; } | 'EST' @{ DateTimeFields.ZoneOffsetMinutes = -(i32)TDuration::Hours(5).Minutes();} @@ -156,11 +156,11 @@ digit_offset = ('+' | '-') > { Sign = fc == '+' ? 1 : -1; } . int4 @set_digit_of offset = ( zone | mil_zone | digit_offset ); rfc822datetime = ws0 . dow_spec . ws0 . day . ws1 . month3 . ws1 . year . ws1 . hour . ':' . min . sec_spec . ws1 . offset . ws0; - + main := rfc822datetime; - + write data noerror; - + }%% TRfc822DateTimeParserDeprecated::TRfc822DateTimeParserDeprecated() { @@ -680,7 +680,7 @@ bool ParseRFC822DateTime(const char* input, size_t inputLen, time_t& utcTime) { utcTime = ParseUnsafe<TRfc822DateTimeParser, TInstant>(input, inputLen).TimeT(); return true; } catch (const TDateTimeParseException&) { - return false; + return false; } } @@ -690,8 +690,8 @@ bool ParseISO8601DateTime(const char* input, size_t inputLen, time_t& utcTime) { return true; } catch (const TDateTimeParseException&) { return false; - } -} + } +} bool ParseHTTPDateTime(const char* input, size_t inputLen, time_t& utcTime) { try { diff --git a/util/datetime/parser_ut.cpp b/util/datetime/parser_ut.cpp index 61364af997..6cea48cad0 100644 --- a/util/datetime/parser_ut.cpp +++ b/util/datetime/parser_ut.cpp @@ -1,7 +1,7 @@ #include "parser.h" #include <library/cpp/testing/unittest/registar.h> - + static const time_t SECONDS_PER_HOUR = 3600; static const time_t SECONDS_PER_MINUTE = 60; @@ -68,7 +68,7 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) { r = ParseRFC822DateTime("Fri, 4 Mar 2005 19:34:45 +0300", t); UNIT_ASSERT(r); UNIT_ASSERT_EQUAL(t, (time_t)1109954085); - + r = ParseRFC822DateTime("Fri, 4 Mar 05 19:34:45 +0300", t); UNIT_ASSERT(r); UNIT_ASSERT_EQUAL(t, (time_t)1109954085); @@ -126,8 +126,8 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) { r = ParseRFC822DateTime("Sat, 14 Feb 2009 02:31:30 +0300", t); // spaces with tabs UNIT_ASSERT(r); UNIT_ASSERT_EQUAL(t, (time_t)1234567890); - } - + } + time_t GetOffset(char militaryZone) { char ch = (char)toupper(militaryZone); if (ch == 'Z') { @@ -184,15 +184,15 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) { r = ParseRFC822DateTime("Fri, 4 Mar 2005 19:34:45 UTC", t); UNIT_ASSERT(!r); UNIT_ASSERT_EQUAL(t, (time_t)54321); - - // TODO: check semantic validity of parsed date (30 Feb, 88:90 etc.). - // The following tests MUST fail (they don't now) + + // TODO: check semantic validity of parsed date (30 Feb, 88:90 etc.). + // The following tests MUST fail (they don't now) // r = ParseRFC822DateTime("45 Mar 2005 19:34:45 UT", t); // UNIT_ASSERT_EQUAL(r, false); - + // r = ParseRFC822DateTime("29 Feb 2005 19:34:45 +0300", t); // UNIT_ASSERT_EQUAL(r, false); - + // r = ParseRFC822DateTime("31 Apr 2004 19:34:45 +0300", t); // UNIT_ASSERT_EQUAL(r, false); @@ -253,7 +253,7 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) { UNIT_ASSERT(!r); r = ParseRFC822DateTime("Mon, 17 Nov 2008 19:34:45 -03030", t); UNIT_ASSERT(!r); - } + } Y_UNIT_TEST(TestRfc822Partial) { TRfc822DateTimeParser p; @@ -267,7 +267,7 @@ Y_UNIT_TEST_SUITE(TDateTimeParseTest) { UNIT_ASSERT(p.ParsePart(part3, strlen(part3))); UNIT_ASSERT_VALUES_EQUAL(TInstant::Seconds(1109954086), p.GetResult(TInstant::Zero())); } - + Y_UNIT_TEST(TestIso8601Partial) { TIso8601DateTimeParser p; const char* part1 = "1990-03-15T15:1"; diff --git a/util/digest/numeric.h b/util/digest/numeric.h index e20bd908e4..32fbe71445 100644 --- a/util/digest/numeric.h +++ b/util/digest/numeric.h @@ -18,7 +18,7 @@ static constexpr ui8 IntHashImpl(ui8 key8) noexcept { key += ~(key << 11); key ^= (key >> 16); - return static_cast<ui8>(key); + return static_cast<ui8>(key); } static constexpr ui16 IntHashImpl(ui16 key16) noexcept { @@ -31,7 +31,7 @@ static constexpr ui16 IntHashImpl(ui16 key16) noexcept { key += ~(key << 11); key ^= (key >> 16); - return static_cast<ui16>(key); + return static_cast<ui16>(key); } static constexpr ui32 IntHashImpl(ui32 key) noexcept { @@ -55,7 +55,7 @@ static constexpr ui64 IntHashImpl(ui64 key) noexcept { key += ~(key << 27); key ^= (key >> 31); - return key; + return key; } template <class T> diff --git a/util/folder/dirut.h b/util/folder/dirut.h index 2537027b12..c5df802458 100644 --- a/util/folder/dirut.h +++ b/util/folder/dirut.h @@ -1,5 +1,5 @@ #pragma once - + #include <util/system/defaults.h> #include <util/system/sysstat.h> #include <util/system/fs.h> @@ -36,7 +36,7 @@ char* mkdtemp(char* path); #include <sys/stat.h> #endif #endif - + bool IsDir(const TString& path); int mkpath(char* path, int mode = 0777); diff --git a/util/network/socket.h b/util/network/socket.h index 40c8648b40..d28d8451b7 100644 --- a/util/network/socket.h +++ b/util/network/socket.h @@ -279,7 +279,7 @@ public: inline void Swap(TSocketHolder& r) noexcept { DoSwap(Fd_, r.Fd_); } - + inline bool Closed() const noexcept { return Fd_ == INVALID_SOCKET; } |