diff options
author | danlark <danlark@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:08 +0300 |
commit | 3426a9bc7f169ae9da54cef557ad2a33f6e8eee0 (patch) | |
tree | 26154e1e9990f1bb4525d3e3fb5b6dac2c2c1da2 /library/cpp/codecs | |
parent | cb68f224c46a8ee52ac3fdd2a32534b8bb8dc134 (diff) | |
download | ydb-3426a9bc7f169ae9da54cef557ad2a33f6e8eee0.tar.gz |
Restoring authorship annotation for <danlark@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/codecs')
-rw-r--r-- | library/cpp/codecs/codecs.cpp | 24 | ||||
-rw-r--r-- | library/cpp/codecs/codecs.h | 2 | ||||
-rw-r--r-- | library/cpp/codecs/codecs_registry.cpp | 4 | ||||
-rw-r--r-- | library/cpp/codecs/delta_codec.h | 8 | ||||
-rw-r--r-- | library/cpp/codecs/greedy_dict/gd_builder.cpp | 2 | ||||
-rw-r--r-- | library/cpp/codecs/greedy_dict/gd_entry.cpp | 4 | ||||
-rw-r--r-- | library/cpp/codecs/greedy_dict/gd_entry.h | 12 | ||||
-rw-r--r-- | library/cpp/codecs/huffman_codec.cpp | 12 | ||||
-rw-r--r-- | library/cpp/codecs/pfor_codec.h | 20 | ||||
-rw-r--r-- | library/cpp/codecs/sample.h | 2 | ||||
-rw-r--r-- | library/cpp/codecs/solar_codec.cpp | 8 | ||||
-rw-r--r-- | library/cpp/codecs/solar_codec.h | 14 | ||||
-rw-r--r-- | library/cpp/codecs/static/common.h | 4 | ||||
-rw-r--r-- | library/cpp/codecs/static/static.cpp | 12 | ||||
-rw-r--r-- | library/cpp/codecs/static/tools/common/ct_common.cpp | 12 | ||||
-rw-r--r-- | library/cpp/codecs/static/ut/static_ut.cpp | 4 | ||||
-rw-r--r-- | library/cpp/codecs/ut/codecs_ut.cpp | 10 | ||||
-rw-r--r-- | library/cpp/codecs/ut/tls_cache_ut.cpp | 2 | ||||
-rw-r--r-- | library/cpp/codecs/zstd_dict_codec.cpp | 36 |
19 files changed, 96 insertions, 96 deletions
diff --git a/library/cpp/codecs/codecs.cpp b/library/cpp/codecs/codecs.cpp index b17a3156d2..2bc9f8b909 100644 --- a/library/cpp/codecs/codecs.cpp +++ b/library/cpp/codecs/codecs.cpp @@ -12,9 +12,9 @@ namespace NCodecs { Y_ENSURE_EX(p->AlreadyTrained(), TCodecException() << "untrained codec " << p->GetName()); const TString& n = p->GetName(); - Y_VERIFY(n.size() <= Max<ui16>()); - ::Save(out, (ui16)n.size()); - out->Write(n.data(), n.size()); + Y_VERIFY(n.size() <= Max<ui16>()); + ::Save(out, (ui16)n.size()); + out->Write(n.data(), n.size()); p->Save(out); } @@ -38,7 +38,7 @@ namespace NCodecs { } TCodecPtr ICodec::RestoreFromString(TStringBuf s) { - TMemoryInput minp{s.data(), s.size()}; + TMemoryInput minp{s.data(), s.size()}; return Restore(&minp); } @@ -47,12 +47,12 @@ namespace NCodecs { } ui8 TPipelineCodec::Encode(TStringBuf in, TBuffer& out) const { - size_t res = Traits().ApproximateSizeOnEncode(in.size()); + size_t res = Traits().ApproximateSizeOnEncode(in.size()); out.Reserve(res); out.Clear(); if (Pipeline.empty()) { - out.Append(in.data(), in.size()); + out.Append(in.data(), in.size()); return 0; } else if (Pipeline.size() == 1) { return Pipeline.front()->Encode(in, out); @@ -68,7 +68,7 @@ namespace NCodecs { if (it != Pipeline.begin()) { tmp.Clear(); tmp.Swap(out); - in = TStringBuf{tmp.data(), tmp.size()}; + in = TStringBuf{tmp.data(), tmp.size()}; } freelastbits = (*it)->Encode(in, out); } @@ -77,12 +77,12 @@ namespace NCodecs { } void TPipelineCodec::Decode(TStringBuf in, TBuffer& out) const { - size_t res = Traits().ApproximateSizeOnDecode(in.size()); + size_t res = Traits().ApproximateSizeOnDecode(in.size()); out.Reserve(res); out.Clear(); if (Pipeline.empty()) { - out.Append(in.data(), in.size()); + out.Append(in.data(), in.size()); return; } else if (Pipeline.size() == 1) { Pipeline.front()->Decode(in, out); @@ -98,7 +98,7 @@ namespace NCodecs { if (it != Pipeline.rbegin()) { tmp.Clear(); tmp.Swap(out); - in = TStringBuf{tmp.data(), tmp.size()}; + in = TStringBuf{tmp.data(), tmp.size()}; } (*it)->Decode(in, out); } @@ -163,7 +163,7 @@ namespace NCodecs { TStringBuf r; while (in.NextRegion(r)) { - trainingInput.emplace_back(r.data(), r.size()); + trainingInput.emplace_back(r.data(), r.size()); } TBuffer buff; @@ -172,7 +172,7 @@ namespace NCodecs { for (auto& bit : trainingInput) { buff.Clear(); - it->Encode(TStringBuf{bit.data(), bit.size()}, buff); + it->Encode(TStringBuf{bit.data(), bit.size()}, buff); buff.Swap(bit); } } diff --git a/library/cpp/codecs/codecs.h b/library/cpp/codecs/codecs.h index cc5e72b285..2197488589 100644 --- a/library/cpp/codecs/codecs.h +++ b/library/cpp/codecs/codecs.h @@ -144,7 +144,7 @@ namespace NCodecs { class TBasicTrivialCodec: public ICodec { public: ui8 Encode(TStringBuf in, TBuffer& out) const override { - out.Assign(in.data(), in.size()); + out.Assign(in.data(), in.size()); return 0; } diff --git a/library/cpp/codecs/codecs_registry.cpp b/library/cpp/codecs/codecs_registry.cpp index 17d07062ab..2536195d75 100644 --- a/library/cpp/codecs/codecs_registry.cpp +++ b/library/cpp/codecs/codecs_registry.cpp @@ -73,9 +73,9 @@ namespace NCodecs { return new TSolarCodec(); } if (name.EndsWith(TStringBuf("-a"))) { - return MakeCodecImpl<TAdaptiveSolarCodec>(name, name.SubStr(TSolarCodec::MyName().size()).Chop(2)); + return MakeCodecImpl<TAdaptiveSolarCodec>(name, name.SubStr(TSolarCodec::MyName().size()).Chop(2)); } else { - return MakeCodecImpl<TSolarCodec>(name, name.SubStr(TSolarCodec::MyName().size())); + return MakeCodecImpl<TSolarCodec>(name, name.SubStr(TSolarCodec::MyName().size())); } } diff --git a/library/cpp/codecs/delta_codec.h b/library/cpp/codecs/delta_codec.h index 21325825e6..0f42d22ebb 100644 --- a/library/cpp/codecs/delta_codec.h +++ b/library/cpp/codecs/delta_codec.h @@ -80,11 +80,11 @@ namespace NCodecs { ui8 Encode(TStringBuf s, TBuffer& b) const override { b.Clear(); - if (s.empty()) { + if (s.empty()) { return 0; } - b.Reserve(s.size()); + b.Reserve(s.size()); TArrayRef<const T> tin{(const T*)s.data(), s.size() / sizeof(T)}; const T* it = tin.begin(); @@ -117,11 +117,11 @@ namespace NCodecs { void Decode(TStringBuf s, TBuffer& b) const override { b.Clear(); - if (s.empty()) { + if (s.empty()) { return; } - b.Reserve(s.size()); + b.Reserve(s.size()); TArrayRef<const T> tin{(const T*)s.data(), s.size() / sizeof(T)}; TDecoder dec; diff --git a/library/cpp/codecs/greedy_dict/gd_builder.cpp b/library/cpp/codecs/greedy_dict/gd_builder.cpp index 561bfbca01..ea4ec0d65c 100644 --- a/library/cpp/codecs/greedy_dict/gd_builder.cpp +++ b/library/cpp/codecs/greedy_dict/gd_builder.cpp @@ -116,7 +116,7 @@ namespace NGreedyDict { ui32 TDictBuilder::Build(ui32 maxentries, ui32 maxiters, ui32 mindiff) { size_t totalsz = 0; for (auto it : Input) - totalsz += it.size(); + totalsz += it.size(); while (maxiters) { maxiters--; diff --git a/library/cpp/codecs/greedy_dict/gd_entry.cpp b/library/cpp/codecs/greedy_dict/gd_entry.cpp index 2c315c7f7c..0580d14e1d 100644 --- a/library/cpp/codecs/greedy_dict/gd_entry.cpp +++ b/library/cpp/codecs/greedy_dict/gd_entry.cpp @@ -41,11 +41,11 @@ namespace NGreedyDict { size_t len = 0; ui32 val = 0; - if (builder.FindLongestPrefix(suff.data(), suff.size(), &len, &val) && len) { + if (builder.FindLongestPrefix(suff.data(), suff.size(), &len, &val) && len) { it->NearestPrefix = val; } - builder.Add(suff.data(), suff.size(), it->Number); + builder.Add(suff.data(), suff.size(), it->Number); } TBufferOutput bout; diff --git a/library/cpp/codecs/greedy_dict/gd_entry.h b/library/cpp/codecs/greedy_dict/gd_entry.h index 18b5be0e15..2ddbd7531b 100644 --- a/library/cpp/codecs/greedy_dict/gd_entry.h +++ b/library/cpp/codecs/greedy_dict/gd_entry.h @@ -34,7 +34,7 @@ namespace NGreedyDict { return NearestPrefix != NoPrefix; } ui32 Len() const { - return Str.size(); + return Str.size(); } static bool StrLess(const TEntry& a, const TEntry& b) { @@ -58,14 +58,14 @@ namespace NGreedyDict { void InitWithAlpha(); void Add(TStringBuf a) { - push_back(TStringBuf(Pool.Append(a.data(), a.size()), a.size())); + push_back(TStringBuf(Pool.Append(a.data(), a.size()), a.size())); } void Add(TStringBuf a, TStringBuf b) { - size_t sz = a.size() + b.size(); + size_t sz = a.size() + b.size(); char* p = (char*)Pool.Allocate(sz); - memcpy(p, a.data(), a.size()); - memcpy(p + a.size(), b.data(), b.size()); + memcpy(p, a.data(), a.size()); + memcpy(p + a.size(), b.data(), b.size()); push_back(TStringBuf(p, sz)); } @@ -92,7 +92,7 @@ namespace NGreedyDict { const TEntry& p = Get(e.NearestPrefix); suff = e.Str; - suff.Skip(p.Str.size()); + suff.Skip(p.Str.size()); return &p; } diff --git a/library/cpp/codecs/huffman_codec.cpp b/library/cpp/codecs/huffman_codec.cpp index 650fe7cdfd..a78c10d0b4 100644 --- a/library/cpp/codecs/huffman_codec.cpp +++ b/library/cpp/codecs/huffman_codec.cpp @@ -69,7 +69,7 @@ namespace NCodecs { TStringBuf r; while (in->NextRegion(r)) { - for (ui64 i = 0; i < r.size(); ++i) + for (ui64 i = 0; i < r.size(); ++i) ++freqs[(ui8)r[i]]; } @@ -249,11 +249,11 @@ namespace NCodecs { ui8 Encode(TStringBuf in, TBuffer& out) const { out.Clear(); - if (in.empty()) { + if (in.empty()) { return 0; } - out.Reserve(in.size() * 2); + out.Reserve(in.size() * 2); { NBitIO::TBitOutputVector<TBuffer> bout(&out); @@ -282,7 +282,7 @@ namespace NCodecs { void Decode(TStringBuf in, TBuffer& out) const { out.Clear(); - if (in.empty()) { + if (in.empty()) { return; } @@ -293,9 +293,9 @@ namespace NCodecs { // if data is uncompressed if (!f) { in.Skip(1); - out.Append(in.data(), in.size()); + out.Append(in.data(), in.size()); } else { - out.Reserve(in.size() * 8); + out.Reserve(in.size() * 8); if (Cache.Get()) { Cache->Decode(bin, out); diff --git a/library/cpp/codecs/pfor_codec.h b/library/cpp/codecs/pfor_codec.h index d7d4bb8bf4..4b51eafa51 100644 --- a/library/cpp/codecs/pfor_codec.h +++ b/library/cpp/codecs/pfor_codec.h @@ -37,19 +37,19 @@ namespace NCodecs { ui8 Encode(TStringBuf s, TBuffer& b) const override { b.Clear(); - if (s.empty()) { + if (s.empty()) { return 0; } - b.Reserve(2 * s.size() + b.Size()); + b.Reserve(2 * s.size() + b.Size()); if (WithDelta) { auto buffer = TBufferTlsCache::TlsInstance().Item(); TBuffer& db = buffer.Get(); db.Clear(); - db.Reserve(2 * s.size()); + db.Reserve(2 * s.size()); DeltaCodec.Encode(s, db); - s = TStringBuf{db.data(), db.size()}; + s = TStringBuf{db.data(), db.size()}; } TArrayRef<const TValue> tin{(const TValue*)s.data(), s.size() / sizeof(TValue)}; @@ -97,7 +97,7 @@ namespace NCodecs { if (!optimalbits || BitsInT == optimalbits) { b.Append((ui8)-1); - b.Append(s.data(), s.size()); + b.Append(s.data(), s.size()); return 0; } else { NBitIO::TBitOutputVector<TBuffer> bout(&b); @@ -124,11 +124,11 @@ namespace NCodecs { void Decode(TStringBuf s, TBuffer& b) const override { b.Clear(); - if (s.empty()) { + if (s.empty()) { return; } - b.Reserve(s.size() * sizeof(T) + b.Size()); + b.Reserve(s.size() * sizeof(T) + b.Size()); ui64 isplain = 0; ui64 hasexceptions = 0; @@ -145,7 +145,7 @@ namespace NCodecs { if (WithDelta) { DeltaCodec.Decode(s, b); } else { - b.Append(s.data(), s.size()); + b.Append(s.data(), s.size()); } } else { typename TDCodec::TDecoder decoder; @@ -161,11 +161,11 @@ namespace NCodecs { if (WithDelta) { if (decoder.Decode(t)) { TStringBuf r{(char*)&decoder.Result, sizeof(decoder.Result)}; - b.Append(r.data(), r.size()); + b.Append(r.data(), r.size()); } } else { TStringBuf r{(char*)&t, sizeof(t)}; - b.Append(r.data(), r.size()); + b.Append(r.data(), r.size()); } } } diff --git a/library/cpp/codecs/sample.h b/library/cpp/codecs/sample.h index 15f03afcc5..0b454c1a60 100644 --- a/library/cpp/codecs/sample.h +++ b/library/cpp/codecs/sample.h @@ -74,7 +74,7 @@ namespace NCodecs { for (TIter iter = begin; iter != end; ++iter) { if (sampleProb >= 1 || rng.GenRandReal1() < sampleProb) { TStringBuf reg = getter(iter); - result.emplace_back(reg.data(), reg.size()); + result.emplace_back(reg.data(), reg.size()); } } Shuffle(result.begin(), result.end(), rng); diff --git a/library/cpp/codecs/solar_codec.cpp b/library/cpp/codecs/solar_codec.cpp index d0692fe2a4..d524eacd45 100644 --- a/library/cpp/codecs/solar_codec.cpp +++ b/library/cpp/codecs/solar_codec.cpp @@ -10,7 +10,7 @@ namespace NCodecs { static inline ui32 Append(TBuffer& pool, TStringBuf data) { - pool.Append(data.data(), data.size()); + pool.Append(data.data(), data.size()); return pool.Size(); } @@ -74,7 +74,7 @@ namespace NCodecs { for (ui32 i = 1, sz = Decoder.size(); i < sz; ++i) { TStringBuf s = DoDecode(i); tmp2.push_back(std::make_pair(s, i - 1)); - Y_ENSURE(s.size() == (Decoder[i] - Decoder[i - 1]), "learning invariant failed"); + Y_ENSURE(s.size() == (Decoder[i] - Decoder[i - 1]), "learning invariant failed"); } Sort(tmp2.begin(), tmp2.end()); @@ -82,7 +82,7 @@ namespace NCodecs { { TEncoder::TBuilder builder(CTBF_PREFIX_GROUPED); for (const auto& it : tmp2) { - builder.Add(it.first.data(), it.first.size(), it.second); + builder.Add(it.first.data(), it.first.size(), it.second); } builder.Save(bout); @@ -112,7 +112,7 @@ namespace NCodecs { for (TEncoder::TConstIterator it = Encoder.Begin(); it != Encoder.End(); ++it) { const TString& s = it.GetKey(); tmp.push_back(std::make_pair(it.GetValue(), !s ? TString("\0", 1) : s)); - poolsz += Max<ui32>(s.size(), 1); + poolsz += Max<ui32>(s.size(), 1); } Sort(tmp.begin(), tmp.end()); diff --git a/library/cpp/codecs/solar_codec.h b/library/cpp/codecs/solar_codec.h index 7158ae7926..71d606a01c 100644 --- a/library/cpp/codecs/solar_codec.h +++ b/library/cpp/codecs/solar_codec.h @@ -31,7 +31,7 @@ namespace NCodecs { if (!(b & 0x80)) { value = result; return; - } else if (Y_UNLIKELY(r.empty())) { + } else if (Y_UNLIKELY(r.empty())) { break; } } @@ -54,7 +54,7 @@ namespace NCodecs { ui32 result = static_cast<ui8>(r[0]); r.Skip(1); if (result >= 0x80) { - Y_ENSURE_EX(!r.empty(), TCodecException() << "Bad data"); + Y_ENSURE_EX(!r.empty(), TCodecException() << "Bad data"); result = ((result << 8) & 0x7FFF) | static_cast<ui8>(r[0]); r.Skip(1); } @@ -140,8 +140,8 @@ namespace NCodecs { template <class TTraits> Y_FORCE_INLINE void EncodeImpl(TStringBuf r, TBuffer& b) const { b.Clear(); - b.Reserve(r.size()); - while (!r.empty()) { + b.Reserve(r.size()); + while (!r.empty()) { size_t sz = 0; ui32 val = (ui32)-1; Encoder.FindLongestPrefix(r, &sz, &val); @@ -153,12 +153,12 @@ namespace NCodecs { template <class TTraits> Y_FORCE_INLINE void DecodeImpl(TStringBuf r, TBuffer& b) const { b.Clear(); - b.Reserve(r.size()); + b.Reserve(r.size()); ui32 v = 0; - while (!r.empty()) { + while (!r.empty()) { TTraits::Read(r, v); TStringBuf s = DoDecode(v); - b.Append(s.data(), s.size()); + b.Append(s.data(), s.size()); } } diff --git a/library/cpp/codecs/static/common.h b/library/cpp/codecs/static/common.h index 211de2a27d..dec4046a21 100644 --- a/library/cpp/codecs/static/common.h +++ b/library/cpp/codecs/static/common.h @@ -8,7 +8,7 @@ namespace NCodecs { template <class T> ui64 DataSignature(const T& t) { static_assert(!std::is_scalar<T>::value, "no scalars"); - return CityHash64(t.data(), t.size()); + return CityHash64(t.data(), t.size()); } template <class T> @@ -24,7 +24,7 @@ namespace NCodecs { T HexReadScalar(TStringBuf s) { static_assert(std::is_scalar<T>::value, "scalars only"); T t = 0; - HexDecode(s.data(), Min(s.size(), sizeof(T)), &t); + HexDecode(s.data(), Min(s.size(), sizeof(T)), &t); t = BigToLittle(t); return t; } diff --git a/library/cpp/codecs/static/static.cpp b/library/cpp/codecs/static/static.cpp index 44a07dd73a..71d1f1cce0 100644 --- a/library/cpp/codecs/static/static.cpp +++ b/library/cpp/codecs/static/static.cpp @@ -31,10 +31,10 @@ namespace NCodecs { TStaticCodecInfo LoadCodecInfoFromStream(IInputStream& in) { { TBuffer magic; - magic.Resize(GetStaticCodecInfoMagic().size()); - Y_ENSURE_EX(in.Read(magic.Data(), GetStaticCodecInfoMagic().size()) == GetStaticCodecInfoMagic().size(), + magic.Resize(GetStaticCodecInfoMagic().size()); + Y_ENSURE_EX(in.Read(magic.Data(), GetStaticCodecInfoMagic().size()) == GetStaticCodecInfoMagic().size(), TCodecException() << "bad codec info"); - Y_ENSURE_EX(TStringBuf(magic.data(), magic.size()) == GetStaticCodecInfoMagic(), + Y_ENSURE_EX(TStringBuf(magic.data(), magic.size()) == GetStaticCodecInfoMagic(), TCodecException() << "bad codec info"); } @@ -45,7 +45,7 @@ namespace NCodecs { Y_ENSURE_EX(hash == DataSignature(info), TCodecException() << "bad codec info"); TStaticCodecInfo result; - Y_ENSURE_EX(result.ParseFromArray(info.data(), info.size()), TCodecException() << "bad codec info"); + Y_ENSURE_EX(result.ParseFromArray(info.data(), info.size()), TCodecException() << "bad codec info"); return result; } @@ -57,7 +57,7 @@ namespace NCodecs { } TStaticCodecInfo LoadCodecInfoFromString(TStringBuf data) { - TMemoryInput m{data.data(), data.size()}; + TMemoryInput m{data.data(), data.size()}; return LoadCodecInfoFromStream(m); } @@ -81,7 +81,7 @@ namespace NCodecs { TArchiveReader ar(TBlob::NoCopy(begin, size)); Y_VERIFY(ar.Count() == 1, "invalid number of entries"); auto blob = ar.ObjectBlobByKey(ar.KeyByIndex(0)); - return TString{blob.AsCharPtr(), blob.Size()}; + return TString{blob.AsCharPtr(), blob.Size()}; } TCodecConstPtr RestoreCodecFromCodecInfo(const TStaticCodecInfo& info) { diff --git a/library/cpp/codecs/static/tools/common/ct_common.cpp b/library/cpp/codecs/static/tools/common/ct_common.cpp index fe77691280..ded3a503ff 100644 --- a/library/cpp/codecs/static/tools/common/ct_common.cpp +++ b/library/cpp/codecs/static/tools/common/ct_common.cpp @@ -36,23 +36,23 @@ namespace NCodecs { decodeBuffer.Clear(); stats.Records += 1; - stats.RawSize += data.size(); + stats.RawSize += data.size(); THPTimer timer; c.Encode(data, encodeBuffer); - stats.EncSize += encodeBuffer.size(); + stats.EncSize += encodeBuffer.size(); stats.EncSeconds += timer.PassedReset(); - c.Decode(TStringBuf{encodeBuffer.data(), encodeBuffer.size()}, decodeBuffer); + c.Decode(TStringBuf{encodeBuffer.data(), encodeBuffer.size()}, decodeBuffer); stats.DecSeconds += timer.PassedReset(); - Y_ENSURE(data == TStringBuf(decodeBuffer.data(), decodeBuffer.size()), "invalid encoding at record " << stats.Records); + Y_ENSURE(data == TStringBuf(decodeBuffer.data(), decodeBuffer.size()), "invalid encoding at record " << stats.Records); } return stats; } void ParseBlob(TVector<TString>& result, EDataStreamFormat fmt, const TBlob& blob) { - TStringBuf bin(blob.AsCharPtr(), blob.Size()); + TStringBuf bin(blob.AsCharPtr(), blob.Size()); TStringBuf line; TString buffer; while (bin.ReadLine(line)) { @@ -63,7 +63,7 @@ namespace NCodecs { if (!line) { continue; } - result.emplace_back(line.data(), line.size()); + result.emplace_back(line.data(), line.size()); } } diff --git a/library/cpp/codecs/static/ut/static_ut.cpp b/library/cpp/codecs/static/ut/static_ut.cpp index 57e1e62887..ae11e2f2d2 100644 --- a/library/cpp/codecs/static/ut/static_ut.cpp +++ b/library/cpp/codecs/static/ut/static_ut.cpp @@ -12,10 +12,10 @@ private: TBuffer outEnc, outDec; NStaticCodecExample::Encode(outEnc, letov, dv); - NStaticCodecExample::Decode(outDec, TStringBuf{outEnc.data(), outEnc.size()}); + NStaticCodecExample::Decode(outDec, TStringBuf{outEnc.data(), outEnc.size()}); UNIT_ASSERT_VALUES_EQUAL(outEnc.Size(), expectedSize); - UNIT_ASSERT_EQUAL(TStringBuf(outDec.data(), outDec.size()), letov); + UNIT_ASSERT_EQUAL(TStringBuf(outDec.data(), outDec.size()), letov); } void TestUsage() { diff --git a/library/cpp/codecs/ut/codecs_ut.cpp b/library/cpp/codecs/ut/codecs_ut.cpp index caf6089aef..6c8d6e10a7 100644 --- a/library/cpp/codecs/ut/codecs_ut.cpp +++ b/library/cpp/codecs/ut/codecs_ut.cpp @@ -877,9 +877,9 @@ private: TStringOutput sout(s); sout << codec << ": " << i << ", " << "\n"; - sout << HexEncode(learn.data(), learn.size()); //NEscJ::EscapeJ<true>(learn, sout); + sout << HexEncode(learn.data(), learn.size()); //NEscJ::EscapeJ<true>(learn, sout); sout << " != \n"; - sout << HexEncode(test.data(), test.size()); //NEscJ::EscapeJ<true>(test, sout); + sout << HexEncode(test.data(), test.size()); //NEscJ::EscapeJ<true>(test, sout); if (s.Size() > 1536) { TString res = s.substr(0, 512); @@ -891,7 +891,7 @@ private: } TStringBuf AsStrBuf(const TBuffer& b) { - return TStringBuf(b.data(), b.size()); + return TStringBuf(b.data(), b.size()); } template <typename TCodec, bool testsaveload> @@ -936,7 +936,7 @@ private: c->Decode(AsStrBuf(out[i]), vecl); UNIT_ASSERT_EQUAL_C(AsStrBuf(inlearn[i]), AsStrBuf(vecl), - PrintError(TStringBuf(inlearn[i].data(), inlearn[i].size()), + PrintError(TStringBuf(inlearn[i].data(), inlearn[i].size()), TStringBuf(vecl.data(), vecl.size()), c->GetName(), i)); } } @@ -960,7 +960,7 @@ private: outsz += out.Size(); c->Decode(AsStrBuf(out), in1); UNIT_ASSERT_EQUAL_C(AsStrBuf(in[i]), AsStrBuf(in1), - PrintError(TStringBuf(in[i].data(), in[i].size()), + PrintError(TStringBuf(in[i].data(), in[i].size()), TStringBuf(in1.data(), in1.size()), c->GetName(), i)); } } diff --git a/library/cpp/codecs/ut/tls_cache_ut.cpp b/library/cpp/codecs/ut/tls_cache_ut.cpp index 8101af761f..1a30de92c9 100644 --- a/library/cpp/codecs/ut/tls_cache_ut.cpp +++ b/library/cpp/codecs/ut/tls_cache_ut.cpp @@ -3,7 +3,7 @@ Y_UNIT_TEST_SUITE(CodecsBufferFactoryTest){ void AssignToBuffer(TBuffer & buf, TStringBuf val){ - buf.Assign(val.data(), val.size()); + buf.Assign(val.data(), val.size()); } TStringBuf AsStringBuf(const TBuffer& b) { diff --git a/library/cpp/codecs/zstd_dict_codec.cpp b/library/cpp/codecs/zstd_dict_codec.cpp index c42a2879e6..a053f28e85 100644 --- a/library/cpp/codecs/zstd_dict_codec.cpp +++ b/library/cpp/codecs/zstd_dict_codec.cpp @@ -71,7 +71,7 @@ namespace NCodecs { { const size_t zeroSz = TSizePacker().MeasureLeaf(0); Zero.Resize(zeroSz); - TSizePacker().PackLeaf(Zero.data(), 0, zeroSz); + TSizePacker().PackLeaf(Zero.data(), 0, zeroSz); } ui32 GetCompressionLevel() const { @@ -81,32 +81,32 @@ namespace NCodecs { ui8 Encode(TStringBuf in, TBuffer& outbuf) const { outbuf.Clear(); - if (in.empty()) { + if (in.empty()) { return 0; } TSizePacker packer; - const char* rawBeg = in.data(); - const size_t rawSz = in.size(); + const char* rawBeg = in.data(); + const size_t rawSz = in.size(); const size_t szSz = packer.MeasureLeaf(rawSz); const size_t maxDatSz = ZSTD_compressBound(rawSz); outbuf.Resize(szSz + maxDatSz); - packer.PackLeaf(outbuf.data(), rawSz, szSz); + packer.PackLeaf(outbuf.data(), rawSz, szSz); TCCtx ctx{CheckPtr(ZSTD_createCCtx(), __LOCATION__)}; const size_t resSz = CheckSize(ZSTD_compress_usingCDict( - ctx.Get(), outbuf.data() + szSz, maxDatSz, rawBeg, rawSz, CDict.Get()), + ctx.Get(), outbuf.data() + szSz, maxDatSz, rawBeg, rawSz, CDict.Get()), __LOCATION__); if (resSz < rawSz) { outbuf.Resize(resSz + szSz); } else { - outbuf.Resize(Zero.size() + rawSz); - memcpy(outbuf.data(), Zero.data(), Zero.size()); - memcpy(outbuf.data() + Zero.size(), rawBeg, rawSz); + outbuf.Resize(Zero.size() + rawSz); + memcpy(outbuf.data(), Zero.data(), Zero.size()); + memcpy(outbuf.data() + Zero.size(), rawBeg, rawSz); } return 0; } @@ -114,14 +114,14 @@ namespace NCodecs { void Decode(TStringBuf in, TBuffer& outbuf) const { outbuf.Clear(); - if (in.empty()) { + if (in.empty()) { return; } TSizePacker packer; - const char* rawBeg = in.data(); - size_t rawSz = in.size(); + const char* rawBeg = in.data(); + size_t rawSz = in.size(); const size_t szSz = packer.SkipLeaf(rawBeg); ui64 datSz = 0; @@ -132,14 +132,14 @@ namespace NCodecs { if (!datSz) { outbuf.Resize(rawSz); - memcpy(outbuf.data(), rawBeg, rawSz); + memcpy(outbuf.data(), rawBeg, rawSz); } else { // size_t zSz = ZSTD_getDecompressedSize(rawBeg, rawSz); // Y_ENSURE_EX(datSz == zSz, TCodecException() << datSz << " != " << zSz); outbuf.Resize(datSz); TDCtx ctx{CheckPtr(ZSTD_createDCtx(), __LOCATION__)}; CheckSize(ZSTD_decompress_usingDDict( - ctx.Get(), outbuf.data(), outbuf.size(), rawBeg, rawSz, DDict.Get()), + ctx.Get(), outbuf.data(), outbuf.size(), rawBeg, rawSz, DDict.Get()), __LOCATION__); outbuf.Resize(datSz); } @@ -155,8 +155,8 @@ namespace NCodecs { if (!r) { continue; } - data.Append(r.data(), r.size()); - lens.push_back(r.size()); + data.Append(r.data(), r.size()); + lens.push_back(r.size()); } ZDICT_legacy_params_t params; @@ -193,8 +193,8 @@ namespace NCodecs { } void InitContexts() { - CDict.Reset(CheckPtr(ZSTD_createCDict(Dict.data(), Dict.size(), CompressionLevel), __LOCATION__)); - DDict.Reset(CheckPtr(ZSTD_createDDict(Dict.data(), Dict.size()), __LOCATION__)); + CDict.Reset(CheckPtr(ZSTD_createCDict(Dict.data(), Dict.size(), CompressionLevel), __LOCATION__)); + DDict.Reset(CheckPtr(ZSTD_createDDict(Dict.data(), Dict.size()), __LOCATION__)); } static size_t CheckSize(size_t sz, TSourceLocation loc) { |