diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:48 +0300 |
commit | 9abfb1a53b7f7b791444d1378e645d8fad9b06ed (patch) | |
tree | 49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/streams | |
parent | 8cbc307de0221f84c80c42dcbe07d40727537e2c (diff) | |
download | ydb-9abfb1a53b7f7b791444d1378e645d8fad9b06ed.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/streams')
-rw-r--r-- | library/cpp/streams/brotli/brotli_ut.cpp | 14 | ||||
-rw-r--r-- | library/cpp/streams/bzip2/bzip2.cpp | 12 | ||||
-rw-r--r-- | library/cpp/streams/bzip2/bzip2.h | 8 | ||||
-rw-r--r-- | library/cpp/streams/bzip2/bzip2_ut.cpp | 8 | ||||
-rw-r--r-- | library/cpp/streams/lz/lz.cpp | 70 | ||||
-rw-r--r-- | library/cpp/streams/lz/lz.h | 52 | ||||
-rw-r--r-- | library/cpp/streams/lz/lz_ut.cpp | 42 | ||||
-rw-r--r-- | library/cpp/streams/lzma/lzma.cpp | 38 | ||||
-rw-r--r-- | library/cpp/streams/lzma/lzma.h | 10 | ||||
-rw-r--r-- | library/cpp/streams/lzma/lzma_ut.cpp | 6 |
10 files changed, 130 insertions, 130 deletions
diff --git a/library/cpp/streams/brotli/brotli_ut.cpp b/library/cpp/streams/brotli/brotli_ut.cpp index 6dcec657b1..aeb2e284dc 100644 --- a/library/cpp/streams/brotli/brotli_ut.cpp +++ b/library/cpp/streams/brotli/brotli_ut.cpp @@ -4,7 +4,7 @@ #include <util/random/fast.h> -Y_UNIT_TEST_SUITE(TBrotliTestSuite) { +Y_UNIT_TEST_SUITE(TBrotliTestSuite) { TString Compress(TString data) { TString compressed; TStringOutput output(compressed); @@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(TBrotliTestSuite) { return result; } - Y_UNIT_TEST(TestHelloWorld) { + Y_UNIT_TEST(TestHelloWorld) { TestCase("hello world"); } @@ -58,7 +58,7 @@ Y_UNIT_TEST_SUITE(TBrotliTestSuite) { } } - Y_UNIT_TEST(TestSeveralStreams) { + Y_UNIT_TEST(TestSeveralStreams) { auto s1 = GenerateRandomString(1 << 15); auto s2 = GenerateRandomString(1 << 15); auto c1 = Compress(s1); @@ -66,24 +66,24 @@ Y_UNIT_TEST_SUITE(TBrotliTestSuite) { UNIT_ASSERT_VALUES_EQUAL(s1 + s2, Decompress(c1 + c2)); } - Y_UNIT_TEST(TestIncompleteStream) { + Y_UNIT_TEST(TestIncompleteStream) { TString manyAs(64 * 1024, 'a'); auto compressed = Compress(manyAs); TString truncated(compressed.data(), compressed.size() - 1); UNIT_CHECK_GENERATED_EXCEPTION(Decompress(truncated), std::exception); } - Y_UNIT_TEST(Test64KB) { + Y_UNIT_TEST(Test64KB) { auto manyAs = TString(64 * 1024, 'a'); TString str("Hello from the Matrix!@#% How are you?}{\n\t\a"); TestCase(manyAs + str + manyAs); } - Y_UNIT_TEST(Test1MB) { + Y_UNIT_TEST(Test1MB) { TestCase(GenerateRandomString(1 * 1024 * 1024)); } - Y_UNIT_TEST(TestEmpty) { + Y_UNIT_TEST(TestEmpty) { TestCase(""); } } diff --git a/library/cpp/streams/bzip2/bzip2.cpp b/library/cpp/streams/bzip2/bzip2.cpp index 1fcb31c99c..bccc5c6807 100644 --- a/library/cpp/streams/bzip2/bzip2.cpp +++ b/library/cpp/streams/bzip2/bzip2.cpp @@ -7,7 +7,7 @@ class TBZipDecompress::TImpl: public TAdditionalStorage<TImpl> { public: - inline TImpl(IInputStream* input) + inline TImpl(IInputStream* input) : Stream_(input) { Zero(BzStream_); @@ -70,11 +70,11 @@ public: } private: - IInputStream* Stream_; + IInputStream* Stream_; bz_stream BzStream_; }; -TBZipDecompress::TBZipDecompress(IInputStream* input, size_t bufLen) +TBZipDecompress::TBZipDecompress(IInputStream* input, size_t bufLen) : Impl_(new (bufLen) TImpl(input)) { } @@ -88,7 +88,7 @@ size_t TBZipDecompress::DoRead(void* buf, size_t size) { class TBZipCompress::TImpl: public TAdditionalStorage<TImpl> { public: - inline TImpl(IOutputStream* stream, size_t level) + inline TImpl(IOutputStream* stream, size_t level) : Stream_(stream) { Zero(BzStream_); @@ -165,11 +165,11 @@ private: } private: - IOutputStream* Stream_; + IOutputStream* Stream_; bz_stream BzStream_; }; -TBZipCompress::TBZipCompress(IOutputStream* out, size_t compressionLevel, size_t bufLen) +TBZipCompress::TBZipCompress(IOutputStream* out, size_t compressionLevel, size_t bufLen) : Impl_(new (bufLen) TImpl(out, compressionLevel)) { } diff --git a/library/cpp/streams/bzip2/bzip2.h b/library/cpp/streams/bzip2/bzip2.h index 1271b976df..2322277ef6 100644 --- a/library/cpp/streams/bzip2/bzip2.h +++ b/library/cpp/streams/bzip2/bzip2.h @@ -22,9 +22,9 @@ class TBZipDecompressError: public TBZipException { class TBZipCompressError: public TBZipException { }; -class TBZipDecompress: public IInputStream { +class TBZipDecompress: public IInputStream { public: - TBZipDecompress(IInputStream* input, size_t bufLen = BZIP_BUF_LEN); + TBZipDecompress(IInputStream* input, size_t bufLen = BZIP_BUF_LEN); ~TBZipDecompress() override; private: @@ -35,9 +35,9 @@ private: THolder<TImpl> Impl_; }; -class TBZipCompress: public IOutputStream { +class TBZipCompress: public IOutputStream { public: - TBZipCompress(IOutputStream* out, size_t compressionLevel = BZIP_COMPRESSION_LEVEL, size_t bufLen = BZIP_BUF_LEN); + TBZipCompress(IOutputStream* out, size_t compressionLevel = BZIP_COMPRESSION_LEVEL, size_t bufLen = BZIP_BUF_LEN); ~TBZipCompress() override; private: diff --git a/library/cpp/streams/bzip2/bzip2_ut.cpp b/library/cpp/streams/bzip2/bzip2_ut.cpp index cb7e11d099..69a98f296c 100644 --- a/library/cpp/streams/bzip2/bzip2_ut.cpp +++ b/library/cpp/streams/bzip2/bzip2_ut.cpp @@ -7,10 +7,10 @@ #define ZDATA "./zdata" -Y_UNIT_TEST_SUITE(TBZipTest) { +Y_UNIT_TEST_SUITE(TBZipTest) { static const TString data = "8s7d5vc6s5vc67sa4c65ascx6asd4xcv76adsfxv76s"; - Y_UNIT_TEST(TestCompress) { + Y_UNIT_TEST(TestCompress) { TUnbufferedFileOutput o(ZDATA); TBZipCompress c(&o); @@ -19,7 +19,7 @@ Y_UNIT_TEST_SUITE(TBZipTest) { o.Finish(); } - Y_UNIT_TEST(TestDecompress) { + Y_UNIT_TEST(TestDecompress) { TTempFile tmp(ZDATA); { @@ -30,7 +30,7 @@ Y_UNIT_TEST_SUITE(TBZipTest) { } } - Y_UNIT_TEST(TestCorrupted) { + Y_UNIT_TEST(TestCorrupted) { TMemoryInput i("blablabla", 10); TBZipDecompress d(&i); diff --git a/library/cpp/streams/lz/lz.cpp b/library/cpp/streams/lz/lz.cpp index 2bfa93a4aa..b65bb3ed96 100644 --- a/library/cpp/streams/lz/lz.cpp +++ b/library/cpp/streams/lz/lz.cpp @@ -32,7 +32,7 @@ const size_t SIGNATURE_SIZE = 4; template <class TCompressor, class TBase> class TCompressorBase: public TAdditionalStorage<TCompressorBase<TCompressor, TBase>>, public TCompressor, public TCommonData { public: - inline TCompressorBase(IOutputStream* slave, ui16 blockSize) + inline TCompressorBase(IOutputStream* slave, ui16 blockSize) : Slave_(slave) , BlockSize_(blockSize) { @@ -76,7 +76,7 @@ public: } template <class T> - static inline void Save(T t, IOutputStream* out) { + static inline void Save(T t, IOutputStream* out) { t = HostToLittle(t); out->Write(&t, sizeof(t)); @@ -97,14 +97,14 @@ private: } inline void WriteBlock(const void* ptr, ui16 len) { - Y_ASSERT(len <= this->BlockSize()); + Y_ASSERT(len <= this->BlockSize()); ui8 compressed = false; if (len) { const size_t out = this->Compress((const char*)ptr, len, (char*)Block(), this->AdditionalDataLength()); // catch compressor buffer overrun (e.g. SEARCH-2043) - //Y_VERIFY(out <= this->Hint(this->BlockSize())); + //Y_VERIFY(out <= this->Hint(this->BlockSize())); if (out < len || TCompressor::SaveIncompressibleChunks()) { compressed = true; @@ -119,7 +119,7 @@ private: this->Save(len, &header); this->Save(compressed, &header); - using TPart = IOutputStream::TPart; + using TPart = IOutputStream::TPart; if (ptr) { const TPart parts[] = { TPart(tmp, sizeof(tmp)), @@ -133,12 +133,12 @@ private: } private: - IOutputStream* Slave_; + IOutputStream* Slave_; const ui16 BlockSize_; }; template <class T> -static inline T GLoad(IInputStream* input) { +static inline T GLoad(IInputStream* input) { T t; if (input->Load(&t, sizeof(t)) != sizeof(t)) { @@ -150,7 +150,7 @@ static inline T GLoad(IInputStream* input) { class TDecompressSignature { public: - inline TDecompressSignature(IInputStream* input) { + inline TDecompressSignature(IInputStream* input) { if (input->Load(Buffer_, SIGNATURE_SIZE) != SIGNATURE_SIZE) { ythrow TDecompressorError() << "can not load stream signature"; } @@ -167,7 +167,7 @@ private: }; template <class TDecompressor> -static inline IInputStream* ConsumeSignature(IInputStream* input) { +static inline IInputStream* ConsumeSignature(IInputStream* input) { TDecompressSignature sign(input); if (!sign.Check<TDecompressor>()) { ythrow TDecompressorError() << "incorrect signature"; @@ -186,7 +186,7 @@ public: return v; } - inline TDecompressorBaseImpl(IInputStream* slave) + inline TDecompressorBaseImpl(IInputStream* slave) : Slave_(slave) , Input_(nullptr, 0) , Eof_(false) @@ -265,7 +265,7 @@ public: } protected: - IInputStream* Slave_; + IInputStream* Slave_; TMemoryInput Input_; bool Eof_; const ui32 Version_; @@ -279,7 +279,7 @@ protected: template <class TDecompressor, class TBase> class TDecompressorBase: public TDecompressorBaseImpl<TDecompressor> { public: - inline TDecompressorBase(IInputStream* slave) + inline TDecompressorBase(IInputStream* slave) : TDecompressorBaseImpl<TDecompressor>(ConsumeSignature<TDecompressor>(slave)) { } @@ -323,12 +323,12 @@ public: #define DEF_COMPRESSOR(rname, name) \ class rname::TImpl: public TCompressorBase<name, TImpl> { \ public: \ - inline TImpl(IOutputStream* out, ui16 blockSize) \ + inline TImpl(IOutputStream* out, ui16 blockSize) \ : TCompressorBase<name, TImpl>(out, blockSize) { \ } \ }; \ \ - rname::rname(IOutputStream* slave, ui16 blockSize) \ + rname::rname(IOutputStream* slave, ui16 blockSize) \ : Impl_(new (TImpl::Hint(blockSize)) TImpl(slave, blockSize)) { \ } \ \ @@ -337,12 +337,12 @@ public: #define DEF_DECOMPRESSOR(rname, name) \ class rname::TImpl: public TDecompressorBase<name, TImpl> { \ public: \ - inline TImpl(IInputStream* in) \ + inline TImpl(IInputStream* in) \ : TDecompressorBase<name, TImpl>(in) { \ } \ }; \ \ - rname::rname(IInputStream* slave) \ + rname::rname(IInputStream* slave) \ : Impl_(new TImpl(slave)) { \ } \ \ @@ -420,7 +420,7 @@ public: return ret; } - inline void InitFromStream(IInputStream*) const noexcept { + inline void InitFromStream(IInputStream*) const noexcept { } }; @@ -446,7 +446,7 @@ public: return fastlz_decompress(data, len, ptr, max); } - inline void InitFromStream(IInputStream*) const noexcept { + inline void InitFromStream(IInputStream*) const noexcept { } static inline bool SaveIncompressibleChunks() noexcept { @@ -481,7 +481,7 @@ public: return res; } - inline void InitFromStream(IInputStream*) const noexcept { + inline void InitFromStream(IInputStream*) const noexcept { } static inline bool SaveIncompressibleChunks() noexcept { @@ -518,7 +518,7 @@ public: return srclen; } - inline void InitFromStream(IInputStream*) const noexcept { + inline void InitFromStream(IInputStream*) const noexcept { } static inline bool SaveIncompressibleChunks() noexcept { @@ -586,7 +586,7 @@ public: return Table_->Decompress(data, ptr, (char*)Mem_.Get()); } - inline void InitFromStream(IInputStream* in) { + inline void InitFromStream(IInputStream* in) { const ui8 ver = ::GLoad<ui8>(in); const ui8 lev = ::GLoad<ui8>(in); const ui8 mod = ::GLoad<ui8>(in); @@ -597,7 +597,7 @@ public: class TLzqCompress::TImpl: public TCompressorBase<TQuickLZCompress, TImpl> { public: - inline TImpl(IOutputStream* out, ui16 blockSize, EVersion ver, unsigned level, EMode mode) + inline TImpl(IOutputStream* out, ui16 blockSize, EVersion ver, unsigned level, EMode mode) : TCompressorBase<TQuickLZCompress, TImpl>(out, blockSize) { memset(AdditionalData(), 0, AdditionalDataLength()); @@ -610,7 +610,7 @@ public: } }; -TLzqCompress::TLzqCompress(IOutputStream* slave, ui16 blockSize, EVersion ver, unsigned level, EMode mode) +TLzqCompress::TLzqCompress(IOutputStream* slave, ui16 blockSize, EVersion ver, unsigned level, EMode mode) : Impl_(new (TImpl::Hint(blockSize)) TImpl(slave, blockSize, ver, level, mode)) { } @@ -639,7 +639,7 @@ namespace { // Decompressing input streams without signature verification template <class TInput, class TDecompressor> - class TLzDecompressInput: public TInputHolder<TInput>, public IInputStream { + class TLzDecompressInput: public TInputHolder<TInput>, public IInputStream { public: inline TLzDecompressInput(TInput in) : Impl_(this->Set(in)) @@ -657,7 +657,7 @@ namespace { } template <class T> -static TAutoPtr<IInputStream> TryOpenLzDecompressorX(const TDecompressSignature& s, T input) { +static TAutoPtr<IInputStream> TryOpenLzDecompressorX(const TDecompressSignature& s, T input) { if (s.Check<TLZ4>()) return new TLzDecompressInput<T, TLZ4>(input); @@ -677,7 +677,7 @@ static TAutoPtr<IInputStream> TryOpenLzDecompressorX(const TDecompressSignature& } template <class T> -static inline TAutoPtr<IInputStream> TryOpenLzDecompressorImpl(const TStringBuf& signature, T input) { +static inline TAutoPtr<IInputStream> TryOpenLzDecompressorImpl(const TStringBuf& signature, T input) { if (signature.size() == SIGNATURE_SIZE) { TMemoryInput mem(signature.data(), signature.size()); TDecompressSignature s(&mem); @@ -689,15 +689,15 @@ static inline TAutoPtr<IInputStream> TryOpenLzDecompressorImpl(const TStringBuf& } template <class T> -static inline TAutoPtr<IInputStream> TryOpenLzDecompressorImpl(T input) { +static inline TAutoPtr<IInputStream> TryOpenLzDecompressorImpl(T input) { TDecompressSignature s(&*input); return TryOpenLzDecompressorX(s, input); } template <class T> -static inline TAutoPtr<IInputStream> OpenLzDecompressorImpl(T input) { - TAutoPtr<IInputStream> ret = TryOpenLzDecompressorImpl(input); +static inline TAutoPtr<IInputStream> OpenLzDecompressorImpl(T input) { + TAutoPtr<IInputStream> ret = TryOpenLzDecompressorImpl(input); if (!ret) { ythrow TDecompressorError() << "Unknown compression format"; @@ -706,26 +706,26 @@ static inline TAutoPtr<IInputStream> OpenLzDecompressorImpl(T input) { return ret; } -TAutoPtr<IInputStream> OpenLzDecompressor(IInputStream* input) { +TAutoPtr<IInputStream> OpenLzDecompressor(IInputStream* input) { return OpenLzDecompressorImpl(input); } -TAutoPtr<IInputStream> TryOpenLzDecompressor(IInputStream* input) { +TAutoPtr<IInputStream> TryOpenLzDecompressor(IInputStream* input) { return TryOpenLzDecompressorImpl(input); } -TAutoPtr<IInputStream> TryOpenLzDecompressor(const TStringBuf& signature, IInputStream* input) { +TAutoPtr<IInputStream> TryOpenLzDecompressor(const TStringBuf& signature, IInputStream* input) { return TryOpenLzDecompressorImpl(signature, input); } -TAutoPtr<IInputStream> OpenOwnedLzDecompressor(TAutoPtr<IInputStream> input) { +TAutoPtr<IInputStream> OpenOwnedLzDecompressor(TAutoPtr<IInputStream> input) { return OpenLzDecompressorImpl(input); } -TAutoPtr<IInputStream> TryOpenOwnedLzDecompressor(TAutoPtr<IInputStream> input) { +TAutoPtr<IInputStream> TryOpenOwnedLzDecompressor(TAutoPtr<IInputStream> input) { return TryOpenLzDecompressorImpl(input); } -TAutoPtr<IInputStream> TryOpenOwnedLzDecompressor(const TStringBuf& signature, TAutoPtr<IInputStream> input) { +TAutoPtr<IInputStream> TryOpenOwnedLzDecompressor(const TStringBuf& signature, TAutoPtr<IInputStream> input) { return TryOpenLzDecompressorImpl(signature, input); } diff --git a/library/cpp/streams/lz/lz.h b/library/cpp/streams/lz/lz.h index 2207a46fe5..3a2eaad88b 100644 --- a/library/cpp/streams/lz/lz.h +++ b/library/cpp/streams/lz/lz.h @@ -30,9 +30,9 @@ struct TDecompressorError: public yexception { * * @see http://code.google.com/p/lz4/ */ -class TLz4Compress: public IOutputStream { +class TLz4Compress: public IOutputStream { public: - TLz4Compress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); + TLz4Compress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); ~TLz4Compress() override; private: @@ -50,9 +50,9 @@ private: * * @see http://code.google.com/p/lz4/ */ -class TLz4Decompress: public IInputStream { +class TLz4Decompress: public IInputStream { public: - TLz4Decompress(IInputStream* slave); + TLz4Decompress(IInputStream* slave); ~TLz4Decompress() override; private: @@ -68,9 +68,9 @@ private: * * @see http://code.google.com/p/snappy/ */ -class TSnappyCompress: public IOutputStream { +class TSnappyCompress: public IOutputStream { public: - TSnappyCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); + TSnappyCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); ~TSnappyCompress() override; private: @@ -88,9 +88,9 @@ private: * * @see http://code.google.com/p/snappy/ */ -class TSnappyDecompress: public IInputStream { +class TSnappyDecompress: public IInputStream { public: - TSnappyDecompress(IInputStream* slave); + TSnappyDecompress(IInputStream* slave); ~TSnappyDecompress() override; private: @@ -104,9 +104,9 @@ private: /** * MiniLZO compressing stream. */ -class TLzoCompress: public IOutputStream { +class TLzoCompress: public IOutputStream { public: - TLzoCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); + TLzoCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); ~TLzoCompress() override; private: @@ -122,9 +122,9 @@ private: /** * MiniLZO decompressing stream. */ -class TLzoDecompress: public IInputStream { +class TLzoDecompress: public IInputStream { public: - TLzoDecompress(IInputStream* slave); + TLzoDecompress(IInputStream* slave); ~TLzoDecompress() override; private: @@ -138,9 +138,9 @@ private: /** * FastLZ compressing stream. */ -class TLzfCompress: public IOutputStream { +class TLzfCompress: public IOutputStream { public: - TLzfCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); + TLzfCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15); ~TLzfCompress() override; private: @@ -156,9 +156,9 @@ private: /** * FastLZ decompressing stream. */ -class TLzfDecompress: public IInputStream { +class TLzfDecompress: public IInputStream { public: - TLzfDecompress(IInputStream* slave); + TLzfDecompress(IInputStream* slave); ~TLzfDecompress() override; private: @@ -172,7 +172,7 @@ private: /** * QuickLZ compressing stream. */ -class TLzqCompress: public IOutputStream { +class TLzqCompress: public IOutputStream { public: enum EVersion { V_1_31 = 0, @@ -189,7 +189,7 @@ public: M_1000000 = 2 }; - TLzqCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15, + TLzqCompress(IOutputStream* slave, ui16 maxBlockSize = 1 << 15, EVersion ver = V_1_31, unsigned level = 0, EMode mode = M_0); @@ -208,9 +208,9 @@ private: /** * QuickLZ decompressing stream. */ -class TLzqDecompress: public IInputStream { +class TLzqDecompress: public IInputStream { public: - TLzqDecompress(IInputStream* slave); + TLzqDecompress(IInputStream* slave); ~TLzqDecompress() override; private: @@ -233,10 +233,10 @@ private: * @param input Stream to decompress. * @return Decompressing proxy input stream. */ -TAutoPtr<IInputStream> OpenLzDecompressor(IInputStream* input); -TAutoPtr<IInputStream> TryOpenLzDecompressor(IInputStream* input); -TAutoPtr<IInputStream> TryOpenLzDecompressor(const TStringBuf& signature, IInputStream* input); +TAutoPtr<IInputStream> OpenLzDecompressor(IInputStream* input); +TAutoPtr<IInputStream> TryOpenLzDecompressor(IInputStream* input); +TAutoPtr<IInputStream> TryOpenLzDecompressor(const TStringBuf& signature, IInputStream* input); -TAutoPtr<IInputStream> OpenOwnedLzDecompressor(TAutoPtr<IInputStream> input); -TAutoPtr<IInputStream> TryOpenOwnedLzDecompressor(TAutoPtr<IInputStream> input); -TAutoPtr<IInputStream> TryOpenOwnedLzDecompressor(const TStringBuf& signature, TAutoPtr<IInputStream> input); +TAutoPtr<IInputStream> OpenOwnedLzDecompressor(TAutoPtr<IInputStream> input); +TAutoPtr<IInputStream> TryOpenOwnedLzDecompressor(TAutoPtr<IInputStream> input); +TAutoPtr<IInputStream> TryOpenOwnedLzDecompressor(const TStringBuf& signature, TAutoPtr<IInputStream> input); diff --git a/library/cpp/streams/lz/lz_ut.cpp b/library/cpp/streams/lz/lz_ut.cpp index ffa0065f46..6876f070fc 100644 --- a/library/cpp/streams/lz/lz_ut.cpp +++ b/library/cpp/streams/lz/lz_ut.cpp @@ -31,7 +31,7 @@ namespace { seed += 1; } } while (!sym); - Y_ASSERT(sym); + Y_ASSERT(sym); j = (j + 1) % entropy.size(); result += char(sym + entropy[j]); } @@ -75,7 +75,7 @@ static const TVector<size_t> bufferSizes = { namespace { template <TLzqCompress::EVersion Ver, int Level, TLzqCompress::EMode Mode> struct TLzqCompressX: public TLzqCompress { - inline TLzqCompressX(IOutputStream* out, size_t bufLen) + inline TLzqCompressX(IOutputStream* out, size_t bufLen) : TLzqCompress(out, bufLen, Ver, Level, Mode) { } @@ -160,9 +160,9 @@ static inline void TestDecompress() { } } -class TMixedDecompress: public IInputStream { +class TMixedDecompress: public IInputStream { public: - TMixedDecompress(IInputStream* input) + TMixedDecompress(IInputStream* input) : Slave_(OpenLzDecompressor(input).Release()) { } @@ -173,7 +173,7 @@ private: } private: - THolder<IInputStream> Slave_; + THolder<IInputStream> Slave_; }; template <class C> @@ -188,63 +188,63 @@ static inline void TestDecompressError() { UNIT_ASSERT_EXCEPTION(TestDecompress<D>(), TDecompressorError); } -Y_UNIT_TEST_SUITE(TLzTest) { - Y_UNIT_TEST(TestLzo) { +Y_UNIT_TEST_SUITE(TLzTest) { + Y_UNIT_TEST(TestLzo) { TestCompress<TLzoCompress>(); TestDecompress<TLzoDecompress>(); } - Y_UNIT_TEST(TestLzf) { + Y_UNIT_TEST(TestLzf) { TestCompress<TLzfCompress>(); TestDecompress<TLzfDecompress>(); } - Y_UNIT_TEST(TestLzq) { + Y_UNIT_TEST(TestLzq) { TestCompress<TLzqCompress>(); TestDecompress<TLzqDecompress>(); } - Y_UNIT_TEST(TestLzq151_1) { + Y_UNIT_TEST(TestLzq151_1) { TestCompress<TLzqCompressX<TLzqCompress::V_1_51, 1, TLzqCompress::M_0>>(); TestDecompress<TLzqDecompress>(); } - Y_UNIT_TEST(TestLzq151_2) { + Y_UNIT_TEST(TestLzq151_2) { TestCompress<TLzqCompressX<TLzqCompress::V_1_51, 2, TLzqCompress::M_100000>>(); TestDecompress<TLzqDecompress>(); } - Y_UNIT_TEST(TestLzq151_3) { + Y_UNIT_TEST(TestLzq151_3) { TestCompress<TLzqCompressX<TLzqCompress::V_1_51, 3, TLzqCompress::M_1000000>>(); TestDecompress<TLzqDecompress>(); } - Y_UNIT_TEST(TestLzq140_1) { + Y_UNIT_TEST(TestLzq140_1) { TestCompress<TLzqCompressX<TLzqCompress::V_1_40, 1, TLzqCompress::M_0>>(); TestDecompress<TLzqDecompress>(); } - Y_UNIT_TEST(TestLzq140_2) { + Y_UNIT_TEST(TestLzq140_2) { TestCompress<TLzqCompressX<TLzqCompress::V_1_40, 2, TLzqCompress::M_100000>>(); TestDecompress<TLzqDecompress>(); } - Y_UNIT_TEST(TestLzq140_3) { + Y_UNIT_TEST(TestLzq140_3) { TestCompress<TLzqCompressX<TLzqCompress::V_1_40, 3, TLzqCompress::M_1000000>>(); TestDecompress<TLzqDecompress>(); } - Y_UNIT_TEST(TestLz4) { + Y_UNIT_TEST(TestLz4) { TestCompress<TLz4Compress>(); TestDecompress<TLz4Decompress>(); } - Y_UNIT_TEST(TestSnappy) { + Y_UNIT_TEST(TestSnappy) { TestCompress<TSnappyCompress>(); TestDecompress<TSnappyDecompress>(); } - Y_UNIT_TEST(TestGeneric) { + Y_UNIT_TEST(TestGeneric) { TestMixedDecompress<TLzoCompress>(); TestMixedDecompress<TLzfCompress>(); TestMixedDecompress<TLzqCompress>(); @@ -252,7 +252,7 @@ Y_UNIT_TEST_SUITE(TLzTest) { TestMixedDecompress<TSnappyCompress>(); } - Y_UNIT_TEST(TestDecompressorError) { + Y_UNIT_TEST(TestDecompressorError) { TestDecompressError<TLzoDecompress, TLzfCompress>(); TestDecompressError<TLzfDecompress, TLzqCompress>(); TestDecompressError<TLzqDecompress, TLz4Compress>(); @@ -261,7 +261,7 @@ Y_UNIT_TEST_SUITE(TLzTest) { TestDecompressError<TMixedDecompress, TBufferedOutput>(); } - Y_UNIT_TEST(TestFactory) { + Y_UNIT_TEST(TestFactory) { TStringStream ss; { @@ -271,7 +271,7 @@ Y_UNIT_TEST_SUITE(TLzTest) { c.Finish(); } - TAutoPtr<IInputStream> is(OpenOwnedLzDecompressor(new TStringInput(ss.Str()))); + TAutoPtr<IInputStream> is(OpenOwnedLzDecompressor(new TStringInput(ss.Str()))); UNIT_ASSERT_EQUAL(is->ReadAll(), "123456789"); } diff --git a/library/cpp/streams/lzma/lzma.cpp b/library/cpp/streams/lzma/lzma.cpp index 0a8235d02b..f1942fa546 100644 --- a/library/cpp/streams/lzma/lzma.cpp +++ b/library/cpp/streams/lzma/lzma.cpp @@ -58,7 +58,7 @@ namespace { TInverseFilter* Parent_; }; - class TInput: public IInputStream { + class TInput: public IInputStream { public: inline TInput(TInverseFilter* parent) : Parent_(parent) @@ -76,7 +76,7 @@ namespace { TInverseFilter* Parent_; }; - class TOutput: public IOutputStream { + class TOutput: public IOutputStream { public: inline TOutput(TInverseFilter* parent) : Parent_(parent) @@ -95,7 +95,7 @@ namespace { }; public: - inline TInverseFilter(IOutputStream* slave, T* filter) + inline TInverseFilter(IOutputStream* slave, T* filter) : Slave_(slave) , Filter_(filter) , TrampoLine_(this) @@ -168,7 +168,7 @@ namespace { } inline void WriteImpl(const void* ptr, size_t len) { - Y_ASSERT(!Out_.Avail()); + Y_ASSERT(!Out_.Avail()); Out_.Reset(ptr, len); @@ -205,7 +205,7 @@ namespace { } private: - IOutputStream* Slave_; + IOutputStream* Slave_; T* Filter_; TTrampoLine TrampoLine_; char Stack_[16 * 1024]; @@ -221,7 +221,7 @@ namespace { public: class TLzmaInput: public ISeqInStream { public: - inline TLzmaInput(IInputStream* slave) + inline TLzmaInput(IInputStream* slave) : Slave_(slave) { Read = ReadFunc; @@ -235,12 +235,12 @@ namespace { } private: - IInputStream* Slave_; + IInputStream* Slave_; }; class TLzmaOutput: public ISeqOutStream { public: - inline TLzmaOutput(IOutputStream* slave) + inline TLzmaOutput(IOutputStream* slave) : Slave_(slave) { Write = WriteFunc; @@ -254,7 +254,7 @@ namespace { } private: - IOutputStream* Slave_; + IOutputStream* Slave_; }; class TAlloc: public ISzAlloc { @@ -321,7 +321,7 @@ namespace { LzmaEnc_Destroy(H_, Alloc(), Alloc()); } - inline void operator()(IInputStream* in, IOutputStream* out) { + inline void operator()(IInputStream* in, IOutputStream* out) { TLzmaInput input(in); TLzmaOutput output(out); @@ -339,7 +339,7 @@ namespace { class TLzmaCompress::TImpl: public TLzmaCompressBase, public TInverseFilter<TLzmaCompressBase> { public: - inline TImpl(IOutputStream* slave, size_t level) + inline TImpl(IOutputStream* slave, size_t level) : TLzmaCompressBase(level) , TInverseFilter<TLzmaCompressBase>(slave, this) { @@ -373,7 +373,7 @@ public: pos += bufLen; if (status == LZMA_STATUS_NEEDS_MORE_INPUT) { - Y_ASSERT(InEnd_ == InBegin_); + Y_ASSERT(InEnd_ == InBegin_); if (!Fill()) { ythrow yexception() << "incomplete lzma stream"; } @@ -395,7 +395,7 @@ protected: class TLzmaDecompress::TImplStream: public TImpl { public: - inline TImplStream(IInputStream* slave) + inline TImplStream(IInputStream* slave) : Slave_(slave) { Byte buf[LZMA_PROPS_SIZE]; @@ -417,13 +417,13 @@ private: } private: - IInputStream* Slave_; + IInputStream* Slave_; char In_[4096]; }; class TLzmaDecompress::TImplZeroCopy: public TLzmaDecompress::TImpl { public: - inline TImplZeroCopy(IZeroCopyInput* in) + inline TImplZeroCopy(IZeroCopyInput* in) : Input_(in) { if (!Fill()) @@ -475,10 +475,10 @@ private: return false; } - IZeroCopyInput* Input_; + IZeroCopyInput* Input_; }; -TLzmaCompress::TLzmaCompress(IOutputStream* slave, size_t level) +TLzmaCompress::TLzmaCompress(IOutputStream* slave, size_t level) : Impl_(new TImpl(slave, level)) { } @@ -502,12 +502,12 @@ void TLzmaCompress::DoFinish() { } } -TLzmaDecompress::TLzmaDecompress(IInputStream* slave) +TLzmaDecompress::TLzmaDecompress(IInputStream* slave) : Impl_(new TImplStream(slave)) { } -TLzmaDecompress::TLzmaDecompress(IZeroCopyInput* input) +TLzmaDecompress::TLzmaDecompress(IZeroCopyInput* input) : Impl_(new TImplZeroCopy(input)) { } diff --git a/library/cpp/streams/lzma/lzma.h b/library/cpp/streams/lzma/lzma.h index 9a86213655..ca1e06e9ef 100644 --- a/library/cpp/streams/lzma/lzma.h +++ b/library/cpp/streams/lzma/lzma.h @@ -6,9 +6,9 @@ #include <util/generic/ptr.h> -class TLzmaCompress: public IOutputStream { +class TLzmaCompress: public IOutputStream { public: - TLzmaCompress(IOutputStream* slave, size_t level = 7); + TLzmaCompress(IOutputStream* slave, size_t level = 7); ~TLzmaCompress() override; private: @@ -20,10 +20,10 @@ private: THolder<TImpl> Impl_; }; -class TLzmaDecompress: public IInputStream { +class TLzmaDecompress: public IInputStream { public: - TLzmaDecompress(IInputStream* slave); - TLzmaDecompress(IZeroCopyInput* input); + TLzmaDecompress(IInputStream* slave); + TLzmaDecompress(IZeroCopyInput* input); ~TLzmaDecompress() override; private: diff --git a/library/cpp/streams/lzma/lzma_ut.cpp b/library/cpp/streams/lzma/lzma_ut.cpp index e71e1bde49..847e98d1ca 100644 --- a/library/cpp/streams/lzma/lzma_ut.cpp +++ b/library/cpp/streams/lzma/lzma_ut.cpp @@ -6,7 +6,7 @@ #include <util/random/fast.h> #include <util/random/random.h> -class TStrokaByOneByte: public IZeroCopyInput { +class TStrokaByOneByte: public IZeroCopyInput { public: TStrokaByOneByte(const TString& s) : Data(s) @@ -52,7 +52,7 @@ private: } inline void Test2() { - class TExcOutput: public IOutputStream { + class TExcOutput: public IOutputStream { public: ~TExcOutput() override { } @@ -93,7 +93,7 @@ private: { TMemoryInput mi(res.data(), res.size()); TStringOutput so(data1); - TLzmaDecompress d((IInputStream*)&mi); + TLzmaDecompress d((IInputStream*)&mi); TransferData(&d, &so); } |