diff options
author | prime <prime@yandex-team.ru> | 2022-02-10 16:46:00 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:00 +0300 |
commit | 3695a7cd42b74a4987d8d5a8f2e2443556998943 (patch) | |
tree | ee79ee9294a61ee00e647684b3700d0a87e102a3 /util | |
parent | 4d8b546b89b5afc08cf3667e176271c7ba935f33 (diff) | |
download | ydb-3695a7cd42b74a4987d8d5a8f2e2443556998943.tar.gz |
Restoring authorship annotation for <prime@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util')
-rw-r--r-- | util/network/pollerimpl.h | 8 | ||||
-rw-r--r-- | util/network/socket.cpp | 12 | ||||
-rw-r--r-- | util/stream/zlib.cpp | 8 | ||||
-rw-r--r-- | util/stream/zlib_ut.cpp | 118 | ||||
-rw-r--r-- | util/system/context.cpp | 4 | ||||
-rw-r--r-- | util/system/context.h | 2 |
6 files changed, 76 insertions, 76 deletions
diff --git a/util/network/pollerimpl.h b/util/network/pollerimpl.h index e8c7e40fba..d417a1ad4a 100644 --- a/util/network/pollerimpl.h +++ b/util/network/pollerimpl.h @@ -204,8 +204,8 @@ class TEpollPoller { public: typedef struct ::epoll_event TEvent; - inline TEpollPoller(bool closeOnExec = false) - : Fd_(epoll_create1(closeOnExec ? EPOLL_CLOEXEC : 0)) + inline TEpollPoller(bool closeOnExec = false) + : Fd_(epoll_create1(closeOnExec ? EPOLL_CLOEXEC : 0)) { if (Fd_ == -1) { ythrow TSystemError() << "epoll_create failed"; @@ -655,8 +655,8 @@ static inline TDuration PollStep(const TInstant& deadLine, const TInstant& now) template <class TBase> class TGenericPoller: public TBase { public: - using TBase::TBase; - + using TBase::TBase; + using TEvent = typename TBase::TEvent; inline void Set(void* data, SOCKET fd, int what) { diff --git a/util/network/socket.cpp b/util/network/socket.cpp index 4f6e804346..7b402d1996 100644 --- a/util/network/socket.cpp +++ b/util/network/socket.cpp @@ -981,15 +981,15 @@ private: void operator()(struct addrinfo* ai) noexcept { if (!UseFreeAddrInfo_ && ai != NULL) { if (ai->ai_addr != NULL) { - free(ai->ai_addr); + free(ai->ai_addr); } struct addrinfo* p; while (ai != NULL) { p = ai; ai = ai->ai_next; - free(p->ai_canonname); - free(p); + free(p->ai_canonname); + free(p); } } else if (ai != NULL) { freeaddrinfo(ai); @@ -1035,14 +1035,14 @@ public: inline TImpl(const char* path, int flags) : Info_(nullptr, TAddrInfoDeleter{/* useFreeAddrInfo = */ false}) { - THolder<struct sockaddr_un, TFree> sockAddr( - reinterpret_cast<struct sockaddr_un*>(malloc(sizeof(struct sockaddr_un)))); + THolder<struct sockaddr_un, TFree> sockAddr( + reinterpret_cast<struct sockaddr_un*>(malloc(sizeof(struct sockaddr_un)))); Y_ENSURE(strlen(path) < sizeof(sockAddr->sun_path), "Unix socket path more than " << sizeof(sockAddr->sun_path)); sockAddr->sun_family = AF_UNIX; strcpy(sockAddr->sun_path, path); - TAddrInfoPtr hints(reinterpret_cast<struct addrinfo*>(malloc(sizeof(struct addrinfo))), TAddrInfoDeleter{/* useFreeAddrInfo = */ false}); + TAddrInfoPtr hints(reinterpret_cast<struct addrinfo*>(malloc(sizeof(struct addrinfo))), TAddrInfoDeleter{/* useFreeAddrInfo = */ false}); memset(hints.get(), 0, sizeof(*hints)); hints->ai_flags = flags; diff --git a/util/stream/zlib.cpp b/util/stream/zlib.cpp index 60f4e9439f..605143aa0e 100644 --- a/util/stream/zlib.cpp +++ b/util/stream/zlib.cpp @@ -233,10 +233,10 @@ public: const Bytef* b = (const Bytef*)buf; const Bytef* e = b + size; - Y_DEFER { - Z()->next_in = nullptr; - Z()->avail_in = 0; - }; + Y_DEFER { + Z()->next_in = nullptr; + Z()->avail_in = 0; + }; do { b = WritePart(b, e); } while (b < e); diff --git a/util/stream/zlib_ut.cpp b/util/stream/zlib_ut.cpp index 2290b4a9de..424a422fda 100644 --- a/util/stream/zlib_ut.cpp +++ b/util/stream/zlib_ut.cpp @@ -4,53 +4,53 @@ #include "file.h" #include <util/system/tempfile.h> -#include <util/random/entropy.h> -#include <util/random/random.h> +#include <util/random/entropy.h> +#include <util/random/random.h> #define ZDATA "./zdata" -class TThrowingStream: public IOutputStream { -public: - TThrowingStream(int limit) - : Limit_(limit) - { - } - - void DoWrite(const void*, size_t size) override { - if (Ignore) { - return; - } - - Limit_ -= size; - if (Limit_ < 0) { - throw yexception() << "catch this"; - } - } - - void DoFinish() override { - if (Ignore) { - return; - } - if (Limit_ < 0) { - throw yexception() << "catch this"; - } - } - - void DoFlush() override { - if (Ignore) { - return; - } - if (Limit_ < 0) { - throw yexception() << "catch this"; - } - } - - bool Ignore = false; - -private: - int Limit_; -}; - +class TThrowingStream: public IOutputStream { +public: + TThrowingStream(int limit) + : Limit_(limit) + { + } + + void DoWrite(const void*, size_t size) override { + if (Ignore) { + return; + } + + Limit_ -= size; + if (Limit_ < 0) { + throw yexception() << "catch this"; + } + } + + void DoFinish() override { + if (Ignore) { + return; + } + if (Limit_ < 0) { + throw yexception() << "catch this"; + } + } + + void DoFlush() override { + if (Ignore) { + return; + } + if (Limit_ < 0) { + throw yexception() << "catch this"; + } + } + + bool Ignore = false; + +private: + int Limit_; +}; + Y_UNIT_TEST_SUITE(TZLibTest) { static const TString DATA = "8s7d5vc6s5vc67sa4c65ascx6asd4xcv76adsfxv76s"; static const TString DATA2 = "cn8wk2bd9vb3vdfif83g1ks94bfiovtwv"; @@ -111,21 +111,21 @@ Y_UNIT_TEST_SUITE(TZLibTest) { } } - Y_UNIT_TEST(CompressionExceptionSegfault) { - TVector<char> buf(512 * 1024); - EntropyPool().Load(buf.data(), buf.size()); - - TThrowingStream o(128 * 1024); - TZLibCompress c(&o, ZLib::GZip, 4, 1 << 15); - try { - c.Write(buf.data(), buf.size()); - } catch (...) { - } - - o.Ignore = true; - TVector<char>().swap(buf); - } - + Y_UNIT_TEST(CompressionExceptionSegfault) { + TVector<char> buf(512 * 1024); + EntropyPool().Load(buf.data(), buf.size()); + + TThrowingStream o(128 * 1024); + TZLibCompress c(&o, ZLib::GZip, 4, 1 << 15); + try { + c.Write(buf.data(), buf.size()); + } catch (...) { + } + + o.Ignore = true; + TVector<char>().swap(buf); + } + Y_UNIT_TEST(DecompressFirstOfTwoStreams) { // Check that Decompress(Compress(X) + Compress(Y)) == X when single stream is allowed TTempFile tmpFile(ZDATA); diff --git a/util/system/context.cpp b/util/system/context.cpp index ad99309088..7cd7b6e5b8 100644 --- a/util/system/context.cpp +++ b/util/system/context.cpp @@ -145,9 +145,9 @@ TContMachineContext::TSan::TSan(const TContClosure& c) noexcept { } -void TContMachineContext::TSan::DoRunNaked() { +void TContMachineContext::TSan::DoRunNaked() { AfterSwitch(); - TL->DoRunNaked(); + TL->DoRunNaked(); BeforeFinish(); } diff --git a/util/system/context.h b/util/system/context.h index d2a349bfc5..cf0b449c0f 100644 --- a/util/system/context.h +++ b/util/system/context.h @@ -142,7 +142,7 @@ private: TSan() noexcept; TSan(const TContClosure& c) noexcept; - void DoRunNaked() override; + void DoRunNaked() override; ITrampoLine* TL; }; |