diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:10 +0300 |
commit | baa58daefa91fde4b4769facdbd2903763b9c6a8 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/blockcodecs | |
parent | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (diff) | |
download | ydb-baa58daefa91fde4b4769facdbd2903763b9c6a8.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/blockcodecs')
-rw-r--r-- | library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp | 4 | ||||
-rw-r--r-- | library/cpp/blockcodecs/codecs_ut.cpp | 12 | ||||
-rw-r--r-- | library/cpp/blockcodecs/core/codecs.h | 24 | ||||
-rw-r--r-- | library/cpp/blockcodecs/core/common.h | 22 | ||||
-rw-r--r-- | library/cpp/blockcodecs/core/stream.cpp | 4 |
5 files changed, 33 insertions, 33 deletions
diff --git a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp index f2b16b2f7d..042f031679 100644 --- a/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp +++ b/library/cpp/blockcodecs/codecs/legacy_zstd06/legacy_zstd06.cpp @@ -28,11 +28,11 @@ namespace { } inline size_t DoCompress(const TData& in, void* out) const { - return CheckError(ZSTD_compress(out, DoMaxCompressedLength(in.size()), in.data(), in.size(), Level), "compress"); + 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"); + const size_t res = CheckError(ZSTD_decompress(out, dsize, in.data(), in.size()), "decompress"); if (res != dsize) { ythrow TDecompressError(dsize, res); diff --git a/library/cpp/blockcodecs/codecs_ut.cpp b/library/cpp/blockcodecs/codecs_ut.cpp index 6e02232d5d..bfe5a23690 100644 --- a/library/cpp/blockcodecs/codecs_ut.cpp +++ b/library/cpp/blockcodecs/codecs_ut.cpp @@ -12,7 +12,7 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { TBuffer Buffer(TStringBuf b) { TBuffer bb; - bb.Assign(b.data(), b.size()); + bb.Assign(b.data(), b.size()); return bb; } @@ -39,7 +39,7 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { TCodecList lst = ListAllCodecs(); - for (size_t i = 0; i < lst.size(); ++i) { + for (size_t i = 0; i < lst.size(); ++i) { const ICodec* c = Codec(lst[i]); const auto h = MultiHash(c->Name(), i, 1); @@ -48,7 +48,7 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { continue; } - for (size_t j = 0; j < datas.size(); ++j) { + for (size_t j = 0; j < datas.size(); ++j) { const TBuffer& data = datas[j]; TString res; @@ -151,13 +151,13 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { datas.push_back(TString(i, (char)(i % 128))); } - for (size_t i = 0; i < datas.size(); ++i) { + for (size_t i = 0; i < datas.size(); ++i) { res += datas[i]; } TCodecList lst = ListAllCodecs(); - for (size_t i = 0; i < lst.size(); ++i) { + for (size_t i = 0; i < lst.size(); ++i) { TStringStream ss; const ICodec* c = Codec(lst[i]); @@ -171,7 +171,7 @@ Y_UNIT_TEST_SUITE(TBlockCodecsTest) { { TCodedOutput out(&ss, c, 1234); - for (size_t j = 0; j < datas.size(); ++j) { + for (size_t j = 0; j < datas.size(); ++j) { out << datas[j]; } diff --git a/library/cpp/blockcodecs/core/codecs.h b/library/cpp/blockcodecs/core/codecs.h index d6606775e2..9c93c00274 100644 --- a/library/cpp/blockcodecs/core/codecs.h +++ b/library/cpp/blockcodecs/core/codecs.h @@ -3,26 +3,26 @@ #include <util/generic/buffer.h> #include <util/generic/strbuf.h> #include <util/generic/string.h> -#include <util/generic/typetraits.h> +#include <util/generic/typetraits.h> #include <util/generic/vector.h> #include <util/generic/yexception.h> namespace NBlockCodecs { struct TData: public TStringBuf { - inline TData() = default; - - Y_HAS_MEMBER(Data); - Y_HAS_MEMBER(Size); - - template <class T, std::enable_if_t<!THasSize<T>::value || !THasData<T>::value, int> = 0> - inline TData(const T& t) - : TStringBuf((const char*)t.data(), t.size()) - { + inline TData() = default; + + Y_HAS_MEMBER(Data); + Y_HAS_MEMBER(Size); + + template <class T, std::enable_if_t<!THasSize<T>::value || !THasData<T>::value, int> = 0> + inline TData(const T& t) + : TStringBuf((const char*)t.data(), t.size()) + { } - template <class T, std::enable_if_t<THasSize<T>::value && THasData<T>::value, int> = 0> + template <class T, std::enable_if_t<THasSize<T>::value && THasData<T>::value, int> = 0> inline TData(const T& t) - : TStringBuf((const char*)t.Data(), t.Size()) + : TStringBuf((const char*)t.Data(), t.Size()) { } }; diff --git a/library/cpp/blockcodecs/core/common.h b/library/cpp/blockcodecs/core/common.h index 5389f71726..f05df4d334 100644 --- a/library/cpp/blockcodecs/core/common.h +++ b/library/cpp/blockcodecs/core/common.h @@ -36,23 +36,23 @@ namespace NBlockCodecs { struct TNullCodec: public ICodec { size_t DecompressedLength(const TData& in) const override { - return in.size(); + return in.size(); } size_t MaxCompressedLength(const TData& in) const override { - return in.size(); + return in.size(); } size_t Compress(const TData& in, void* out) const override { - MemCopy((char*)out, in.data(), in.size()); + MemCopy((char*)out, in.data(), in.size()); - return in.size(); + return in.size(); } size_t Decompress(const TData& in, void* out) const override { - MemCopy((char*)out, in.data(), in.size()); + MemCopy((char*)out, in.data(), in.size()); - return in.size(); + return in.size(); } TStringBuf Name() const noexcept override { @@ -63,7 +63,7 @@ namespace NBlockCodecs { template <class T> struct TAddLengthCodec: public ICodec { static inline void Check(const TData& in) { - if (in.size() < sizeof(ui64)) { + if (in.size() < sizeof(ui64)) { ythrow TDataError() << "too small input"; } } @@ -71,17 +71,17 @@ namespace NBlockCodecs { size_t DecompressedLength(const TData& in) const override { Check(in); - return ReadUnaligned<ui64>(in.data()); + return ReadUnaligned<ui64>(in.data()); } size_t MaxCompressedLength(const TData& in) const override { - return T::DoMaxCompressedLength(in.size()) + sizeof(ui64); + return T::DoMaxCompressedLength(in.size()) + sizeof(ui64); } size_t Compress(const TData& in, void* out) const override { ui64* ptr = (ui64*)out; - WriteUnaligned<ui64>(ptr, (ui64) in.size()); + WriteUnaligned<ui64>(ptr, (ui64) in.size()); return Base()->DoCompress(!in ? TData(TStringBuf("")) : in, ptr + 1) + sizeof(*ptr); } @@ -89,7 +89,7 @@ namespace NBlockCodecs { size_t Decompress(const TData& in, void* out) const override { Check(in); - const auto len = ReadUnaligned<ui64>(in.data()); + const auto len = ReadUnaligned<ui64>(in.data()); if (!len) return 0; diff --git a/library/cpp/blockcodecs/core/stream.cpp b/library/cpp/blockcodecs/core/stream.cpp index 99f2f554ea..4f7db3c32b 100644 --- a/library/cpp/blockcodecs/core/stream.cpp +++ b/library/cpp/blockcodecs/core/stream.cpp @@ -21,7 +21,7 @@ namespace { inline TIds() { const TCodecList lst = ListAllCodecs(); - for (size_t i = 0; i < lst.size(); ++i) { + for (size_t i = 0; i < lst.size(); ++i) { const ICodec* c = Codec(lst[i]); ByID[CodecID(c)] = c; @@ -36,7 +36,7 @@ namespace { ui32 Data; } x; - x.Data = MurmurHash<ui32>(name.data(), name.size()); + x.Data = MurmurHash<ui32>(name.data(), name.size()); return x.Parts[1] ^ x.Parts[0]; } |