diff options
author | gulin <gulin@yandex-team.ru> | 2022-02-10 16:47:32 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:32 +0300 |
commit | 7199613d295246a07c2f7b331fbb3128936039dc (patch) | |
tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/binsaver/blob_io.h | |
parent | c807aae441c17fc7f577c35757a4b6e0bd909802 (diff) | |
download | ydb-7199613d295246a07c2f7b331fbb3128936039dc.tar.gz |
Restoring authorship annotation for <gulin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/binsaver/blob_io.h')
-rw-r--r-- | library/cpp/binsaver/blob_io.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/library/cpp/binsaver/blob_io.h b/library/cpp/binsaver/blob_io.h index 71ea3050db..abe518ef30 100644 --- a/library/cpp/binsaver/blob_io.h +++ b/library/cpp/binsaver/blob_io.h @@ -1,27 +1,27 @@ -#pragma once +#pragma once #include "bin_saver.h" #include "buffered_io.h" -#include <util/memory/blob.h> - +#include <util/memory/blob.h> + class TYaBlobStream: public IBinaryStream { - TBlob Blob; + TBlob Blob; i64 Pos; - + int WriteImpl(const void*, int) override { Y_ASSERT(0); - return 0; - } + return 0; + } int ReadImpl(void* userBuffer, int size) override { - if (size == 0) - return 0; + if (size == 0) + return 0; i64 res = Min<i64>(Blob.Length() - Pos, size); - if (res) - memcpy(userBuffer, ((const char*)Blob.Data()) + Pos, res); - Pos += res; - return res; - } + if (res) + memcpy(userBuffer, ((const char*)Blob.Data()) + Pos, res); + Pos += res; + return res; + } bool IsValid() const override { return true; } @@ -29,19 +29,19 @@ class TYaBlobStream: public IBinaryStream { return false; } -public: +public: TYaBlobStream(const TBlob& blob) : Blob(blob) , Pos(0) { } -}; - +}; + template <class T> inline void SerializeBlob(const TBlob& data, T& c) { - TYaBlobStream f(data); - { - IBinSaver bs(f, true); - bs.Add(1, &c); - } -} + TYaBlobStream f(data); + { + IBinSaver bs(f, true); + bs.Add(1, &c); + } +} |