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 | 05f59b2581f074c756adaee6b260014ac3a0c3ec (patch) | |
tree | 9814fbd1c3effac9b8377c5d604b367b14e2db55 | |
parent | 5d8d1af4df7f9cd4acc021f069546c30677e7979 (diff) | |
download | ydb-05f59b2581f074c756adaee6b260014ac3a0c3ec.tar.gz |
Restoring authorship annotation for <sergey@yandex-team.ru>. Commit 2 of 2.
28 files changed, 265 insertions, 265 deletions
diff --git a/contrib/libs/crcutil/ya.make b/contrib/libs/crcutil/ya.make index afb01a19ed..2da8ef940f 100644 --- a/contrib/libs/crcutil/ya.make +++ b/contrib/libs/crcutil/ya.make @@ -51,7 +51,7 @@ IF (ARCH_I386 OR ARCH_X86_64) SRCS( multiword_128_64_gcc_amd64_sse2.cc multiword_64_64_gcc_amd64_asm.cc - ) + ) ENDIF() IF (OS_WINDOWS) SRCS( diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h index 54be1935aa..87d1ab0ad4 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 69b1b49fd4..5e40f47ab9 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 986c00c5ec..994755f34d 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 f37394139d..4a3ce6d05e 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; - } + ++buf; + } + + return crc ^ 0xFFFFFFFF; +} - 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 657ec2e45e..d5821304ce 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 7823c64f5f..ad8c80ac1e 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 fb04a322ea..cbfbaa1188 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 1af93b3064..4a3031bbf4 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 -* -* 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. +/*- +* Copyright 1997 Massachusetts Institute of Technology * -* 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. -*/ +* 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. +*/ #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" -}; + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" +}; + +static const char *months[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", + "Nov", "Dec" +}; -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 f292b6a5cb..04876f38fe 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 ddab9c94bb..706d776b24 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 06c126dc8f..05da389ea9 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 e7b8fc957e..85f4ac5d69 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 ca11fd3e56..84137ccc57 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> diff --git a/util/datetime/base.h b/util/datetime/base.h index 088dfd284a..5e902b8f63 100644 --- a/util/datetime/base.h +++ b/util/datetime/base.h @@ -1,5 +1,5 @@ #pragma once - + #include "systime.h" #include <util/str_stl.h> @@ -11,7 +11,7 @@ #include <util/generic/utility.h> #include <util/generic/typetraits.h> #include <util/generic/yexception.h> - + #include <chrono> #if defined(__cpp_lib_three_way_comparison) diff --git a/util/datetime/systime.h b/util/datetime/systime.h index daa0d21f7d..491d36e802 100644 --- a/util/datetime/systime.h +++ b/util/datetime/systime.h @@ -1,5 +1,5 @@ #pragma once - + #include <util/system/platform.h> #include <util/generic/string.h> diff --git a/util/digest/fnv.h b/util/digest/fnv.h index 442449a03b..87b41a3de7 100644 --- a/util/digest/fnv.h +++ b/util/digest/fnv.h @@ -1,12 +1,12 @@ #pragma once - + #include <util/system/defaults.h> - + #define FNV32INIT 2166136261U -#define FNV32PRIME 16777619U +#define FNV32PRIME 16777619U #define FNV64INIT ULL(14695981039346656037) -#define FNV64PRIME ULL(1099511628211) - +#define FNV64PRIME ULL(1099511628211) + namespace NFnvPrivate { template <class It> constexpr ui32 FnvHash32(It b, It e, ui32 init) { @@ -22,7 +22,7 @@ namespace NFnvPrivate { while (b != e) { init = (init * FNV64PRIME) ^ (unsigned char)*b++; } - + return init; } diff --git a/util/folder/filelist.cpp b/util/folder/filelist.cpp index 50ac04d795..b21fcdbf20 100644 --- a/util/folder/filelist.cpp +++ b/util/folder/filelist.cpp @@ -3,7 +3,7 @@ #include "iterator.h" #include <util/system/defaults.h> - + void TFileEntitiesList::Fill(const TString& dirname, TStringBuf prefix, TStringBuf suffix, int depth, bool sort) { TDirIterator::TOptions opts; opts.SetMaxLevel(depth); @@ -34,7 +34,7 @@ void TFileEntitiesList::Fill(const TString& dirname, TStringBuf prefix, TStringB ++FileNamesSize; FileNames.Append(filename.data(), filename.size() + 1); } - } - + } + Restart(); -} +} diff --git a/util/folder/filelist.h b/util/folder/filelist.h index bc57c18435..3f615fa4c2 100644 --- a/util/folder/filelist.h +++ b/util/folder/filelist.h @@ -1,12 +1,12 @@ #pragma once - + #include <util/generic/buffer.h> #include <util/generic/string.h> #include <util/generic/strbuf.h> #include <util/generic/flags.h> - + class TFileEntitiesList { -public: +public: enum EMaskFlag { EM_FILES = 1, EM_DIRS = 2, @@ -23,27 +23,27 @@ public: : Mask(mask) { Clear(); - } - - void Clear() { + } + + void Clear() { Cur = nullptr; FileNamesSize = CurName = 0; FileNames.Clear(); FileNames.Append("", 1); - } - + } + const char* Next() { return Cur = (CurName++ < FileNamesSize ? strchr(Cur, 0) + 1 : nullptr); - } - + } + size_t Size() { return FileNamesSize; - } - + } + inline void Fill(const TString& dirname, bool sort = false) { Fill(dirname, TStringBuf(), sort); } - + inline void Fill(const TString& dirname, TStringBuf prefix, bool sort = false) { Fill(dirname, prefix, TStringBuf(), 1, sort); } @@ -55,13 +55,13 @@ public: CurName = 0; } -protected: +protected: TBuffer FileNames; size_t FileNamesSize, CurName; const char* Cur; EMask Mask; -}; - +}; + Y_DECLARE_OPERATORS_FOR_FLAGS(TFileEntitiesList::EMask) class TFileList: public TFileEntitiesList { diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h index b41c627be6..f77d182460 100644 --- a/util/generic/bitmap.h +++ b/util/generic/bitmap.h @@ -353,7 +353,7 @@ public: if (val) *Chunk |= static_cast<TChunk>(1) << Offset; else - *Chunk &= ~(static_cast<TChunk>(1) << Offset); + *Chunk &= ~(static_cast<TChunk>(1) << Offset); return *this; } @@ -479,15 +479,15 @@ public: return Xor(val); } - template <class T> + template <class T> Y_FORCE_INLINE TThis& operator-=(const TBitMapOps<T>& bitmap) { - return SetDifference(bitmap); - } - + return SetDifference(bitmap); + } + Y_FORCE_INLINE TThis& operator-=(const TChunk& val) { - return SetDifference(val); - } - + return SetDifference(val); + } + Y_FORCE_INLINE TThis& operator<<=(size_t pos) { return LShift(pos); } @@ -739,22 +739,22 @@ public: return *this; } - TThis& SetDifference(const TThis& bitmap) { - for (size_t i = 0; i < Min(bitmap.Mask.GetChunkCapacity(), Mask.GetChunkCapacity()); ++i) - Mask.Data[i] &= ~bitmap.Mask.Data[i]; - return *this; - } - - template <class T> + TThis& SetDifference(const TThis& bitmap) { + for (size_t i = 0; i < Min(bitmap.Mask.GetChunkCapacity(), Mask.GetChunkCapacity()); ++i) + Mask.Data[i] &= ~bitmap.Mask.Data[i]; + return *this; + } + + template <class T> Y_FORCE_INLINE TThis& SetDifference(const TBitMapOps<T>& bitmap) { - return SetDifference(TThis(bitmap)); - } - + return SetDifference(TThis(bitmap)); + } + Y_FORCE_INLINE TThis& SetDifference(const TChunk& val) { - Mask.Data[0] &= ~val; - return *this; - } - + Mask.Data[0] &= ~val; + return *this; + } + Y_FORCE_INLINE TThis& Flip() { for (size_t i = 0; i < Mask.GetChunkCapacity(); ++i) Mask.Data[i] = ~Mask.Data[i]; @@ -1055,22 +1055,22 @@ inline TBitMapOps<X> operator^(const typename TBitMapOps<X>::TChunk& x, const TB return TBitMapOps<X>(x).Xor(y); } -template <class X, class Y> +template <class X, class Y> inline TBitMapOps<X> operator-(const TBitMapOps<X>& x, const TBitMapOps<Y>& y) { - return TBitMapOps<X>(x).SetDifference(y); -} - + return TBitMapOps<X>(x).SetDifference(y); +} + template <class X> inline TBitMapOps<X> operator-(const TBitMapOps<X>& x, const typename TBitMapOps<X>::TChunk& y) { - return TBitMapOps<X>(x).SetDifference(y); -} - -template <class X> + return TBitMapOps<X>(x).SetDifference(y); +} + +template <class X> inline TBitMapOps<X> operator-(const typename TBitMapOps<X>::TChunk& x, const TBitMapOps<X>& y) { - return TBitMapOps<X>(x).SetDifference(y); -} - -template <class X> + return TBitMapOps<X>(x).SetDifference(y); +} + +template <class X> inline TBitMapOps<X> operator~(const TBitMapOps<X>& x) { return TBitMapOps<X>(x).Flip(); } diff --git a/util/generic/yexception.h b/util/generic/yexception.h index dbd15ea21f..b0c604e8c4 100644 --- a/util/generic/yexception.h +++ b/util/generic/yexception.h @@ -1,5 +1,5 @@ #pragma once - + #include "bt_exception.h" #include "strbuf.h" #include "string.h" @@ -48,7 +48,7 @@ namespace NPrivateException { const char* what() const noexcept override; virtual const TBackTrace* BackTrace() const noexcept; - + template <class T> inline void Append(const T& t) { TTempBufCuttingWrapperOutput tempBuf(Buf_); @@ -153,7 +153,7 @@ namespace NPrivate { } void fputs(const std::exception& e, FILE* f = stderr); - + TString CurrentExceptionMessage(); /* diff --git a/util/network/socket.cpp b/util/network/socket.cpp index adc5df0551..4f6e804346 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -281,7 +281,7 @@ void SetSocketTimeout(SOCKET s, long sec, long msec) { CheckedSetSockOpt(s, SOL_SOCKET, SO_RCVTIMEO, timeout, "recv timeout"); CheckedSetSockOpt(s, SOL_SOCKET, SO_SNDTIMEO, timeout, "send timeout"); #endif -} +} void SetLinger(SOCKET s, bool on, unsigned len) { #ifdef SO_LINGER @@ -551,7 +551,7 @@ static ssize_t DoSendMsg(SOCKET sock, const struct iovec* iov, int iovcnt) { return sendmsg(sock, &message, MSG_NOSIGNAL); } -#endif +#endif void TSocketHolder::Close() noexcept { if (Fd_ != INVALID_SOCKET) { diff --git a/util/system/condvar.cpp b/util/system/condvar.cpp index e765b4d86d..62f3d22356 100644 --- a/util/system/condvar.cpp +++ b/util/system/condvar.cpp @@ -4,7 +4,7 @@ #include "condvar.h" #include "datetime.h" #include "spinlock.h" - + #include <util/generic/ylimits.h> #include <util/generic/intrlist.h> #include <util/generic/yexception.h> diff --git a/util/system/defaults.h b/util/system/defaults.h index df8eab29bf..dcd7abea38 100644 --- a/util/system/defaults.h +++ b/util/system/defaults.h @@ -2,14 +2,14 @@ #include "platform.h" -#if defined _unix_ +#if defined _unix_ #define LOCSLASH_C '/' #define LOCSLASH_S "/" -#else +#else #define LOCSLASH_C '\\' #define LOCSLASH_S "\\" -#endif // _unix_ - +#endif // _unix_ + #if defined(__INTEL_COMPILER) && defined(__cplusplus) #include <new> #endif diff --git a/util/system/mktemp.cpp b/util/system/mktemp.cpp index f0c1db8885..505b7b4a4b 100644 --- a/util/system/mktemp.cpp +++ b/util/system/mktemp.cpp @@ -14,7 +14,7 @@ #include <unistd.h> #include <stdlib.h> #endif - + extern "C" int mkstemps(char* path, int slen); TString MakeTempName(const char* wrkDir, const char* prefix, const char* extension) { diff --git a/util/system/mktemp_system.cpp b/util/system/mktemp_system.cpp index 990729f357..32bea2987c 100644 --- a/util/system/mktemp_system.cpp +++ b/util/system/mktemp_system.cpp @@ -1,46 +1,46 @@ -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS 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. - */ - +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS 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 "defaults.h" -#include <sys/types.h> -#include <fcntl.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - +#include <sys/types.h> +#include <fcntl.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + #ifdef _win32_ #include "winint.h" #include <util/folder/dirut.h> @@ -50,13 +50,13 @@ #include <util/random/random.h> #include "sysstat.h" - -static const unsigned char padchar[] = + +static const unsigned char padchar[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - -static int + +static int GetTemp(char* path, int* doopen, int domkdir, int slen) -{ +{ char *start, *trv, *suffp; char* pad; #ifndef _win32_ @@ -64,12 +64,12 @@ GetTemp(char* path, int* doopen, int domkdir, int slen) int rval; #endif ui32 rand; - + if (doopen != nullptr && domkdir) { errno = EINVAL; return (0); } - + for (trv = path; *trv != '\0'; ++trv) { ; } @@ -80,17 +80,17 @@ GetTemp(char* path, int* doopen, int domkdir, int slen) errno = EINVAL; return (0); } - + /* Fill space with random characters */ while (trv >= path && *trv == 'X') { rand = (RandomNumber<ui32>()) % (sizeof(padchar) - 1); *trv-- = padchar[rand]; } start = trv + 1; - + /* - * check the target directory. - */ + * check the target directory. + */ if (doopen != nullptr || domkdir) { for (; trv > path; --trv) { if (*trv == '/') { @@ -117,9 +117,9 @@ GetTemp(char* path, int* doopen, int domkdir, int slen) #endif break; } - } + } } - + for (;;) { if (doopen) { if ((*doopen = @@ -157,10 +157,10 @@ GetTemp(char* path, int* doopen, int domkdir, int slen) *trv++ = *pad; break; } - } + } } /*NOTREACHED*/ -} +} extern "C" int mkstemps(char* path, int slen) { int fd; diff --git a/util/system/tls.cpp b/util/system/tls.cpp index afd5d4bc94..c2f1a04a14 100644 --- a/util/system/tls.cpp +++ b/util/system/tls.cpp @@ -241,8 +241,8 @@ private: TKey::TKey(TDtor dtor) : Impl_(new TImpl(dtor)) { -} - +} + TKey::TKey(TKey&&) noexcept = default; TKey::~TKey() = default; diff --git a/util/system/tls.h b/util/system/tls.h index 99902b18d1..3c4f56dbeb 100644 --- a/util/system/tls.h +++ b/util/system/tls.h @@ -155,7 +155,7 @@ namespace NTls { using TDtor = void (*)(void*); class TKey { - public: + public: TKey(TDtor dtor); TKey(TKey&&) noexcept; ~TKey(); @@ -168,7 +168,7 @@ namespace NTls { private: class TImpl; THolder<TImpl> Impl_; - }; + }; struct TCleaner { inline ~TCleaner() { |