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 | 2342f2b56e674c21307fcb92a37853f950224d31 (patch) | |
tree | 7e3170fde6aea33759fe624ee5b7ec29de8af150 /util/stream/str.cpp | |
parent | 2896882074ce784b7cabc4f2f7c502db74b34b80 (diff) | |
download | ydb-2342f2b56e674c21307fcb92a37853f950224d31.tar.gz |
Restoring authorship annotation for <nikitamorozov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/stream/str.cpp')
-rw-r--r-- | util/stream/str.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/util/stream/str.cpp b/util/stream/str.cpp index 13f0e8ef28..622f2fa160 100644 --- a/util/stream/str.cpp +++ b/util/stream/str.cpp @@ -1,7 +1,7 @@ #include "str.h" -static constexpr size_t MIN_BUFFER_GROW_SIZE = 16; - +static constexpr size_t MIN_BUFFER_GROW_SIZE = 16; + TStringInput::~TStringInput() = default; size_t TStringInput::DoNext(const void** ptr, size_t len) { @@ -18,21 +18,21 @@ void TStringInput::DoUndo(size_t len) { TStringOutput::~TStringOutput() = default; -size_t TStringOutput::DoNext(void** ptr) { +size_t TStringOutput::DoNext(void** ptr) { if (S_->size() == S_->capacity()) { S_->reserve(FastClp2(S_->capacity() + MIN_BUFFER_GROW_SIZE)); - } + } size_t previousSize = S_->size(); ResizeUninitialized(*S_, S_->capacity()); *ptr = S_->begin() + previousSize; return S_->size() - previousSize; -} - -void TStringOutput::DoUndo(size_t len) { +} + +void TStringOutput::DoUndo(size_t len) { Y_VERIFY(len <= S_->size(), "trying to undo more bytes than actually written"); S_->resize(S_->size() - len); -} - +} + void TStringOutput::DoWrite(const void* buf, size_t len) { S_->append((const char*)buf, len); } |