diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:44 +0300 |
commit | 59e19371de37995fcb36beb16cd6ec030af960bc (patch) | |
tree | fa68e36093ebff8b805462e9e6d331fe9d348214 /util/stream | |
parent | 89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff) | |
download | ydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/stream')
-rw-r--r-- | util/stream/aligned.h | 2 | ||||
-rw-r--r-- | util/stream/buffer.h | 2 | ||||
-rw-r--r-- | util/stream/buffered.h | 2 | ||||
-rw-r--r-- | util/stream/debug.h | 2 | ||||
-rw-r--r-- | util/stream/file.h | 2 | ||||
-rw-r--r-- | util/stream/format.h | 2 | ||||
-rw-r--r-- | util/stream/input.cpp | 10 | ||||
-rw-r--r-- | util/stream/input.h | 2 | ||||
-rw-r--r-- | util/stream/length.cpp | 58 | ||||
-rw-r--r-- | util/stream/length.h | 40 | ||||
-rw-r--r-- | util/stream/mem.h | 2 | ||||
-rw-r--r-- | util/stream/multi.h | 2 | ||||
-rw-r--r-- | util/stream/null.h | 2 | ||||
-rw-r--r-- | util/stream/output.h | 2 | ||||
-rw-r--r-- | util/stream/pipe.h | 2 | ||||
-rw-r--r-- | util/stream/printf.h | 2 | ||||
-rw-r--r-- | util/stream/str.h | 2 | ||||
-rw-r--r-- | util/stream/tee.h | 2 | ||||
-rw-r--r-- | util/stream/tempbuf.h | 2 | ||||
-rw-r--r-- | util/stream/tokenizer.h | 2 | ||||
-rw-r--r-- | util/stream/walk.h | 2 | ||||
-rw-r--r-- | util/stream/zerocopy.h | 2 | ||||
-rw-r--r-- | util/stream/zlib.h | 2 |
23 files changed, 74 insertions, 74 deletions
diff --git a/util/stream/aligned.h b/util/stream/aligned.h index 70e7be05a99..5c86beddc63 100644 --- a/util/stream/aligned.h +++ b/util/stream/aligned.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" #include "output.h" diff --git a/util/stream/buffer.h b/util/stream/buffer.h index 9dc99dbe49f..4ca6128d804 100644 --- a/util/stream/buffer.h +++ b/util/stream/buffer.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "zerocopy_output.h" diff --git a/util/stream/buffered.h b/util/stream/buffered.h index 0847186141f..42405d326c0 100644 --- a/util/stream/buffered.h +++ b/util/stream/buffered.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "zerocopy_output.h" diff --git a/util/stream/debug.h b/util/stream/debug.h index 92d6d4b42da..cbee0ee770c 100644 --- a/util/stream/debug.h +++ b/util/stream/debug.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "output.h" diff --git a/util/stream/file.h b/util/stream/file.h index c1cf4f591d4..eee86658df6 100644 --- a/util/stream/file.h +++ b/util/stream/file.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "fwd.h" #include "input.h" diff --git a/util/stream/format.h b/util/stream/format.h index b033208a1b0..04257f5a810 100644 --- a/util/stream/format.h +++ b/util/stream/format.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "mem.h" #include "output.h" diff --git a/util/stream/input.cpp b/util/stream/input.cpp index 6e8170f2f9f..5f545c2bca6 100644 --- a/util/stream/input.cpp +++ b/util/stream/input.cpp @@ -120,9 +120,9 @@ TString IInputStream::ReadTo(char ch) { } size_t IInputStream::Skip(size_t sz) { - return DoSkip(sz); -} - + return DoSkip(sz); +} + size_t IInputStream::DoSkip(size_t sz) { if (sz < 128) { return Load(alloca(sz), sz); @@ -143,8 +143,8 @@ size_t IInputStream::DoSkip(size_t sz) { } return total; -} - +} + TString IInputStream::ReadAll() { TString result; TStringOutput stream(result); diff --git a/util/stream/input.h b/util/stream/input.h index f0d5807ed27..59874fd06e6 100644 --- a/util/stream/input.h +++ b/util/stream/input.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/generic/fwd.h> #include <util/generic/noncopyable.h> diff --git a/util/stream/length.cpp b/util/stream/length.cpp index 9907fe2ac94..09968fc2abb 100644 --- a/util/stream/length.cpp +++ b/util/stream/length.cpp @@ -1,32 +1,32 @@ -#include "length.h" - -size_t TLengthLimitedInput::DoRead(void* buf, size_t len) { - const size_t toRead = (size_t)Min<ui64>(Length_, len); - const size_t ret = Slave_->Read(buf, toRead); - - Length_ -= ret; - - return ret; -} - -size_t TLengthLimitedInput::DoSkip(size_t len) { - len = (size_t)Min<ui64>((ui64)len, Length_); - len = Slave_->Skip(len); - Length_ -= len; - return len; -} - -size_t TCountingInput::DoRead(void* buf, size_t len) { - const size_t ret = Slave_->Read(buf, len); - Count_ += ret; - return ret; -} - -size_t TCountingInput::DoSkip(size_t len) { - const size_t ret = Slave_->Skip(len); - Count_ += ret; - return ret; -} +#include "length.h" + +size_t TLengthLimitedInput::DoRead(void* buf, size_t len) { + const size_t toRead = (size_t)Min<ui64>(Length_, len); + const size_t ret = Slave_->Read(buf, toRead); + + Length_ -= ret; + + return ret; +} + +size_t TLengthLimitedInput::DoSkip(size_t len) { + len = (size_t)Min<ui64>((ui64)len, Length_); + len = Slave_->Skip(len); + Length_ -= len; + return len; +} + +size_t TCountingInput::DoRead(void* buf, size_t len) { + const size_t ret = Slave_->Read(buf, len); + Count_ += ret; + return ret; +} + +size_t TCountingInput::DoSkip(size_t len) { + const size_t ret = Slave_->Skip(len); + Count_ += ret; + return ret; +} size_t TCountingInput::DoReadTo(TString& st, char ch) { const size_t ret = Slave_->ReadTo(st, ch); diff --git a/util/stream/length.h b/util/stream/length.h index 4d508ae24d2..7d8e1c4a09f 100644 --- a/util/stream/length.h +++ b/util/stream/length.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" #include "output.h" @@ -13,58 +13,58 @@ * treat these as separate streams. */ class TLengthLimitedInput: public IInputStream { -public: +public: inline TLengthLimitedInput(IInputStream* slave, ui64 length) noexcept : Slave_(slave) , Length_(length) { - } + } ~TLengthLimitedInput() override = default; inline ui64 Left() const noexcept { - return Length_; - } + return Length_; + } -private: +private: size_t DoRead(void* buf, size_t len) override; size_t DoSkip(size_t len) override; -private: +private: IInputStream* Slave_; - ui64 Length_; -}; + ui64 Length_; +}; /** * Proxy input stream that counts the number of characters read. */ class TCountingInput: public IInputStream { -public: +public: inline TCountingInput(IInputStream* slave) noexcept : Slave_(slave) , Count_() { - } - + } + ~TCountingInput() override = default; - + /** * \returns The total number of characters read from * this stream. */ inline ui64 Counter() const noexcept { - return Count_; - } - -private: + return Count_; + } + +private: size_t DoRead(void* buf, size_t len) override; size_t DoSkip(size_t len) override; size_t DoReadTo(TString& st, char ch) override; ui64 DoReadAll(IOutputStream& out) override; - -private: + +private: IInputStream* Slave_; - ui64 Count_; + ui64 Count_; }; /** diff --git a/util/stream/mem.h b/util/stream/mem.h index 18a5d467729..5dd475deb9f 100644 --- a/util/stream/mem.h +++ b/util/stream/mem.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "zerocopy_output.h" diff --git a/util/stream/multi.h b/util/stream/multi.h index 8bfd462d99e..6c62501139c 100644 --- a/util/stream/multi.h +++ b/util/stream/multi.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" diff --git a/util/stream/null.h b/util/stream/null.h index 8c335a9a789..87c5bd9470a 100644 --- a/util/stream/null.h +++ b/util/stream/null.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "output.h" diff --git a/util/stream/output.h b/util/stream/output.h index 00eef50b958..29d43d4c255 100644 --- a/util/stream/output.h +++ b/util/stream/output.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "fwd.h" #include "labeled.h" diff --git a/util/stream/pipe.h b/util/stream/pipe.h index 18525b9517d..3f96fa5cc00 100644 --- a/util/stream/pipe.h +++ b/util/stream/pipe.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" #include "output.h" diff --git a/util/stream/printf.h b/util/stream/printf.h index 1c7ddc06646..7067f7eae4d 100644 --- a/util/stream/printf.h +++ b/util/stream/printf.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/system/compat.h> diff --git a/util/stream/str.h b/util/stream/str.h index 028bd572c03..1d1e99980dc 100644 --- a/util/stream/str.h +++ b/util/stream/str.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" #include "zerocopy_output.h" diff --git a/util/stream/tee.h b/util/stream/tee.h index c69e232fb9f..bf3072f095d 100644 --- a/util/stream/tee.h +++ b/util/stream/tee.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "output.h" diff --git a/util/stream/tempbuf.h b/util/stream/tempbuf.h index a6dc001025a..0e2f2b3040f 100644 --- a/util/stream/tempbuf.h +++ b/util/stream/tempbuf.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "output.h" diff --git a/util/stream/tokenizer.h b/util/stream/tokenizer.h index b2398efdd1a..6677c3354ef 100644 --- a/util/stream/tokenizer.h +++ b/util/stream/tokenizer.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "input.h" diff --git a/util/stream/walk.h b/util/stream/walk.h index 7e62cb44dc9..d972458fdd5 100644 --- a/util/stream/walk.h +++ b/util/stream/walk.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "zerocopy.h" diff --git a/util/stream/zerocopy.h b/util/stream/zerocopy.h index 3315aa3a517..957f6233c11 100644 --- a/util/stream/zerocopy.h +++ b/util/stream/zerocopy.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/system/yassert.h> #include <util/system/defaults.h> diff --git a/util/stream/zlib.h b/util/stream/zlib.h index e7de7c81b74..1d4ca35cbbb 100644 --- a/util/stream/zlib.h +++ b/util/stream/zlib.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "fwd.h" #include "input.h" |