diff options
| author | dvorkanton <[email protected]> | 2022-02-10 16:46:04 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:04 +0300 | 
| commit | ce1ca0f8ad5b8231d32b35629f85bb09beea1bfb (patch) | |
| tree | 19b21fdcf9ef01e0c94a15434fb08a4a555a79e9 /library/cpp/blockcodecs/codecs/zlib | |
| parent | fc361854fd6ee8d747229b090f0b8018e260d1fb (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/blockcodecs/codecs/zlib')
| -rw-r--r-- | library/cpp/blockcodecs/codecs/zlib/ya.make | 26 | ||||
| -rw-r--r-- | library/cpp/blockcodecs/codecs/zlib/zlib.cpp | 118 | 
2 files changed, 72 insertions, 72 deletions
diff --git a/library/cpp/blockcodecs/codecs/zlib/ya.make b/library/cpp/blockcodecs/codecs/zlib/ya.make index 9f04995f667..86944366fa8 100644 --- a/library/cpp/blockcodecs/codecs/zlib/ya.make +++ b/library/cpp/blockcodecs/codecs/zlib/ya.make @@ -1,14 +1,14 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( -    contrib/libs/zlib +LIBRARY()  +  +OWNER(pg)  +  +PEERDIR(  +    contrib/libs/zlib       library/cpp/blockcodecs/core -) - -SRCS( -    GLOBAL zlib.cpp -) - -END() +)  +  +SRCS(  +    GLOBAL zlib.cpp  +)  +  +END()  diff --git a/library/cpp/blockcodecs/codecs/zlib/zlib.cpp b/library/cpp/blockcodecs/codecs/zlib/zlib.cpp index cdb556c36d4..077751d21ba 100644 --- a/library/cpp/blockcodecs/codecs/zlib/zlib.cpp +++ b/library/cpp/blockcodecs/codecs/zlib/zlib.cpp @@ -1,64 +1,64 @@  #include <library/cpp/blockcodecs/core/codecs.h>  #include <library/cpp/blockcodecs/core/common.h>  #include <library/cpp/blockcodecs/core/register.h> - -#include <contrib/libs/zlib/zlib.h> - -using namespace NBlockCodecs; - -namespace { -    struct TZLibCodec: public TAddLengthCodec<TZLibCodec> { -        inline TZLibCodec(int level) -            : MyName("zlib-" + ToString(level)) -            , Level(level) -        { -        } - -        static inline size_t DoMaxCompressedLength(size_t in) noexcept { -            return compressBound(in); -        } - -        TStringBuf Name() const noexcept override { -            return MyName; -        } - -        inline size_t DoCompress(const TData& in, void* buf) const { -            //TRASH detected -            uLong ret = Max<unsigned int>(); - -            int cres = compress2((Bytef*)buf, &ret, (const Bytef*)in.data(), in.size(), Level); - -            if (cres != Z_OK) { -                ythrow TCompressError(cres); -            } - -            return ret; -        } - -        inline void DoDecompress(const TData& in, void* out, size_t len) const { -            uLong ret = len; - -            int uncres = uncompress((Bytef*)out, &ret, (const Bytef*)in.data(), in.size()); -            if (uncres != Z_OK) { -                ythrow TDecompressError(uncres); -            } - -            if (ret != len) { -                ythrow TDecompressError(len, ret); -            } -        } - -        const TString MyName; -        const int Level; -    }; - -    struct TZLibRegistrar { -        TZLibRegistrar() { -            for (int i = 0; i < 10; ++i) { +  +#include <contrib/libs/zlib/zlib.h>  +  +using namespace NBlockCodecs;  +  +namespace {  +    struct TZLibCodec: public TAddLengthCodec<TZLibCodec> {  +        inline TZLibCodec(int level)  +            : MyName("zlib-" + ToString(level))  +            , Level(level)  +        {  +        }  +  +        static inline size_t DoMaxCompressedLength(size_t in) noexcept {  +            return compressBound(in);  +        }  +  +        TStringBuf Name() const noexcept override {  +            return MyName;  +        }  +  +        inline size_t DoCompress(const TData& in, void* buf) const {  +            //TRASH detected  +            uLong ret = Max<unsigned int>();  +  +            int cres = compress2((Bytef*)buf, &ret, (const Bytef*)in.data(), in.size(), Level);  +  +            if (cres != Z_OK) {  +                ythrow TCompressError(cres);  +            }  +  +            return ret;  +        }  +  +        inline void DoDecompress(const TData& in, void* out, size_t len) const {  +            uLong ret = len;  +  +            int uncres = uncompress((Bytef*)out, &ret, (const Bytef*)in.data(), in.size());  +            if (uncres != Z_OK) {  +                ythrow TDecompressError(uncres);  +            }  +  +            if (ret != len) {  +                ythrow TDecompressError(len, ret);  +            }  +        }  +  +        const TString MyName;  +        const int Level;  +    };  +  +    struct TZLibRegistrar {  +        TZLibRegistrar() {  +            for (int i = 0; i < 10; ++i) {                   RegisterCodec(MakeHolder<TZLibCodec>(i)); -            } -            RegisterAlias("zlib", "zlib-6"); -        } -    }; +            }  +            RegisterAlias("zlib", "zlib-6");  +        }  +    };       const TZLibRegistrar Registrar{}; -} +}   | 
