diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
commit | 9123176b341b6f2658cff5132482b8237c1416c8 (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/streams | |
parent | 59e19371de37995fcb36beb16cd6ec030af960bc (diff) | |
download | ydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/streams')
-rw-r--r-- | library/cpp/streams/bzip2/bzip2.h | 2 | ||||
-rw-r--r-- | library/cpp/streams/lz/lz.cpp | 64 | ||||
-rw-r--r-- | library/cpp/streams/lz/lz.h | 38 | ||||
-rw-r--r-- | library/cpp/streams/lz/lz_ut.cpp | 16 | ||||
-rw-r--r-- | library/cpp/streams/lzma/lzma.h | 2 | ||||
-rw-r--r-- | library/cpp/streams/zc_memory_input/zc_memory_input.h | 8 |
6 files changed, 65 insertions, 65 deletions
diff --git a/library/cpp/streams/bzip2/bzip2.h b/library/cpp/streams/bzip2/bzip2.h index 7ac43ffa66..2322277ef6 100644 --- a/library/cpp/streams/bzip2/bzip2.h +++ b/library/cpp/streams/bzip2/bzip2.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/stream/input.h> #include <util/stream/output.h> diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp index 484fd3cf7c..b65bb3ed96 100644 --- a/library/cpp/streams/lz/lz.cpp +++ b/library/cpp/streams/lz/lz.cpp @@ -460,78 +460,78 @@ DEF_COMPRESSOR(TLzfCompress, TFastLZ) DEF_DECOMPRESSOR(TLzfDecompress, TFastLZ) /* - * LZ4 - */ -class TLZ4 { + * LZ4 + */ +class TLZ4 { public: static const char signature[]; - + static inline size_t Hint(size_t len) noexcept { return Max<size_t>((size_t)(len * 1.06), 100); } - + inline size_t Compress(const char* data, size_t len, char* ptr, size_t dstMaxSize) { return LZ4_compress_default(data, ptr, len, dstMaxSize); } - + inline size_t Decompress(const char* data, size_t len, char* ptr, size_t max) { int res = LZ4_decompress_safe(data, ptr, len, max); if (res < 0) ythrow TDecompressorError(); return res; } - + inline void InitFromStream(IInputStream*) const noexcept { } - + static inline bool SaveIncompressibleChunks() noexcept { return false; } -}; - -const char TLZ4::signature[] = "LZ.4"; - -DEF_COMPRESSOR(TLz4Compress, TLZ4) -DEF_DECOMPRESSOR(TLz4Decompress, TLZ4) - -/* - * Snappy - */ -class TSnappy { +}; + +const char TLZ4::signature[] = "LZ.4"; + +DEF_COMPRESSOR(TLz4Compress, TLZ4) +DEF_DECOMPRESSOR(TLz4Decompress, TLZ4) + +/* + * Snappy + */ +class TSnappy { public: static const char signature[]; - + static inline size_t Hint(size_t len) noexcept { return Max<size_t>(snappy::MaxCompressedLength(len), 100); } - + inline size_t Compress(const char* data, size_t len, char* ptr, size_t /*dstMaxSize*/) { size_t reslen = 0; snappy::RawCompress(data, len, ptr, &reslen); return reslen; } - + inline size_t Decompress(const char* data, size_t len, char* ptr, size_t) { size_t srclen = 0; if (!snappy::GetUncompressedLength(data, len, &srclen) || !snappy::RawUncompress(data, len, ptr)) ythrow TDecompressorError(); return srclen; } - + inline void InitFromStream(IInputStream*) const noexcept { } - + static inline bool SaveIncompressibleChunks() noexcept { return false; } -}; - -const char TSnappy::signature[] = "Snap"; - -DEF_COMPRESSOR(TSnappyCompress, TSnappy) -DEF_DECOMPRESSOR(TSnappyDecompress, TSnappy) - -/* +}; + +const char TSnappy::signature[] = "Snap"; + +DEF_COMPRESSOR(TSnappyCompress, TSnappy) +DEF_DECOMPRESSOR(TSnappyDecompress, TSnappy) + +/* * QuickLZ */ class TQuickLZBase { diff --git a/library/cpp/streams/lz/lz.h b/library/cpp/streams/lz/lz.h index 9e97c3389b..3a2eaad88b 100644 --- a/library/cpp/streams/lz/lz.h +++ b/library/cpp/streams/lz/lz.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/stream/output.h> #include <util/stream/input.h> @@ -23,7 +23,7 @@ struct TDecompressorError: public yexception { /** * @addtogroup Streams_Archs * @{ - */ + */ /** * Lz4 compressing stream. @@ -34,17 +34,17 @@ class TLz4Compress: public IOutputStream { public: TLz4Compress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); ~TLz4Compress() override; - + private: void DoWrite(const void* buf, size_t len) override; void DoFlush() override; void DoFinish() override; - + private: class TImpl; THolder<TImpl> Impl_; -}; - +}; + /** * Lz4 decompressing stream. * @@ -54,35 +54,35 @@ class TLz4Decompress: public IInputStream { public: TLz4Decompress(IInputStream* slave); ~TLz4Decompress() override; - + private: size_t DoRead(void* buf, size_t len) override; - + private: class TImpl; THolder<TImpl> Impl_; -}; - +}; + /** * Snappy compressing stream. * * @see http://code.google.com/p/snappy/ - */ + */ class TSnappyCompress: public IOutputStream { public: TSnappyCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); ~TSnappyCompress() override; - + private: void DoWrite(const void* buf, size_t len) override; void DoFlush() override; void DoFinish() override; - + private: class TImpl; THolder<TImpl> Impl_; -}; - +}; + /** * Snappy decompressing stream. * @@ -92,15 +92,15 @@ class TSnappyDecompress: public IInputStream { public: TSnappyDecompress(IInputStream* slave); ~TSnappyDecompress() override; - + private: size_t DoRead(void* buf, size_t len) override; - + private: class TImpl; THolder<TImpl> Impl_; -}; - +}; + /** * MiniLZO compressing stream. */ diff --git a/library/cpp/streams/lz/lz_ut.cpp b/library/cpp/streams/lz/lz_ut.cpp index 1b84978710..6876f070fc 100644 --- a/library/cpp/streams/lz/lz_ut.cpp +++ b/library/cpp/streams/lz/lz_ut.cpp @@ -203,7 +203,7 @@ Y_UNIT_TEST_SUITE(TLzTest) { TestCompress<TLzqCompress>(); TestDecompress<TLzqDecompress>(); } - + Y_UNIT_TEST(TestLzq151_1) { TestCompress<TLzqCompressX<TLzqCompress::V_1_51, 1, TLzqCompress::M_0>>(); TestDecompress<TLzqDecompress>(); @@ -235,14 +235,14 @@ Y_UNIT_TEST_SUITE(TLzTest) { } Y_UNIT_TEST(TestLz4) { - TestCompress<TLz4Compress>(); - TestDecompress<TLz4Decompress>(); - } - + TestCompress<TLz4Compress>(); + TestDecompress<TLz4Decompress>(); + } + Y_UNIT_TEST(TestSnappy) { - TestCompress<TSnappyCompress>(); - TestDecompress<TSnappyDecompress>(); - } + TestCompress<TSnappyCompress>(); + TestDecompress<TSnappyDecompress>(); + } Y_UNIT_TEST(TestGeneric) { TestMixedDecompress<TLzoCompress>(); diff --git a/library/cpp/streams/lzma/lzma.h b/library/cpp/streams/lzma/lzma.h index 79f891b4ab..ca1e06e9ef 100644 --- a/library/cpp/streams/lzma/lzma.h +++ b/library/cpp/streams/lzma/lzma.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include <util/stream/input.h> #include <util/stream/output.h> diff --git a/library/cpp/streams/zc_memory_input/zc_memory_input.h b/library/cpp/streams/zc_memory_input/zc_memory_input.h index b0beed9e91..c939d8e426 100644 --- a/library/cpp/streams/zc_memory_input/zc_memory_input.h +++ b/library/cpp/streams/zc_memory_input/zc_memory_input.h @@ -31,14 +31,14 @@ public: } template <class T> - Y_FORCE_INLINE T LoadPOD() { + Y_FORCE_INLINE T LoadPOD() { const char* buf = nullptr; if (!ReadFixed(buf, sizeof(T))) ythrow yexception() << "TZCMemoryInput::LoadPOD failed: not enough data (" << Avail() << " of " << sizeof(T) << " bytes)"; - T res; - memcpy(&res, buf, sizeof(T)); - return res; + T res; + memcpy(&res, buf, sizeof(T)); + return res; } template <class T> |