diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:23 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:23 +0300 |
commit | 706b83ed7de5a473436620367af31fc0ceecde07 (patch) | |
tree | 103305d30dec77e8f6367753367f59b3cd68f9f1 /library/cpp/streams/lz | |
parent | 918e8a1574070d0ec733f0b76cfad8f8892ad2e5 (diff) | |
download | ydb-706b83ed7de5a473436620367af31fc0ceecde07.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/streams/lz')
-rw-r--r-- | library/cpp/streams/lz/lz.cpp | 42 | ||||
-rw-r--r-- | library/cpp/streams/lz/lz.h | 20 | ||||
-rw-r--r-- | library/cpp/streams/lz/lz_ut.cpp | 44 |
3 files changed, 53 insertions, 53 deletions
diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp index b65bb3ed96..0ddeb2a6c2 100644 --- a/library/cpp/streams/lz/lz.cpp +++ b/library/cpp/streams/lz/lz.cpp @@ -15,11 +15,11 @@ #include <contrib/libs/quicklz/quicklz.h> #include <contrib/libs/minilzo/minilzo.h> -static inline ui8 HostToLittle(ui8 t) noexcept { +static inline ui8 HostToLittle(ui8 t) noexcept { return t; } -static inline ui8 LittleToHost(ui8 t) noexcept { +static inline ui8 LittleToHost(ui8 t) noexcept { return t; } @@ -53,7 +53,7 @@ public: this->Save(BlockSize()); } - inline ~TCompressorBase() { + inline ~TCompressorBase() { } inline void Write(const char* buf, size_t len) { @@ -88,11 +88,11 @@ public: } private: - inline void* Block() const noexcept { + inline void* Block() const noexcept { return this->AdditionalData(); } - inline ui16 BlockSize() const noexcept { + inline ui16 BlockSize() const noexcept { return BlockSize_; } @@ -200,7 +200,7 @@ public: this->InitFromStream(Slave_); } - inline ~TDecompressorBaseImpl() { + inline ~TDecompressorBaseImpl() { } inline size_t Read(void* buf, size_t len) { @@ -284,7 +284,7 @@ public: { } - inline ~TDecompressorBase() { + inline ~TDecompressorBase() { } }; @@ -373,16 +373,16 @@ public: Singleton<TInit>(); } - inline ~TMiniLzo() { + inline ~TMiniLzo() { } - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { // see SEARCH-2043 and, e.g. examples at // http://stackoverflow.com/questions/4235019/how-to-get-lzo-to-work-with-a-file-stream return len + (len / 16) + 64 + 3; } - static inline bool SaveIncompressibleChunks() noexcept { + static inline bool SaveIncompressibleChunks() noexcept { return false; } }; @@ -392,7 +392,7 @@ const char TMiniLzo::signature[] = "YLZO"; template <size_t N> class TFixedArray { public: - inline TFixedArray() noexcept { + inline TFixedArray() noexcept { memset(WorkMem_, 0, sizeof(WorkMem_)); } @@ -434,7 +434,7 @@ class TFastLZ { public: static const char signature[]; - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { return Max<size_t>((size_t)(len * 1.06), 100); } @@ -449,7 +449,7 @@ public: inline void InitFromStream(IInputStream*) const noexcept { } - static inline bool SaveIncompressibleChunks() noexcept { + static inline bool SaveIncompressibleChunks() noexcept { return false; } }; @@ -466,7 +466,7 @@ class TLZ4 { public: static const char signature[]; - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { return Max<size_t>((size_t)(len * 1.06), 100); } @@ -484,7 +484,7 @@ public: inline void InitFromStream(IInputStream*) const noexcept { } - static inline bool SaveIncompressibleChunks() noexcept { + static inline bool SaveIncompressibleChunks() noexcept { return false; } }; @@ -501,7 +501,7 @@ class TSnappy { public: static const char signature[]; - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { return Max<size_t>(snappy::MaxCompressedLength(len), 100); } @@ -521,7 +521,7 @@ public: inline void InitFromStream(IInputStream*) const noexcept { } - static inline bool SaveIncompressibleChunks() noexcept { + static inline bool SaveIncompressibleChunks() noexcept { return false; } }; @@ -538,7 +538,7 @@ class TQuickLZBase { public: static const char signature[]; - static inline size_t Hint(size_t len) noexcept { + static inline size_t Hint(size_t len) noexcept { return len + 500; } @@ -560,7 +560,7 @@ public: memset(Mem_.Get(), 0, size); } - inline bool SaveIncompressibleChunks() const noexcept { + inline bool SaveIncompressibleChunks() const noexcept { // we must save incompressible chunks "as is" // after compressor run in streaming mode return Table_->Setting(3); @@ -621,14 +621,14 @@ DEF_DECOMPRESSOR(TLzqDecompress, TQuickLZDecompress) namespace { template <class T> struct TInputHolder { - static inline T Set(T t) noexcept { + static inline T Set(T t) noexcept { return t; } }; template <class T> struct TInputHolder<TAutoPtr<T>> { - inline T* Set(TAutoPtr<T> v) noexcept { + inline T* Set(TAutoPtr<T> v) noexcept { V_ = v; return V_.Get(); diff --git a/library/cpp/streams/lz/lz.h b/library/cpp/streams/lz/lz.h index 3a2eaad88b..b2850cc290 100644 --- a/library/cpp/streams/lz/lz.h +++ b/library/cpp/streams/lz/lz.h @@ -33,7 +33,7 @@ struct TDecompressorError: public yexception { class TLz4Compress: public IOutputStream { public: TLz4Compress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); - ~TLz4Compress() override; + ~TLz4Compress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -53,7 +53,7 @@ private: class TLz4Decompress: public IInputStream { public: TLz4Decompress(IInputStream* slave); - ~TLz4Decompress() override; + ~TLz4Decompress() override; private: size_t DoRead(void* buf, size_t len) override; @@ -71,7 +71,7 @@ private: class TSnappyCompress: public IOutputStream { public: TSnappyCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); - ~TSnappyCompress() override; + ~TSnappyCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -91,7 +91,7 @@ private: class TSnappyDecompress: public IInputStream { public: TSnappyDecompress(IInputStream* slave); - ~TSnappyDecompress() override; + ~TSnappyDecompress() override; private: size_t DoRead(void* buf, size_t len) override; @@ -107,7 +107,7 @@ private: class TLzoCompress: public IOutputStream { public: TLzoCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); - ~TLzoCompress() override; + ~TLzoCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -125,7 +125,7 @@ private: class TLzoDecompress: public IInputStream { public: TLzoDecompress(IInputStream* slave); - ~TLzoDecompress() override; + ~TLzoDecompress() override; private: size_t DoRead(void* buf, size_t len) override; @@ -141,7 +141,7 @@ private: class TLzfCompress: public IOutputStream { public: TLzfCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); - ~TLzfCompress() override; + ~TLzfCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -159,7 +159,7 @@ private: class TLzfDecompress: public IInputStream { public: TLzfDecompress(IInputStream* slave); - ~TLzfDecompress() override; + ~TLzfDecompress() override; private: size_t DoRead(void* buf, size_t len) override; @@ -193,7 +193,7 @@ public: EVersion ver = V_1_31, unsigned level = 0, EMode mode = M_0); - ~TLzqCompress() override; + ~TLzqCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -211,7 +211,7 @@ private: class TLzqDecompress: public IInputStream { public: TLzqDecompress(IInputStream* slave); - ~TLzqDecompress() override; + ~TLzqDecompress() override; private: size_t DoRead(void* buf, size_t len) override; diff --git a/library/cpp/streams/lz/lz_ut.cpp b/library/cpp/streams/lz/lz_ut.cpp index 6876f070fc..04c53f5cb5 100644 --- a/library/cpp/streams/lz/lz_ut.cpp +++ b/library/cpp/streams/lz/lz_ut.cpp @@ -11,15 +11,15 @@ #define LDATA "./ldata" #define LDATA_RANDOM "./ldata.random" -static const TString data = "aa aaa aa aaa aa aaa bb bbb bb bbb bb bbb"; +static const TString data = "aa aaa aa aaa aa aaa bb bbb bb bbb bb bbb"; namespace { /** * Produces well-formed random crap **/ - TString RandomString(size_t size) { - TString entropy(NResource::Find("/random.data")); - TString result; + TString RandomString(size_t size) { + TString entropy(NResource::Find("/random.data")); + TString result; size_t seed = 1; size_t j = 0; for (size_t i = 0; i < size; ++i) { @@ -38,8 +38,8 @@ namespace { return result; } - TVector<TString> InitRandomData() { - static const TVector<size_t> sizes = { + TVector<TString> InitRandomData() { + static const TVector<size_t> sizes = { 0, 1, 127, @@ -47,7 +47,7 @@ namespace { 32767, }; - TVector<TString> result; + TVector<TString> result; for (auto size : sizes) { result.push_back(RandomString(size)); } @@ -55,18 +55,18 @@ namespace { return result; } - TString TestFileName(const TString& d, size_t bufferSize) { + TString TestFileName(const TString& d, size_t bufferSize) { return LDATA_RANDOM + TString(".") + ToString(d.size()) + TString(".") + ToString(bufferSize); } - struct TRandomData: public TVector<TString> { + struct TRandomData: public TVector<TString> { inline TRandomData() { InitRandomData().swap(*this); } }; } -static const TVector<size_t> bufferSizes = { +static const TVector<size_t> bufferSizes = { 127, 1024, 32768, @@ -84,10 +84,10 @@ namespace { template <class C> static inline void TestGoodDataCompress() { - TFixedBufferFileOutput o(LDATA); + TFixedBufferFileOutput o(LDATA); C c(&o, 1024); - TString d = data; + TString d = data; for (size_t i = 0; i < 10; ++i) { c.Write(d.data(), d.size()); @@ -100,9 +100,9 @@ static inline void TestGoodDataCompress() { } template <class C> -static inline void TestIncompressibleDataCompress(const TString& d, size_t bufferSize) { - TString testFileName = TestFileName(d, bufferSize); - TFixedBufferFileOutput o(testFileName); +static inline void TestIncompressibleDataCompress(const TString& d, size_t bufferSize) { + TString testFileName = TestFileName(d, bufferSize); + TFixedBufferFileOutput o(testFileName); C c(&o, bufferSize); c.Write(d.data(), d.size()); c.Finish(); @@ -124,12 +124,12 @@ static inline void TestGoodDataDecompress() { TTempFile tmpFile(LDATA); { - TFileInput i1(LDATA); - D ld(&i1); + TFileInput i1(LDATA); + D ld(&i1); - TString d = data; + TString d = data; - for (size_t i2 = 0; i2 < 10; ++i2) { + for (size_t i2 = 0; i2 < 10; ++i2) { UNIT_ASSERT_EQUAL(ld.ReadLine(), d); d = d + d; @@ -138,12 +138,12 @@ static inline void TestGoodDataDecompress() { } template <class D> -static inline void TestIncompressibleDataDecompress(const TString& d, size_t bufferSize) { - TString testFileName = TestFileName(d, bufferSize); +static inline void TestIncompressibleDataDecompress(const TString& d, size_t bufferSize) { + TString testFileName = TestFileName(d, bufferSize); TTempFile tmpFile(testFileName); { - TFileInput i(testFileName); + TFileInput i(testFileName); D ld(&i); UNIT_ASSERT_EQUAL(ld.ReadAll(), d); |