diff options
author | Vlad Yaroslavlev <vladon@vladon.com> | 2022-02-10 16:46:25 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:25 +0300 |
commit | 344ea37b4a345701ab0e67de2266a1c1bd7baf2d (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/streams | |
parent | 706b83ed7de5a473436620367af31fc0ceecde07 (diff) | |
download | ydb-344ea37b4a345701ab0e67de2266a1c1bd7baf2d.tar.gz |
Restoring authorship annotation for Vlad Yaroslavlev <vladon@vladon.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/streams')
-rw-r--r-- | library/cpp/streams/bzip2/bzip2.cpp | 14 | ||||
-rw-r--r-- | library/cpp/streams/bzip2/bzip2.h | 4 | ||||
-rw-r--r-- | library/cpp/streams/bzip2/bzip2_ut.cpp | 6 | ||||
-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 | ||||
-rw-r--r-- | library/cpp/streams/lzma/lzma.cpp | 18 | ||||
-rw-r--r-- | library/cpp/streams/lzma/lzma.h | 4 | ||||
-rw-r--r-- | library/cpp/streams/lzma/lzma_ut.cpp | 20 |
9 files changed, 86 insertions, 86 deletions
diff --git a/library/cpp/streams/bzip2/bzip2.cpp b/library/cpp/streams/bzip2/bzip2.cpp index 9121244e83..bccc5c6807 100644 --- a/library/cpp/streams/bzip2/bzip2.cpp +++ b/library/cpp/streams/bzip2/bzip2.cpp @@ -14,7 +14,7 @@ public: Init(); } - inline ~TImpl() { + inline ~TImpl() { Clear(); } @@ -24,7 +24,7 @@ public: } } - inline void Clear() noexcept { + inline void Clear() noexcept { BZ2_bzDecompressEnd(&BzStream_); } @@ -79,7 +79,7 @@ TBZipDecompress::TBZipDecompress(IInputStream* input, size_t bufLen) { } -TBZipDecompress::~TBZipDecompress() { +TBZipDecompress::~TBZipDecompress() { } size_t TBZipDecompress::DoRead(void* buf, size_t size) { @@ -101,7 +101,7 @@ public: BzStream_.avail_out = TmpBufLen(); } - inline ~TImpl() { + inline ~TImpl() { BZ2_bzCompressEnd(&BzStream_); } @@ -156,11 +156,11 @@ public: } private: - inline char* TmpBuf() noexcept { + inline char* TmpBuf() noexcept { return (char*)AdditionalData(); } - inline size_t TmpBufLen() const noexcept { + inline size_t TmpBufLen() const noexcept { return AdditionalDataLength(); } @@ -174,7 +174,7 @@ TBZipCompress::TBZipCompress(IOutputStream* out, size_t compressionLevel, size_t { } -TBZipCompress::~TBZipCompress() { +TBZipCompress::~TBZipCompress() { try { Finish(); } catch (...) { diff --git a/library/cpp/streams/bzip2/bzip2.h b/library/cpp/streams/bzip2/bzip2.h index 07c8837997..2322277ef6 100644 --- a/library/cpp/streams/bzip2/bzip2.h +++ b/library/cpp/streams/bzip2/bzip2.h @@ -25,7 +25,7 @@ class TBZipCompressError: public TBZipException { class TBZipDecompress: public IInputStream { public: TBZipDecompress(IInputStream* input, size_t bufLen = BZIP_BUF_LEN); - ~TBZipDecompress() override; + ~TBZipDecompress() override; private: size_t DoRead(void* buf, size_t size) override; @@ -38,7 +38,7 @@ private: class TBZipCompress: public IOutputStream { public: TBZipCompress(IOutputStream* out, size_t compressionLevel = BZIP_COMPRESSION_LEVEL, size_t bufLen = BZIP_BUF_LEN); - ~TBZipCompress() override; + ~TBZipCompress() override; private: void DoWrite(const void* buf, size_t size) override; diff --git a/library/cpp/streams/bzip2/bzip2_ut.cpp b/library/cpp/streams/bzip2/bzip2_ut.cpp index 4de72e8ad5..69a98f296c 100644 --- a/library/cpp/streams/bzip2/bzip2_ut.cpp +++ b/library/cpp/streams/bzip2/bzip2_ut.cpp @@ -8,10 +8,10 @@ #define ZDATA "./zdata" Y_UNIT_TEST_SUITE(TBZipTest) { - static const TString data = "8s7d5vc6s5vc67sa4c65ascx6asd4xcv76adsfxv76s"; + static const TString data = "8s7d5vc6s5vc67sa4c65ascx6asd4xcv76adsfxv76s"; Y_UNIT_TEST(TestCompress) { - TUnbufferedFileOutput o(ZDATA); + TUnbufferedFileOutput o(ZDATA); TBZipCompress c(&o); c.Write(data.data(), data.size()); @@ -23,7 +23,7 @@ Y_UNIT_TEST_SUITE(TBZipTest) { TTempFile tmp(ZDATA); { - TUnbufferedFileInput i(ZDATA); + TUnbufferedFileInput i(ZDATA); TBZipDecompress d(&i); UNIT_ASSERT_EQUAL(d.ReadLine(), data); diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp index 0ddeb2a6c2..b65bb3ed96 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 b2850cc290..3a2eaad88b 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 04c53f5cb5..6876f070fc 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); diff --git a/library/cpp/streams/lzma/lzma.cpp b/library/cpp/streams/lzma/lzma.cpp index 34c4e50c84..f1942fa546 100644 --- a/library/cpp/streams/lzma/lzma.cpp +++ b/library/cpp/streams/lzma/lzma.cpp @@ -31,7 +31,7 @@ namespace { return ret->AdditionalData(); } - inline void Deallocate(void* ptr) noexcept { + inline void Deallocate(void* ptr) noexcept { if (ptr) { delete TAllocation::ObjectFromData(ptr); } @@ -65,7 +65,7 @@ namespace { { } - ~TInput() override { + ~TInput() override { } size_t DoRead(void* ptr, size_t len) override { @@ -83,7 +83,7 @@ namespace { { } - ~TOutput() override { + ~TOutput() override { } void DoWrite(const void* ptr, size_t len) override { @@ -105,7 +105,7 @@ namespace { { } - virtual ~TInverseFilter() { + virtual ~TInverseFilter() { if (!UncaughtException()) { try { Finish(); @@ -277,7 +277,7 @@ namespace { TMemoryGc Gc_; }; - inline ISzAlloc* Alloc() noexcept { + inline ISzAlloc* Alloc() noexcept { return &Alloc_; } @@ -317,7 +317,7 @@ namespace { Check(LzmaEnc_WriteProperties(H_, PropsBuf_, &bufLen)); } - inline ~TLzmaCompressBase() { + inline ~TLzmaCompressBase() { LzmaEnc_Destroy(H_, Alloc(), Alloc()); } @@ -354,7 +354,7 @@ public: { LzmaDec_Construct(&H_); } - inline virtual ~TImpl() { + inline virtual ~TImpl() { LzmaDec_Free(&H_, Alloc()); } @@ -483,7 +483,7 @@ TLzmaCompress::TLzmaCompress(IOutputStream* slave, size_t level) { } -TLzmaCompress::~TLzmaCompress() { +TLzmaCompress::~TLzmaCompress() { } void TLzmaCompress::DoWrite(const void* buf, size_t len) { @@ -512,7 +512,7 @@ TLzmaDecompress::TLzmaDecompress(IZeroCopyInput* input) { } -TLzmaDecompress::~TLzmaDecompress() { +TLzmaDecompress::~TLzmaDecompress() { } size_t TLzmaDecompress::DoRead(void* buf, size_t len) { diff --git a/library/cpp/streams/lzma/lzma.h b/library/cpp/streams/lzma/lzma.h index daf9dd66b9..ca1e06e9ef 100644 --- a/library/cpp/streams/lzma/lzma.h +++ b/library/cpp/streams/lzma/lzma.h @@ -9,7 +9,7 @@ class TLzmaCompress: public IOutputStream { public: TLzmaCompress(IOutputStream* slave, size_t level = 7); - ~TLzmaCompress() override; + ~TLzmaCompress() override; private: void DoWrite(const void* buf, size_t len) override; @@ -24,7 +24,7 @@ class TLzmaDecompress: public IInputStream { public: TLzmaDecompress(IInputStream* slave); TLzmaDecompress(IZeroCopyInput* input); - ~TLzmaDecompress() override; + ~TLzmaDecompress() override; private: size_t DoRead(void* buf, size_t len) override; diff --git a/library/cpp/streams/lzma/lzma_ut.cpp b/library/cpp/streams/lzma/lzma_ut.cpp index 907de209b5..847e98d1ca 100644 --- a/library/cpp/streams/lzma/lzma_ut.cpp +++ b/library/cpp/streams/lzma/lzma_ut.cpp @@ -8,7 +8,7 @@ class TStrokaByOneByte: public IZeroCopyInput { public: - TStrokaByOneByte(const TString& s) + TStrokaByOneByte(const TString& s) : Data(s) , Pos(s.data()) { @@ -26,7 +26,7 @@ private: } } - TString Data; + TString Data; const char* Pos; }; @@ -37,15 +37,15 @@ class TLzmaTest: public TTestBase { UNIT_TEST_SUITE_END(); private: - inline TString GenData() { - TString data; + inline TString GenData() { + TString data; TReallyFastRng32 rnd(RandomNumber<ui64>()); for (size_t i = 0; i < 50000; ++i) { const char ch = rnd.Uniform(256); const size_t len = 1 + rnd.Uniform(10); - data += TString(len, ch); + data += TString(len, ch); } return data; @@ -54,7 +54,7 @@ private: inline void Test2() { class TExcOutput: public IOutputStream { public: - ~TExcOutput() override { + ~TExcOutput() override { } void DoWrite(const void*, size_t) override { @@ -62,7 +62,7 @@ private: } }; - TString data(GenData()); + TString data(GenData()); TMemoryInput mi(data.data(), data.size()); TExcOutput out; @@ -76,9 +76,9 @@ private: } inline void Test1() { - TString data(GenData()); - TString data1; - TString res; + TString data(GenData()); + TString data1; + TString res; { TMemoryInput mi(data.data(), data.size()); |