diff options
author | myltsev <myltsev@yandex-team.ru> | 2022-02-10 16:46:03 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:03 +0300 |
commit | 9166d66c30c23c9e85a7c88185a068987148d23f (patch) | |
tree | 421bdcec5755d9e441c485560aab5ab8d74c7475 /util/stream/zlib.cpp | |
parent | 8d3a5ed3a188a34167eaee54f1691ce5c9edf2f3 (diff) | |
download | ydb-9166d66c30c23c9e85a7c88185a068987148d23f.tar.gz |
Restoring authorship annotation for <myltsev@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/stream/zlib.cpp')
-rw-r--r-- | util/stream/zlib.cpp | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/util/stream/zlib.cpp b/util/stream/zlib.cpp index 60f4e9439f..a9fe352239 100644 --- a/util/stream/zlib.cpp +++ b/util/stream/zlib.cpp @@ -80,17 +80,17 @@ namespace { class TZLibDecompress::TImpl: private TZLibCommon, public TChunkedZeroCopyInput { public: - inline TImpl(IZeroCopyInput* in, ZLib::StreamType type, TStringBuf dict) + inline TImpl(IZeroCopyInput* in, ZLib::StreamType type, TStringBuf dict) : TChunkedZeroCopyInput(in) - , Dict(dict) + , Dict(dict) { if (inflateInit2(Z(), opts[type]) != Z_OK) { ythrow TZLibDecompressorError() << "can not init inflate engine"; } - - if (dict.size() && type == ZLib::Raw) { - SetDict(); - } + + if (dict.size() && type == ZLib::Raw) { + SetDict(); + } } virtual ~TImpl() { @@ -113,11 +113,11 @@ public: } switch (inflate(Z(), Z_SYNC_FLUSH)) { - case Z_NEED_DICT: { - SetDict(); - continue; - } - + case Z_NEED_DICT: { + SetDict(); + continue; + } + case Z_STREAM_END: { if (AllowMultipleStreams_) { if (inflateReset(Z()) != Z_OK) { @@ -151,21 +151,21 @@ private: return Next(&Z()->next_in, &Z()->avail_in); } - void SetDict() { - if (inflateSetDictionary(Z(), (const Bytef*)Dict.data(), Dict.size()) != Z_OK) { - ythrow TZLibCompressorError() << "can not set inflate dictionary"; - } - } - + void SetDict() { + if (inflateSetDictionary(Z(), (const Bytef*)Dict.data(), Dict.size()) != Z_OK) { + ythrow TZLibCompressorError() << "can not set inflate dictionary"; + } + } + bool AllowMultipleStreams_ = true; - TStringBuf Dict; + TStringBuf Dict; }; namespace { class TDecompressStream: public IZeroCopyInput, public TZLibDecompress::TImpl, public TAdditionalStorage<TDecompressStream> { public: - inline TDecompressStream(IInputStream* input, ZLib::StreamType type, TStringBuf dict) - : TZLibDecompress::TImpl(this, type, dict) + inline TDecompressStream(IInputStream* input, ZLib::StreamType type, TStringBuf dict) + : TZLibDecompress::TImpl(this, type, dict) , Stream_(input) { } @@ -318,13 +318,13 @@ private: THolder<gz_header> GZHeader_; }; -TZLibDecompress::TZLibDecompress(IZeroCopyInput* input, ZLib::StreamType type, TStringBuf dict) - : Impl_(new TZeroCopyDecompress(input, type, dict)) +TZLibDecompress::TZLibDecompress(IZeroCopyInput* input, ZLib::StreamType type, TStringBuf dict) + : Impl_(new TZeroCopyDecompress(input, type, dict)) { } -TZLibDecompress::TZLibDecompress(IInputStream* input, ZLib::StreamType type, size_t buflen, TStringBuf dict) - : Impl_(new (buflen) TDecompressStream(input, type, dict)) +TZLibDecompress::TZLibDecompress(IInputStream* input, ZLib::StreamType type, size_t buflen, TStringBuf dict) + : Impl_(new (buflen) TDecompressStream(input, type, dict)) { } |