diff options
author | Anton Samokhvalov <[email protected]> | 2022-02-10 16:45:17 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:17 +0300 |
commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/stream/mem.cpp | |
parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) |
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/stream/mem.cpp')
-rw-r--r-- | util/stream/mem.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/util/stream/mem.cpp b/util/stream/mem.cpp index b2b23d789f6..22a3339e274 100644 --- a/util/stream/mem.cpp +++ b/util/stream/mem.cpp @@ -1,27 +1,27 @@ -#include "mem.h" - +#include "mem.h" + #include <util/generic/yexception.h> - + TMemoryInput::TMemoryInput() noexcept - : Buf_(nullptr) - , Len_(0) -{ -} - + : Buf_(nullptr) + , Len_(0) +{ +} + TMemoryInput::TMemoryInput(const void* buf, size_t len) noexcept - : Buf_((const char*)buf) - , Len_(len) -{ -} - + : Buf_((const char*)buf) + , Len_(len) +{ +} + TMemoryInput::TMemoryInput(const TStringBuf buf) noexcept : Buf_(buf.data()) , Len_(buf.size()) -{ +{ } TMemoryInput::~TMemoryInput() = default; - + size_t TMemoryInput::DoNext(const void** ptr, size_t len) { len = Min(Len_, len); @@ -29,15 +29,15 @@ size_t TMemoryInput::DoNext(const void** ptr, size_t len) { Len_ -= len; Buf_ += len; return len; -} - +} + void TMemoryInput::DoUndo(size_t len) { - Len_ += len; - Buf_ -= len; -} - + Len_ += len; + Buf_ -= len; +} + TMemoryOutput::~TMemoryOutput() = default; - + size_t TMemoryOutput::DoNext(void** ptr) { Y_ENSURE(Buf_ < End_, TStringBuf("memory output stream exhausted")); *ptr = Buf_; @@ -51,13 +51,13 @@ void TMemoryOutput::DoUndo(size_t len) { Buf_ -= len; } -void TMemoryOutput::DoWrite(const void* buf, size_t len) { +void TMemoryOutput::DoWrite(const void* buf, size_t len) { char* end = Buf_ + len; Y_ENSURE(end <= End_, TStringBuf("memory output stream exhausted")); - - memcpy(Buf_, buf, len); + + memcpy(Buf_, buf, len); Buf_ = end; -} +} void TMemoryOutput::DoWriteC(char c) { Y_ENSURE(Buf_ < End_, TStringBuf("memory output stream exhausted")); |