diff options
author | dobrokot <dobrokot@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:07 +0300 |
commit | 25d83bf841d8b3ce3886525078f1964ac3c293c5 (patch) | |
tree | bd52fa16c8dd727890b2ef9d87d1a402bd0d3a9a /library/cpp | |
parent | 1d2e8a8e9976488ea69a7e4763aa749244f82612 (diff) | |
download | ydb-25d83bf841d8b3ce3886525078f1964ac3c293c5.tar.gz |
Restoring authorship annotation for <dobrokot@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp')
34 files changed, 556 insertions, 556 deletions
diff --git a/library/cpp/bit_io/bitoutput.h b/library/cpp/bit_io/bitoutput.h index 2b886c1f02..8df893b9f2 100644 --- a/library/cpp/bit_io/bitoutput.h +++ b/library/cpp/bit_io/bitoutput.h @@ -123,7 +123,7 @@ namespace NBitIO { public: void WriteData(const char* begin, const char* end) { - NAccessors::Append(*Data, begin, end); + NAccessors::Append(*Data, begin, end); } TBitOutputVectorImpl(TVec* data) diff --git a/library/cpp/bucket_quoter/ya.make b/library/cpp/bucket_quoter/ya.make index 49c407b502..ebf87e4606 100644 --- a/library/cpp/bucket_quoter/ya.make +++ b/library/cpp/bucket_quoter/ya.make @@ -1,11 +1,11 @@ -LIBRARY() - -OWNER(serxa) - -SRCS( - bucket_quoter.cpp -) - -END() +LIBRARY() + +OWNER(serxa) + +SRCS( + bucket_quoter.cpp +) + +END() RECURSE_FOR_TESTS(ut) diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp index f3277b8e4b..bdd012d6d3 100644 --- a/library/cpp/cgiparam/cgiparam.cpp +++ b/library/cpp/cgiparam/cgiparam.cpp @@ -90,7 +90,7 @@ static inline TString DoUnescape(const TStringBuf s) { } void TCgiParameters::InsertEscaped(const TStringBuf name, const TStringBuf value) { - InsertUnescaped(DoUnescape(name), DoUnescape(value)); + InsertUnescaped(DoUnescape(name), DoUnescape(value)); } template <bool addAll, class F> @@ -102,17 +102,17 @@ struct TAddEscaped { TCgiParameters* C; inline void operator()(const TStringBuf key, const TStringBuf val) { - C->InsertEscaped(key, val); + C->InsertEscaped(key, val); } }; void TCgiParameters::Scan(const TStringBuf query, bool form) { Flush(); - form ? ScanAdd(query) : ScanAddAll(query); + form ? ScanAdd(query) : ScanAddAll(query); } void TCgiParameters::ScanAdd(const TStringBuf query) { - TAddEscaped f = {this}; + TAddEscaped f = {this}; DoScan<false>(query, f); } @@ -134,7 +134,7 @@ void TCgiParameters::ScanAddAllUnescaped(const TStringBuf query) { } void TCgiParameters::ScanAddAll(const TStringBuf query) { - TAddEscaped f = {this}; + TAddEscaped f = {this}; DoScan<true>(query, f); } diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp index c3ac3ac478..8d2f8f6989 100644 --- a/library/cpp/charset/codepage_ut.cpp +++ b/library/cpp/charset/codepage_ut.cpp @@ -121,43 +121,43 @@ void TCodepageTest::TestUTF() { } } const char* badStrings[] = { - "\xfe", - "\xff", - "\xcc\xc0", + "\xfe", + "\xff", + "\xcc\xc0", "\xf4\x90\x80\x80", - //overlong: - "\xfe\xfe\xff\xff", - "\xc0\xaf", - "\xe0\x80\xaf", - "\xf0\x80\x80\xaf", - "\xf8\x80\x80\x80\xaf", - "\xfc\x80\x80\x80\x80\xaf", - "\xc1\xbf", - "\xe0\x9f\xbf", - "\xf0\x8f\xbf\xbf", - "\xf8\x87\xbf\xbf\xbf", - "\xfc\x83\xbf\xbf\xbf\xbf", - "\xc0\x80", - "\xe0\x80\x80", - "\xf0\x80\x80\x80", - "\xf8\x80\x80\x80\x80", - "\xfc\x80\x80\x80\x80\x80", - //UTF-16 surrogate (not covered): - //"\xed\xa0\x80", - //"\xed\xad\xbf", - //"\xed\xae\x80", - //"\xed\xaf\xbf", - //"\xed\xb0\x80", - //"\xed\xbe\x80", - //"\xed\xbf\xbf", - }; + //overlong: + "\xfe\xfe\xff\xff", + "\xc0\xaf", + "\xe0\x80\xaf", + "\xf0\x80\x80\xaf", + "\xf8\x80\x80\x80\xaf", + "\xfc\x80\x80\x80\x80\xaf", + "\xc1\xbf", + "\xe0\x9f\xbf", + "\xf0\x8f\xbf\xbf", + "\xf8\x87\xbf\xbf\xbf", + "\xfc\x83\xbf\xbf\xbf\xbf", + "\xc0\x80", + "\xe0\x80\x80", + "\xf0\x80\x80\x80", + "\xf8\x80\x80\x80\x80", + "\xfc\x80\x80\x80\x80\x80", + //UTF-16 surrogate (not covered): + //"\xed\xa0\x80", + //"\xed\xad\xbf", + //"\xed\xae\x80", + //"\xed\xaf\xbf", + //"\xed\xb0\x80", + //"\xed\xbe\x80", + //"\xed\xbf\xbf", + }; for (size_t i = 0; i < Y_ARRAY_SIZE(badStrings); ++i) { - wchar32 rune; + wchar32 rune; const ui8* p = (const ui8*)badStrings[i]; - size_t len; + size_t len; RECODE_RESULT res = SafeReadUTF8Char(rune, len, p, p + strlen(badStrings[i])); - UNIT_ASSERT(res == RECODE_BROKENSYMBOL); - } + UNIT_ASSERT(res == RECODE_BROKENSYMBOL); + } } void TCodepageTest::TestBrokenMultibyte() { diff --git a/library/cpp/containers/comptrie/comptrie_builder.inl b/library/cpp/containers/comptrie/comptrie_builder.inl index f273fa6571..850d84121c 100644 --- a/library/cpp/containers/comptrie/comptrie_builder.inl +++ b/library/cpp/containers/comptrie/comptrie_builder.inl @@ -377,7 +377,7 @@ public: case DATA_MALLOCED: case DATA_IN_MEMPOOL: return PayloadAsPtr(); - case DATA_ABSENT: + case DATA_ABSENT: default: abort(); } diff --git a/library/cpp/containers/comptrie/comptrie_trie.h b/library/cpp/containers/comptrie/comptrie_trie.h index 40ec1e52b3..0ddc04c058 100644 --- a/library/cpp/containers/comptrie/comptrie_trie.h +++ b/library/cpp/containers/comptrie/comptrie_trie.h @@ -110,10 +110,10 @@ public: return Skipper; } - TPacker GetPacker() const { - return Packer; - } - + TPacker GetPacker() const { + return Packer; + } + bool HasCorrectSkipper() const { return Skipper.GetPacker() == &Packer; } @@ -175,9 +175,9 @@ public: }; TConstIterator Begin() const; - TConstIterator begin() const; + TConstIterator begin() const; TConstIterator End() const; - TConstIterator end() const; + TConstIterator end() const; // Returns an iterator pointing to the smallest key in the trie >= the argument. // TODO: misleading name. Should be called LowerBound for consistency with stl. @@ -422,22 +422,22 @@ typename TCompactTrie<T, D, S>::TConstIterator TCompactTrie<T, D, S>::Begin() co } template <class T, class D, class S> -typename TCompactTrie<T, D, S>::TConstIterator TCompactTrie<T, D, S>::begin() const { - return Begin(); -} - -template <class T, class D, class S> +typename TCompactTrie<T, D, S>::TConstIterator TCompactTrie<T, D, S>::begin() const { + return Begin(); +} + +template <class T, class D, class S> typename TCompactTrie<T, D, S>::TConstIterator TCompactTrie<T, D, S>::End() const { NCompactTrie::TOpaqueTrie self(DataHolder.AsCharPtr(), DataHolder.Length(), Skipper); return TConstIterator(self, EmptyValue, true, Packer); } template <class T, class D, class S> -typename TCompactTrie<T, D, S>::TConstIterator TCompactTrie<T, D, S>::end() const { - return End(); -} - -template <class T, class D, class S> +typename TCompactTrie<T, D, S>::TConstIterator TCompactTrie<T, D, S>::end() const { + return End(); +} + +template <class T, class D, class S> size_t TCompactTrie<T, D, S>::Size() const { size_t res = 0; for (TConstIterator it = Begin(); it != End(); ++it) diff --git a/library/cpp/containers/comptrie/comptrie_ut.cpp b/library/cpp/containers/comptrie/comptrie_ut.cpp index 74bee09b5d..cfc820592c 100644 --- a/library/cpp/containers/comptrie/comptrie_ut.cpp +++ b/library/cpp/containers/comptrie/comptrie_ut.cpp @@ -445,11 +445,11 @@ void TCompactTrieTest::CheckIterator(const char* data, size_t datalen) { } TMap<TKey, ui64> received2; for (std::pair<TKey, ui64> x : trie) { - received2.insert(x); - } + received2.insert(x); + } UNIT_ASSERT(entry_count == stored.size()); UNIT_ASSERT(received == stored); - UNIT_ASSERT(received2 == stored); + UNIT_ASSERT(received2 == stored); std::reverse(items.begin(), items.end()); typename TCompactTrie<T>::TConstIterator revIt = trie.End(); diff --git a/library/cpp/deprecated/accessors/accessors.h b/library/cpp/deprecated/accessors/accessors.h index 6d4b1da3ad..ab7c0cfb83 100644 --- a/library/cpp/deprecated/accessors/accessors.h +++ b/library/cpp/deprecated/accessors/accessors.h @@ -37,44 +37,44 @@ namespace NAccessors { inline size_t Size(const T& t) { return End(t) - Begin(t); } - - /** - * This gives some unification in terms of memory manipulation. - */ - - template <typename T> - inline void Reserve(T& t, size_t sz) { - NPrivate::TReserve<T>::Do(t, sz); - } - - template <typename T> - inline void Resize(T& t, size_t sz) { - NPrivate::TResize<T>::Do(t, sz); - } - - template <typename T> - inline void Clear(T& t) { - NPrivate::TClear<T, false>::Do(t); - } - - template <typename T> - inline void Init(T& t) { - NPrivate::TClear<T, true>::Do(t); - } - - template <typename T> - inline void Append(T& t, const typename TMemoryTraits<T>::TElementType& v) { - NPrivate::TAppend<T>::Do(t, v); - } - - template <typename T> - inline void Append(T& t, - const typename TMemoryTraits<T>::TElementType* beg, - const typename TMemoryTraits<T>::TElementType* end) { - NPrivate::TAppendRegion<T>::Do(t, beg, end); - } - + + /** + * This gives some unification in terms of memory manipulation. + */ + template <typename T> + inline void Reserve(T& t, size_t sz) { + NPrivate::TReserve<T>::Do(t, sz); + } + + template <typename T> + inline void Resize(T& t, size_t sz) { + NPrivate::TResize<T>::Do(t, sz); + } + + template <typename T> + inline void Clear(T& t) { + NPrivate::TClear<T, false>::Do(t); + } + + template <typename T> + inline void Init(T& t) { + NPrivate::TClear<T, true>::Do(t); + } + + template <typename T> + inline void Append(T& t, const typename TMemoryTraits<T>::TElementType& v) { + NPrivate::TAppend<T>::Do(t, v); + } + + template <typename T> + inline void Append(T& t, + const typename TMemoryTraits<T>::TElementType* beg, + const typename TMemoryTraits<T>::TElementType* end) { + NPrivate::TAppendRegion<T>::Do(t, beg, end); + } + + template <typename T> inline void Assign(T& t, const typename TMemoryTraits<T>::TElementType* beg, const typename TMemoryTraits<T>::TElementType* end) { diff --git a/library/cpp/deprecated/accessors/accessors_impl.h b/library/cpp/deprecated/accessors/accessors_impl.h index 6b2b987351..61d1956a1f 100644 --- a/library/cpp/deprecated/accessors/accessors_impl.h +++ b/library/cpp/deprecated/accessors/accessors_impl.h @@ -113,236 +113,236 @@ namespace NAccessors { return TGet::Get(b); } }; - - template <typename Ta, bool Init> - struct TClear: public TMemoryAccessorBase<Ta> { - template <typename Tb> - struct TNoMemoryIndirectionClear { - static void Do(Tb& b) { - Zero(b); - } - }; - - template <typename Tb> - struct TIndirectMemoryRegionClear { + + template <typename Ta, bool Init> + struct TClear: public TMemoryAccessorBase<Ta> { + template <typename Tb> + struct TNoMemoryIndirectionClear { + static void Do(Tb& b) { + Zero(b); + } + }; + + template <typename Tb> + struct TIndirectMemoryRegionClear { Y_HAS_MEMBER(Clear); Y_HAS_MEMBER(clear); - - template <typename Tc> - struct TByClear { - static void Do(Tc& b) { - b.Clear(); - } - }; - - template <typename Tc> - struct TByclear { - static void Do(Tc& b) { - b.clear(); - } - }; - - template <typename Tc> - struct TByNone { - static void Do(Tc& b) { - if (!Init) - b = Tc(); - } - }; - + + template <typename Tc> + struct TByClear { + static void Do(Tc& b) { + b.Clear(); + } + }; + + template <typename Tc> + struct TByclear { + static void Do(Tc& b) { + b.clear(); + } + }; + + template <typename Tc> + struct TByNone { + static void Do(Tc& b) { + if (!Init) + b = Tc(); + } + }; + using TDo = std::conditional_t< THasClear<Tb>::value, - TByClear<Tb>, + TByClear<Tb>, std::conditional_t< THasclear<Tb>::value, - TByclear<Tb>, - TByNone<Tb>>>; - - static void Do(Tb& b) { - TDo::Do(b); - } - }; - + TByclear<Tb>, + TByNone<Tb>>>; + + static void Do(Tb& b) { + TDo::Do(b); + } + }; + using TDo = std::conditional_t<TMemoryAccessorBase<Ta>::SimpleMemory, TNoMemoryIndirectionClear<Ta>, TIndirectMemoryRegionClear<Ta>>; - - static void Do(Ta& b) { - TDo::Do(b); - } - }; - - template <typename Tb> - struct TReserve { + + static void Do(Ta& b) { + TDo::Do(b); + } + }; + + template <typename Tb> + struct TReserve { Y_HAS_MEMBER(Reserve); Y_HAS_MEMBER(reserve); - - template <typename Tc> - struct TByReserve { - static void Do(Tc& b, size_t sz) { - b.Reserve(sz); - } - }; - - template <typename Tc> - struct TByreserve { - static void Do(Tc& b, size_t sz) { - b.reserve(sz); - } - }; - - template <typename Tc> - struct TByNone { - static void Do(Tc&, size_t) { - } - }; - + + template <typename Tc> + struct TByReserve { + static void Do(Tc& b, size_t sz) { + b.Reserve(sz); + } + }; + + template <typename Tc> + struct TByreserve { + static void Do(Tc& b, size_t sz) { + b.reserve(sz); + } + }; + + template <typename Tc> + struct TByNone { + static void Do(Tc&, size_t) { + } + }; + using TDo = std::conditional_t< THasReserve<Tb>::value, - TByReserve<Tb>, + TByReserve<Tb>, std::conditional_t< THasreserve<Tb>::value, - TByreserve<Tb>, - TByNone<Tb>>>; - - static void Do(Tb& b, size_t sz) { - TDo::Do(b, sz); - } - }; - - template <typename Tb> - struct TResize { + TByreserve<Tb>, + TByNone<Tb>>>; + + static void Do(Tb& b, size_t sz) { + TDo::Do(b, sz); + } + }; + + template <typename Tb> + struct TResize { Y_HAS_MEMBER(Resize); Y_HAS_MEMBER(resize); - - template <typename Tc> - struct TByResize { - static void Do(Tc& b, size_t sz) { - b.Resize(sz); - } - }; - - template <typename Tc> - struct TByresize { - static void Do(Tc& b, size_t sz) { - b.resize(sz); - } - }; - + + template <typename Tc> + struct TByResize { + static void Do(Tc& b, size_t sz) { + b.Resize(sz); + } + }; + + template <typename Tc> + struct TByresize { + static void Do(Tc& b, size_t sz) { + b.resize(sz); + } + }; + using TDo = std::conditional_t<THasResize<Tb>::value, TByResize<Tb>, TByresize<Tb>>; - - static void Do(Tb& b, size_t sz) { - TDo::Do(b, sz); - } - }; - - template <typename Tb> - struct TAppend { + + static void Do(Tb& b, size_t sz) { + TDo::Do(b, sz); + } + }; + + template <typename Tb> + struct TAppend { Y_HAS_MEMBER(Append); Y_HAS_MEMBER(append); Y_HAS_MEMBER(push_back); - - template <typename Tc> - struct TByAppend { - using TElementType = typename TMemoryTraits<Tc>::TElementType; - - static void Do(Tc& b, const TElementType& val) { - b.Append(val); - } - }; - - template <typename Tc> - struct TByappend { - using TElementType = typename TMemoryTraits<Tc>::TElementType; - - static void Do(Tc& b, const TElementType& val) { - b.append(val); - } - }; - - template <typename Tc> - struct TBypush_back { - using TElementType = typename TMemoryTraits<Tc>::TElementType; - - static void Do(Tc& b, const TElementType& val) { - b.push_back(val); - } - }; - + + template <typename Tc> + struct TByAppend { + using TElementType = typename TMemoryTraits<Tc>::TElementType; + + static void Do(Tc& b, const TElementType& val) { + b.Append(val); + } + }; + + template <typename Tc> + struct TByappend { + using TElementType = typename TMemoryTraits<Tc>::TElementType; + + static void Do(Tc& b, const TElementType& val) { + b.append(val); + } + }; + + template <typename Tc> + struct TBypush_back { + using TElementType = typename TMemoryTraits<Tc>::TElementType; + + static void Do(Tc& b, const TElementType& val) { + b.push_back(val); + } + }; + using TDo = std::conditional_t< THasAppend<Tb>::value, - TByAppend<Tb>, + TByAppend<Tb>, std::conditional_t< THasappend<Tb>::value, - TByappend<Tb>, - TBypush_back<Tb>>>; - - using TElementType = typename TMemoryTraits<Tb>::TElementType; - - static void Do(Tb& b, const TElementType& val) { - TDo::Do(b, val); - } - }; - - template <typename Tb> - struct TAppendRegion { + TByappend<Tb>, + TBypush_back<Tb>>>; + + using TElementType = typename TMemoryTraits<Tb>::TElementType; + + static void Do(Tb& b, const TElementType& val) { + TDo::Do(b, val); + } + }; + + template <typename Tb> + struct TAppendRegion { Y_HAS_MEMBER(Append); Y_HAS_MEMBER(append); Y_HAS_MEMBER(insert); - - template <typename Tc> - struct TByAppend { - using TElementType = typename TMemoryTraits<Tc>::TElementType; - - static void Do(Tc& b, const TElementType* beg, const TElementType* end) { - b.Append(beg, end); - } - }; - - template <typename Tc> - struct TByappend { - using TElementType = typename TMemoryTraits<Tc>::TElementType; - - static void Do(Tc& b, const TElementType* beg, const TElementType* end) { - b.append(beg, end); - } - }; - - template <typename Tc> - struct TByinsert { - using TElementType = typename TMemoryTraits<Tc>::TElementType; - - static void Do(Tc& b, const TElementType* beg, const TElementType* end) { - b.insert(b.end(), beg, end); - } - }; - - template <typename Tc> - struct TByNone { - using TElementType = typename TMemoryTraits<Tc>::TElementType; - - static void Do(Tc& b, const TElementType* beg, const TElementType* end) { - for (const TElementType* it = beg; it != end; ++it) - TAppend<Tc>::Do(b, *it); - } - }; - + + template <typename Tc> + struct TByAppend { + using TElementType = typename TMemoryTraits<Tc>::TElementType; + + static void Do(Tc& b, const TElementType* beg, const TElementType* end) { + b.Append(beg, end); + } + }; + + template <typename Tc> + struct TByappend { + using TElementType = typename TMemoryTraits<Tc>::TElementType; + + static void Do(Tc& b, const TElementType* beg, const TElementType* end) { + b.append(beg, end); + } + }; + + template <typename Tc> + struct TByinsert { + using TElementType = typename TMemoryTraits<Tc>::TElementType; + + static void Do(Tc& b, const TElementType* beg, const TElementType* end) { + b.insert(b.end(), beg, end); + } + }; + + template <typename Tc> + struct TByNone { + using TElementType = typename TMemoryTraits<Tc>::TElementType; + + static void Do(Tc& b, const TElementType* beg, const TElementType* end) { + for (const TElementType* it = beg; it != end; ++it) + TAppend<Tc>::Do(b, *it); + } + }; + using TDo = std::conditional_t< THasAppend<Tb>::value, - TByAppend<Tb>, + TByAppend<Tb>, std::conditional_t< THasappend<Tb>::value, - TByappend<Tb>, + TByappend<Tb>, std::conditional_t< THasinsert<Tb>::value, - TByinsert<Tb>, - TByNone<Tb>>>>; - - using TElementType = typename TMemoryTraits<Tb>::TElementType; - - static void Do(Tb& b, const TElementType* beg, const TElementType* end) { - TDo::Do(b, beg, end); - } - }; - + TByinsert<Tb>, + TByNone<Tb>>>>; + + using TElementType = typename TMemoryTraits<Tb>::TElementType; + + static void Do(Tb& b, const TElementType* beg, const TElementType* end) { + TDo::Do(b, beg, end); + } + }; + template <typename Ta> struct TAssign: public TMemoryAccessorBase<Ta> { using TElementType = typename TMemoryTraits<Ta>::TElementType; diff --git a/library/cpp/deprecated/accessors/accessors_ut.cpp b/library/cpp/deprecated/accessors/accessors_ut.cpp index a9bdc9fcc4..794efbf25a 100644 --- a/library/cpp/deprecated/accessors/accessors_ut.cpp +++ b/library/cpp/deprecated/accessors/accessors_ut.cpp @@ -22,30 +22,30 @@ private: UNIT_ASSERT_VALUES_EQUAL_C(end - beg, sz, comm); } - template <typename T> - void TestWrite(const char* comm) { - typename TMemoryTraits<T>::TElementType val[4] = {'t', 'e', 's', 't'}; - T t; - NAccessors::Init(t); - NAccessors::Reserve(t, 6); - - size_t sz = NAccessors::Size(t); - UNIT_ASSERT_VALUES_EQUAL_C(0u, sz, comm); - - NAccessors::Append(t, 'a'); - sz = NAccessors::Size(t); - UNIT_ASSERT_VALUES_EQUAL_C(1u, sz, comm); - - NAccessors::Append(t, val, val + 4); - sz = NAccessors::Size(t); - UNIT_ASSERT_VALUES_EQUAL_C(5u, sz, comm); - - NAccessors::Clear(t); - - sz = NAccessors::Size(t); - UNIT_ASSERT_VALUES_EQUAL_C(0u, sz, comm); - } - + template <typename T> + void TestWrite(const char* comm) { + typename TMemoryTraits<T>::TElementType val[4] = {'t', 'e', 's', 't'}; + T t; + NAccessors::Init(t); + NAccessors::Reserve(t, 6); + + size_t sz = NAccessors::Size(t); + UNIT_ASSERT_VALUES_EQUAL_C(0u, sz, comm); + + NAccessors::Append(t, 'a'); + sz = NAccessors::Size(t); + UNIT_ASSERT_VALUES_EQUAL_C(1u, sz, comm); + + NAccessors::Append(t, val, val + 4); + sz = NAccessors::Size(t); + UNIT_ASSERT_VALUES_EQUAL_C(5u, sz, comm); + + NAccessors::Clear(t); + + sz = NAccessors::Size(t); + UNIT_ASSERT_VALUES_EQUAL_C(0u, sz, comm); + } + void TestAccessors() { TestRead('a', "char"); TestRead(1, "int"); @@ -74,17 +74,17 @@ private: TestWrite<TString>("TString"); TestWrite<TVector<char>>("TVector<char>"); - TestWrite<TBuffer>("TBuffer"); + TestWrite<TBuffer>("TBuffer"); TestWrite<TVector<ui64>>("TVector<ui64>"); TestWrite<TUtf16String>("TUtf16String"); - + std::array<TString, 10> sarr; - NAccessors::Init(sarr); - NAccessors::Clear(sarr); - + NAccessors::Init(sarr); + NAccessors::Clear(sarr); + std::array<char, 10> carr; - NAccessors::Init(carr); - NAccessors::Clear(carr); + NAccessors::Init(carr); + NAccessors::Clear(carr); TestRead(carr, "std::array<char, 10>"); } }; diff --git a/library/cpp/deprecated/split/delim_string_iter.h b/library/cpp/deprecated/split/delim_string_iter.h index 8e4ca171a0..5bf1348bcc 100644 --- a/library/cpp/deprecated/split/delim_string_iter.h +++ b/library/cpp/deprecated/split/delim_string_iter.h @@ -136,26 +136,26 @@ private: TStringBuf Delim; }; -//example: for (TStringBuf field: TDelimStroka(line, "@@")) { ... } +//example: for (TStringBuf field: TDelimStroka(line, "@@")) { ... } struct TDelimStroka { - TStringBuf S; - TStringBuf Delim; - + TStringBuf S; + TStringBuf Delim; + inline TDelimStroka(TStringBuf s, TStringBuf delim) - : S(s) - , Delim(delim) + : S(s) + , Delim(delim) { } - + inline TDelimStringIter begin() const { return TDelimStringIter(S, Delim); - } - + } + inline TDelimStringIter end() const { return TDelimStringIter(); - } -}; - + } +}; + inline TDelimStringIter begin_delim(const TString& str, TStringBuf delim) { return TDelimStringIter(str, delim); } diff --git a/library/cpp/deprecated/split/delim_string_iter_ut.cpp b/library/cpp/deprecated/split/delim_string_iter_ut.cpp index 18a8b2a160..c9d94b4a1d 100644 --- a/library/cpp/deprecated/split/delim_string_iter_ut.cpp +++ b/library/cpp/deprecated/split/delim_string_iter_ut.cpp @@ -38,17 +38,17 @@ Y_UNIT_TEST_SUITE(TDelimStrokaIterTestSuite) { ++it; UNIT_ASSERT_STRINGS_EQUAL(it.Cdr(), ""); } - + Y_UNIT_TEST(ForIter) { TVector<TStringBuf> expected = {"1", "", "3@4", ""}; TVector<TStringBuf> got; - + for (TStringBuf x : TDelimStroka("1@@@@3@4@@", "@@")) { - got.push_back(x); - } - - UNIT_ASSERT_EQUAL(got, expected); - } + got.push_back(x); + } + + UNIT_ASSERT_EQUAL(got, expected); + } } static void AssertKeyValueStringSplit( diff --git a/library/cpp/getopt/small/opt.h b/library/cpp/getopt/small/opt.h index ecb57439bc..6bd81e62cb 100644 --- a/library/cpp/getopt/small/opt.h +++ b/library/cpp/getopt/small/opt.h @@ -94,9 +94,9 @@ public: } TVector<TString> GetFreeArgs() const { - return NLastGetopt::TOptsParseResult(&*Opts_, GetArgC(), GetArgV()).GetFreeArgs(); - } - + return NLastGetopt::TOptsParseResult(&*Opts_, GetArgC(), GetArgV()).GetFreeArgs(); + } + // obsolete, use GetArg() instead char* Arg; /* option argument if any or NULL */ diff --git a/library/cpp/getopt/ut/opt_ut.cpp b/library/cpp/getopt/ut/opt_ut.cpp index 441aa493a0..0148831799 100644 --- a/library/cpp/getopt/ut/opt_ut.cpp +++ b/library/cpp/getopt/ut/opt_ut.cpp @@ -1,7 +1,7 @@ #include <library/cpp/getopt/opt.h> #include <library/cpp/testing/unittest/registar.h> -#include <util/string/vector.h> +#include <util/string/vector.h> Y_UNIT_TEST_SUITE(OptTest) { Y_UNIT_TEST(TestSimple) { @@ -15,38 +15,38 @@ Y_UNIT_TEST_SUITE(OptTest) { UNIT_ASSERT_VALUES_EQUAL(EOF, opt.Get()); UNIT_ASSERT_VALUES_EQUAL(EOF, opt.Get()); } - + Y_UNIT_TEST(TestFreeArguments) { - Opt::Ion options[] = { + Opt::Ion options[] = { {"some-option", Opt::WithArg, nullptr, 123}, {nullptr, Opt::WithoutArg, nullptr, 0}}; const char* argv[] = {"cmd", "ARG1", "-some-option", "ARG2", "ARG3", nullptr}; - int argc = 5; - Opt opts(argc, argv, "", options); - + int argc = 5; + Opt opts(argc, argv, "", options); + UNIT_ASSERT_VALUES_EQUAL(JoinStrings(opts.GetFreeArgs(), ", "), "ARG1, ARG3"); - } - + } + Y_UNIT_TEST(TestLongOption) { - const int SOME_OPTION_ID = 12345678; - Opt::Ion options[] = { + const int SOME_OPTION_ID = 12345678; + Opt::Ion options[] = { {"some-option", Opt::WithArg, nullptr, SOME_OPTION_ID}, {nullptr, Opt::WithoutArg, nullptr, 0}}; - for (int doubleDash = 0; doubleDash <= 1; ++doubleDash) { + for (int doubleDash = 0; doubleDash <= 1; ++doubleDash) { const char* argv[] = {"cmd", "ARG1", (doubleDash ? "--some-option" : "-some-option"), "ARG2", "ARG3", nullptr}; - int argc = 5; - Opt opts(argc, argv, "", options); - + int argc = 5; + Opt opts(argc, argv, "", options); + TString optionValue = ""; - int optlet = 0; - while ((optlet = opts.Get()) != EOF) { - if (optlet == SOME_OPTION_ID) { - optionValue = opts.GetArg(); + int optlet = 0; + while ((optlet = opts.Get()) != EOF) { + if (optlet == SOME_OPTION_ID) { + optionValue = opts.GetArg(); } else { - UNIT_FAIL("don't expected any options, except -some-option"); - } - } - UNIT_ASSERT_VALUES_EQUAL(optionValue, "ARG2"); - } - } + UNIT_FAIL("don't expected any options, except -some-option"); + } + } + UNIT_ASSERT_VALUES_EQUAL(optionValue, "ARG2"); + } + } } diff --git a/library/cpp/html/pcdata/pcdata.cpp b/library/cpp/html/pcdata/pcdata.cpp index 740c240fd2..3a8ded72d4 100644 --- a/library/cpp/html/pcdata/pcdata.cpp +++ b/library/cpp/html/pcdata/pcdata.cpp @@ -47,15 +47,15 @@ static void EncodeHtmlPcdataAppendInternal(const TStringBuf str, TString& strout break; } } -} +} void EncodeHtmlPcdataAppend(const TStringBuf str, TString& strout) { - EncodeHtmlPcdataAppendInternal(str, strout, true); -} - + EncodeHtmlPcdataAppendInternal(str, strout, true); +} + TString EncodeHtmlPcdata(const TStringBuf str, bool qAmp) { TString strout; - EncodeHtmlPcdataAppendInternal(str, strout, qAmp); + EncodeHtmlPcdataAppendInternal(str, strout, qAmp); return strout; } diff --git a/library/cpp/html/pcdata/pcdata_ut.cpp b/library/cpp/html/pcdata/pcdata_ut.cpp index 5833f8bc59..8bd59351cc 100644 --- a/library/cpp/html/pcdata/pcdata_ut.cpp +++ b/library/cpp/html/pcdata/pcdata_ut.cpp @@ -31,18 +31,18 @@ Y_UNIT_TEST_SUITE(TPcdata) { Y_UNIT_TEST(Test2) { UNIT_ASSERT_VALUES_EQUAL(EncodeHtmlPcdata("&qqq"), "&qqq"); } - + Y_UNIT_TEST(TestEncodeHtmlPcdataAppend) { TString s; - EncodeHtmlPcdataAppend("m&m", s); - EncodeHtmlPcdataAppend("'s", s); - UNIT_ASSERT_VALUES_EQUAL(EncodeHtmlPcdata("m&m's"), s); - UNIT_ASSERT_VALUES_EQUAL("m&m's", s); - } - + EncodeHtmlPcdataAppend("m&m", s); + EncodeHtmlPcdataAppend("'s", s); + UNIT_ASSERT_VALUES_EQUAL(EncodeHtmlPcdata("m&m's"), s); + UNIT_ASSERT_VALUES_EQUAL("m&m's", s); + } + Y_UNIT_TEST(TestStrangeAmpParameter) { UNIT_ASSERT_VALUES_EQUAL(EncodeHtmlPcdata("m&m's", true), "m&m's"); UNIT_ASSERT_VALUES_EQUAL(EncodeHtmlPcdata("m&m's"), "m&m's"); //default - UNIT_ASSERT_VALUES_EQUAL(EncodeHtmlPcdata("m&m's", false), "m&m's"); - } + UNIT_ASSERT_VALUES_EQUAL(EncodeHtmlPcdata("m&m's", false), "m&m's"); + } } diff --git a/library/cpp/json/ut/json_writer_ut.cpp b/library/cpp/json/ut/json_writer_ut.cpp index ca11d34dad..bcb1af0f24 100644 --- a/library/cpp/json/ut/json_writer_ut.cpp +++ b/library/cpp/json/ut/json_writer_ut.cpp @@ -179,14 +179,14 @@ Y_UNIT_TEST_SUITE(TJsonWriterTest) { UNIT_ASSERT_VALUES_EQUAL(out.Str(), expected); } } - + Y_UNIT_TEST(Callback) { - NJsonWriter::TBuf json; - json.WriteString("A"); - UNIT_ASSERT_VALUES_EQUAL(json.Str(), "\"A\""); - UNIT_ASSERT_VALUES_EQUAL(WrapJsonToCallback(json, ""), "\"A\""); - UNIT_ASSERT_VALUES_EQUAL(WrapJsonToCallback(json, "Foo"), "Foo(\"A\")"); - } + NJsonWriter::TBuf json; + json.WriteString("A"); + UNIT_ASSERT_VALUES_EQUAL(json.Str(), "\"A\""); + UNIT_ASSERT_VALUES_EQUAL(WrapJsonToCallback(json, ""), "\"A\""); + UNIT_ASSERT_VALUES_EQUAL(WrapJsonToCallback(json, "Foo"), "Foo(\"A\")"); + } Y_UNIT_TEST(FloatPrecision) { const double value = 1517933989.4242; diff --git a/library/cpp/json/writer/json.cpp b/library/cpp/json/writer/json.cpp index 02370c2d79..85642e6d8e 100644 --- a/library/cpp/json/writer/json.cpp +++ b/library/cpp/json/writer/json.cpp @@ -506,8 +506,8 @@ namespace NJsonWriter { NeedComma = from.NeedComma; NeedNewline = from.NeedNewline; Stack = from.Stack; - } - + } + void TBuf::Reset(TBufState&& from) { NeedComma = from.NeedComma; NeedNewline = from.NeedNewline; diff --git a/library/cpp/json/writer/json.h b/library/cpp/json/writer/json.h index 0aae2531b9..64ec7a4253 100644 --- a/library/cpp/json/writer/json.h +++ b/library/cpp/json/writer/json.h @@ -284,6 +284,6 @@ namespace NJsonWriter { TPairContext TValueWriter<TOutContext>::BeginObject() { return Buf.BeginObject(); } - + TString WrapJsonToCallback(const TBuf& buf, TStringBuf callback); } diff --git a/library/cpp/lwtrace/signature.h b/library/cpp/lwtrace/signature.h index 868bd9bcf2..b263fe5298 100644 --- a/library/cpp/lwtrace/signature.h +++ b/library/cpp/lwtrace/signature.h @@ -545,9 +545,9 @@ namespace NLWTrace { STORE_TYPE_AS(i32, i64); STORE_TYPE_AS(bool, ui64); STORE_TYPE_AS(float, double); -#define FOREACH_PARAMTYPE_MACRO(n, t, v) STORE_TYPE_AS(t, t) +#define FOREACH_PARAMTYPE_MACRO(n, t, v) STORE_TYPE_AS(t, t) FOREACH_PARAMTYPE(FOREACH_PARAMTYPE_MACRO) -#undef STORE_TYPE_AS +#undef STORE_TYPE_AS #undef FOREACH_PARAMTYPE_MACRO // Nil type staits. diff --git a/library/cpp/lwtrace/tests/test_all_parallel.sh b/library/cpp/lwtrace/tests/test_all_parallel.sh index 8020783d67..5351bef969 100755 --- a/library/cpp/lwtrace/tests/test_all_parallel.sh +++ b/library/cpp/lwtrace/tests/test_all_parallel.sh @@ -1,29 +1,29 @@ - -mkdir -p out - -echo " - LogIntModFilter - SleepCheck - MultipleActionsCheck - KillCheck - InMemoryLog - InMemoryLogCheck - NoExec - Log - LogTs - FalseIntFilter - LogIntAfterFilter - LogInt - FalseStringFilter - FalseStringFilterPartialMatch - LogStringAfterFilter - LogString - LogCheck -" | awk NF | ( while read l; do ./tests --unsafe-lwtrace 1 $l > out/out_$l.txt 2>out/err_$l.txt && echo done $l & done ; wait ) - - -grep . out/out_*.txt -grep . out/err_*.txt --color=always - - - + +mkdir -p out + +echo " + LogIntModFilter + SleepCheck + MultipleActionsCheck + KillCheck + InMemoryLog + InMemoryLogCheck + NoExec + Log + LogTs + FalseIntFilter + LogIntAfterFilter + LogInt + FalseStringFilter + FalseStringFilterPartialMatch + LogStringAfterFilter + LogString + LogCheck +" | awk NF | ( while read l; do ./tests --unsafe-lwtrace 1 $l > out/out_$l.txt 2>out/err_$l.txt && echo done $l & done ; wait ) + + +grep . out/out_*.txt +grep . out/err_*.txt --color=always + + + diff --git a/library/cpp/lwtrace/trace.cpp b/library/cpp/lwtrace/trace.cpp index 3c974c85a0..76c77312fd 100644 --- a/library/cpp/lwtrace/trace.cpp +++ b/library/cpp/lwtrace/trace.cpp @@ -196,28 +196,28 @@ namespace NLWTrace { const TString Get(const TParams&) { return Dummy; } - + void Set(const TString&) { } }; - + template <> class TOperand<TSymbol, OT_VARIABLE> { private: TSymbol Dummy; - + public: TOperand(TSession::TTraceVariables&, const TString&, const TString&, size_t) { } - + const TSymbol Get(const TParams&) { return Dummy; } - + void Set(const TSymbol&) { } }; - + // IOperandGetter: hide concrete EOperandType, to save compilation time template <class T> struct IOperandGetter { @@ -330,7 +330,7 @@ namespace NLWTrace { Func(Receiver, Param.Get(params)); return true; } - + public: TBinaryInplaceStatementExecutor(TReceiver<TP>& receiver, const TOperand<TP, TParam>& param) : Receiver(receiver) @@ -516,7 +516,7 @@ namespace NLWTrace { return y; } }; - + void TSession::InsertExecutor( TTraceVariables& traceVariables, size_t bi, const TPredicate* pred, const NProtoBuf::RepeatedPtrField<TAction>& actions, TProbe* probe, @@ -547,16 +547,16 @@ namespace NLWTrace { TArgumentDescription arg0 = arguments.at(0); TArgumentDescription arg1 = arguments.at(1); - + const char* tName0 = arg0.ParamIdx == size_t(-1) ? nullptr : probe->Event.Signature.ParamTypes[arg0.ParamIdx]; const char* tName1 = arg1.ParamIdx == size_t(-1) ? nullptr : probe->Event.Signature.ParamTypes[arg1.ParamIdx]; - + TString var0 = op.GetArgument(0).GetVariable(); TString var1 = op.GetArgument(1).GetVariable(); - + TString val0 = op.GetArgument(0).GetValue(); TString val1 = op.GetArgument(1).GetValue(); - + #define FOREACH_OPERAND_TYPE_RT(n, t, v, fn, lt, rt) \ if (rt == arg1.Type) { \ TOperand<t, rt> rhs(traceVariables, var1, val1, arg1.ParamIdx); \ @@ -574,9 +574,9 @@ namespace NLWTrace { if ((arg0.ParamIdx == size_t(-1) || strcmp(tName0, n) == 0) && (arg1.ParamIdx == size_t(-1) || strcmp(tName1, n) == 0)) { \ FOREACH_LEFT_TYPE(FOREACH_OPERAND_TYPE_LT, n, t, v, fn); \ } - + bool invertCompare = EqualToOneOf(op.GetType(), OT_NE, OT_GE, OT_LE); - + switch (op.GetType()) { case OT_EQ: case OT_NE: @@ -595,8 +595,8 @@ namespace NLWTrace { << " has not supported operator type #" << int(op.GetType()); } -#undef FOREACH_OPERAND_TYPE_RT -#undef FOREACH_OPERAND_TYPE_LT +#undef FOREACH_OPERAND_TYPE_RT +#undef FOREACH_OPERAND_TYPE_LT #undef FOREACH_PARAMTYPE_MACRO if (!opExec) { @@ -731,13 +731,13 @@ namespace NLWTrace { actExec.Reset(new TExec(receiver, firstParam)); \ break; \ } - + #define PARSE_BINARY_INPLACE_STATEMENT_MACRO(n, t, v, fn) \ if (arg1.ParamIdx == size_t(-1) || strcmp(tName1, n) == 0) { \ TReceiver<t> receiver(traceVariables, var0); \ FOREACH_RIGHT_TYPE(PARSE_BINARY_INPLACE_STATEMENT_MACRO2, n, t, v, fn); \ } - + #define PARSE_BINARY_STATEMENT_MACRO2(n, t, v, fn, ft) \ if (arg1.Type == ft) { \ typedef TBinaryStatementExecutor<t, fn<t, t>, ft> TExec; \ @@ -745,20 +745,20 @@ namespace NLWTrace { actExec.Reset(new TExec(receiver, firstParam)); \ break; \ } - + #define PARSE_BINARY_STATEMENT_MACRO(n, t, v, fn) \ if (arg1.ParamIdx == size_t(-1) || strcmp(tName1, n) == 0) { \ TReceiver<t> receiver(traceVariables, var0); \ FOREACH_RIGHT_TYPE(PARSE_BINARY_STATEMENT_MACRO2, n, t, v, fn); \ } - + #define CREATE_OPERAND_GETTER_N(N, type, arg_type) \ if (arg##N.Type == arg_type) { \ - operand##N.Reset(new TOperandGetter<type, arg_type>(TOperand<type, arg_type>(traceVariables, var##N, val##N, arg##N.ParamIdx))); \ - } - + operand##N.Reset(new TOperandGetter<type, arg_type>(TOperand<type, arg_type>(traceVariables, var##N, val##N, arg##N.ParamIdx))); \ + } + #define TERNARY_ON_TYPE(n, t, v, fn) \ - if ((arg1.ParamIdx == size_t(-1) || strcmp(tName1, n) == 0) && (arg2.ParamIdx == size_t(-1) || strcmp(tName2, n) == 0)) { \ + if ((arg1.ParamIdx == size_t(-1) || strcmp(tName1, n) == 0) && (arg2.ParamIdx == size_t(-1) || strcmp(tName2, n) == 0)) { \ TAutoPtr<IOperandGetter<t>> operand1, operand2; \ FOREACH_LEFT_TYPE(CREATE_OPERAND_GETTER_N, 1, t); \ FOREACH_RIGHT_TYPE(CREATE_OPERAND_GETTER_N, 2, t); \ @@ -769,10 +769,10 @@ namespace NLWTrace { operand2)); \ } \ break; \ - } - -#define IMPLEMENT_TERNARY_STATEMENT(fn) FOR_MATH_PARAMTYPE(TERNARY_ON_TYPE, fn) - + } + +#define IMPLEMENT_TERNARY_STATEMENT(fn) FOR_MATH_PARAMTYPE(TERNARY_ON_TYPE, fn) + case ST_INC: FOR_MATH_PARAMTYPE(PARSE_UNARY_INPLACE_STATEMENT_MACRO, TInc); break; @@ -807,13 +807,13 @@ namespace NLWTrace { ythrow yexception() << "block #" << bi + 1 << " action #" << i + 1 << " has not supported statement type #" << int(statement.GetType()); } - } + } if (!actExec) { - ythrow yexception() << "block #" << bi + 1 << " action #" << i + 1 - << " can't create action"; + ythrow yexception() << "block #" << bi + 1 << " action #" << i + 1 + << " can't create action"; } -#undef CREATE_OPERAND_GETTER_N -#undef TERNARY_ON_TYPE +#undef CREATE_OPERAND_GETTER_N +#undef TERNARY_ON_TYPE #undef IMPLEMENT_TERNARY_STATEMENT #undef PARSE_TERNARY_STATEMENT_MACRO #undef PARSE_BINARY_STATEMENT_MACRO diff --git a/library/cpp/messagebus/actor/ring_buffer.h b/library/cpp/messagebus/actor/ring_buffer.h index ec5706f7c7..8b63149f4f 100644 --- a/library/cpp/messagebus/actor/ring_buffer.h +++ b/library/cpp/messagebus/actor/ring_buffer.h @@ -34,7 +34,7 @@ private: return; ui32 newCapacityPow = CapacityPow; - while ((1u << newCapacityPow) < sz + ui32(Size()) + 1u) { + while ((1u << newCapacityPow) < sz + ui32(Size()) + 1u) { ++newCapacityPow; } ui32 newCapacity = 1u << newCapacityPow; diff --git a/library/cpp/messagebus/remote_client_session.h b/library/cpp/messagebus/remote_client_session.h index 7160d0dae9..bde90a90b0 100644 --- a/library/cpp/messagebus/remote_client_session.h +++ b/library/cpp/messagebus/remote_client_session.h @@ -6,10 +6,10 @@ #include <util/generic/array_ref.h> #include <util/generic/object_counter.h> -#ifdef _MSC_VER -#pragma warning(push) +#ifdef _MSC_VER +#pragma warning(push) #pragma warning(disable : 4250) // 'NBus::NPrivate::TRemoteClientSession' : inherits 'NBus::NPrivate::TBusSessionImpl::NBus::NPrivate::TBusSessionImpl::GetConfig' via dominance -#endif +#endif namespace NBus { namespace NPrivate { @@ -51,9 +51,9 @@ namespace NBus { TBusClientConnectionPtr GetConnection(const TNetAddr&) override; }; -#ifdef _MSC_VER -#pragma warning(pop) -#endif - +#ifdef _MSC_VER +#pragma warning(pop) +#endif + } } diff --git a/library/cpp/messagebus/remote_server_session.h b/library/cpp/messagebus/remote_server_session.h index f5c266a7f7..3970a31aa6 100644 --- a/library/cpp/messagebus/remote_server_session.h +++ b/library/cpp/messagebus/remote_server_session.h @@ -3,10 +3,10 @@ #include "remote_server_session_semaphore.h" #include "session_impl.h" -#ifdef _MSC_VER -#pragma warning(push) +#ifdef _MSC_VER +#pragma warning(push) #pragma warning(disable : 4250) // 'NBus::NPrivate::TRemoteClientSession' : inherits 'NBus::NPrivate::TBusSessionImpl::NBus::NPrivate::TBusSessionImpl::GetConfig' via dominance -#endif +#endif namespace NBus { namespace NPrivate { @@ -46,9 +46,9 @@ namespace NBus { void ConvertInWork(TBusIdentity& req, TBusMessage* reply); }; -#ifdef _MSC_VER -#pragma warning(pop) -#endif - +#ifdef _MSC_VER +#pragma warning(pop) +#endif + } } diff --git a/library/cpp/messagebus/synchandler.cpp b/library/cpp/messagebus/synchandler.cpp index 8e891d66b3..821b778d30 100644 --- a/library/cpp/messagebus/synchandler.cpp +++ b/library/cpp/messagebus/synchandler.cpp @@ -91,11 +91,11 @@ private: namespace NBus { namespace NPrivate { -#ifdef _MSC_VER -#pragma warning(push) +#ifdef _MSC_VER +#pragma warning(push) #pragma warning(disable : 4250) // 'NBus::NPrivate::TRemoteClientSession' : inherits 'NBus::NPrivate::TBusSessionImpl::NBus::NPrivate::TBusSessionImpl::GetConfig' via dominance -#endif - +#endif + /////////////////////////////////////////////////////////////////////////// class TBusSyncSourceSessionImpl : private TSyncHandler @@ -147,12 +147,12 @@ namespace NBus { } }; -#ifdef _MSC_VER -#pragma warning(pop) -#endif +#ifdef _MSC_VER +#pragma warning(pop) +#endif } } - + TBusSyncSourceSession::TBusSyncSourceSession(TIntrusivePtr< ::NBus::NPrivate::TBusSyncSourceSessionImpl> session) : Session(session) { diff --git a/library/cpp/regex/pcre/regexp.h b/library/cpp/regex/pcre/regexp.h index bc610bd2f3..d91084eddd 100644 --- a/library/cpp/regex/pcre/regexp.h +++ b/library/cpp/regex/pcre/regexp.h @@ -9,7 +9,7 @@ #include <contrib/libs/pcre/pcre.h> #include <contrib/libs/pcre/pcreposix.h> -//THIS CODE LOOKS LIKE A TRASH, BUT WORKS. +//THIS CODE LOOKS LIKE A TRASH, BUT WORKS. #define NMATCHES 100 #define REGEXP_GLOBAL 0x0080 // use this if you want to find all occurences diff --git a/library/cpp/resource/registry.h b/library/cpp/resource/registry.h index fe67702cbc..336402ebe6 100644 --- a/library/cpp/resource/registry.h +++ b/library/cpp/resource/registry.h @@ -21,8 +21,8 @@ namespace NResource { virtual void FindMatch(const TStringBuf subkey, IMatch& cb) const = 0; virtual size_t Count() const noexcept = 0; virtual TStringBuf KeyByIndex(size_t idx) const = 0; - virtual ~IStore() { - } + virtual ~IStore() { + } }; IStore* CommonStore(); diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp index e523350b80..a445636fd6 100644 --- a/library/cpp/string_utils/quote/quote.cpp +++ b/library/cpp/string_utils/quote/quote.cpp @@ -77,9 +77,9 @@ static inline const char* FixZero(const char* s) noexcept { // '%', '&', '+', ',', // '#', '<', '=', '>', // '[', '\\',']', '?', -// ':', '{', '}', +// ':', '{', '}', // all below ' ' (0x20) and above '~' (0x7E). -// ' ' converted to '+' +// ' ' converted to '+' static const bool chars_to_url_escape[256] = { // 0 1 2 3 4 5 6 7 8 9 A B C D E F 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, //0 @@ -111,7 +111,7 @@ static inline It1 Escape(It1 to, It2 from, It3 end, const bool* escape_map = cha *to++ = d2x((unsigned char)*from >> 4); *to++ = d2x((unsigned char)*from & 0xF); } else { - *to++ = (*from == ' ' ? '+' : *from); + *to++ = (*from == ' ' ? '+' : *from); } ++from; @@ -123,7 +123,7 @@ static inline It1 Escape(It1 to, It2 from, It3 end, const bool* escape_map = cha } template <class It1, class It2, class It3, class FromHex> -static inline It1 Unescape(It1 to, It2 from, It3 end, FromHex fromHex) { +static inline It1 Unescape(It1 to, It2 from, It3 end, FromHex fromHex) { (void)fromHex; while (from != end) { @@ -167,8 +167,8 @@ TString CGIEscapeRet(const TStringBuf url) { to.ReserveAndResize(CgiEscapeBufLen(url.size())); to.resize(CGIEscape(to.begin(), url.data(), url.size()) - to.data()); return to; -} - +} + TString& AppendCgiEscaped(const TStringBuf value, TString& to) { const size_t origLength = to.length(); to.ReserveAndResize(origLength + CgiEscapeBufLen(value.size())); @@ -215,11 +215,11 @@ void Quote(TString& url, const char* safe) { } char* CGIUnescape(char* to, const char* from) { - return Unescape(to, FixZero(from), TCStringEndIterator(), TFromHexZeroTerm()); + return Unescape(to, FixZero(from), TCStringEndIterator(), TFromHexZeroTerm()); } -char* CGIUnescape(char* to, const char* from, size_t len) { - return Unescape(to, from, from + len, TFromHexLenLimited(from + len)); +char* CGIUnescape(char* to, const char* from, size_t len) { + return Unescape(to, from, from + len, TFromHexLenLimited(from + len)); } void CGIUnescape(TString& url) { @@ -240,8 +240,8 @@ TString CGIUnescapeRet(const TStringBuf from) { to.ReserveAndResize(CgiUnescapeBufLen(from.size())); to.resize(CGIUnescape(to.begin(), from.data(), from.size()) - to.data()); return to; -} - +} + char* UrlUnescape(char* to, TStringBuf from) { while (!from.empty()) { char ch = from[0]; diff --git a/library/cpp/string_utils/quote/quote.h b/library/cpp/string_utils/quote/quote.h index 3b7221154e..55150d31f6 100644 --- a/library/cpp/string_utils/quote/quote.h +++ b/library/cpp/string_utils/quote/quote.h @@ -3,11 +3,11 @@ #include <util/generic/strbuf.h> #include <util/generic/string.h> -//CGIEscape*: -// ' ' converted to '+', -// Some punctuation and chars outside [32, 126] range are converted to %xx -// Use function CgiEscapeBufLen to determine number of characters needed for 'char* to' parameter. -// Returns pointer to the end of the result string +//CGIEscape*: +// ' ' converted to '+', +// Some punctuation and chars outside [32, 126] range are converted to %xx +// Use function CgiEscapeBufLen to determine number of characters needed for 'char* to' parameter. +// Returns pointer to the end of the result string char* CGIEscape(char* to, const char* from); char* CGIEscape(char* to, const char* from, size_t len); inline char* CGIEscape(char* to, const TStringBuf from) { @@ -24,12 +24,12 @@ inline TStringBuf CgiEscape(void* tmp, const TStringBuf s) { return CgiEscapeBuf(static_cast<char*>(tmp), s); } -//CgiUnescape*: -// Decodes '%xx' to bytes, '+' to space. -// Use function CgiUnescapeBufLen to determine number of characters needed for 'char* to' parameter. -// If pointer returned, then this is pointer to the end of the result string. -char* CGIUnescape(char* to, const char* from); -char* CGIUnescape(char* to, const char* from, size_t len); +//CgiUnescape*: +// Decodes '%xx' to bytes, '+' to space. +// Use function CgiUnescapeBufLen to determine number of characters needed for 'char* to' parameter. +// If pointer returned, then this is pointer to the end of the result string. +char* CGIUnescape(char* to, const char* from); +char* CGIUnescape(char* to, const char* from, size_t len); void CGIUnescape(TString& url); TString CGIUnescapeRet(const TStringBuf from); @@ -40,29 +40,29 @@ inline TStringBuf CgiUnescape(void* tmp, const TStringBuf s) { return CgiUnescapeBuf(static_cast<char*>(tmp), s); } -//Quote: -// Is like CGIEscape, also skips encoding of user-supplied 'safe' characters. +//Quote: +// Is like CGIEscape, also skips encoding of user-supplied 'safe' characters. char* Quote(char* to, const char* from, const char* safe = "/"); char* Quote(char* to, const TStringBuf s, const char* safe = "/"); void Quote(TString& url, const char* safe = "/"); -//UrlEscape: -// Can't be used for cgi parameters ('&' character is not escaped)! +//UrlEscape: +// Can't be used for cgi parameters ('&' character is not escaped)! // escapes only '%' not followed by two hex-digits or if forceEscape set to ture, // and chars outside [32, 126] range. // Can't handle '\0'-chars in TString. char* UrlEscape(char* to, const char* from, bool forceEscape = false); void UrlEscape(TString& url, bool forceEscape = false); TString UrlEscapeRet(const TStringBuf from, bool forceEscape = false); - -//UrlUnescape: -// '+' is NOT converted to space! -// %xx converted to bytes, other characters are copied unchanged. + +//UrlUnescape: +// '+' is NOT converted to space! +// %xx converted to bytes, other characters are copied unchanged. char* UrlUnescape(char* to, TStringBuf from); void UrlUnescape(TString& url); TString UrlUnescapeRet(const TStringBuf from); -//*BufLen: how much characters you should allocate for 'char* to' buffers. +//*BufLen: how much characters you should allocate for 'char* to' buffers. constexpr size_t CgiEscapeBufLen(const size_t len) noexcept { return 3 * len + 1; } diff --git a/library/cpp/string_utils/quote/quote_ut.cpp b/library/cpp/string_utils/quote/quote_ut.cpp index 6c552b279e..056589b3eb 100644 --- a/library/cpp/string_utils/quote/quote_ut.cpp +++ b/library/cpp/string_utils/quote/quote_ut.cpp @@ -24,10 +24,10 @@ Y_UNIT_TEST_SUITE(TCGIEscapeTest) { UNIT_ASSERT_VALUES_EQUAL(CgiEscape(tmp, "!@#$%^&*(){}[]\" "), TStringBuf("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+")); } - + Y_UNIT_TEST(StrokaRet) { UNIT_ASSERT_VALUES_EQUAL(CGIEscapeRet("!@#$%^&*(){}[]\" "), TString("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+")); - } + } Y_UNIT_TEST(StrokaAppendRet) { TString param; @@ -82,7 +82,7 @@ Y_UNIT_TEST_SUITE(TCGIUnescapeTest) { CGIUnescape(r, "12%3g34"); UNIT_ASSERT_VALUES_EQUAL(r, "12%3g34"); - CGIUnescape(r, "%3u123"); + CGIUnescape(r, "%3u123"); UNIT_ASSERT_VALUES_EQUAL(r, "%3u123"); } @@ -114,13 +114,13 @@ Y_UNIT_TEST_SUITE(TCGIUnescapeTest) { CGIUnescape(r, "12%3g345678", 7); UNIT_ASSERT_VALUES_EQUAL(r, "12%3g34"); - CGIUnescape(r, "%3u1234", 2); + CGIUnescape(r, "%3u1234", 2); UNIT_ASSERT_VALUES_EQUAL(r, "%3"); - CGIUnescape(r, "%3u1234", 3); + CGIUnescape(r, "%3u1234", 3); UNIT_ASSERT_VALUES_EQUAL(r, "%3u"); - CGIUnescape(r, "%3u1234", 4); + CGIUnescape(r, "%3u1234", 4); UNIT_ASSERT_VALUES_EQUAL(r, "%3u1"); } diff --git a/library/cpp/string_utils/url/url.cpp b/library/cpp/string_utils/url/url.cpp index 85f4ac5d69..82887bd3a0 100644 --- a/library/cpp/string_utils/url/url.cpp +++ b/library/cpp/string_utils/url/url.cpp @@ -241,11 +241,11 @@ TStringBuf GetOnlyHost(const TStringBuf url) noexcept { TStringBuf GetPathAndQuery(const TStringBuf url, bool trimFragment) noexcept { const size_t off = url.find('/', GetHttpPrefixSize(url)); - TStringBuf hostUnused, path; - if (!url.TrySplitAt(off, hostUnused, path)) + TStringBuf hostUnused, path; + if (!url.TrySplitAt(off, hostUnused, path)) return "/"; - - return trimFragment ? path.Before('#') : path; + + return trimFragment ? path.Before('#') : path; } // this strange creature returns 2nd level domain, possibly with port @@ -311,15 +311,15 @@ TStringBuf CutMPrefix(const TStringBuf url) noexcept { } static inline bool IsSchemeChar(char c) noexcept { - return IsAsciiAlnum(c); //what about '+' ?.. + return IsAsciiAlnum(c); //what about '+' ?.. } static bool HasPrefix(const TStringBuf url) noexcept { - TStringBuf scheme, unused; + TStringBuf scheme, unused; if (!url.TrySplit(TStringBuf("://"), scheme, unused)) return false; - return AllOf(scheme, IsSchemeChar); + return AllOf(scheme, IsSchemeChar); } TString AddSchemePrefix(const TString& url) { diff --git a/library/cpp/xml/document/node-attr.h b/library/cpp/xml/document/node-attr.h index 6e74403943..1d187573bb 100644 --- a/library/cpp/xml/document/node-attr.h +++ b/library/cpp/xml/document/node-attr.h @@ -1,12 +1,12 @@ #pragma once -#include "xml-document-decl.h" +#include "xml-document-decl.h" #include "libxml-guards.h" #include <util/stream/str.h> #include <util/string/cast.h> namespace NXml { -#define THROW(x, y) ythrow yexception() << #x << ": " << y +#define THROW(x, y) ythrow yexception() << #x << ": " << y // libxml defines unsigned char -> xmlChar, // and all functions use xmlChar. @@ -40,7 +40,7 @@ namespace NXml { } T t; - AttrInternal(value, t, name); + AttrInternal(value, t, name); return t; } @@ -52,7 +52,7 @@ namespace NXml { } T t; - AttrInternal(attr, t, name); + AttrInternal(attr, t, name); return t; } @@ -63,7 +63,7 @@ namespace NXml { THROW(AttributeNotFound, Path() << name); } - AttrInternal(attr, value, name); + AttrInternal(attr, value, name); } template <class T> @@ -73,7 +73,7 @@ namespace NXml { if (!attr) { value = defvalue; } else { - AttrInternal(attr, value, name); + AttrInternal(attr, value, name); } } @@ -85,7 +85,7 @@ namespace NXml { TCharPtr val(xmlNodeGetContent(NodePointer)); T t; - AttrInternal(val, t, this->Name()); + AttrInternal(val, t, this->Name()); return t; } @@ -97,7 +97,7 @@ namespace NXml { TCharPtr val(xmlNodeGetContent(NodePointer)); T t; - AttrInternal(val, t, this->Name()); + AttrInternal(val, t, this->Name()); return t; } diff --git a/library/cpp/xml/document/xml-document-decl.h b/library/cpp/xml/document/xml-document-decl.h index bfda1fb7e6..db57ab1180 100644 --- a/library/cpp/xml/document/xml-document-decl.h +++ b/library/cpp/xml/document/xml-document-decl.h @@ -4,8 +4,8 @@ #include <util/generic/string.h> #include <util/generic/vector.h> -#include <util/stream/output.h> -#include <util/stream/str.h> +#include <util/stream/output.h> +#include <util/stream/str.h> #include <algorithm> #include "libxml-guards.h" @@ -48,20 +48,20 @@ namespace NXml { TConstNode Root() const; void Save(IOutputStream& stream, TZtStringBuf enc = "", bool shouldFormat = true) const { - int bufferSize = 0; - xmlChar* xmlBuff = nullptr; + int bufferSize = 0; + xmlChar* xmlBuff = nullptr; const char* encoding = enc.size() ? enc.data() : Doc->encoding ? nullptr : "UTF-8"; xmlDocDumpFormatMemoryEnc(Doc.Get(), &xmlBuff, &bufferSize, encoding, shouldFormat); - TCharPtr xmlCharBuffPtr(xmlBuff); - stream.Write(xmlBuff, bufferSize); - } + TCharPtr xmlCharBuffPtr(xmlBuff); + stream.Write(xmlBuff, bufferSize); + } TString ToString(TZtStringBuf enc = "", bool shouldFormat = true) const { - TStringStream s; + TStringStream s; Save(s, enc, shouldFormat); return s.Str(); - } - + } + void Swap(TDocument& that) { std::swap(this->Doc, that.Doc); } |