diff options
author | a-square <a-square@yandex-team.ru> | 2022-02-10 16:50:24 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:50:24 +0300 |
commit | a01c1f7b71b4422f01b11d9ea45bfd88e228c968 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/stream/buffered.cpp | |
parent | 34f3f9bd7972f67d913075206081554a3e39a0de (diff) | |
download | ydb-a01c1f7b71b4422f01b11d9ea45bfd88e228c968.tar.gz |
Restoring authorship annotation for <a-square@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/stream/buffered.cpp')
-rw-r--r-- | util/stream/buffered.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/util/stream/buffered.cpp b/util/stream/buffered.cpp index 9854490add..a00e592e1c 100644 --- a/util/stream/buffered.cpp +++ b/util/stream/buffered.cpp @@ -36,32 +36,32 @@ public: } inline size_t Skip(size_t len) { - size_t totalSkipped = 0; - while (len) { - const size_t skipped = DoSkip(len); - if (skipped == 0) { - break; - } - - totalSkipped += skipped; - len -= skipped; + size_t totalSkipped = 0; + while (len) { + const size_t skipped = DoSkip(len); + if (skipped == 0) { + break; + } + + totalSkipped += skipped; + len -= skipped; } - - return totalSkipped; + + return totalSkipped; + } + + inline size_t DoSkip(size_t len) { + if (MemInput_.Exhausted()) { + if (len > BufLen() / 2) { + return Slave_->Skip(len); + } + + MemInput_.Reset(Buf(), Slave_->Read(Buf(), BufLen())); + } + + return MemInput_.Skip(len); } - inline size_t DoSkip(size_t len) { - if (MemInput_.Exhausted()) { - if (len > BufLen() / 2) { - return Slave_->Skip(len); - } - - MemInput_.Reset(Buf(), Slave_->Read(Buf(), BufLen())); - } - - return MemInput_.Skip(len); - } - inline size_t ReadTo(TString& st, char to) { st.clear(); @@ -122,9 +122,9 @@ TBufferedInput::TBufferedInput(IInputStream* slave, size_t buflen) { } -TBufferedInput::TBufferedInput(TBufferedInput&&) noexcept = default; -TBufferedInput& TBufferedInput::operator=(TBufferedInput&&) noexcept = default; - +TBufferedInput::TBufferedInput(TBufferedInput&&) noexcept = default; +TBufferedInput& TBufferedInput::operator=(TBufferedInput&&) noexcept = default; + TBufferedInput::~TBufferedInput() = default; size_t TBufferedInput::DoRead(void* buf, size_t len) { @@ -356,9 +356,9 @@ TBufferedOutputBase::TBufferedOutputBase(IOutputStream* slave, size_t buflen) { } -TBufferedOutputBase::TBufferedOutputBase(TBufferedOutputBase&&) noexcept = default; -TBufferedOutputBase& TBufferedOutputBase::operator=(TBufferedOutputBase&&) noexcept = default; - +TBufferedOutputBase::TBufferedOutputBase(TBufferedOutputBase&&) noexcept = default; +TBufferedOutputBase& TBufferedOutputBase::operator=(TBufferedOutputBase&&) noexcept = default; + TBufferedOutputBase::~TBufferedOutputBase() { try { Finish(); |