diff options
author | sergey <sergey@yandex-team.ru> | 2022-02-10 16:47:29 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:29 +0300 |
commit | 5d8d1af4df7f9cd4acc021f069546c30677e7979 (patch) | |
tree | 07a39da188e8b418699f992f22d829a37a1411b2 /library | |
parent | 32b231c8474a1ade4bdf776ade6a20341691d9d7 (diff) | |
download | ydb-5d8d1af4df7f9cd4acc021f069546c30677e7979.tar.gz |
Restoring authorship annotation for <sergey@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/cgiparam/cgiparam.h | 2 | ||||
-rw-r--r-- | library/cpp/containers/atomizer/atomizer.h | 18 | ||||
-rw-r--r-- | library/cpp/digest/old_crc/crc.cpp | 8 | ||||
-rw-r--r-- | library/cpp/digest/old_crc/crc.h | 58 | ||||
-rw-r--r-- | library/cpp/digest/old_crc/gencrc/main.cpp | 50 | ||||
-rw-r--r-- | library/cpp/http/misc/httpcodes.cpp | 4 | ||||
-rw-r--r-- | library/cpp/http/misc/httpcodes.h | 18 | ||||
-rw-r--r-- | library/cpp/http/misc/httpdate.cpp | 90 | ||||
-rw-r--r-- | library/cpp/http/misc/httpdate.h | 2 | ||||
-rw-r--r-- | library/cpp/mime/types/mime.cpp | 2 | ||||
-rw-r--r-- | library/cpp/mime/types/mime.h | 4 | ||||
-rw-r--r-- | library/cpp/string_utils/url/url.cpp | 2 | ||||
-rw-r--r-- | library/cpp/string_utils/url/url.h | 2 |
13 files changed, 130 insertions, 130 deletions
diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h index 87d1ab0ad4..54be1935aa 100644 --- a/library/cpp/cgiparam/cgiparam.h +++ b/library/cpp/cgiparam/cgiparam.h @@ -56,7 +56,7 @@ public: Y_PURE_FUNCTION size_t PrintSize() const noexcept; - + /** The same as Print* except that RFC-3986 reserved characters are escaped. * @param safe - set of characters to be skipped in escaping */ diff --git a/library/cpp/containers/atomizer/atomizer.h b/library/cpp/containers/atomizer/atomizer.h index 5e40f47ab9..69b1b49fd4 100644 --- a/library/cpp/containers/atomizer/atomizer.h +++ b/library/cpp/containers/atomizer/atomizer.h @@ -25,14 +25,14 @@ public: using value_type = typename string_hash<ui32, HashFcn, EqualTo>::value_type; using size_type = typename string_hash<ui32, HashFcn, EqualTo>::size_type; using pool_size_type = typename string_hash<ui32, HashFcn, EqualTo>::pool_size_type; - - using string_hash<ui32, HashFcn, EqualTo>::pool; - using string_hash<ui32, HashFcn, EqualTo>::size; - using string_hash<ui32, HashFcn, EqualTo>::find; - using string_hash<ui32, HashFcn, EqualTo>::end; - using string_hash<ui32, HashFcn, EqualTo>::insert_copy; - using string_hash<ui32, HashFcn, EqualTo>::clear_hash; - + + using string_hash<ui32, HashFcn, EqualTo>::pool; + using string_hash<ui32, HashFcn, EqualTo>::size; + using string_hash<ui32, HashFcn, EqualTo>::find; + using string_hash<ui32, HashFcn, EqualTo>::end; + using string_hash<ui32, HashFcn, EqualTo>::insert_copy; + using string_hash<ui32, HashFcn, EqualTo>::clear_hash; + atomizer() { order.reserve(HASH_SIZE_DEFAULT); } @@ -104,7 +104,7 @@ public: order[(*I).second - 1] = (*I).first; } }; - + template <class T, class HashFcn, class EqualTo> class super_atomizer: public string_hash<ui32, HashFcn, EqualTo> { private: diff --git a/library/cpp/digest/old_crc/crc.cpp b/library/cpp/digest/old_crc/crc.cpp index 994755f34d..986c00c5ec 100644 --- a/library/cpp/digest/old_crc/crc.cpp +++ b/library/cpp/digest/old_crc/crc.cpp @@ -1,10 +1,10 @@ #include "crc.h" - + #include <library/cpp/digest/old_crc/crc.inc> #include <util/system/defaults.h> -static const ui64 CRCTAB64[256] = { +static const ui64 CRCTAB64[256] = { ULL(0x0000000000000000), ULL(0xE543279765927881), ULL(0x2FC568B9AEB68983), @@ -261,8 +261,8 @@ static const ui64 CRCTAB64[256] = { ULL(0x8B8AF709E5AF8488), ULL(0x410CB8272E8B758A), ULL(0xA44F9FB04B190D0B), -}; - +}; + const ui32* crctab16 = CRCTAB16; const ui32* crctab32 = CRCTAB32; const ui64* crctab64 = CRCTAB64; diff --git a/library/cpp/digest/old_crc/crc.h b/library/cpp/digest/old_crc/crc.h index 4a3ce6d05e..f37394139d 100644 --- a/library/cpp/digest/old_crc/crc.h +++ b/library/cpp/digest/old_crc/crc.h @@ -1,45 +1,45 @@ #pragma once - + #include <util/system/defaults.h> - -#define CRC16INIT 0 -#define CRC32INIT 0 -#define CRC64INIT ULL(0xFFFFFFFFFFFFFFFF) - -// CCITT CRC-16 + +#define CRC16INIT 0 +#define CRC32INIT 0 +#define CRC64INIT ULL(0xFFFFFFFFFFFFFFFF) + +// CCITT CRC-16 inline ui16 crc16(const char* buf, size_t buflen, ui32 crcinit = CRC16INIT) { - ui32 crc = 0xFFFF & ((crcinit >> 8) ^ (crcinit << 8)); + ui32 crc = 0xFFFF & ((crcinit >> 8) ^ (crcinit << 8)); const char* end = buf + buflen; extern const ui32* crctab16; - - while (buf < end) { - crc = (crc >> 8) ^ crctab16[(crc ^ *buf) & 0xFF]; - ++buf; - } + + while (buf < end) { + crc = (crc >> 8) ^ crctab16[(crc ^ *buf) & 0xFF]; + ++buf; + } return (ui16)(0xFFFF & ((crc >> 8) ^ (crc << 8))); -} - +} + struct IdTR { Y_FORCE_INLINE static ui8 T(ui8 a) { return a; } }; -// CCITT CRC-32 +// CCITT CRC-32 template <class TR> inline ui32 crc32(const char* buf, size_t buflen, ui32 crcinit = CRC32INIT) { - ui32 crc = crcinit ^ 0xFFFFFFFF; + ui32 crc = crcinit ^ 0xFFFFFFFF; const char* end = buf + buflen; extern const ui32* crctab32; - + while (buf < end) { crc = (crc >> 8) ^ crctab32[(crc ^ TR::T((ui8)*buf)) & 0xFF]; - ++buf; - } - - return crc ^ 0xFFFFFFFF; -} + ++buf; + } + return crc ^ 0xFFFFFFFF; +} + inline ui32 crc32(const char* buf, size_t buflen, ui32 crcinit = CRC32INIT) { return crc32<IdTR>(buf, buflen, crcinit); } @@ -48,17 +48,17 @@ inline ui32 crc32(const void* buf, size_t buflen, ui32 crcinit = CRC32INIT) { return crc32((const char*)buf, buflen, crcinit); } -// Copyright (C) Sewell Development Corporation, 1994 - 1998. +// Copyright (C) Sewell Development Corporation, 1994 - 1998. inline ui64 crc64(const void* buf, size_t buflen, ui64 crcinit = CRC64INIT) { const unsigned char* ptr = (const unsigned char*)buf; extern const ui64* crctab64; - + while (buflen--) { - crcinit = crctab64[((crcinit >> 56) ^ *ptr++)] ^ (crcinit << 8); + crcinit = crctab64[((crcinit >> 56) ^ *ptr++)] ^ (crcinit << 8); } - return crcinit; -} - + return crcinit; +} + namespace NCrcPrivate { template <unsigned N> struct TCrcHelper; diff --git a/library/cpp/digest/old_crc/gencrc/main.cpp b/library/cpp/digest/old_crc/gencrc/main.cpp index d5821304ce..657ec2e45e 100644 --- a/library/cpp/digest/old_crc/gencrc/main.cpp +++ b/library/cpp/digest/old_crc/gencrc/main.cpp @@ -1,20 +1,20 @@ #include <util/stream/output.h> - -#define POLY_16 0x1021 -#define POLY_32 0xEDB88320UL + +#define POLY_16 0x1021 +#define POLY_32 0xEDB88320UL #define POLY_64 ULL(0xE543279765927881) - + static void crc16init() { ui32 CRCTAB16[256]; - ui32 crc; - int i, j; - + ui32 crc; + int i, j; + for (i = 0; i < 256; CRCTAB16[i++] = 0xFFFF & ((crc << 8) ^ (crc >> 8))) - for (crc = i, j = 8; j > 0; j--) - if (crc & 1) - crc = (crc >> 1) ^ POLY_16; - else - crc >>= 1; + for (crc = i, j = 8; j > 0; j--) + if (crc & 1) + crc = (crc >> 1) ^ POLY_16; + else + crc >>= 1; for (size_t k = 0; k < 256; ++k) { Cout << " ULL(" << CRCTAB16[k] << ")"; @@ -23,19 +23,19 @@ static void crc16init() { Cout << ",\n"; } } -} - +} + static void crc32init() { ui32 CRCTAB32[256]; - ui32 crc; - int i, j; - - for (i = 0; i < 256; CRCTAB32[i++] = crc) - for (crc = i, j = 8; j > 0; j--) - if (crc & 1) - crc = (crc >> 1) ^ POLY_32; - else - crc >>= 1; + ui32 crc; + int i, j; + + for (i = 0; i < 256; CRCTAB32[i++] = crc) + for (crc = i, j = 8; j > 0; j--) + if (crc & 1) + crc = (crc >> 1) ^ POLY_32; + else + crc >>= 1; for (size_t k = 0; k < 256; ++k) { Cout << " ULL(" << CRCTAB32[k] << ")"; @@ -44,8 +44,8 @@ static void crc32init() { Cout << ",\n"; } } -} - +} + int main() { Cout << "static const ui32 CRCTAB16[] = {\n\n"; crc16init(); diff --git a/library/cpp/http/misc/httpcodes.cpp b/library/cpp/http/misc/httpcodes.cpp index ad8c80ac1e..7823c64f5f 100644 --- a/library/cpp/http/misc/httpcodes.cpp +++ b/library/cpp/http/misc/httpcodes.cpp @@ -1,5 +1,5 @@ -#include "httpcodes.h" - +#include "httpcodes.h" + TStringBuf HttpCodeStrEx(int code) noexcept { switch (code) { case HTTP_CONTINUE: diff --git a/library/cpp/http/misc/httpcodes.h b/library/cpp/http/misc/httpcodes.h index cbfbaa1188..fb04a322ea 100644 --- a/library/cpp/http/misc/httpcodes.h +++ b/library/cpp/http/misc/httpcodes.h @@ -1,12 +1,12 @@ #pragma once - + #include <util/generic/strbuf.h> -enum HttpCodes { +enum HttpCodes { HTTP_CONTINUE = 100, HTTP_SWITCHING_PROTOCOLS = 101, HTTP_PROCESSING = 102, - + HTTP_OK = 200, HTTP_CREATED = 201, HTTP_ACCEPTED = 202, @@ -17,7 +17,7 @@ enum HttpCodes { HTTP_MULTI_STATUS = 207, HTTP_ALREADY_REPORTED = 208, HTTP_IM_USED = 226, - + HTTP_MULTIPLE_CHOICES = 300, HTTP_MOVED_PERMANENTLY = 301, HTTP_FOUND = 302, @@ -26,7 +26,7 @@ enum HttpCodes { HTTP_USE_PROXY = 305, HTTP_TEMPORARY_REDIRECT = 307, HTTP_PERMANENT_REDIRECT = 308, - + HTTP_BAD_REQUEST = 400, HTTP_UNAUTHORIZED = 401, HTTP_PAYMENT_REQUIRED = 402, @@ -57,7 +57,7 @@ enum HttpCodes { HTTP_TOO_MANY_REQUESTS = 429, HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431, HTTP_UNAVAILABLE_FOR_LEGAL_REASONS = 451, - + HTTP_INTERNAL_SERVER_ERROR = 500, HTTP_NOT_IMPLEMENTED = 501, HTTP_BAD_GATEWAY = 502, @@ -71,10 +71,10 @@ enum HttpCodes { HTTP_NOT_EXTENDED = 510, HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511, HTTP_UNASSIGNED_512 = 512, - + HTTP_CODE_MAX -}; - +}; + TStringBuf HttpCodeStrEx(int code) noexcept; inline TStringBuf HttpCodeStr(int code) noexcept { diff --git a/library/cpp/http/misc/httpdate.cpp b/library/cpp/http/misc/httpdate.cpp index 4a3031bbf4..1af93b3064 100644 --- a/library/cpp/http/misc/httpdate.cpp +++ b/library/cpp/http/misc/httpdate.cpp @@ -1,69 +1,69 @@ -/*- -* Copyright 1997 Massachusetts Institute of Technology +/*- +* Copyright 1997 Massachusetts Institute of Technology +* +* Permission to use, copy, modify, and distribute this software and +* its documentation for any purpose and without fee is hereby +* granted, provided that both the above copyright notice and this +* permission notice appear in all copies, that both the above +* copyright notice and this permission notice appear in all +* supporting documentation, and that the name of M.I.T. not be used +* in advertising or publicity pertaining to distribution of the +* software without specific, written prior permission. M.I.T. makes +* no representations about the suitability of this software for any +* purpose. It is provided "as is" without express or implied +* warranty. * -* Permission to use, copy, modify, and distribute this software and -* its documentation for any purpose and without fee is hereby -* granted, provided that both the above copyright notice and this -* permission notice appear in all copies, that both the above -* copyright notice and this permission notice appear in all -* supporting documentation, and that the name of M.I.T. not be used -* in advertising or publicity pertaining to distribution of the -* software without specific, written prior permission. M.I.T. makes -* no representations about the suitability of this software for any -* purpose. It is provided "as is" without express or implied -* warranty. -* -* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS -* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, -* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT -* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -* SUCH DAMAGE. -*/ +* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS +* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT +* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ #include <util/system/defaults.h> - -#include <sys/types.h> + +#include <sys/types.h> #include <cctype> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> - + #include <util/system/compat.h> /* stricmp */ #include <util/system/yassert.h> #include "httpdate.h" #include <util/datetime/base.h> - + static const char *wkdays[] = { - "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" -}; - -static const char *months[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", - "Nov", "Dec" -}; + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" +}; +static const char *months[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", + "Nov", "Dec" +}; + int format_http_date(char buf[], size_t size, time_t when) { - struct tm tms; + struct tm tms; GmTimeR(&when, &tms); - -#ifndef HTTP_DATE_ISO_8601 + +#ifndef HTTP_DATE_ISO_8601 return snprintf(buf, size, "%s, %02d %s %04d %02d:%02d:%02d GMT", wkdays[tms.tm_wday], tms.tm_mday, months[tms.tm_mon], tms.tm_year + 1900, tms.tm_hour, tms.tm_min, tms.tm_sec); -#else /* ISO 8601 */ +#else /* ISO 8601 */ return snprintf(buf, size, "%04d%02d%02dT%02d%02d%02d+0000", tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday, tms.tm_hour, tms.tm_min, tms.tm_sec); -#endif -} - +#endif +} + char* format_http_date(time_t when, char* buf, size_t buflen) { const int len = format_http_date(buf, buflen, when); diff --git a/library/cpp/http/misc/httpdate.h b/library/cpp/http/misc/httpdate.h index 04876f38fe..f292b6a5cb 100644 --- a/library/cpp/http/misc/httpdate.h +++ b/library/cpp/http/misc/httpdate.h @@ -1,5 +1,5 @@ #pragma once - + #include <util/datetime/base.h> #include <util/generic/string.h> diff --git a/library/cpp/mime/types/mime.cpp b/library/cpp/mime/types/mime.cpp index 706d776b24..ddab9c94bb 100644 --- a/library/cpp/mime/types/mime.cpp +++ b/library/cpp/mime/types/mime.cpp @@ -250,4 +250,4 @@ const char* MimeNames[MIME_MAX] = { "woff2", // MIME_WOFF2 // 44 "ttf", // MIME_TTF // 45 "webmanifest" // MIME_WEBMANIFEST // 46 -}; +}; diff --git a/library/cpp/mime/types/mime.h b/library/cpp/mime/types/mime.h index 05da389ea9..06c126dc8f 100644 --- a/library/cpp/mime/types/mime.h +++ b/library/cpp/mime/types/mime.h @@ -24,7 +24,7 @@ enum MimeTypes { MIME_EXCEL = MIME_XLS, MIME_PPT = 11, MIME_IMAGE_JPG = 12, - MIME_IMAGE_PJPG = 13, + MIME_IMAGE_PJPG = 13, MIME_IMAGE_PNG = 14, MIME_IMAGE_GIF = 15, MIME_DOCX = 16, @@ -62,7 +62,7 @@ enum MimeTypes { }; 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); diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 85f4ac5d69..e7b8fc957e 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -12,7 +12,7 @@ #include <util/generic/hash_set.h> #include <util/generic/yexception.h> #include <util/generic/singleton.h> - + #include <cstdlib> namespace { diff --git a/library/cpp/string_utils/url/url.h b/library/cpp/string_utils/url/url.h index 84137ccc57..ca11fd3e56 100644 --- a/library/cpp/string_utils/url/url.h +++ b/library/cpp/string_utils/url/url.h @@ -1,5 +1,5 @@ #pragma once - + #include <util/generic/fwd.h> #include <util/generic/strbuf.h> |