diff options
author | nikitamorozov <nikitamorozov@yandex-team.ru> | 2022-02-10 16:49:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:20 +0300 |
commit | 523d26598d9784601932189f7fceb34d61bf7641 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /util/stream/buffer.cpp | |
parent | 2342f2b56e674c21307fcb92a37853f950224d31 (diff) | |
download | ydb-523d26598d9784601932189f7fceb34d61bf7641.tar.gz |
Restoring authorship annotation for <nikitamorozov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/stream/buffer.cpp')
-rw-r--r-- | util/stream/buffer.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/util/stream/buffer.cpp b/util/stream/buffer.cpp index b7871a9900..2facece4ea 100644 --- a/util/stream/buffer.cpp +++ b/util/stream/buffer.cpp @@ -1,6 +1,6 @@ #include "buffer.h" #include <util/generic/buffer.h> -#include <util/generic/yexception.h> +#include <util/generic/yexception.h> class TBufferOutput::TImpl { public: @@ -11,21 +11,21 @@ public: virtual ~TImpl() = default; - inline size_t DoNext(void** ptr) { - if (Data_.Avail() == 0) { - Data_.Reserve(FastClp2(Data_.Capacity() + MinBufferGrowSize)); - } - size_t previousSize = Data_.size(); - Data_.Resize(Data_.Capacity()); - *ptr = Data_.Begin() + previousSize; - return Data_.Size() - previousSize; - } - - inline void DoUndo(size_t len) { - Y_VERIFY(len <= Data_.Size(), "trying to undo more bytes than actually written"); - Data_.Resize(Data_.size() - len); - } - + inline size_t DoNext(void** ptr) { + if (Data_.Avail() == 0) { + Data_.Reserve(FastClp2(Data_.Capacity() + MinBufferGrowSize)); + } + size_t previousSize = Data_.size(); + Data_.Resize(Data_.Capacity()); + *ptr = Data_.Begin() + previousSize; + return Data_.Size() - previousSize; + } + + inline void DoUndo(size_t len) { + Y_VERIFY(len <= Data_.Size(), "trying to undo more bytes than actually written"); + Data_.Resize(Data_.size() - len); + } + inline void DoWrite(const void* buf, size_t len) { Data_.Append((const char*)buf, len); } @@ -40,7 +40,7 @@ public: private: TBuffer& Data_; - static constexpr size_t MinBufferGrowSize = 16; + static constexpr size_t MinBufferGrowSize = 16; }; namespace { @@ -75,14 +75,14 @@ TBuffer& TBufferOutput::Buffer() const noexcept { return Impl_->Buffer(); } -size_t TBufferOutput::DoNext(void** ptr) { - return Impl_->DoNext(ptr); -} - -void TBufferOutput::DoUndo(size_t len) { - Impl_->DoUndo(len); -} - +size_t TBufferOutput::DoNext(void** ptr) { + return Impl_->DoNext(ptr); +} + +void TBufferOutput::DoUndo(size_t len) { + Impl_->DoUndo(len); +} + void TBufferOutput::DoWrite(const void* buf, size_t len) { Impl_->DoWrite(buf, len); } |