diff options
author | dmikhalev <dmikhalev@yandex-team.ru> | 2022-02-10 16:49:29 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:29 +0300 |
commit | b93b3eb857a34bc32cef3c1b0c709e8365253b34 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | 3b5ee31ed70f690af39dfdec632060610b71b89e (diff) | |
download | ydb-b93b3eb857a34bc32cef3c1b0c709e8365253b34.tar.gz |
Restoring authorship annotation for <dmikhalev@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | library/cpp/binsaver/bin_saver.h | 18 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpload.cpp | 2 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpparser.h | 10 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpzreader.h | 4 | ||||
-rw-r--r-- | library/cpp/sighandler/async_signals_handler.cpp | 2 | ||||
-rw-r--r-- | util/digest/numeric.h | 2 | ||||
-rw-r--r-- | util/draft/holder_vector.h | 2 | ||||
-rw-r--r-- | util/folder/dirut.cpp | 12 | ||||
-rw-r--r-- | util/folder/iterator_ut.cpp | 6 | ||||
-rw-r--r-- | util/generic/bitmap.h | 52 | ||||
-rw-r--r-- | util/generic/bitmap_ut.cpp | 28 | ||||
-rw-r--r-- | util/network/socket.cpp | 6 | ||||
-rw-r--r-- | util/system/context.cpp | 2 | ||||
-rw-r--r-- | util/system/daemon.cpp | 20 | ||||
-rw-r--r-- | util/system/daemon.h | 2 | ||||
-rw-r--r-- | util/system/fs.cpp | 8 |
16 files changed, 88 insertions, 88 deletions
diff --git a/library/cpp/binsaver/bin_saver.h b/library/cpp/binsaver/bin_saver.h index a435a969f2..412424889f 100644 --- a/library/cpp/binsaver/bin_saver.h +++ b/library/cpp/binsaver/bin_saver.h @@ -566,25 +566,25 @@ int TPtrBase<TUserObj, TRef>::operator&(IBinSaver& f) { } //////////////////////////////////////////////////////////////////////////////////////////////////// - + extern TClassFactory<IObjectBase>* pSaverClasses; void StartRegisterSaveload(); - + template <class TReg> -struct TRegisterSaveLoadType { - TRegisterSaveLoadType(int num) { - StartRegisterSaveload(); +struct TRegisterSaveLoadType { + TRegisterSaveLoadType(int num) { + StartRegisterSaveload(); pSaverClasses->RegisterType(num, TReg::NewSaveLoadNullItem, (TReg*)nullptr); - } -}; - + } +}; + #define Y_BINSAVER_REGISTER(name) \ BASIC_REGISTER_CLASS(name) \ static TRegisterSaveLoadType<name> init##name(MurmurHash<int>(#name, sizeof(#name))); #define REGISTER_SAVELOAD_CLASS(N, name) \ BASIC_REGISTER_CLASS(name) \ - static TRegisterSaveLoadType<name> init##name##N(N); + static TRegisterSaveLoadType<name> init##name##N(N); // using TObj/TRef on forward declared templ class will not work // but multiple registration with same id is allowed diff --git a/library/cpp/http/fetch/httpload.cpp b/library/cpp/http/fetch/httpload.cpp index 1d59e3f46d..82ea8900b5 100644 --- a/library/cpp/http/fetch/httpload.cpp +++ b/library/cpp/http/fetch/httpload.cpp @@ -108,7 +108,7 @@ long httpAgentReader::readPortion(void*& buf) { /************************************************************/ bool httpAgentReader::skipTheRest() { - void* b; + void* b; while (!eof()) readPortion(b); return (State == hp_eof); diff --git a/library/cpp/http/fetch/httpparser.h b/library/cpp/http/fetch/httpparser.h index a93f67aa62..769828e4ae 100644 --- a/library/cpp/http/fetch/httpparser.h +++ b/library/cpp/http/fetch/httpparser.h @@ -161,7 +161,7 @@ protected: : hp_read_closed; if (State == hp_begin_chunk_header) { // unget \n for chunk reader - buf = (char*)buf - 1; + buf = (char*)buf - 1; size++; } if (isReader) @@ -223,7 +223,7 @@ protected: if (isReader) return ChunkSize; size -= ChunkSize; - buf = (char*)buf + ChunkSize; + buf = (char*)buf + ChunkSize; } else { Header->entity_size += size; ChunkSize -= size; @@ -252,7 +252,7 @@ public: } void Parse(void* buf, long size) { - TBaseT::ParseGeneric(buf, size); + TBaseT::ParseGeneric(buf, size); } }; @@ -310,7 +310,7 @@ public: return Eoferr = -1; } } - Chunk = ParseGeneric(Ptr, Size); + Chunk = ParseGeneric(Ptr, Size); buf = Ptr; Ptr = (char*)Ptr + Chunk; Size -= Chunk; @@ -330,7 +330,7 @@ protected: while (State == hp_in_header) { if ((Size = (long)Reader::Read(Ptr)) < 0) return Eoferr = -1; - ParseGeneric(Ptr, Size); + ParseGeneric(Ptr, Size); } if (State == hp_error) return Eoferr = -1; diff --git a/library/cpp/http/fetch/httpzreader.h b/library/cpp/http/fetch/httpzreader.h index 52ac7274ed..68eb00853d 100644 --- a/library/cpp/http/fetch/httpzreader.h +++ b/library/cpp/http/fetch/httpzreader.h @@ -94,8 +94,8 @@ public: while (true) { if (Stream.avail_in == 0) { void* tmpin = Stream.next_in; - long res = TBase::Read(tmpin); - Stream.next_in = (Bytef*)tmpin; + long res = TBase::Read(tmpin); + Stream.next_in = (Bytef*)tmpin; if (res <= 0) return res; Stream.avail_in = (uInt)res; diff --git a/library/cpp/sighandler/async_signals_handler.cpp b/library/cpp/sighandler/async_signals_handler.cpp index dce409b96b..00ce1c18fb 100644 --- a/library/cpp/sighandler/async_signals_handler.cpp +++ b/library/cpp/sighandler/async_signals_handler.cpp @@ -1,6 +1,6 @@ #include "async_signals_handler.h" -#include <util/system/platform.h> +#include <util/system/platform.h> #if !defined(_win_) diff --git a/util/digest/numeric.h b/util/digest/numeric.h index 53abcd145c..e20bd908e4 100644 --- a/util/digest/numeric.h +++ b/util/digest/numeric.h @@ -77,7 +77,7 @@ static constexpr size_t NumericHash(T t) noexcept { TCvt cvt; } u{t}; - return (size_t)IntHash(u.cvt); + return (size_t)IntHash(u.cvt); } template <class T> diff --git a/util/draft/holder_vector.h b/util/draft/holder_vector.h index 8c9ac0ba23..1c62055bd9 100644 --- a/util/draft/holder_vector.h +++ b/util/draft/holder_vector.h @@ -91,7 +91,7 @@ public: using TBase::empty; using TBase::end; using TBase::front; - using TBase::reserve; + using TBase::reserve; using TBase::size; using typename TBase::const_iterator; diff --git a/util/folder/dirut.cpp b/util/folder/dirut.cpp index 1541245b5d..ffc9b09f96 100644 --- a/util/folder/dirut.cpp +++ b/util/folder/dirut.cpp @@ -491,12 +491,12 @@ void MakePathIfNotExist(const char* path, int mode) { const char* GetFileNameComponent(const char* f) { const char* p = strrchr(f, LOCSLASH_C); -#ifdef _win_ - // "/" is also valid char separator on Windows - const char* p2 = strrchr(f, '/'); - if (p2 > p) - p = p2; -#endif +#ifdef _win_ + // "/" is also valid char separator on Windows + const char* p2 = strrchr(f, '/'); + if (p2 > p) + p = p2; +#endif if (p) { return p + 1; diff --git a/util/folder/iterator_ut.cpp b/util/folder/iterator_ut.cpp index e9797e0698..936becd139 100644 --- a/util/folder/iterator_ut.cpp +++ b/util/folder/iterator_ut.cpp @@ -82,9 +82,9 @@ private: inline ~TDirHier() { for (size_t i = 0; i < Paths_.size(); ++i) { NFs::Remove(Paths_[Paths_.size() - i - 1].Path); - } - } - + } + } + private: TVector<TPath> Paths_; THashMap<TString, TPath> Srch_; diff --git a/util/generic/bitmap.h b/util/generic/bitmap.h index 565d86c2d1..f77d182460 100644 --- a/util/generic/bitmap.h +++ b/util/generic/bitmap.h @@ -566,28 +566,28 @@ public: } template <class TTo> - void Export(size_t pos, TTo& to) const { + void Export(size_t pos, TTo& to) const { static_assert(std::is_unsigned<TTo>::value, "expect std::is_unsigned<TTo>::value"); - to = 0; - size_t chunkpos = pos >> DivCount; - if (chunkpos >= Mask.GetChunkCapacity()) - return; - if ((pos & ModMask) == 0) { - if (sizeof(TChunk) >= sizeof(TTo)) - to = (TTo)Mask.Data[chunkpos]; - else //if (sizeof(TChunk) < sizeof(TTo)) - NBitMapPrivate::CopyData(&to, 1, Mask.Data + chunkpos, Min(((sizeof(TTo) * 8) >> DivCount), Mask.GetChunkCapacity() - chunkpos)); - } else if ((pos & (sizeof(TTo) * 8 - 1)) == 0 && sizeof(TChunk) >= 2 * sizeof(TTo)) - to = (TTo)(Mask.Data[chunkpos] >> (pos & ModMask)); - else { + to = 0; + size_t chunkpos = pos >> DivCount; + if (chunkpos >= Mask.GetChunkCapacity()) + return; + if ((pos & ModMask) == 0) { + if (sizeof(TChunk) >= sizeof(TTo)) + to = (TTo)Mask.Data[chunkpos]; + else //if (sizeof(TChunk) < sizeof(TTo)) + NBitMapPrivate::CopyData(&to, 1, Mask.Data + chunkpos, Min(((sizeof(TTo) * 8) >> DivCount), Mask.GetChunkCapacity() - chunkpos)); + } else if ((pos & (sizeof(TTo) * 8 - 1)) == 0 && sizeof(TChunk) >= 2 * sizeof(TTo)) + to = (TTo)(Mask.Data[chunkpos] >> (pos & ModMask)); + else { static constexpr size_t copyToSize = (sizeof(TChunk) >= sizeof(TTo)) ? (sizeof(TChunk) / sizeof(TTo)) + 2 : 3; - TTo temp[copyToSize] = {0, 0}; - //or use non defined by now TBitmap<copyToSize, TTo>::CopyData,RShift(pos & ModMask),Export(0,to) - NBitMapPrivate::CopyData(temp, copyToSize, Mask.Data + chunkpos, Min((sizeof(TTo) / sizeof(TChunk)) + 1, Mask.GetChunkCapacity() - chunkpos)); - to = (temp[0] >> (pos & ModMask)) | (temp[1] << (8 * sizeof(TTo) - (pos & ModMask))); - } - } - + TTo temp[copyToSize] = {0, 0}; + //or use non defined by now TBitmap<copyToSize, TTo>::CopyData,RShift(pos & ModMask),Export(0,to) + NBitMapPrivate::CopyData(temp, copyToSize, Mask.Data + chunkpos, Min((sizeof(TTo) / sizeof(TChunk)) + 1, Mask.GetChunkCapacity() - chunkpos)); + to = (temp[0] >> (pos & ModMask)) | (temp[1] << (8 * sizeof(TTo) - (pos & ModMask))); + } + } + Y_FORCE_INLINE bool Test(size_t n) const { return Get(n); } @@ -608,8 +608,8 @@ public: Mask.Data[i] = 0; } return *this; - } - + } + // Returns bits capacity Y_FORCE_INLINE constexpr size_t Size() const noexcept { return Mask.GetBitCapacity(); @@ -631,10 +631,10 @@ public: Y_PURE_FUNCTION Y_FORCE_INLINE bool Empty() const { for (size_t i = 0; i < Mask.GetChunkCapacity(); ++i) if (Mask.Data[i]) - return false; - return true; - } - + return false; + return true; + } + bool HasAny(const TThis& bitmap) const { for (size_t i = 0; i < Min(Mask.GetChunkCapacity(), bitmap.Mask.GetChunkCapacity()); ++i) { if (0 != (Mask.Data[i] & bitmap.Mask.Data[i])) { diff --git a/util/generic/bitmap_ut.cpp b/util/generic/bitmap_ut.cpp index de3fedbc0a..087d34a8dc 100644 --- a/util/generic/bitmap_ut.cpp +++ b/util/generic/bitmap_ut.cpp @@ -264,25 +264,25 @@ Y_UNIT_TEST_SUITE(TBitMapTest) { TDynBitMap bitmap4 = ~((bitmap3 | 3) & bitmap2); CHECK_BITMAP_WITH_TAIL(bitmap4, resBits); - - TBitMap<128, ui32> expmap; - expmap.Set(47); - expmap.Set(90); - ui64 tst1 = 0; - ui32 tst2 = 0; - ui16 tst3 = 0; - expmap.Export(32, tst1); + + TBitMap<128, ui32> expmap; + expmap.Set(47); + expmap.Set(90); + ui64 tst1 = 0; + ui32 tst2 = 0; + ui16 tst3 = 0; + expmap.Export(32, tst1); UNIT_ASSERT_EQUAL(tst1, (1 << 15) | (((ui64)1) << 58)); - expmap.Export(32, tst2); + expmap.Export(32, tst2); UNIT_ASSERT_EQUAL(tst2, (1 << 15)); - expmap.Export(32, tst3); + expmap.Export(32, tst3); UNIT_ASSERT_EQUAL(tst3, (1 << 15)); - - expmap.Export(33, tst1); + + expmap.Export(33, tst1); UNIT_ASSERT_EQUAL(tst1, (1 << 14) | (((ui64)1) << 57)); - expmap.Export(33, tst2); + expmap.Export(33, tst2); UNIT_ASSERT_EQUAL(tst2, (1 << 14)); - expmap.Export(33, tst3); + expmap.Export(33, tst3); UNIT_ASSERT_EQUAL(tst3, (1 << 14)); } diff --git a/util/network/socket.cpp b/util/network/socket.cpp index e568eacbbc..4f6e804346 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -707,10 +707,10 @@ static inline SOCKET DoConnect(const struct addrinfo* res, const TInstant& deadL } static inline ssize_t DoSendV(SOCKET fd, const struct iovec* iov, size_t count) { - ssize_t ret = -1; - do { + ssize_t ret = -1; + do { ret = DoSendMsg(fd, iov, (int)count); - } while (ret == -1 && errno == EINTR); + } while (ret == -1 && errno == EINTR); if (ret < 0) { return -LastSystemError(); diff --git a/util/system/context.cpp b/util/system/context.cpp index cbf823afee..ad99309088 100644 --- a/util/system/context.cpp +++ b/util/system/context.cpp @@ -227,7 +227,7 @@ TContMachineContext::TContMachineContext() TContMachineContext::TContMachineContext(const TContClosure& c) : Fiber_(CreateFiber(c.Stack.size(), (LPFIBER_START_ROUTINE)ContextTrampoLine, (LPVOID)c.TrampoLine)) , MainFiber_(false) -{ +{ Y_ENSURE(Fiber_, TStringBuf("fiber error")); } diff --git a/util/system/daemon.cpp b/util/system/daemon.cpp index ced376487a..130e6c8f45 100644 --- a/util/system/daemon.cpp +++ b/util/system/daemon.cpp @@ -1,17 +1,17 @@ #include <util/generic/yexception.h> -#include <cerrno> +#include <cerrno> #include <cstdlib> #include <util/system/info.h> -#if defined(_win_) +#if defined(_win_) #include <io.h> -#else +#else #include <sys/wait.h> #include <unistd.h> #include <fcntl.h> -#endif - +#endif + #include "daemon.h" #ifdef _unix_ @@ -62,18 +62,18 @@ static void CloseFromToExcept(int from, int to, const int* except) { goto dontclose; } } - while (close(s) == -1) { + while (close(s) == -1) { if (errno == EBADF) { - break; + break; } if (errno != EINTR) { ythrow TSystemError() << "close(" << s << ") failed"; } - } + } dontclose:; } -#endif /* _unix_ */ -} +#endif /* _unix_ */ +} bool NDaemonMaker::MakeMeDaemon(ECloseDescriptors cd, EStdIoDescriptors iod, EChDir chd, EParent parent) { (void)cd; diff --git a/util/system/daemon.h b/util/system/daemon.h index 31689f9cda..b00793b9c9 100644 --- a/util/system/daemon.h +++ b/util/system/daemon.h @@ -23,5 +23,5 @@ namespace NDaemonMaker { }; bool MakeMeDaemon(ECloseDescriptors cd = closeAll, EStdIoDescriptors iod = openDevNull, EChDir chd = chdirRoot, EParent parent = callExitFromParent); - void CloseFrom(int fd); + void CloseFrom(int fd); } diff --git a/util/system/fs.cpp b/util/system/fs.cpp index c8988d85d6..d2611a8ccc 100644 --- a/util/system/fs.cpp +++ b/util/system/fs.cpp @@ -91,7 +91,7 @@ bool NFs::Rename(const TString& oldPath, const TString& newPath) { return ::rename(oldPath.data(), newPath.data()) == 0; #endif } - + void NFs::HardLinkOrCopy(const TString& existingPath, const TString& newPath) { if (!NFs::HardLink(existingPath, newPath)) { Copy(existingPath, newPath); @@ -101,10 +101,10 @@ void NFs::HardLinkOrCopy(const TString& existingPath, const TString& newPath) { bool NFs::HardLink(const TString& existingPath, const TString& newPath) { #if defined(_win_) return NFsPrivate::WinHardLink(existingPath, newPath); -#elif defined(_unix_) +#elif defined(_unix_) return (0 == link(existingPath.data(), newPath.data())); -#endif -} +#endif +} bool NFs::SymLink(const TString& targetPath, const TString& linkPath) { #if defined(_win_) |