diff options
author | dvorkanton <dvorkanton@yandex-team.ru> | 2022-02-10 16:46:04 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:04 +0300 |
commit | ce1ca0f8ad5b8231d32b35629f85bb09beea1bfb (patch) | |
tree | 19b21fdcf9ef01e0c94a15434fb08a4a555a79e9 /library | |
parent | fc361854fd6ee8d747229b090f0b8018e260d1fb (diff) | |
download | ydb-ce1ca0f8ad5b8231d32b35629f85bb09beea1bfb.tar.gz |
Restoring authorship annotation for <dvorkanton@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
35 files changed, 769 insertions, 769 deletions
diff --git a/library/cpp/blockcodecs/README.md b/library/cpp/blockcodecs/README.md index 417917a475..e59beab023 100644 --- a/library/cpp/blockcodecs/README.md +++ b/library/cpp/blockcodecs/README.md @@ -15,9 +15,9 @@ Streaming ========= Use `stream.h` to obtain simple streams over block codecs (buffer data, compress them by blocks, write to the resulting stream). - -Using codec plugins -=================== -If you don't want your code to bloat from unused codecs, you can use the small version of the + +Using codec plugins +=================== +If you don't want your code to bloat from unused codecs, you can use the small version of the library: `library/cpp/blockcodecs/core`. In that case, you need to manually set `PEERDIR()`s to needed codecs (i.e. `PEERDIR(library/cpp/blockcodecs/codecs/lzma)`). diff --git a/library/cpp/blockcodecs/codecs.cpp b/library/cpp/blockcodecs/codecs.cpp index fdec4809d3..7690558f60 100644 --- a/library/cpp/blockcodecs/codecs.cpp +++ b/library/cpp/blockcodecs/codecs.cpp @@ -1 +1 @@ -#include "codecs.h" +#include "codecs.h" diff --git a/library/cpp/blockcodecs/codecs.h b/library/cpp/blockcodecs/codecs.h index fd499b54b0..1343ca31ac 100644 --- a/library/cpp/blockcodecs/codecs.h +++ b/library/cpp/blockcodecs/codecs.h @@ -1,3 +1,3 @@ -#pragma once - +#pragma once + #include <library/cpp/blockcodecs/core/codecs.h> diff --git a/library/cpp/blockcodecs/codecs/brotli/brotli.cpp b/library/cpp/blockcodecs/codecs/brotli/brotli.cpp index 6e3cd971bd..ed16c426b5 100644 --- a/library/cpp/blockcodecs/codecs/brotli/brotli.cpp +++ b/library/cpp/blockcodecs/codecs/brotli/brotli.cpp @@ -1,67 +1,67 @@ #include <library/cpp/blockcodecs/core/codecs.h> #include <library/cpp/blockcodecs/core/common.h> #include <library/cpp/blockcodecs/core/register.h> - -#include <contrib/libs/brotli/include/brotli/encode.h> -#include <contrib/libs/brotli/include/brotli/decode.h> - -using namespace NBlockCodecs; - -namespace { - struct TBrotliCodec : public TAddLengthCodec<TBrotliCodec> { - static constexpr int BEST_QUALITY = 11; - - inline TBrotliCodec(ui32 level) - : Quality(level) + +#include <contrib/libs/brotli/include/brotli/encode.h> +#include <contrib/libs/brotli/include/brotli/decode.h> + +using namespace NBlockCodecs; + +namespace { + struct TBrotliCodec : public TAddLengthCodec<TBrotliCodec> { + static constexpr int BEST_QUALITY = 11; + + inline TBrotliCodec(ui32 level) + : Quality(level) , MyName(TStringBuf("brotli_") + ToString(level)) - { - } - - static inline size_t DoMaxCompressedLength(size_t l) noexcept { - return BrotliEncoderMaxCompressedSize(l); - } - - inline size_t DoCompress(const TData& in, void* out) const { - size_t resultSize = MaxCompressedLength(in); - auto result = BrotliEncoderCompress( - /*quality*/ Quality, - /*window*/ BROTLI_DEFAULT_WINDOW, - /*mode*/ BrotliEncoderMode::BROTLI_MODE_GENERIC, - /*input_size*/ in.size(), - /*input_buffer*/ (const unsigned char*)(in.data()), - /*encoded_size*/ &resultSize, - /*encoded_buffer*/ static_cast<unsigned char*>(out)); - if (result != BROTLI_TRUE) { - ythrow yexception() << "internal brotli error during compression"; - } - - return resultSize; - } - - inline void DoDecompress(const TData& in, void* out, size_t dsize) const { - size_t decoded = dsize; - auto result = BrotliDecoderDecompress(in.size(), (const unsigned char*)in.data(), &decoded, static_cast<unsigned char*>(out)); - if (result != BROTLI_DECODER_RESULT_SUCCESS) { - ythrow yexception() << "internal brotli error during decompression"; - } else if (decoded != dsize) { - ythrow TDecompressError(dsize, decoded); - } - } - - TStringBuf Name() const noexcept override { - return MyName; - } - - const int Quality = BEST_QUALITY; - const TString MyName; - }; - - struct TBrotliRegistrar { - TBrotliRegistrar() { - for (int i = 1; i <= TBrotliCodec::BEST_QUALITY; ++i) { + { + } + + static inline size_t DoMaxCompressedLength(size_t l) noexcept { + return BrotliEncoderMaxCompressedSize(l); + } + + inline size_t DoCompress(const TData& in, void* out) const { + size_t resultSize = MaxCompressedLength(in); + auto result = BrotliEncoderCompress( + /*quality*/ Quality, + /*window*/ BROTLI_DEFAULT_WINDOW, + /*mode*/ BrotliEncoderMode::BROTLI_MODE_GENERIC, + /*input_size*/ in.size(), + /*input_buffer*/ (const unsigned char*)(in.data()), + /*encoded_size*/ &resultSize, + /*encoded_buffer*/ static_cast<unsigned char*>(out)); + if (result != BROTLI_TRUE) { + ythrow yexception() << "internal brotli error during compression"; + } + + return resultSize; + } + + inline void DoDecompress(const TData& in, void* out, size_t dsize) const { + size_t decoded = dsize; + auto result = BrotliDecoderDecompress(in.size(), (const unsigned char*)in.data(), &decoded, static_cast<unsigned char*>(out)); + if (result != BROTLI_DECODER_RESULT_SUCCESS) { + ythrow yexception() << "internal brotli error during decompression"; + } else if (decoded != dsize) { + ythrow TDecompressError(dsize, decoded); + } + } + + TStringBuf Name() const noexcept override { + return MyName; + } + + const int Quality = BEST_QUALITY; + const TString MyName; + }; + + struct TBrotliRegistrar { + TBrotliRegistrar() { + for (int i = 1; i <= TBrotliCodec::BEST_QUALITY; ++i) { RegisterCodec(MakeHolder<TBrotliCodec>(i)); - } - } - }; + } + } + }; const TBrotliRegistrar Registrar{}; -} +} diff --git a/library/cpp/blockcodecs/codecs/brotli/ya.make b/library/cpp/blockcodecs/codecs/brotli/ya.make index 17aff0bb72..6425fc990a 100644 --- a/library/cpp/blockcodecs/codecs/brotli/ya.make +++ b/library/cpp/blockcodecs/codecs/brotli/ya.make @@ -1,15 +1,15 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( - contrib/libs/brotli/enc - contrib/libs/brotli/dec +LIBRARY() + +OWNER(pg) + +PEERDIR( + contrib/libs/brotli/enc + contrib/libs/brotli/dec library/cpp/blockcodecs/core -) - -SRCS( - GLOBAL brotli.cpp -) - -END() +) + +SRCS( + GLOBAL brotli.cpp +) + +END() diff --git a/library/cpp/blockcodecs/codecs/bzip/bzip.cpp b/library/cpp/blockcodecs/codecs/bzip/bzip.cpp index 3a5cfdd0e9..851c1447c3 100644 --- a/library/cpp/blockcodecs/codecs/bzip/bzip.cpp +++ b/library/cpp/blockcodecs/codecs/bzip/bzip.cpp @@ -1,62 +1,62 @@ #include <library/cpp/blockcodecs/core/codecs.h> #include <library/cpp/blockcodecs/core/common.h> #include <library/cpp/blockcodecs/core/register.h> - -#include <contrib/libs/libbz2/bzlib.h> - -using namespace NBlockCodecs; - -namespace { - struct TBZipCodec: public TAddLengthCodec<TBZipCodec> { - inline TBZipCodec(int level) - : Level(level) - , MyName("bzip2-" + ToString(Level)) - { - } - - static inline size_t DoMaxCompressedLength(size_t in) noexcept { - // very strange - return in * 2 + 128; - } - - TStringBuf Name() const noexcept override { - return MyName; - } - - inline size_t DoCompress(const TData& in, void* buf) const { - unsigned int ret = DoMaxCompressedLength(in.size()); - const int res = BZ2_bzBuffToBuffCompress((char*)buf, &ret, (char*)in.data(), in.size(), Level, 0, 0); - if (res != BZ_OK) { - ythrow TCompressError(res); - } - - return ret; - } - - inline void DoDecompress(const TData& in, void* out, size_t len) const { - unsigned int tmp = SafeIntegerCast<unsigned int>(len); - const int res = BZ2_bzBuffToBuffDecompress((char*)out, &tmp, (char*)in.data(), in.size(), 0, 0); - - if (res != BZ_OK) { - ythrow TDecompressError(res); - } - - if (len != tmp) { - ythrow TDecompressError(len, tmp); - } - } - - const int Level; - const TString MyName; - }; - - struct TBZipRegistrar { - TBZipRegistrar() { - for (int i = 1; i < 10; ++i) { + +#include <contrib/libs/libbz2/bzlib.h> + +using namespace NBlockCodecs; + +namespace { + struct TBZipCodec: public TAddLengthCodec<TBZipCodec> { + inline TBZipCodec(int level) + : Level(level) + , MyName("bzip2-" + ToString(Level)) + { + } + + static inline size_t DoMaxCompressedLength(size_t in) noexcept { + // very strange + return in * 2 + 128; + } + + TStringBuf Name() const noexcept override { + return MyName; + } + + inline size_t DoCompress(const TData& in, void* buf) const { + unsigned int ret = DoMaxCompressedLength(in.size()); + const int res = BZ2_bzBuffToBuffCompress((char*)buf, &ret, (char*)in.data(), in.size(), Level, 0, 0); + if (res != BZ_OK) { + ythrow TCompressError(res); + } + + return ret; + } + + inline void DoDecompress(const TData& in, void* out, size_t len) const { + unsigned int tmp = SafeIntegerCast<unsigned int>(len); + const int res = BZ2_bzBuffToBuffDecompress((char*)out, &tmp, (char*)in.data(), in.size(), 0, 0); + + if (res != BZ_OK) { + ythrow TDecompressError(res); + } + + if (len != tmp) { + ythrow TDecompressError(len, tmp); + } + } + + const int Level; + const TString MyName; + }; + + struct TBZipRegistrar { + TBZipRegistrar() { + for (int i = 1; i < 10; ++i) { RegisterCodec(MakeHolder<TBZipCodec>(i)); - } - RegisterAlias("bzip2", "bzip2-6"); - } - }; + } + RegisterAlias("bzip2", "bzip2-6"); + } + }; const TBZipRegistrar Registrar{}; -} +} diff --git a/library/cpp/blockcodecs/codecs/bzip/ya.make b/library/cpp/blockcodecs/codecs/bzip/ya.make index f0a8aefd62..ddf2f7b29f 100644 --- a/library/cpp/blockcodecs/codecs/bzip/ya.make +++ b/library/cpp/blockcodecs/codecs/bzip/ya.make @@ -1,14 +1,14 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( - contrib/libs/libbz2 +LIBRARY() + +OWNER(pg) + +PEERDIR( + contrib/libs/libbz2 library/cpp/blockcodecs/core -) - -SRCS( - GLOBAL bzip.cpp -) - -END() +) + +SRCS( + GLOBAL bzip.cpp +) + +END() diff --git a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp index da2831fbd2..1fe7bb3a7d 100644 --- a/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp +++ b/library/cpp/blockcodecs/codecs/fastlz/fastlz.cpp @@ -1,54 +1,54 @@ #include <library/cpp/blockcodecs/core/codecs.h> #include <library/cpp/blockcodecs/core/common.h> #include <library/cpp/blockcodecs/core/register.h> - -#include <contrib/libs/fastlz/fastlz.h> - -using namespace NBlockCodecs; - -namespace { - struct TFastLZCodec: public TAddLengthCodec<TFastLZCodec> { - inline TFastLZCodec(int level) - : MyName("fastlz-" + ToString(level)) - , Level(level) - { - } - - static inline size_t DoMaxCompressedLength(size_t in) noexcept { - return Max<size_t>(in + in / 20, 128); - } - - TStringBuf Name() const noexcept override { - return MyName; - } - - inline size_t DoCompress(const TData& in, void* buf) const { - if (Level) { - return fastlz_compress_level(Level, in.data(), in.size(), buf); - } - - return fastlz_compress(in.data(), in.size(), buf); - } - - inline void DoDecompress(const TData& in, void* out, size_t len) const { - const int ret = fastlz_decompress(in.data(), in.size(), out, len); - - if (ret < 0 || (size_t)ret != len) { + +#include <contrib/libs/fastlz/fastlz.h> + +using namespace NBlockCodecs; + +namespace { + struct TFastLZCodec: public TAddLengthCodec<TFastLZCodec> { + inline TFastLZCodec(int level) + : MyName("fastlz-" + ToString(level)) + , Level(level) + { + } + + static inline size_t DoMaxCompressedLength(size_t in) noexcept { + return Max<size_t>(in + in / 20, 128); + } + + TStringBuf Name() const noexcept override { + return MyName; + } + + inline size_t DoCompress(const TData& in, void* buf) const { + if (Level) { + return fastlz_compress_level(Level, in.data(), in.size(), buf); + } + + return fastlz_compress(in.data(), in.size(), buf); + } + + inline void DoDecompress(const TData& in, void* out, size_t len) const { + const int ret = fastlz_decompress(in.data(), in.size(), out, len); + + if (ret < 0 || (size_t)ret != len) { ythrow TDataError() << TStringBuf("can not decompress"); - } - } - - const TString MyName; - const int Level; - }; - - struct TFastLZRegistrar { - TFastLZRegistrar() { - for (int i = 0; i < 3; ++i) { + } + } + + const TString MyName; + const int Level; + }; + + struct TFastLZRegistrar { + TFastLZRegistrar() { + for (int i = 0; i < 3; ++i) { RegisterCodec(MakeHolder<TFastLZCodec>(i)); - } - RegisterAlias("fastlz", "fastlz-0"); - } - }; + } + RegisterAlias("fastlz", "fastlz-0"); + } + }; const TFastLZRegistrar Registrar{}; -} +} diff --git a/library/cpp/blockcodecs/codecs/fastlz/ya.make b/library/cpp/blockcodecs/codecs/fastlz/ya.make index 59c09b329b..87bbb298cf 100644 --- a/library/cpp/blockcodecs/codecs/fastlz/ya.make +++ b/library/cpp/blockcodecs/codecs/fastlz/ya.make @@ -1,14 +1,14 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( - contrib/libs/fastlz +LIBRARY() + +OWNER(pg) + +PEERDIR( + contrib/libs/fastlz library/cpp/blockcodecs/core -) - -SRCS( - GLOBAL fastlz.cpp -) - -END() +) + +SRCS( + GLOBAL fastlz.cpp +) + +END() diff --git a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp index 042f031679..58c4808273 100644 --- a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp +++ b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp @@ -47,12 +47,12 @@ namespace { const TString MyName; }; - struct TZStd06Registrar { - TZStd06Registrar() { - for (unsigned i = 1; i <= ZSTD_maxCLevel(); ++i) { + struct TZStd06Registrar { + TZStd06Registrar() { + for (unsigned i = 1; i <= ZSTD_maxCLevel(); ++i) { RegisterCodec(MakeHolder<TZStd06Codec>(i)); - } + } } - }; + }; const TZStd06Registrar Registrar{}; } diff --git a/library/cpp/blockcodecs/codecs/legacy_zstd06/ya.make b/library/cpp/blockcodecs/codecs/legacy_zstd06/ya.make index 067f731233..f042befbbe 100644 --- a/library/cpp/blockcodecs/codecs/legacy_zstd06/ya.make +++ b/library/cpp/blockcodecs/codecs/legacy_zstd06/ya.make @@ -1,14 +1,14 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( - contrib/libs/zstd06 +LIBRARY() + +OWNER(pg) + +PEERDIR( + contrib/libs/zstd06 library/cpp/blockcodecs/core -) - -SRCS( - GLOBAL legacy_zstd06.cpp -) - -END() +) + +SRCS( + GLOBAL legacy_zstd06.cpp +) + +END() diff --git a/library/cpp/blockcodecs/codecs/lz4/lz4.cpp b/library/cpp/blockcodecs/codecs/lz4/lz4.cpp index fbf0fe110f..7ece0ad448 100644 --- a/library/cpp/blockcodecs/codecs/lz4/lz4.cpp +++ b/library/cpp/blockcodecs/codecs/lz4/lz4.cpp @@ -1,123 +1,123 @@ #include <library/cpp/blockcodecs/core/codecs.h> #include <library/cpp/blockcodecs/core/common.h> #include <library/cpp/blockcodecs/core/register.h> - -#include <contrib/libs/lz4/lz4.h> -#include <contrib/libs/lz4/lz4hc.h> -#include <contrib/libs/lz4/generated/iface.h> - -using namespace NBlockCodecs; - -namespace { - struct TLz4Base { - static inline size_t DoMaxCompressedLength(size_t in) { - return LZ4_compressBound(SafeIntegerCast<int>(in)); - } - }; - - struct TLz4FastCompress { - inline TLz4FastCompress(int memory) - : Memory(memory) - , Methods(LZ4Methods(Memory)) - { - } - - inline size_t DoCompress(const TData& in, void* buf) const { - return Methods->LZ4CompressLimited(in.data(), (char*)buf, in.size(), LZ4_compressBound(in.size())); - } - - inline TString CPrefix() { - return "fast" + ToString(Memory); - } - - const int Memory; - const TLZ4Methods* Methods; - }; - - struct TLz4BestCompress { - inline size_t DoCompress(const TData& in, void* buf) const { - return LZ4_compress_HC(in.data(), (char*)buf, in.size(), LZ4_compressBound(in.size()), 0); - } - - static inline TString CPrefix() { - return "hc"; - } - }; - - struct TLz4FastDecompress { - inline void DoDecompress(const TData& in, void* out, size_t len) const { - ssize_t res = LZ4_decompress_fast(in.data(), (char*)out, len); - if (res < 0) { - ythrow TDecompressError(res); - } - } - - static inline TStringBuf DPrefix() { + +#include <contrib/libs/lz4/lz4.h> +#include <contrib/libs/lz4/lz4hc.h> +#include <contrib/libs/lz4/generated/iface.h> + +using namespace NBlockCodecs; + +namespace { + struct TLz4Base { + static inline size_t DoMaxCompressedLength(size_t in) { + return LZ4_compressBound(SafeIntegerCast<int>(in)); + } + }; + + struct TLz4FastCompress { + inline TLz4FastCompress(int memory) + : Memory(memory) + , Methods(LZ4Methods(Memory)) + { + } + + inline size_t DoCompress(const TData& in, void* buf) const { + return Methods->LZ4CompressLimited(in.data(), (char*)buf, in.size(), LZ4_compressBound(in.size())); + } + + inline TString CPrefix() { + return "fast" + ToString(Memory); + } + + const int Memory; + const TLZ4Methods* Methods; + }; + + struct TLz4BestCompress { + inline size_t DoCompress(const TData& in, void* buf) const { + return LZ4_compress_HC(in.data(), (char*)buf, in.size(), LZ4_compressBound(in.size()), 0); + } + + static inline TString CPrefix() { + return "hc"; + } + }; + + struct TLz4FastDecompress { + inline void DoDecompress(const TData& in, void* out, size_t len) const { + ssize_t res = LZ4_decompress_fast(in.data(), (char*)out, len); + if (res < 0) { + ythrow TDecompressError(res); + } + } + + static inline TStringBuf DPrefix() { return TStringBuf("fast"); - } - }; - - struct TLz4SafeDecompress { - inline void DoDecompress(const TData& in, void* out, size_t len) const { - ssize_t res = LZ4_decompress_safe(in.data(), (char*)out, in.size(), len); - if (res < 0) { - ythrow TDecompressError(res); - } - } - - static inline TStringBuf DPrefix() { + } + }; + + struct TLz4SafeDecompress { + inline void DoDecompress(const TData& in, void* out, size_t len) const { + ssize_t res = LZ4_decompress_safe(in.data(), (char*)out, in.size(), len); + if (res < 0) { + ythrow TDecompressError(res); + } + } + + static inline TStringBuf DPrefix() { return TStringBuf("safe"); - } - }; - - template <class TC, class TD> - struct TLz4Codec: public TAddLengthCodec<TLz4Codec<TC, TD>>, public TLz4Base, public TC, public TD { - inline TLz4Codec() - : MyName("lz4-" + TC::CPrefix() + "-" + TD::DPrefix()) - { - } - - template <class T> - inline TLz4Codec(const T& t) - : TC(t) - , MyName("lz4-" + TC::CPrefix() + "-" + TD::DPrefix()) - { - } - - TStringBuf Name() const noexcept override { - return MyName; - } - - const TString MyName; - }; - - struct TLz4Registrar { - TLz4Registrar() { - for (int i = 0; i < 30; ++i) { - typedef TLz4Codec<TLz4FastCompress, TLz4FastDecompress> T1; - typedef TLz4Codec<TLz4FastCompress, TLz4SafeDecompress> T2; - - THolder<T1> t1(new T1(i)); - THolder<T2> t2(new T2(i)); - - if (t1->Methods) { + } + }; + + template <class TC, class TD> + struct TLz4Codec: public TAddLengthCodec<TLz4Codec<TC, TD>>, public TLz4Base, public TC, public TD { + inline TLz4Codec() + : MyName("lz4-" + TC::CPrefix() + "-" + TD::DPrefix()) + { + } + + template <class T> + inline TLz4Codec(const T& t) + : TC(t) + , MyName("lz4-" + TC::CPrefix() + "-" + TD::DPrefix()) + { + } + + TStringBuf Name() const noexcept override { + return MyName; + } + + const TString MyName; + }; + + struct TLz4Registrar { + TLz4Registrar() { + for (int i = 0; i < 30; ++i) { + typedef TLz4Codec<TLz4FastCompress, TLz4FastDecompress> T1; + typedef TLz4Codec<TLz4FastCompress, TLz4SafeDecompress> T2; + + THolder<T1> t1(new T1(i)); + THolder<T2> t2(new T2(i)); + + if (t1->Methods) { RegisterCodec(std::move(t1)); - } - - if (t2->Methods) { + } + + if (t2->Methods) { RegisterCodec(std::move(t2)); - } - } - + } + } + RegisterCodec(MakeHolder<TLz4Codec<TLz4BestCompress, TLz4FastDecompress>>()); RegisterCodec(MakeHolder<TLz4Codec<TLz4BestCompress, TLz4SafeDecompress>>()); - - RegisterAlias("lz4-fast-safe", "lz4-fast14-safe"); - RegisterAlias("lz4-fast-fast", "lz4-fast14-fast"); - RegisterAlias("lz4", "lz4-fast-safe"); - RegisterAlias("lz4fast", "lz4-fast-fast"); - RegisterAlias("lz4hc", "lz4-hc-safe"); - } - }; + + RegisterAlias("lz4-fast-safe", "lz4-fast14-safe"); + RegisterAlias("lz4-fast-fast", "lz4-fast14-fast"); + RegisterAlias("lz4", "lz4-fast-safe"); + RegisterAlias("lz4fast", "lz4-fast-fast"); + RegisterAlias("lz4hc", "lz4-hc-safe"); + } + }; const TLz4Registrar Registrar{}; -} +} diff --git a/library/cpp/blockcodecs/codecs/lz4/ya.make b/library/cpp/blockcodecs/codecs/lz4/ya.make index f2471d7d96..112ef8ee80 100644 --- a/library/cpp/blockcodecs/codecs/lz4/ya.make +++ b/library/cpp/blockcodecs/codecs/lz4/ya.make @@ -1,15 +1,15 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( - contrib/libs/lz4 - contrib/libs/lz4/generated +LIBRARY() + +OWNER(pg) + +PEERDIR( + contrib/libs/lz4 + contrib/libs/lz4/generated library/cpp/blockcodecs/core -) - -SRCS( - GLOBAL lz4.cpp -) - -END() +) + +SRCS( + GLOBAL lz4.cpp +) + +END() diff --git a/library/cpp/blockcodecs/codecs/lzma/lzma.cpp b/library/cpp/blockcodecs/codecs/lzma/lzma.cpp index 6c8d5fded4..eb52842aee 100644 --- a/library/cpp/blockcodecs/codecs/lzma/lzma.cpp +++ b/library/cpp/blockcodecs/codecs/lzma/lzma.cpp @@ -1,74 +1,74 @@ #include <library/cpp/blockcodecs/core/codecs.h> #include <library/cpp/blockcodecs/core/common.h> #include <library/cpp/blockcodecs/core/register.h> - -#include <contrib/libs/lzmasdk/LzmaLib.h> - -using namespace NBlockCodecs; - -namespace { - struct TLzmaCodec: public TAddLengthCodec<TLzmaCodec> { - inline TLzmaCodec(int level) - : Level(level) - , MyName("lzma-" + ToString(Level)) - { - } - - static inline size_t DoMaxCompressedLength(size_t in) noexcept { - return Max<size_t>(in + in / 20, 128) + LZMA_PROPS_SIZE; - } - - TStringBuf Name() const noexcept override { - return MyName; - } - - inline size_t DoCompress(const TData& in, void* buf) const { - unsigned char* props = (unsigned char*)buf; - unsigned char* data = props + LZMA_PROPS_SIZE; - size_t destLen = Max<size_t>(); - size_t outPropsSize = LZMA_PROPS_SIZE; - - const int ret = LzmaCompress(data, &destLen, (const unsigned char*)in.data(), in.size(), props, &outPropsSize, Level, 0, -1, -1, -1, -1, -1); - - if (ret != SZ_OK) { - ythrow TCompressError(ret); - } - - return destLen + LZMA_PROPS_SIZE; - } - - inline void DoDecompress(const TData& in, void* out, size_t len) const { - if (in.size() <= LZMA_PROPS_SIZE) { + +#include <contrib/libs/lzmasdk/LzmaLib.h> + +using namespace NBlockCodecs; + +namespace { + struct TLzmaCodec: public TAddLengthCodec<TLzmaCodec> { + inline TLzmaCodec(int level) + : Level(level) + , MyName("lzma-" + ToString(Level)) + { + } + + static inline size_t DoMaxCompressedLength(size_t in) noexcept { + return Max<size_t>(in + in / 20, 128) + LZMA_PROPS_SIZE; + } + + TStringBuf Name() const noexcept override { + return MyName; + } + + inline size_t DoCompress(const TData& in, void* buf) const { + unsigned char* props = (unsigned char*)buf; + unsigned char* data = props + LZMA_PROPS_SIZE; + size_t destLen = Max<size_t>(); + size_t outPropsSize = LZMA_PROPS_SIZE; + + const int ret = LzmaCompress(data, &destLen, (const unsigned char*)in.data(), in.size(), props, &outPropsSize, Level, 0, -1, -1, -1, -1, -1); + + if (ret != SZ_OK) { + ythrow TCompressError(ret); + } + + return destLen + LZMA_PROPS_SIZE; + } + + inline void DoDecompress(const TData& in, void* out, size_t len) const { + if (in.size() <= LZMA_PROPS_SIZE) { ythrow TDataError() << TStringBuf("broken lzma stream"); - } - - const unsigned char* props = (const unsigned char*)in.data(); - const unsigned char* data = props + LZMA_PROPS_SIZE; - size_t destLen = len; - SizeT srcLen = in.size() - LZMA_PROPS_SIZE; - - const int res = LzmaUncompress((unsigned char*)out, &destLen, data, &srcLen, props, LZMA_PROPS_SIZE); - - if (res != SZ_OK) { - ythrow TDecompressError(res); - } - - if (destLen != len) { - ythrow TDecompressError(len, destLen); - } - } - - const int Level; - const TString MyName; - }; - - struct TLzmaRegistrar { - TLzmaRegistrar() { - for (int i = 0; i < 10; ++i) { + } + + const unsigned char* props = (const unsigned char*)in.data(); + const unsigned char* data = props + LZMA_PROPS_SIZE; + size_t destLen = len; + SizeT srcLen = in.size() - LZMA_PROPS_SIZE; + + const int res = LzmaUncompress((unsigned char*)out, &destLen, data, &srcLen, props, LZMA_PROPS_SIZE); + + if (res != SZ_OK) { + ythrow TDecompressError(res); + } + + if (destLen != len) { + ythrow TDecompressError(len, destLen); + } + } + + const int Level; + const TString MyName; + }; + + struct TLzmaRegistrar { + TLzmaRegistrar() { + for (int i = 0; i < 10; ++i) { RegisterCodec(MakeHolder<TLzmaCodec>(i)); - } - RegisterAlias("lzma", "lzma-5"); - } - }; + } + RegisterAlias("lzma", "lzma-5"); + } + }; const TLzmaRegistrar Registrar{}; -} +} diff --git a/library/cpp/blockcodecs/codecs/lzma/ya.make b/library/cpp/blockcodecs/codecs/lzma/ya.make index e145834da6..11f38eca71 100644 --- a/library/cpp/blockcodecs/codecs/lzma/ya.make +++ b/library/cpp/blockcodecs/codecs/lzma/ya.make @@ -1,14 +1,14 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( - contrib/libs/lzmasdk +LIBRARY() + +OWNER(pg) + +PEERDIR( + contrib/libs/lzmasdk library/cpp/blockcodecs/core -) - -SRCS( - GLOBAL lzma.cpp -) - -END() +) + +SRCS( + GLOBAL lzma.cpp +) + +END() diff --git a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp index f6be05a05f..0cacc876de 100644 --- a/library/cpp/blockcodecs/codecs/snappy/snappy.cpp +++ b/library/cpp/blockcodecs/codecs/snappy/snappy.cpp @@ -1,52 +1,52 @@ #include <library/cpp/blockcodecs/core/codecs.h> #include <library/cpp/blockcodecs/core/common.h> #include <library/cpp/blockcodecs/core/register.h> - -#include <contrib/libs/snappy/snappy.h> - -using namespace NBlockCodecs; - -namespace { - struct TSnappyCodec: public ICodec { - size_t DecompressedLength(const TData& in) const override { - size_t ret; - - if (snappy::GetUncompressedLength(in.data(), in.size(), &ret)) { - return ret; - } - - ythrow TDecompressError(0); - } - - size_t MaxCompressedLength(const TData& in) const override { - return snappy::MaxCompressedLength(in.size()); - } - - size_t Compress(const TData& in, void* out) const override { - size_t ret; - - snappy::RawCompress(in.data(), in.size(), (char*)out, &ret); - - return ret; - } - - size_t Decompress(const TData& in, void* out) const override { - if (snappy::RawUncompress(in.data(), in.size(), (char*)out)) { - return DecompressedLength(in); - } - - ythrow TDecompressError(0); - } - - TStringBuf Name() const noexcept override { - return "snappy"; - } - }; - - struct TSnappyRegistrar { - TSnappyRegistrar() { + +#include <contrib/libs/snappy/snappy.h> + +using namespace NBlockCodecs; + +namespace { + struct TSnappyCodec: public ICodec { + size_t DecompressedLength(const TData& in) const override { + size_t ret; + + if (snappy::GetUncompressedLength(in.data(), in.size(), &ret)) { + return ret; + } + + ythrow TDecompressError(0); + } + + size_t MaxCompressedLength(const TData& in) const override { + return snappy::MaxCompressedLength(in.size()); + } + + size_t Compress(const TData& in, void* out) const override { + size_t ret; + + snappy::RawCompress(in.data(), in.size(), (char*)out, &ret); + + return ret; + } + + size_t Decompress(const TData& in, void* out) const override { + if (snappy::RawUncompress(in.data(), in.size(), (char*)out)) { + return DecompressedLength(in); + } + + ythrow TDecompressError(0); + } + + TStringBuf Name() const noexcept override { + return "snappy"; + } + }; + + struct TSnappyRegistrar { + TSnappyRegistrar() { RegisterCodec(MakeHolder<TSnappyCodec>()); - } - }; + } + }; const TSnappyRegistrar Registrar{}; -} +} diff --git a/library/cpp/blockcodecs/codecs/snappy/ya.make b/library/cpp/blockcodecs/codecs/snappy/ya.make index 0cf2be2f94..d939ef648e 100644 --- a/library/cpp/blockcodecs/codecs/snappy/ya.make +++ b/library/cpp/blockcodecs/codecs/snappy/ya.make @@ -1,14 +1,14 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( - contrib/libs/snappy +LIBRARY() + +OWNER(pg) + +PEERDIR( + contrib/libs/snappy library/cpp/blockcodecs/core -) - -SRCS( - GLOBAL snappy.cpp -) - -END() +) + +SRCS( + GLOBAL snappy.cpp +) + +END() diff --git a/library/cpp/blockcodecs/codecs/zlib/ya.make b/library/cpp/blockcodecs/codecs/zlib/ya.make index 9f04995f66..86944366fa 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 cdb556c36d..077751d21b 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{}; -} +} diff --git a/library/cpp/blockcodecs/codecs/zstd/ya.make b/library/cpp/blockcodecs/codecs/zstd/ya.make index c077dd47b7..67435b71b2 100644 --- a/library/cpp/blockcodecs/codecs/zstd/ya.make +++ b/library/cpp/blockcodecs/codecs/zstd/ya.make @@ -1,14 +1,14 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( - contrib/libs/zstd +LIBRARY() + +OWNER(pg) + +PEERDIR( + contrib/libs/zstd library/cpp/blockcodecs/core -) - -SRCS( - GLOBAL zstd.cpp -) - -END() +) + +SRCS( + GLOBAL zstd.cpp +) + +END() diff --git a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp index 95299b3f6d..158747c52c 100644 --- a/library/cpp/blockcodecs/codecs/zstd/zstd.cpp +++ b/library/cpp/blockcodecs/codecs/zstd/zstd.cpp @@ -1,59 +1,59 @@ #include <library/cpp/blockcodecs/core/codecs.h> #include <library/cpp/blockcodecs/core/common.h> #include <library/cpp/blockcodecs/core/register.h> - -#define ZSTD_STATIC_LINKING_ONLY + +#define ZSTD_STATIC_LINKING_ONLY #include <contrib/libs/zstd/include/zstd.h> - -using namespace NBlockCodecs; - -namespace { - struct TZStd08Codec: public TAddLengthCodec<TZStd08Codec> { - inline TZStd08Codec(unsigned level) - : Level(level) + +using namespace NBlockCodecs; + +namespace { + struct TZStd08Codec: public TAddLengthCodec<TZStd08Codec> { + inline TZStd08Codec(unsigned level) + : Level(level) , MyName(TStringBuf("zstd08_") + ToString(Level)) - { - } - - static inline size_t CheckError(size_t ret, const char* what) { - if (ZSTD_isError(ret)) { + { + } + + static inline size_t CheckError(size_t ret, const char* what) { + if (ZSTD_isError(ret)) { ythrow yexception() << what << TStringBuf(" zstd error: ") << ZSTD_getErrorName(ret); - } - - return ret; - } - - static inline size_t DoMaxCompressedLength(size_t l) noexcept { - return ZSTD_compressBound(l); - } - - inline size_t DoCompress(const TData& in, void* out) const { - return CheckError(ZSTD_compress(out, DoMaxCompressedLength(in.size()), in.data(), in.size(), Level), "compress"); - } - - inline void DoDecompress(const TData& in, void* out, size_t dsize) const { - const size_t res = CheckError(ZSTD_decompress(out, dsize, in.data(), in.size()), "decompress"); - - if (res != dsize) { - ythrow TDecompressError(dsize, res); - } - } - - TStringBuf Name() const noexcept override { - return MyName; - } - - const unsigned Level; - const TString MyName; - }; - - struct TZStd08Registrar { - TZStd08Registrar() { - for (int i = 1; i <= ZSTD_maxCLevel(); ++i) { + } + + return ret; + } + + static inline size_t DoMaxCompressedLength(size_t l) noexcept { + return ZSTD_compressBound(l); + } + + inline size_t DoCompress(const TData& in, void* out) const { + return CheckError(ZSTD_compress(out, DoMaxCompressedLength(in.size()), in.data(), in.size(), Level), "compress"); + } + + inline void DoDecompress(const TData& in, void* out, size_t dsize) const { + const size_t res = CheckError(ZSTD_decompress(out, dsize, in.data(), in.size()), "decompress"); + + if (res != dsize) { + ythrow TDecompressError(dsize, res); + } + } + + TStringBuf Name() const noexcept override { + return MyName; + } + + const unsigned Level; + const TString MyName; + }; + + struct TZStd08Registrar { + TZStd08Registrar() { + for (int i = 1; i <= ZSTD_maxCLevel(); ++i) { RegisterCodec(MakeHolder<TZStd08Codec>(i)); - RegisterAlias("zstd_" + ToString(i), "zstd08_" + ToString(i)); - } - } - }; + RegisterAlias("zstd_" + ToString(i), "zstd08_" + ToString(i)); + } + } + }; const TZStd08Registrar Registrar{}; -} +} diff --git a/library/cpp/blockcodecs/codecs_ut.cpp b/library/cpp/blockcodecs/codecs_ut.cpp index bfe5a23690..10559e4c3f 100644 --- a/library/cpp/blockcodecs/codecs_ut.cpp +++ b/library/cpp/blockcodecs/codecs_ut.cpp @@ -4,7 +4,7 @@ #include <library/cpp/testing/unittest/registar.h> #include <util/stream/str.h> -#include <util/string/join.h> +#include <util/string/join.h> #include <util/digest/multi.h> Y_UNIT_TEST_SUITE(TBlockCodecsTest) { @@ -290,40 +290,40 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { // restore status quo SetMaxPossibleDecompressedLength(Max<size_t>()); } - - Y_UNIT_TEST(TestListAllCodecs) { - static const TString ALL_CODECS = - "brotli_1,brotli_10,brotli_11,brotli_2,brotli_3,brotli_4,brotli_5,brotli_6,brotli_7,brotli_8,brotli_9," - - "bzip2,bzip2-1,bzip2-2,bzip2-3,bzip2-4,bzip2-5,bzip2-6,bzip2-7,bzip2-8,bzip2-9," - - "fastlz,fastlz-0,fastlz-1,fastlz-2," - - "lz4,lz4-fast-fast,lz4-fast-safe,lz4-fast10-fast,lz4-fast10-safe,lz4-fast11-fast,lz4-fast11-safe," - "lz4-fast12-fast,lz4-fast12-safe,lz4-fast13-fast,lz4-fast13-safe,lz4-fast14-fast,lz4-fast14-safe," - "lz4-fast15-fast,lz4-fast15-safe,lz4-fast16-fast,lz4-fast16-safe,lz4-fast17-fast,lz4-fast17-safe," - "lz4-fast18-fast,lz4-fast18-safe,lz4-fast19-fast,lz4-fast19-safe,lz4-fast20-fast,lz4-fast20-safe," - "lz4-hc-fast,lz4-hc-safe,lz4fast,lz4hc," - - "lzma,lzma-0,lzma-1,lzma-2,lzma-3,lzma-4,lzma-5,lzma-6,lzma-7,lzma-8,lzma-9," - - "null," - - "snappy," - - "zlib,zlib-0,zlib-1,zlib-2,zlib-3,zlib-4,zlib-5,zlib-6,zlib-7,zlib-8,zlib-9," - - "zstd06_1,zstd06_10,zstd06_11,zstd06_12,zstd06_13,zstd06_14,zstd06_15,zstd06_16,zstd06_17,zstd06_18," - "zstd06_19,zstd06_2,zstd06_20,zstd06_21,zstd06_22,zstd06_3,zstd06_4,zstd06_5,zstd06_6,zstd06_7,zstd06_8," - "zstd06_9," - - "zstd08_1,zstd08_10,zstd08_11,zstd08_12,zstd08_13,zstd08_14,zstd08_15,zstd08_16,zstd08_17,zstd08_18," - "zstd08_19,zstd08_2,zstd08_20,zstd08_21,zstd08_22,zstd08_3,zstd08_4,zstd08_5,zstd08_6,zstd08_7,zstd08_8," - "zstd08_9,zstd_1,zstd_10,zstd_11,zstd_12,zstd_13,zstd_14,zstd_15,zstd_16,zstd_17,zstd_18,zstd_19,zstd_2," - "zstd_20,zstd_21,zstd_22,zstd_3,zstd_4,zstd_5,zstd_6,zstd_7,zstd_8,zstd_9"; - - UNIT_ASSERT_VALUES_EQUAL(ALL_CODECS, JoinSeq(",", ListAllCodecs())); - } + + Y_UNIT_TEST(TestListAllCodecs) { + static const TString ALL_CODECS = + "brotli_1,brotli_10,brotli_11,brotli_2,brotli_3,brotli_4,brotli_5,brotli_6,brotli_7,brotli_8,brotli_9," + + "bzip2,bzip2-1,bzip2-2,bzip2-3,bzip2-4,bzip2-5,bzip2-6,bzip2-7,bzip2-8,bzip2-9," + + "fastlz,fastlz-0,fastlz-1,fastlz-2," + + "lz4,lz4-fast-fast,lz4-fast-safe,lz4-fast10-fast,lz4-fast10-safe,lz4-fast11-fast,lz4-fast11-safe," + "lz4-fast12-fast,lz4-fast12-safe,lz4-fast13-fast,lz4-fast13-safe,lz4-fast14-fast,lz4-fast14-safe," + "lz4-fast15-fast,lz4-fast15-safe,lz4-fast16-fast,lz4-fast16-safe,lz4-fast17-fast,lz4-fast17-safe," + "lz4-fast18-fast,lz4-fast18-safe,lz4-fast19-fast,lz4-fast19-safe,lz4-fast20-fast,lz4-fast20-safe," + "lz4-hc-fast,lz4-hc-safe,lz4fast,lz4hc," + + "lzma,lzma-0,lzma-1,lzma-2,lzma-3,lzma-4,lzma-5,lzma-6,lzma-7,lzma-8,lzma-9," + + "null," + + "snappy," + + "zlib,zlib-0,zlib-1,zlib-2,zlib-3,zlib-4,zlib-5,zlib-6,zlib-7,zlib-8,zlib-9," + + "zstd06_1,zstd06_10,zstd06_11,zstd06_12,zstd06_13,zstd06_14,zstd06_15,zstd06_16,zstd06_17,zstd06_18," + "zstd06_19,zstd06_2,zstd06_20,zstd06_21,zstd06_22,zstd06_3,zstd06_4,zstd06_5,zstd06_6,zstd06_7,zstd06_8," + "zstd06_9," + + "zstd08_1,zstd08_10,zstd08_11,zstd08_12,zstd08_13,zstd08_14,zstd08_15,zstd08_16,zstd08_17,zstd08_18," + "zstd08_19,zstd08_2,zstd08_20,zstd08_21,zstd08_22,zstd08_3,zstd08_4,zstd08_5,zstd08_6,zstd08_7,zstd08_8," + "zstd08_9,zstd_1,zstd_10,zstd_11,zstd_12,zstd_13,zstd_14,zstd_15,zstd_16,zstd_17,zstd_18,zstd_19,zstd_2," + "zstd_20,zstd_21,zstd_22,zstd_3,zstd_4,zstd_5,zstd_6,zstd_7,zstd_8,zstd_9"; + + UNIT_ASSERT_VALUES_EQUAL(ALL_CODECS, JoinSeq(",", ListAllCodecs())); + } Y_UNIT_TEST(TestEncodeDecodeIntoString) { TStringBuf data = "na gorshke sidel korol"; diff --git a/library/cpp/blockcodecs/core/codecs.cpp b/library/cpp/blockcodecs/core/codecs.cpp index 21506e812b..d9eed9ca8f 100644 --- a/library/cpp/blockcodecs/core/codecs.cpp +++ b/library/cpp/blockcodecs/core/codecs.cpp @@ -1,6 +1,6 @@ #include "codecs.h" #include "common.h" -#include "register.h" +#include "register.h" #include <util/ysaveload.h> #include <util/stream/null.h> @@ -49,11 +49,11 @@ namespace { Registry[codec->Name()] = codec; } - inline void Add(TCodecPtr codec) { - Codecs.push_back(std::move(codec)); - Add(Codecs.back().Get()); - } - + inline void Add(TCodecPtr codec) { + Codecs.push_back(std::move(codec)); + Add(Codecs.back().Get()); + } + inline void Alias(TStringBuf from, TStringBuf to) { Tmp.emplace_back(from); Registry[Tmp.back()] = Registry[to]; @@ -86,14 +86,14 @@ TString NBlockCodecs::ListAllCodecsAsString() { return JoinSeq(TStringBuf(","), ListAllCodecs()); } -void NBlockCodecs::RegisterCodec(TCodecPtr codec) { - Singleton<TCodecFactory>()->Add(std::move(codec)); -} - -void NBlockCodecs::RegisterAlias(TStringBuf from, TStringBuf to) { - Singleton<TCodecFactory>()->Alias(from, to); -} - +void NBlockCodecs::RegisterCodec(TCodecPtr codec) { + Singleton<TCodecFactory>()->Add(std::move(codec)); +} + +void NBlockCodecs::RegisterAlias(TStringBuf from, TStringBuf to) { + Singleton<TCodecFactory>()->Alias(from, to); +} + void NBlockCodecs::SetMaxPossibleDecompressedLength(size_t maxPossibleDecompressedLength) { Singleton<TCodecFactory>()->MaxPossibleDecompressedLength = maxPossibleDecompressedLength; } diff --git a/library/cpp/blockcodecs/core/codecs.h b/library/cpp/blockcodecs/core/codecs.h index 9c93c00274..2662759b9a 100644 --- a/library/cpp/blockcodecs/core/codecs.h +++ b/library/cpp/blockcodecs/core/codecs.h @@ -73,8 +73,8 @@ namespace NBlockCodecs { size_t GetDecompressedLength(const TData& in) const; }; - using TCodecPtr = THolder<ICodec>; - + using TCodecPtr = THolder<ICodec>; + const ICodec* Codec(const TStringBuf& name); // some aux methods diff --git a/library/cpp/blockcodecs/core/register.h b/library/cpp/blockcodecs/core/register.h index fa1186dd70..632a41e4a8 100644 --- a/library/cpp/blockcodecs/core/register.h +++ b/library/cpp/blockcodecs/core/register.h @@ -1,10 +1,10 @@ -#pragma once - -#include "codecs.h" - -namespace NBlockCodecs{ - - void RegisterCodec(TCodecPtr codec); - void RegisterAlias(TStringBuf from, TStringBuf to); - -} +#pragma once + +#include "codecs.h" + +namespace NBlockCodecs{ + + void RegisterCodec(TCodecPtr codec); + void RegisterAlias(TStringBuf from, TStringBuf to); + +} diff --git a/library/cpp/blockcodecs/stream.cpp b/library/cpp/blockcodecs/stream.cpp index 65e61e9221..4ad6b2cb3f 100644 --- a/library/cpp/blockcodecs/stream.cpp +++ b/library/cpp/blockcodecs/stream.cpp @@ -1 +1 @@ -#include "stream.h" +#include "stream.h" diff --git a/library/cpp/blockcodecs/stream.h b/library/cpp/blockcodecs/stream.h index 96c479cf7e..45aea32525 100644 --- a/library/cpp/blockcodecs/stream.h +++ b/library/cpp/blockcodecs/stream.h @@ -1,3 +1,3 @@ -#pragma once - +#pragma once + #include <library/cpp/blockcodecs/core/stream.h> diff --git a/library/cpp/blockcodecs/ya.make b/library/cpp/blockcodecs/ya.make index b8f03d5421..32c6d35c51 100644 --- a/library/cpp/blockcodecs/ya.make +++ b/library/cpp/blockcodecs/ya.make @@ -1,8 +1,8 @@ -LIBRARY() - -OWNER(pg) - -PEERDIR( +LIBRARY() + +OWNER(pg) + +PEERDIR( library/cpp/blockcodecs/core library/cpp/blockcodecs/codecs/brotli library/cpp/blockcodecs/codecs/bzip @@ -13,14 +13,14 @@ PEERDIR( library/cpp/blockcodecs/codecs/snappy library/cpp/blockcodecs/codecs/zlib library/cpp/blockcodecs/codecs/zstd -) - -SRCS( - codecs.cpp - stream.cpp -) - -END() +) + +SRCS( + codecs.cpp + stream.cpp +) + +END() RECURSE_FOR_TESTS( ut diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.cpp b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.cpp index 8883d7df07..98402ac53a 100644 --- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.cpp +++ b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.cpp @@ -1 +1 @@ -#include "levenshtein_diff.h" +#include "levenshtein_diff.h" diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h index 8a240bfed8..40d33ee048 100644 --- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h +++ b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff.h @@ -8,7 +8,7 @@ #include <type_traits> #include <utility> -namespace NLevenshtein { +namespace NLevenshtein { enum EEditMoveType { EMT_SPECIAL, EMT_PRESERVE, @@ -140,7 +140,7 @@ namespace NLevenshtein { } template <class TStringType> - size_t Distance(const TStringType& str1, const TStringType& str2) { + size_t Distance(const TStringType& str1, const TStringType& str2) { TEditChain editChain; GetEditChain(str1, str2, editChain); size_t result = 0; @@ -169,7 +169,7 @@ namespace NLevenshtein { { } }; - + template <class TStringType> void GetStringReplacements(const TStringType& str1, const TStringType& str2, TVector<TReplacement>& res) { TEditChain editChain; diff --git a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp index cf0f78637f..36ec9253cb 100644 --- a/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp +++ b/library/cpp/string_utils/levenshtein_diff/levenshtein_diff_ut.cpp @@ -1,4 +1,4 @@ -#include "levenshtein_diff.h" +#include "levenshtein_diff.h" #include <library/cpp/testing/unittest/registar.h> @@ -33,17 +33,17 @@ Y_UNIT_TEST_SUITE(Levenstein) { Y_UNIT_TEST_SUITE(WeightedLevenstein) { Y_UNIT_TEST(EqualStrings) { - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString("12345"), TString("12345"), chain, &distance, binaryMaxWeigher, unaryMaxWeigher, unaryMaxWeigher); + NLevenshtein::GetEditChain(TString("12345"), TString("12345"), chain, &distance, binaryMaxWeigher, unaryMaxWeigher, unaryMaxWeigher); UNIT_ASSERT_VALUES_EQUAL(distance, 0.0f); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 5); } Y_UNIT_TEST(EmptyStrings) { - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString(""), TString(""), chain, &distance, binaryMaxWeigher, unaryMaxWeigher, unaryMaxWeigher); + NLevenshtein::GetEditChain(TString(""), TString(""), chain, &distance, binaryMaxWeigher, unaryMaxWeigher, unaryMaxWeigher); UNIT_ASSERT_VALUES_EQUAL(distance, 0.0f); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 0); } @@ -52,9 +52,9 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { auto unaryWeigher = [](const char&) { return 2.0f; }; - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString(""), TString("12345"), chain, &distance, binaryZeroWeigher, unaryZeroWeigher, unaryWeigher); + NLevenshtein::GetEditChain(TString(""), TString("12345"), chain, &distance, binaryZeroWeigher, unaryZeroWeigher, unaryWeigher); UNIT_ASSERT_VALUES_EQUAL(distance, 10.0f); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 5); } @@ -63,9 +63,9 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { auto unaryWeigher = [](const char&) { return 3.0f; }; - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString("54321"), TString(""), chain, &distance, binaryZeroWeigher, unaryWeigher, unaryZeroWeigher); + NLevenshtein::GetEditChain(TString("54321"), TString(""), chain, &distance, binaryZeroWeigher, unaryWeigher, unaryZeroWeigher); UNIT_ASSERT_VALUES_EQUAL(distance, 15.0f); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 5); } @@ -76,20 +76,20 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { const float trgDistance = 2.0f; const size_t trgChainLen = 5; - NLevenshtein::TEditChain chainLeftRight; + NLevenshtein::TEditChain chainLeftRight; float distanceLeftRight = 0.0f; - NLevenshtein::GetEditChain(str1, str2, chainLeftRight, &distanceLeftRight, binaryMaxWeigher, unaryMaxWeigher, unaryMaxWeigher); + NLevenshtein::GetEditChain(str1, str2, chainLeftRight, &distanceLeftRight, binaryMaxWeigher, unaryMaxWeigher, unaryMaxWeigher); UNIT_ASSERT_VALUES_EQUAL(distanceLeftRight, trgDistance); UNIT_ASSERT_VALUES_EQUAL(chainLeftRight.size(), trgChainLen); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[0]), static_cast<int>(NLevenshtein::EMT_REPLACE)); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[1]), static_cast<int>(NLevenshtein::EMT_PRESERVE)); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[2]), static_cast<int>(NLevenshtein::EMT_PRESERVE)); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[3]), static_cast<int>(NLevenshtein::EMT_REPLACE)); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[4]), static_cast<int>(NLevenshtein::EMT_PRESERVE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[0]), static_cast<int>(NLevenshtein::EMT_REPLACE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[1]), static_cast<int>(NLevenshtein::EMT_PRESERVE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[2]), static_cast<int>(NLevenshtein::EMT_PRESERVE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[3]), static_cast<int>(NLevenshtein::EMT_REPLACE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chainLeftRight[4]), static_cast<int>(NLevenshtein::EMT_PRESERVE)); - NLevenshtein::TEditChain chainRightLeft; + NLevenshtein::TEditChain chainRightLeft; float distanceRightLeft = 0.0f; - NLevenshtein::GetEditChain(str2, str1, chainRightLeft, &distanceRightLeft, binaryMaxWeigher, unaryMaxWeigher, unaryMaxWeigher); + NLevenshtein::GetEditChain(str2, str1, chainRightLeft, &distanceRightLeft, binaryMaxWeigher, unaryMaxWeigher, unaryMaxWeigher); UNIT_ASSERT_VALUES_EQUAL(distanceRightLeft, trgDistance); UNIT_ASSERT_VALUES_EQUAL(chainRightLeft.size(), trgChainLen); UNIT_ASSERT(chainRightLeft == chainLeftRight); @@ -99,9 +99,9 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { auto binaryWeigher = [](const char&, const char&) { return 0.0625f; }; - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString("54321"), TString("43210"), chain, &distance, binaryWeigher, unaryMaxWeigher, unaryMaxWeigher); + NLevenshtein::GetEditChain(TString("54321"), TString("43210"), chain, &distance, binaryWeigher, unaryMaxWeigher, unaryMaxWeigher); UNIT_ASSERT_VALUES_EQUAL(distance, 0.3125f); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 5); } @@ -110,9 +110,9 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { auto unaryWeigher = [](const char&) { return 0.0625f; }; - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString("54321"), TString("98765"), chain, &distance, binaryMaxWeigher, unaryWeigher, unaryWeigher); + NLevenshtein::GetEditChain(TString("54321"), TString("98765"), chain, &distance, binaryMaxWeigher, unaryWeigher, unaryWeigher); UNIT_ASSERT_VALUES_EQUAL(distance, 0.5f); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 9); } @@ -121,12 +121,12 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { auto unaryWeigher = [](const char& c) { return c == 'x' ? 100.0f : 1.0f; }; - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString("543x1"), TString("5431"), chain, &distance, binaryMaxWeigher, unaryWeigher, unaryMaxWeigher); + NLevenshtein::GetEditChain(TString("543x1"), TString("5431"), chain, &distance, binaryMaxWeigher, unaryWeigher, unaryMaxWeigher); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 5); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[3]), static_cast<int>(NLevenshtein::EMT_REPLACE)); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[4]), static_cast<int>(NLevenshtein::EMT_DELETE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[3]), static_cast<int>(NLevenshtein::EMT_REPLACE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[4]), static_cast<int>(NLevenshtein::EMT_DELETE)); UNIT_ASSERT_VALUES_EQUAL(distance, 2.0f); } @@ -134,12 +134,12 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { auto unaryWeigher = [](const char& c) { return c == 'x' ? 100.0f : 1.0f; }; - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString("5431"), TString("543x1"), chain, &distance, binaryMaxWeigher, unaryMaxWeigher, unaryWeigher); + NLevenshtein::GetEditChain(TString("5431"), TString("543x1"), chain, &distance, binaryMaxWeigher, unaryMaxWeigher, unaryWeigher); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 5); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[3]), static_cast<int>(NLevenshtein::EMT_REPLACE)); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[4]), static_cast<int>(NLevenshtein::EMT_INSERT)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[3]), static_cast<int>(NLevenshtein::EMT_REPLACE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[4]), static_cast<int>(NLevenshtein::EMT_INSERT)); UNIT_ASSERT_VALUES_EQUAL(distance, 2.0f); } @@ -147,12 +147,12 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { auto binaryWeigher = [](const char& l, const char&) { return l == 'x' ? 100.0f : 1.0f; }; - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString("5432x"), TString("5432y"), chain, &distance, binaryWeigher, unaryMaxWeigher, unaryMaxWeigher); + NLevenshtein::GetEditChain(TString("5432x"), TString("5432y"), chain, &distance, binaryWeigher, unaryMaxWeigher, unaryMaxWeigher); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 6); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[4]), static_cast<int>(NLevenshtein::EMT_DELETE)); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[5]), static_cast<int>(NLevenshtein::EMT_INSERT)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[4]), static_cast<int>(NLevenshtein::EMT_DELETE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[5]), static_cast<int>(NLevenshtein::EMT_INSERT)); UNIT_ASSERT_VALUES_EQUAL(distance, 2.0f); } @@ -160,12 +160,12 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { auto binaryWeigher = [](const char&, const char& r) { return r == 'x' ? 100.0f : 1.0f; }; - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString("y4321"), TString("x4321"), chain, &distance, binaryWeigher, unaryMaxWeigher, unaryMaxWeigher); + NLevenshtein::GetEditChain(TString("y4321"), TString("x4321"), chain, &distance, binaryWeigher, unaryMaxWeigher, unaryMaxWeigher); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 6); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[0]), static_cast<int>(NLevenshtein::EMT_DELETE)); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[1]), static_cast<int>(NLevenshtein::EMT_INSERT)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[0]), static_cast<int>(NLevenshtein::EMT_DELETE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[1]), static_cast<int>(NLevenshtein::EMT_INSERT)); UNIT_ASSERT_VALUES_EQUAL(distance, 2.0f); } @@ -179,12 +179,12 @@ Y_UNIT_TEST_SUITE(WeightedLevenstein) { auto insertWeigher = [](const char&) { return 0.9f; }; - NLevenshtein::TEditChain chain; + NLevenshtein::TEditChain chain; float distance = 0.0f; - NLevenshtein::GetEditChain(TString("y0"), TString("0x"), chain, &distance, replaceWeigher, deleteWeigher, insertWeigher); + NLevenshtein::GetEditChain(TString("y0"), TString("0x"), chain, &distance, replaceWeigher, deleteWeigher, insertWeigher); UNIT_ASSERT_VALUES_EQUAL(chain.size(), 2); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[0]), static_cast<int>(NLevenshtein::EMT_REPLACE)); - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[1]), static_cast<int>(NLevenshtein::EMT_REPLACE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[0]), static_cast<int>(NLevenshtein::EMT_REPLACE)); + UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(chain[1]), static_cast<int>(NLevenshtein::EMT_REPLACE)); UNIT_ASSERT_VALUES_EQUAL(distance, 1.0f); } } diff --git a/library/cpp/string_utils/levenshtein_diff/ut/ya.make b/library/cpp/string_utils/levenshtein_diff/ut/ya.make index a3b9b8fea5..316ddabc89 100644 --- a/library/cpp/string_utils/levenshtein_diff/ut/ya.make +++ b/library/cpp/string_utils/levenshtein_diff/ut/ya.make @@ -1,9 +1,9 @@ -UNITTEST_FOR(library/cpp/string_utils/levenshtein_diff) +UNITTEST_FOR(library/cpp/string_utils/levenshtein_diff) OWNER(myltsev) SRCS( - levenshtein_diff_ut.cpp + levenshtein_diff_ut.cpp ) END() diff --git a/library/cpp/string_utils/levenshtein_diff/ya.make b/library/cpp/string_utils/levenshtein_diff/ya.make index bafefe5365..531fd976b7 100644 --- a/library/cpp/string_utils/levenshtein_diff/ya.make +++ b/library/cpp/string_utils/levenshtein_diff/ya.make @@ -3,7 +3,7 @@ LIBRARY() OWNER(g:mt) SRCS( - levenshtein_diff.cpp + levenshtein_diff.cpp ) PEERDIR( diff --git a/library/cpp/string_utils/ya.make b/library/cpp/string_utils/ya.make index cd731bda95..024bd766d3 100644 --- a/library/cpp/string_utils/ya.make +++ b/library/cpp/string_utils/ya.make @@ -12,8 +12,8 @@ RECURSE( col_diff col_diff/ut indent_text - levenshtein_diff - levenshtein_diff/ut + levenshtein_diff + levenshtein_diff/ut old_url_normalize old_url_normalize/ut parse_size diff --git a/library/cpp/yson_pull/detail/lexer_base.h b/library/cpp/yson_pull/detail/lexer_base.h index 572bdb3d18..8cf4d45f2a 100644 --- a/library/cpp/yson_pull/detail/lexer_base.h +++ b/library/cpp/yson_pull/detail/lexer_base.h @@ -55,7 +55,7 @@ namespace NYsonPull { token_buffer_.clear(); auto type = number_type::int64; while (true) { - auto ch = this->Base::template get_byte<true>(); + auto ch = this->Base::template get_byte<true>(); if (isdigit(ch) || ch == '+' || ch == '-') { token_buffer_.push_back(ch); } else if (ch == '.' || ch == 'e' || ch == 'E') { @@ -106,7 +106,7 @@ namespace NYsonPull { token_buffer_.clear(); auto& buf = Base::stream().buffer(); while (true) { - this->Base::template fill_buffer<false>(); + this->Base::template fill_buffer<false>(); auto* quote = reinterpret_cast<const ui8*>( ::memchr(buf.pos(), '"', buf.available())); if (quote == nullptr) { @@ -144,7 +144,7 @@ namespace NYsonPull { TStringBuf read_unquoted_string() { token_buffer_.clear(); while (true) { - auto ch = this->Base::template get_byte<true>(); + auto ch = this->Base::template get_byte<true>(); if (isalpha(ch) || isdigit(ch) || ch == '_' || ch == '-' || ch == '%' || ch == '.') { token_buffer_.push_back(ch); @@ -185,7 +185,7 @@ namespace NYsonPull { auto needToRead = length; token_buffer_.clear(); while (needToRead) { - this->Base::template fill_buffer<false>(); + this->Base::template fill_buffer<false>(); auto chunk_size = std::min(needToRead, buf.available()); token_buffer_.insert( @@ -206,7 +206,7 @@ namespace NYsonPull { auto assert_literal = [&](TStringBuf literal) -> void { for (size_t i = 2; i < literal.size(); ++i) { - token_buffer_.push_back(this->Base::template get_byte<false>()); + token_buffer_.push_back(this->Base::template get_byte<false>()); Base::advance(1); if (Y_UNLIKELY(token_buffer_.back() != literal[i])) { throw_incorrect_percent_scalar(); @@ -215,7 +215,7 @@ namespace NYsonPull { }; token_buffer_.clear(); - token_buffer_.push_back(this->Base::template get_byte<false>()); + token_buffer_.push_back(this->Base::template get_byte<false>()); Base::advance(1); switch (token_buffer_[0]) { |