aboutsummaryrefslogtreecommitdiffstats
path: root/util/stream/mem.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:15 +0300
commit72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch)
treeda2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/stream/mem.cpp
parent778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff)
downloadydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/stream/mem.cpp')
-rw-r--r--util/stream/mem.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/util/stream/mem.cpp b/util/stream/mem.cpp
index 22a3339e27..b2b23d789f 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"));