diff options
| author | Ruslan Kovalev <[email protected]> | 2022-02-10 16:46:44 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:46:44 +0300 | 
| commit | 59e19371de37995fcb36beb16cd6ec030af960bc (patch) | |
| tree | fa68e36093ebff8b805462e9e6d331fe9d348214 /library/cpp/codecs/static/example/example.cpp | |
| parent | 89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff) | |
Restoring authorship annotation for Ruslan Kovalev <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/codecs/static/example/example.cpp')
| -rw-r--r-- | library/cpp/codecs/static/example/example.cpp | 76 | 
1 files changed, 38 insertions, 38 deletions
| diff --git a/library/cpp/codecs/static/example/example.cpp b/library/cpp/codecs/static/example/example.cpp index 5b750b717e1..0c50a1a5be8 100644 --- a/library/cpp/codecs/static/example/example.cpp +++ b/library/cpp/codecs/static/example/example.cpp @@ -1,43 +1,43 @@ -#include "example.h" - +#include "example.h"  +   #include <library/cpp/codecs/static/static.h> - -#include <util/generic/yexception.h> - -extern "C" { +  +#include <util/generic/yexception.h>  +  +extern "C" {   extern const ui8 codec_info_huff_20160707[];  extern const ui32 codec_info_huff_20160707Size;  extern const ui8 codec_info_sa_huff_20160707[];  extern const ui32 codec_info_sa_huff_20160707Size; -}; - -namespace NStaticCodecExample { -    static const NCodecs::TCodecConstPtr CODECS[] = { -        nullptr, -        NCodecs::RestoreCodecFromArchive(codec_info_huff_20160707, codec_info_huff_20160707Size), -        NCodecs::RestoreCodecFromArchive(codec_info_sa_huff_20160707, codec_info_sa_huff_20160707Size), -    }; - -    static_assert(Y_ARRAY_SIZE(CODECS) == DV_COUNT, "bad array size"); - -    void Encode(TBuffer& out, TStringBuf in, EDictVersion dv) { -        Y_ENSURE(dv > DV_NULL && dv < DV_COUNT, "invalid dict version: " << (int)dv); -        out.Clear(); -        if (!in) { -            return; -        } -        CODECS[dv]->Encode(in, out); -        out.Append((char)dv); -    } - -    void Decode(TBuffer& out, TStringBuf in) { -        out.Clear(); -        if (!in) { -            return; -        } -        EDictVersion dv = (EDictVersion)in.back(); -        Y_ENSURE(dv > DV_NULL && dv < DV_COUNT, "invalid dict version: " << (int)dv); -        in.Chop(1); -        CODECS[dv]->Decode(in, out); -    } -} +};  +  +namespace NStaticCodecExample {  +    static const NCodecs::TCodecConstPtr CODECS[] = {  +        nullptr,  +        NCodecs::RestoreCodecFromArchive(codec_info_huff_20160707, codec_info_huff_20160707Size),  +        NCodecs::RestoreCodecFromArchive(codec_info_sa_huff_20160707, codec_info_sa_huff_20160707Size),  +    };  +  +    static_assert(Y_ARRAY_SIZE(CODECS) == DV_COUNT, "bad array size");  +  +    void Encode(TBuffer& out, TStringBuf in, EDictVersion dv) {  +        Y_ENSURE(dv > DV_NULL && dv < DV_COUNT, "invalid dict version: " << (int)dv);  +        out.Clear();  +        if (!in) {  +            return;  +        }  +        CODECS[dv]->Encode(in, out);  +        out.Append((char)dv);  +    }  +  +    void Decode(TBuffer& out, TStringBuf in) {  +        out.Clear();  +        if (!in) {  +            return;  +        }  +        EDictVersion dv = (EDictVersion)in.back();  +        Y_ENSURE(dv > DV_NULL && dv < DV_COUNT, "invalid dict version: " << (int)dv);  +        in.Chop(1);  +        CODECS[dv]->Decode(in, out);  +    }  +}  | 
