diff options
author | sergey <[email protected]> | 2022-02-10 16:47:29 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:29 +0300 |
commit | 5d8d1af4df7f9cd4acc021f069546c30677e7979 (patch) | |
tree | 07a39da188e8b418699f992f22d829a37a1411b2 /util | |
parent | 32b231c8474a1ade4bdf776ade6a20341691d9d7 (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/datetime/base.h | 4 | ||||
-rw-r--r-- | util/datetime/systime.h | 2 | ||||
-rw-r--r-- | util/digest/fnv.h | 12 | ||||
-rw-r--r-- | util/folder/filelist.cpp | 8 | ||||
-rw-r--r-- | util/folder/filelist.h | 32 | ||||
-rw-r--r-- | util/generic/bitmap.h | 68 | ||||
-rw-r--r-- | util/generic/yexception.h | 6 | ||||
-rw-r--r-- | util/network/socket.cpp | 4 | ||||
-rw-r--r-- | util/system/condvar.cpp | 2 | ||||
-rw-r--r-- | util/system/defaults.h | 8 | ||||
-rw-r--r-- | util/system/mktemp.cpp | 2 | ||||
-rw-r--r-- | util/system/mktemp_system.cpp | 112 | ||||
-rw-r--r-- | util/system/tls.cpp | 4 | ||||
-rw-r--r-- | util/system/tls.h | 4 |
14 files changed, 134 insertions, 134 deletions
diff --git a/util/datetime/base.h b/util/datetime/base.h index 5e902b8f633..088dfd284a3 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 491d36e802a..daa0d21f7d7 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 87b41a3de7e..442449a03b2 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 b21fcdbf208..50ac04d7957 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 3f615fa4c2e..bc57c18435a 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 f77d1824607..b41c627be6c 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 b0c604e8c45..dbd15ea21f9 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 4f6e8043462..adc5df0551a 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 62f3d22356c..e765b4d86dc 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 dcd7abea38e..df8eab29bf3 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 505b7b4a4b2..f0c1db8885c 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 32bea2987c5..990729f357e 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 c2f1a04a148..afd5d4bc94d 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 3c4f56dbeb7..99902b18d10 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() { |