aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorOleg Sidorkin <osidorkin@gmail.com>2022-02-10 16:49:36 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:36 +0300
commit5ce74d4fee2d42a4b86efc02dfdc704d458760e1 (patch)
treef16a3558ca40d453a1c6a2ed764bd75d64cffade /library
parentcd33f9aa8461f8e2b0b9e68efbb6bc9856197dc9 (diff)
downloadydb-5ce74d4fee2d42a4b86efc02dfdc704d458760e1.tar.gz
Restoring authorship annotation for Oleg Sidorkin <osidorkin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library')
-rw-r--r--library/cpp/balloc/malloc-info.cpp2
-rw-r--r--library/cpp/cgiparam/cgiparam.h8
-rw-r--r--library/cpp/containers/flat_hash/flat_hash.h2
-rw-r--r--library/cpp/containers/flat_hash/lib/iterator.h8
-rw-r--r--library/cpp/containers/flat_hash/lib/map.h22
-rw-r--r--library/cpp/containers/sorted_vector/sorted_vector.h130
-rw-r--r--library/cpp/containers/sorted_vector/sorted_vector_ut.cpp42
-rw-r--r--library/cpp/containers/sorted_vector/ut/ya.make18
-rw-r--r--library/cpp/containers/sorted_vector/ya.make4
-rw-r--r--library/cpp/http/misc/httpreqdata.cpp6
-rw-r--r--library/cpp/http/misc/httpreqdata.h2
-rw-r--r--library/cpp/http/misc/httpreqdata_ut.cpp48
-rw-r--r--library/cpp/http/server/http.cpp10
-rw-r--r--library/cpp/http/server/http_ex.cpp4
-rw-r--r--library/cpp/logger/file.cpp8
-rw-r--r--library/cpp/logger/file.h2
-rw-r--r--library/cpp/logger/log.cpp4
-rw-r--r--library/cpp/on_disk/chunks/chunked_helpers.h32
-rw-r--r--library/cpp/scheme/scheme.cpp38
-rw-r--r--library/cpp/scheme/scheme.h8
-rw-r--r--library/cpp/scheme/scimpl.h124
-rw-r--r--library/cpp/scheme/scimpl_protobuf.cpp2
-rw-r--r--library/cpp/scheme/scimpl_select.rl66
-rw-r--r--library/cpp/scheme/tests/fuzz_json/lib/fuzz_json.cpp184
-rw-r--r--library/cpp/scheme/tests/fuzz_ops/lib/fuzz_ops.cpp6
-rw-r--r--library/cpp/scheme/tests/fuzz_ops/lib/vm_apply.cpp38
-rw-r--r--library/cpp/scheme/tests/ut/scheme_merge_ut.cpp2
-rw-r--r--library/cpp/scheme/tests/ut/scheme_path_ut.cpp30
-rw-r--r--library/cpp/scheme/tests/ut/scheme_proto_ut.cpp2
-rw-r--r--library/cpp/scheme/tests/ut/scheme_ut.cpp90
-rw-r--r--library/cpp/string_utils/quote/quote.cpp14
-rw-r--r--library/cpp/string_utils/quote/quote.h2
-rw-r--r--library/cpp/string_utils/quote/quote_ut.cpp34
-rw-r--r--library/cpp/threading/light_rw_lock/lightrwlock.h30
-rw-r--r--library/cpp/unicode/punycode/ut/ya.make6
-rw-r--r--library/cpp/unicode/punycode/ya.make6
-rw-r--r--library/cpp/xml/init/ptr.h6
37 files changed, 490 insertions, 490 deletions
diff --git a/library/cpp/balloc/malloc-info.cpp b/library/cpp/balloc/malloc-info.cpp
index 604b1fb145..a51d8eb852 100644
--- a/library/cpp/balloc/malloc-info.cpp
+++ b/library/cpp/balloc/malloc-info.cpp
@@ -11,7 +11,7 @@ extern "C" bool BallocDisabled();
namespace {
bool SetAllocParam(const char* name, const char* value) {
if (strcmp(name, "disable") == 0) {
- if (value == nullptr || strcmp(value, "false") != 0) {
+ if (value == nullptr || strcmp(value, "false") != 0) {
// all values other than "false" are considred to be "true" for compatibility
DisableBalloc();
} else {
diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h
index 87d1ab0ad4..5890580ab1 100644
--- a/library/cpp/cgiparam/cgiparam.h
+++ b/library/cpp/cgiparam/cgiparam.h
@@ -148,11 +148,11 @@ void TCgiParameters::ReplaceUnescaped(const TStringBuf key, TIter valuesBegin, c
}
// if there were less nodes than we need to insert then emplace the rest of the range
- if (valuesBegin != valuesEnd) {
- const TString keyStr = TString(key);
+ if (valuesBegin != valuesEnd) {
+ const TString keyStr = TString(key);
for (; valuesBegin != valuesEnd; ++valuesBegin) {
- emplace_hint(oldRange.second, keyStr, TString(*valuesBegin));
- }
+ emplace_hint(oldRange.second, keyStr, TString(*valuesBegin));
+ }
}
}
diff --git a/library/cpp/containers/flat_hash/flat_hash.h b/library/cpp/containers/flat_hash/flat_hash.h
index 582b8ae8f5..0fad098a59 100644
--- a/library/cpp/containers/flat_hash/flat_hash.h
+++ b/library/cpp/containers/flat_hash/flat_hash.h
@@ -42,7 +42,7 @@ using TDenseHashSetImpl =
namespace NFH {
-/* flat_map: Fast and highly customizable hash map.
+/* flat_map: Fast and highly customizable hash map.
*
* Most features would be available soon.
* Until that time we strongly insist on using only class aliases listed below.
diff --git a/library/cpp/containers/flat_hash/lib/iterator.h b/library/cpp/containers/flat_hash/lib/iterator.h
index f6b1e74355..bec518481b 100644
--- a/library/cpp/containers/flat_hash/lib/iterator.h
+++ b/library/cpp/containers/flat_hash/lib/iterator.h
@@ -65,10 +65,10 @@ public:
return &Cont_->Node(Idx_);
}
- const pointer operator->() const {
- return &Cont_->Node(Idx_);
- }
-
+ const pointer operator->() const {
+ return &Cont_->Node(Idx_);
+ }
+
bool operator==(const TIterator& rhs) const noexcept {
Y_ASSERT(Cont_ == rhs.Cont_);
return Idx_ == rhs.Idx_;
diff --git a/library/cpp/containers/flat_hash/lib/map.h b/library/cpp/containers/flat_hash/lib/map.h
index f77c318a61..42fa0dda35 100644
--- a/library/cpp/containers/flat_hash/lib/map.h
+++ b/library/cpp/containers/flat_hash/lib/map.h
@@ -4,8 +4,8 @@
#include "concepts/iterator.h"
#include <util/generic/algorithm.h>
-#include <util/generic/mapfindptr.h>
-
+#include <util/generic/mapfindptr.h>
+
namespace NFlatHash {
namespace NPrivate {
@@ -34,15 +34,15 @@ class TMap : private TTable<Hash,
NPrivate::TMapKeyGetter,
Probing,
SizeFitter,
- Expander>,
- public TMapOps<TMap<Key,
- T,
- Hash,
- KeyEqual,
- Container,
- Probing,
- SizeFitter,
- Expander>>
+ Expander>,
+ public TMapOps<TMap<Key,
+ T,
+ Hash,
+ KeyEqual,
+ Container,
+ Probing,
+ SizeFitter,
+ Expander>>
{
private:
using TBase = TTable<Hash,
diff --git a/library/cpp/containers/sorted_vector/sorted_vector.h b/library/cpp/containers/sorted_vector/sorted_vector.h
index 123539af9e..7a7550034e 100644
--- a/library/cpp/containers/sorted_vector/sorted_vector.h
+++ b/library/cpp/containers/sorted_vector/sorted_vector.h
@@ -12,35 +12,35 @@
namespace NSorted {
namespace NPrivate {
- template <class TPredicate>
+ template <class TPredicate>
struct TEqual {
- template<typename TValueType1, typename TValueType2>
- inline bool operator()(const TValueType1& l, const TValueType2& r) const {
+ template<typename TValueType1, typename TValueType2>
+ inline bool operator()(const TValueType1& l, const TValueType2& r) const {
TPredicate comp;
return comp(l, r) == comp(r, l);
}
};
- template <typename TValueType, class TPredicate, class TKeyExtractor>
+ template <typename TValueType, class TPredicate, class TKeyExtractor>
struct TKeyCompare {
inline bool operator()(const TValueType& l, const TValueType& r) const {
TKeyExtractor extractKey;
return TPredicate()(extractKey(l), extractKey(r));
}
- template<typename TKeyType>
+ template<typename TKeyType>
inline bool operator()(const TKeyType& l, const TValueType& r) const {
return TPredicate()(l, TKeyExtractor()(r));
}
- template<typename TKeyType>
+ template<typename TKeyType>
inline bool operator()(const TValueType& l, const TKeyType& r) const {
return TPredicate()(TKeyExtractor()(l), r);
}
};
template <typename TValueType, class TPredicate>
- struct TKeyCompare<TValueType, TPredicate, TIdentity> {
- template <typename TValueType1, typename TValueType2>
- inline bool operator()(const TValueType1& l, const TValueType2& r) const {
+ struct TKeyCompare<TValueType, TPredicate, TIdentity> {
+ template <typename TValueType1, typename TValueType2>
+ inline bool operator()(const TValueType1& l, const TValueType2& r) const {
return TPredicate()(l, r);
}
};
@@ -53,9 +53,9 @@ namespace NSorted {
class TSortedVector: public TVector<TValueType, A> {
private:
typedef TVector<TValueType, A> TBase;
- typedef NPrivate::TKeyCompare<TValueType, TPredicate, TKeyExtractor> TKeyCompare;
- typedef NPrivate::TEqual<TKeyCompare> TValueEqual;
- typedef NPrivate::TEqual<TPredicate> TKeyEqual;
+ typedef NPrivate::TKeyCompare<TValueType, TPredicate, TKeyExtractor> TKeyCompare;
+ typedef NPrivate::TEqual<TKeyCompare> TValueEqual;
+ typedef NPrivate::TEqual<TPredicate> TKeyEqual;
public:
typedef TValueType value_type;
@@ -197,8 +197,8 @@ namespace NSorted {
this->MakeUnique();
}
- template<class K>
- inline const_iterator Find(const K& key) const {
+ template<class K>
+ inline const_iterator Find(const K& key) const {
const_iterator i = LowerBound(key);
if (i == TBase::end() || !TKeyEqual()(TKeyExtractor()(*i), key))
return TBase::end();
@@ -207,13 +207,13 @@ namespace NSorted {
}
// STL-compatible synonym
- template<class K>
- Y_FORCE_INLINE const_iterator find(const K& key) const {
+ template<class K>
+ Y_FORCE_INLINE const_iterator find(const K& key) const {
return this->Find(key);
}
- template<class K>
- inline iterator Find(const K& key) {
+ template<class K>
+ inline iterator Find(const K& key) {
iterator i = LowerBound(key);
if (i == TBase::end() || !TKeyEqual()(TKeyExtractor()(*i), key))
return TBase::end();
@@ -222,89 +222,89 @@ namespace NSorted {
}
// STL-compatible synonym
- template<class K>
- Y_FORCE_INLINE iterator find(const K& key) {
+ template<class K>
+ Y_FORCE_INLINE iterator find(const K& key) {
return this->Find(key);
}
- template<class K>
- Y_FORCE_INLINE bool Has(const K& key) const {
+ template<class K>
+ Y_FORCE_INLINE bool Has(const K& key) const {
return this->find(key) != TBase::end();
}
- template<class K>
- Y_FORCE_INLINE bool has(const K& key) const {
+ template<class K>
+ Y_FORCE_INLINE bool has(const K& key) const {
return this->Has(key);
}
- template<class K>
- Y_FORCE_INLINE iterator LowerBound(const K& key) {
+ template<class K>
+ Y_FORCE_INLINE iterator LowerBound(const K& key) {
return ::LowerBound(TBase::begin(), TBase::end(), key, TKeyCompare());
}
// STL-compatible synonym
- template<class K>
- Y_FORCE_INLINE iterator lower_bound(const K& key) {
+ template<class K>
+ Y_FORCE_INLINE iterator lower_bound(const K& key) {
return this->LowerBound(key);
}
- template<class K>
- Y_FORCE_INLINE const_iterator LowerBound(const K& key) const {
+ template<class K>
+ Y_FORCE_INLINE const_iterator LowerBound(const K& key) const {
return ::LowerBound(TBase::begin(), TBase::end(), key, TKeyCompare());
}
// STL-compatible synonym
- template<class K>
- Y_FORCE_INLINE const_iterator lower_bound(const K& key) const {
+ template<class K>
+ Y_FORCE_INLINE const_iterator lower_bound(const K& key) const {
return this->LowerBound(key);
}
- template<class K>
- Y_FORCE_INLINE iterator UpperBound(const K& key) {
+ template<class K>
+ Y_FORCE_INLINE iterator UpperBound(const K& key) {
return ::UpperBound(TBase::begin(), TBase::end(), key, TKeyCompare());
}
// STL-compatible synonym
- template<class K>
- Y_FORCE_INLINE iterator upper_bound(const K& key) {
+ template<class K>
+ Y_FORCE_INLINE iterator upper_bound(const K& key) {
return this->UpperBound(key);
}
- template<class K>
- Y_FORCE_INLINE const_iterator UpperBound(const K& key) const {
+ template<class K>
+ Y_FORCE_INLINE const_iterator UpperBound(const K& key) const {
return ::UpperBound(TBase::begin(), TBase::end(), key, TKeyCompare());
}
// STL-compatible synonym
- template<class K>
- Y_FORCE_INLINE const_iterator upper_bound(const K& key) const {
+ template<class K>
+ Y_FORCE_INLINE const_iterator upper_bound(const K& key) const {
return this->UpperBound(key);
}
- template<class K>
- Y_FORCE_INLINE std::pair<iterator, iterator> EqualRange(const K& key) {
+ template<class K>
+ Y_FORCE_INLINE std::pair<iterator, iterator> EqualRange(const K& key) {
return std::equal_range(TBase::begin(), TBase::end(), key, TKeyCompare());
}
// STL-compatible synonym
- template<class K>
- Y_FORCE_INLINE std::pair<iterator, iterator> equal_range(const K& key) {
+ template<class K>
+ Y_FORCE_INLINE std::pair<iterator, iterator> equal_range(const K& key) {
return this->EqualRange(key);
}
- template<class K>
- Y_FORCE_INLINE std::pair<const_iterator, const_iterator> EqualRange(const K& key) const {
+ template<class K>
+ Y_FORCE_INLINE std::pair<const_iterator, const_iterator> EqualRange(const K& key) const {
return std::equal_range(TBase::begin(), TBase::end(), key, TKeyCompare());
}
// STL-compatible synonym
- template<class K>
- Y_FORCE_INLINE std::pair<const_iterator, const_iterator> equal_range(const K& key) const {
+ template<class K>
+ Y_FORCE_INLINE std::pair<const_iterator, const_iterator> equal_range(const K& key) const {
return this->EqualRange(key);
}
- template<class K>
- inline void Erase(const K& key) {
+ template<class K>
+ inline void Erase(const K& key) {
std::pair<iterator, iterator> res = EqualRange(key);
TBase::erase(res.first, res.second);
}
@@ -314,8 +314,8 @@ namespace NSorted {
this->Erase(key);
}
- template<class K>
- inline size_t count(const K& key) const {
+ template<class K>
+ inline size_t count(const K& key) const {
const std::pair<const_iterator, const_iterator> range = this->EqualRange(key);
return std::distance(range.first, range.second);
}
@@ -369,19 +369,19 @@ namespace NSorted {
return i->second;
}
- template<class K>
- inline const TValueType& Get(const K& key, const TValueType& def) const {
+ template<class K>
+ inline const TValueType& Get(const K& key, const TValueType& def) const {
typename TBase::const_iterator i = TBase::Find(key);
return i != TBase::end() ? i->second : def;
}
- template<class K>
- Y_FORCE_INLINE TValueType& operator[](const K& key) {
+ template<class K>
+ Y_FORCE_INLINE TValueType& operator[](const K& key) {
return Get(key);
}
- template<class K>
- const TValueType& at(const K& key) const {
+ template<class K>
+ const TValueType& at(const K& key) const {
const auto i = TBase::Find(key);
if (i == TBase::end()) {
throw std::out_of_range("NSorted::TSimpleMap: missing key");
@@ -390,8 +390,8 @@ namespace NSorted {
return i->second;
}
- template<class K>
- TValueType& at(const K& key) {
+ template<class K>
+ TValueType& at(const K& key) {
return const_cast<TValueType&>(
const_cast<const TSimpleMap<TKeyType, TValueType, TPredicate, A>*>(this)->at(key));
}
@@ -412,7 +412,7 @@ namespace NSorted {
typedef typename TBase::iterator iterator;
typedef typename TBase::const_iterator const_iterator;
typedef typename TBase::size_type size_type;
- typedef NPrivate::TEqual<TPredicate> TKeyEqual;
+ typedef NPrivate::TEqual<TPredicate> TKeyEqual;
public:
inline TSimpleSet()
@@ -441,14 +441,14 @@ namespace NSorted {
return *i;
}
- template<class K>
- inline const TValueType& Get(const K& key, const TValueType& def) const {
+ template<class K>
+ inline const TValueType& Get(const K& key, const TValueType& def) const {
typename TBase::const_iterator i = TBase::Find(key);
return i != TBase::end() ? *i : def;
}
- template<class K>
- Y_FORCE_INLINE TValueType& operator[](const K& key) {
+ template<class K>
+ Y_FORCE_INLINE TValueType& operator[](const K& key) {
return Get(key);
}
diff --git a/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp b/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp
index 893862f098..4eaa28bc16 100644
--- a/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp
+++ b/library/cpp/containers/sorted_vector/sorted_vector_ut.cpp
@@ -1,24 +1,24 @@
-#include "sorted_vector.h"
-
+#include "sorted_vector.h"
+
#include <library/cpp/testing/unittest/registar.h>
-
-#include <util/generic/string.h>
-#include <util/generic/strbuf.h>
-
-Y_UNIT_TEST_SUITE(TestSimpleMap) {
-
- Y_UNIT_TEST(TestFindPrt) {
- NSorted::TSimpleMap<TString, TString> map(
- {std::make_pair(TString("a"), TString("a")), std::make_pair(TString("b"), TString("b"))});
-
- UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr(TString("a")), nullptr);
- UNIT_ASSERT_VALUES_EQUAL(map.FindPtr(TString("c")), nullptr);
-
+
+#include <util/generic/string.h>
+#include <util/generic/strbuf.h>
+
+Y_UNIT_TEST_SUITE(TestSimpleMap) {
+
+ Y_UNIT_TEST(TestFindPrt) {
+ NSorted::TSimpleMap<TString, TString> map(
+ {std::make_pair(TString("a"), TString("a")), std::make_pair(TString("b"), TString("b"))});
+
+ UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr(TString("a")), nullptr);
+ UNIT_ASSERT_VALUES_EQUAL(map.FindPtr(TString("c")), nullptr);
+
UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr(TStringBuf("a")), nullptr);
UNIT_ASSERT_VALUES_EQUAL(map.FindPtr(TStringBuf("c")), nullptr);
-
- UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr("a"), nullptr);
- UNIT_ASSERT_VALUES_EQUAL(map.FindPtr("c"), nullptr);
- }
-
-}
+
+ UNIT_ASSERT_VALUES_UNEQUAL(map.FindPtr("a"), nullptr);
+ UNIT_ASSERT_VALUES_EQUAL(map.FindPtr("c"), nullptr);
+ }
+
+}
diff --git a/library/cpp/containers/sorted_vector/ut/ya.make b/library/cpp/containers/sorted_vector/ut/ya.make
index eb8a5b4bef..f509db58c5 100644
--- a/library/cpp/containers/sorted_vector/ut/ya.make
+++ b/library/cpp/containers/sorted_vector/ut/ya.make
@@ -1,10 +1,10 @@
UNITTEST_FOR(library/cpp/containers/sorted_vector)
-
-OWNER(udovichenko-r)
-
-
-SRCS(
- sorted_vector_ut.cpp
-)
-
-END()
+
+OWNER(udovichenko-r)
+
+
+SRCS(
+ sorted_vector_ut.cpp
+)
+
+END()
diff --git a/library/cpp/containers/sorted_vector/ya.make b/library/cpp/containers/sorted_vector/ya.make
index 1975c5dc90..e8923b1db2 100644
--- a/library/cpp/containers/sorted_vector/ya.make
+++ b/library/cpp/containers/sorted_vector/ya.make
@@ -7,5 +7,5 @@ SRCS(
)
END()
-
-RECURSE_FOR_TESTS(ut)
+
+RECURSE_FOR_TESTS(ut)
diff --git a/library/cpp/http/misc/httpreqdata.cpp b/library/cpp/http/misc/httpreqdata.cpp
index f6951f68cd..eeb1bb80dd 100644
--- a/library/cpp/http/misc/httpreqdata.cpp
+++ b/library/cpp/http/misc/httpreqdata.cpp
@@ -184,9 +184,9 @@ void TBaseServerRequestData::AddHeader(const TString& name, const TString& value
if (stricmp(name.data(), "Host") == 0) {
size_t hostLen = strcspn(value.data(), ":");
- if (value[hostLen] == ':')
- Port = value.substr(hostLen + 1);
- Host = value.substr(0, hostLen);
+ if (value[hostLen] == ':')
+ Port = value.substr(hostLen + 1);
+ Host = value.substr(0, hostLen);
}
}
diff --git a/library/cpp/http/misc/httpreqdata.h b/library/cpp/http/misc/httpreqdata.h
index 16e59c4d78..1f6597e68e 100644
--- a/library/cpp/http/misc/httpreqdata.h
+++ b/library/cpp/http/misc/httpreqdata.h
@@ -115,7 +115,7 @@ public:
{
Scan();
}
-
+
void Scan() {
CgiParam.Scan(QueryStringBuf());
}
diff --git a/library/cpp/http/misc/httpreqdata_ut.cpp b/library/cpp/http/misc/httpreqdata_ut.cpp
index e7f16ef27c..76b1a53677 100644
--- a/library/cpp/http/misc/httpreqdata_ut.cpp
+++ b/library/cpp/http/misc/httpreqdata_ut.cpp
@@ -6,42 +6,42 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
Y_UNIT_TEST(Headers) {
TServerRequestData sd;
- sd.AddHeader("x-xx", "y-yy");
- sd.AddHeader("x-Xx", "y-yy");
+ sd.AddHeader("x-xx", "y-yy");
+ sd.AddHeader("x-Xx", "y-yy");
UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 1);
- sd.AddHeader("x-XxX", "y-yyy");
+ sd.AddHeader("x-XxX", "y-yyy");
UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 2);
UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy"));
UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XXX")), TStringBuf("y-yyy"));
}
Y_UNIT_TEST(ComplexHeaders) {
- TServerRequestData sd;
- sd.SetHost("zzz", 1);
-
- sd.AddHeader("x-Xx", "y-yy");
- UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 1);
+ TServerRequestData sd;
+ sd.SetHost("zzz", 1);
+
+ sd.AddHeader("x-Xx", "y-yy");
+ UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 1);
UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-XX")), TStringBuf("y-yy"));
-
- sd.AddHeader("x-Xz", "y-yy");
- UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 2);
+
+ sd.AddHeader("x-Xz", "y-yy");
+ UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 2);
UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("X-Xz")), TStringBuf("y-yy"));
-
- UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "zzz");
- UNIT_ASSERT_VALUES_EQUAL(sd.ServerPort(), "1");
- sd.AddHeader("Host", "1234");
- UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 3);
+
+ UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "zzz");
+ UNIT_ASSERT_VALUES_EQUAL(sd.ServerPort(), "1");
+ sd.AddHeader("Host", "1234");
+ UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 3);
UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("1234"));
- UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "1234");
- sd.AddHeader("Host", "12345:678");
- UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 3);
+ UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "1234");
+ sd.AddHeader("Host", "12345:678");
+ UNIT_ASSERT_VALUES_EQUAL(sd.HeadersCount(), 3);
UNIT_ASSERT_VALUES_EQUAL(TStringBuf(sd.HeaderIn("Host")), TStringBuf("12345:678"));
- UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "12345");
- UNIT_ASSERT_VALUES_EQUAL(sd.ServerPort(), "678");
- }
-
+ UNIT_ASSERT_VALUES_EQUAL(sd.ServerName(), "12345");
+ UNIT_ASSERT_VALUES_EQUAL(sd.ServerPort(), "678");
+ }
+
Y_UNIT_TEST(ParseScan) {
TServerRequestData rd;
@@ -133,7 +133,7 @@ Y_UNIT_TEST_SUITE(TRequestServerDataTest) {
UNIT_ASSERT(rd.CgiParam.Has("gta", "true"));
UNIT_ASSERT(rd.CgiParam.Has("gta", "new"));
}
-
+
Y_UNIT_TEST(SetRemoteAddrSimple) {
static const TString TEST = "abacaba.search.yandex.net";
diff --git a/library/cpp/http/server/http.cpp b/library/cpp/http/server/http.cpp
index 128583bdd7..653e0a15f1 100644
--- a/library/cpp/http/server/http.cpp
+++ b/library/cpp/http/server/http.cpp
@@ -695,13 +695,13 @@ void TClientRequest::Process(void* ThreadSpecificResource) {
HttpConn_->Output()->EnableCompression(HttpServ()->Options().CompressionEnabled);
}
- if (ParsedHeaders.empty()) {
- RequestString = Input().FirstLine();
+ if (ParsedHeaders.empty()) {
+ RequestString = Input().FirstLine();
const THttpHeaders& h = Input().Headers();
- ParsedHeaders.reserve(h.Count());
+ ParsedHeaders.reserve(h.Count());
for (THttpHeaders::TConstIterator it = h.Begin(); it != h.End(); ++it) {
- ParsedHeaders.emplace_back(it->Name(), it->Value());
+ ParsedHeaders.emplace_back(it->Name(), it->Value());
}
}
@@ -750,7 +750,7 @@ void TClientRequest::ProcessFailRequest(int failstate) {
++idx;
}
- url = RequestString.substr(start, idx - start);
+ url = RequestString.substr(start, idx - start);
}
}
diff --git a/library/cpp/http/server/http_ex.cpp b/library/cpp/http/server/http_ex.cpp
index e07db22bfc..f2763f7912 100644
--- a/library/cpp/http/server/http_ex.cpp
+++ b/library/cpp/http/server/http_ex.cpp
@@ -22,10 +22,10 @@ bool THttpClientRequestExtension::Parse(char* req, TBaseServerRequestData& rd) {
bool THttpClientRequestExtension::ProcessHeaders(TBaseServerRequestData& rd, TBlob& postData) {
for (const auto& header : ParsedHeaders) {
- rd.AddHeader(header.first, header.second);
+ rd.AddHeader(header.first, header.second);
}
- char* s = RequestString.begin();
+ char* s = RequestString.begin();
enum EMethod {
NotImplemented,
diff --git a/library/cpp/logger/file.cpp b/library/cpp/logger/file.cpp
index 15a4946eda..e7cef960f3 100644
--- a/library/cpp/logger/file.cpp
+++ b/library/cpp/logger/file.cpp
@@ -52,8 +52,8 @@ void TFileLogBackend::WriteData(const TLogRecord& rec) {
}
void TFileLogBackend::ReopenLog() {
- TAtomicSharedPtr<TImpl> copy = Impl_;
- if (copy) {
- copy->ReopenLog();
- }
+ TAtomicSharedPtr<TImpl> copy = Impl_;
+ if (copy) {
+ copy->ReopenLog();
+ }
}
diff --git a/library/cpp/logger/file.h b/library/cpp/logger/file.h
index 10b4cd0c20..f8caacce08 100644
--- a/library/cpp/logger/file.h
+++ b/library/cpp/logger/file.h
@@ -15,5 +15,5 @@ public:
private:
class TImpl;
- TAtomicSharedPtr<TImpl> Impl_;
+ TAtomicSharedPtr<TImpl> Impl_;
};
diff --git a/library/cpp/logger/log.cpp b/library/cpp/logger/log.cpp
index e1d70cc3d2..98aff73b39 100644
--- a/library/cpp/logger/log.cpp
+++ b/library/cpp/logger/log.cpp
@@ -178,8 +178,8 @@ void TLog::AddLogVAList(const char* format, va_list lst) {
void TLog::ReopenLog() {
if (const auto copy = Impl_) {
- copy->ReopenLog();
- }
+ copy->ReopenLog();
+ }
}
void TLog::ReopenLogNoFlush() {
diff --git a/library/cpp/on_disk/chunks/chunked_helpers.h b/library/cpp/on_disk/chunks/chunked_helpers.h
index 5fa96afdca..9003ab74ba 100644
--- a/library/cpp/on_disk/chunks/chunked_helpers.h
+++ b/library/cpp/on_disk/chunks/chunked_helpers.h
@@ -175,12 +175,12 @@ protected:
static TKey GetFirst(const void* self) {
static constexpr size_t offset = offsetof(TThis, Key);
- return ReadUnaligned<TKey>(reinterpret_cast<const char*>(self) + offset);
+ return ReadUnaligned<TKey>(reinterpret_cast<const char*>(self) + offset);
}
static TValue GetSecond(const void* self) {
static constexpr size_t offset = offsetof(TThis, Value);
- return ReadUnaligned<TValue>(reinterpret_cast<const char*>(self) + offset);
+ return ReadUnaligned<TValue>(reinterpret_cast<const char*>(self) + offset);
}
};
#pragma pack(pop)
@@ -205,16 +205,16 @@ protected:
, Length(length)
{
}
-
- static inline ui32 GetOffset(const TInterval* self) {
- static constexpr size_t offset = offsetof(TInterval, Offset);
- return ReadUnaligned<ui32>(reinterpret_cast<const char*>(self) + offset);
- }
-
- static inline ui32 GetLength(const TInterval* self) {
- static constexpr size_t offset = offsetof(TInterval, Length);
- return ReadUnaligned<ui32>(reinterpret_cast<const char*>(self) + offset);
- }
+
+ static inline ui32 GetOffset(const TInterval* self) {
+ static constexpr size_t offset = offsetof(TInterval, Offset);
+ return ReadUnaligned<ui32>(reinterpret_cast<const char*>(self) + offset);
+ }
+
+ static inline ui32 GetLength(const TInterval* self) {
+ static constexpr size_t offset = offsetof(TInterval, Length);
+ return ReadUnaligned<ui32>(reinterpret_cast<const char*>(self) + offset);
+ }
};
#pragma pack(pop)
static_assert(8 == sizeof(TInterval), "expect 8 == sizeof(TInterval)");
@@ -350,10 +350,10 @@ public:
bool Find(typename TTypeTraits<TKey>::TFuncParam key, TValue* res) const {
// Cerr << GetBits() << "\t" << (1 << GetBits()) << "\t" << GetSize() << Endl;
const ui32 hash = KeyHash<TKey>(key, GetBits());
- const TInterval* intervalPtr = GetIntervals();
- const TKeyValuePair* pair = GetData() + TInterval::GetOffset(intervalPtr + hash);
- const ui32 length = TInterval::GetLength(intervalPtr + hash);
- for (ui32 i = 0; i < length; ++i, ++pair) {
+ const TInterval* intervalPtr = GetIntervals();
+ const TKeyValuePair* pair = GetData() + TInterval::GetOffset(intervalPtr + hash);
+ const ui32 length = TInterval::GetLength(intervalPtr + hash);
+ for (ui32 i = 0; i < length; ++i, ++pair) {
if (TKeyValuePair::GetFirst(pair) == key) {
*res = TKeyValuePair::GetSecond(pair);
return true;
diff --git a/library/cpp/scheme/scheme.cpp b/library/cpp/scheme/scheme.cpp
index 3efd116d4f..b3d555e459 100644
--- a/library/cpp/scheme/scheme.cpp
+++ b/library/cpp/scheme/scheme.cpp
@@ -161,7 +161,7 @@ namespace NSc {
return *this;
}
- CoreMutableForSet(); // trigger COW
+ CoreMutableForSet(); // trigger COW
TScCore& selfCore = *TheCore;
const TScCore& otherCore = other.Core();
@@ -191,28 +191,28 @@ namespace NSc {
selfCore.SetNumber(otherCore.FloatNumber);
break;
case EType::String:
- if (selfCore.Pool.Get() == otherCore.Pool.Get()) {
- selfCore.SetOwnedString(otherCore.String);
- } else {
- selfCore.SetString(otherCore.String);
- }
+ if (selfCore.Pool.Get() == otherCore.Pool.Get()) {
+ selfCore.SetOwnedString(otherCore.String);
+ } else {
+ selfCore.SetString(otherCore.String);
+ }
break;
case EType::Array:
selfCore.SetArray();
for (const TValue& e : otherCore.GetArray()) {
- selfCore.Push().DoCopyFromImpl(e, otherLoopCtx, selfOverrideCtx);
+ selfCore.Push().DoCopyFromImpl(e, otherLoopCtx, selfOverrideCtx);
}
break;
case EType::Dict: {
- TCorePtr tmp = NewCore(selfCore.Pool);
- auto& tmpCore = *tmp;
- tmpCore.SetDict();
+ TCorePtr tmp = NewCore(selfCore.Pool);
+ auto& tmpCore = *tmp;
+ tmpCore.SetDict();
const TDict& d = otherCore.GetDict();
- tmpCore.Dict.reserve(d.size());
+ tmpCore.Dict.reserve(d.size());
for (const TDict::value_type& e : d) {
- tmpCore.Add(e.first).DoCopyFromImpl(e.second, otherLoopCtx, selfOverrideCtx);
+ tmpCore.Add(e.first).DoCopyFromImpl(e.second, otherLoopCtx, selfOverrideCtx);
}
- TheCore = std::move(tmp);
+ TheCore = std::move(tmp);
break;
}
}
@@ -231,7 +231,7 @@ namespace NSc {
}
bool TValue::SamePool(const TValue& a, const TValue& b) {
- return Same(a, b) || a.TheCore->Pool.Get() == b.TheCore->Pool.Get();
+ return Same(a, b) || a.TheCore->Pool.Get() == b.TheCore->Pool.Get();
}
bool TValue::Equal(const TValue& a, const TValue& b) {
@@ -323,7 +323,7 @@ namespace NSc {
const TDict& ddelta = deltaCore.Dict;
for (const auto& dit : ddelta) {
- core.GetOrAdd(dit.first).DoMergeImpl(dit.second, lowPriorityDelta, otherLoopCtx, selfOverrideGuard);
+ core.GetOrAdd(dit.first).DoMergeImpl(dit.second, lowPriorityDelta, otherLoopCtx, selfOverrideGuard);
}
} else if (!delta.IsNull() && (!lowPriorityDelta || IsNull())) {
DoCopyFromImpl(delta, otherLoopCtx, selfOverrideGuard);
@@ -394,7 +394,7 @@ namespace NSc {
}
TValue& TValue::FromJsonValue(TValue& res, const NJson::TJsonValue& val) {
- TScCore& core = res.CoreMutableForSet();
+ TScCore& core = res.CoreMutableForSet();
core.SetNull();
switch (val.GetType()) {
@@ -415,19 +415,19 @@ namespace NSc {
core.SetNumber(val.GetDouble());
break;
case NJson::JSON_STRING:
- core.SetString(val.GetString());
+ core.SetString(val.GetString());
break;
case NJson::JSON_ARRAY: {
core.SetArray();
for (const auto& item : val.GetArray()) {
- FromJsonValue(core.Push(), item);
+ FromJsonValue(core.Push(), item);
}
break;
}
case NJson::JSON_MAP: {
core.SetDict();
for (const auto& item : val.GetMap()) {
- FromJsonValue(core.Add(item.first), item.second);
+ FromJsonValue(core.Add(item.first), item.second);
}
break;
}
diff --git a/library/cpp/scheme/scheme.h b/library/cpp/scheme/scheme.h
index 3d7c59f3c9..1b6f5d8323 100644
--- a/library/cpp/scheme/scheme.h
+++ b/library/cpp/scheme/scheme.h
@@ -193,7 +193,7 @@ namespace NSc {
inline bool Has(size_t idx) const;
inline const TValue& Get(size_t idx) const; // returns child or default
- inline TValue* GetNoAdd(size_t idx); // returns link to existing child or nullptr
+ inline TValue* GetNoAdd(size_t idx); // returns link to existing child or nullptr
inline TValue& Push(); // returns new child
@@ -260,7 +260,7 @@ namespace NSc {
inline bool Has(TStringBuf idx) const;
inline const TValue& Get(TStringBuf idx) const;
- inline TValue* GetNoAdd(TStringBuf idx); // returns link to existing child or nullptr
+ inline TValue* GetNoAdd(TStringBuf idx); // returns link to existing child or nullptr
TValue& Add(TStringBuf idx) {
return GetOrAdd(idx);
@@ -364,7 +364,7 @@ namespace NSc {
// if the path is syntactically valid and the target value exists
// otherwise returns NSc::Null()
- TValue* TrySelectOrAdd(TStringBuf path); // returns the target value if it exists or creates if not
+ TValue* TrySelectOrAdd(TStringBuf path); // returns the target value if it exists or creates if not
// if the path is syntactically valid
// otherwise returns NSc::Null()
@@ -413,7 +413,7 @@ namespace NSc {
bool IsSameOrAncestorOfImpl(const TScCore& other, NImpl::TSelfLoopContext& loopCtx) const;
inline TScCore& CoreMutable();
- inline TScCore& CoreMutableForSet();
+ inline TScCore& CoreMutableForSet();
inline const TScCore& Core() const;
static inline TScCore* NewCore(TPoolPtr&);
diff --git a/library/cpp/scheme/scimpl.h b/library/cpp/scheme/scimpl.h
index 4f68f16290..ce9539dfa0 100644
--- a/library/cpp/scheme/scimpl.h
+++ b/library/cpp/scheme/scimpl.h
@@ -6,7 +6,7 @@
namespace NSc {
struct TValue::TScCore : TAtomicRefCount<TScCore, TDestructor>, TNonCopyable {
- TPoolPtr Pool;
+ TPoolPtr Pool;
double FloatNumber = 0;
i64 IntNumber = 0;
TStringBuf String;
@@ -15,9 +15,9 @@ namespace NSc {
TValue::EType ValueType = TValue::EType::Null;
TScCore(TPoolPtr& p)
- : Pool(p)
- , Dict(Pool->Get())
- , Array(Pool->Get())
+ : Pool(p)
+ , Dict(Pool->Get())
+ , Array(Pool->Get())
{
}
@@ -90,13 +90,13 @@ namespace NSc {
IntNumber = b;
}
- void SetString(TStringBuf s) {
- SetOwnedString(Pool->AppendBuf(s));
- }
-
- void SetOwnedString(TStringBuf s) {
+ void SetString(TStringBuf s) {
+ SetOwnedString(Pool->AppendBuf(s));
+ }
+
+ void SetOwnedString(TStringBuf s) {
ValueType = TValue::EType::String;
- String = s;
+ String = s;
}
double& GetNumberMutable(double defaultnum) {
@@ -208,9 +208,9 @@ namespace NSc {
a.back().CopyOnWrite = false;
}
- TValue& Push() {
+ TValue& Push() {
SetArray();
- DoPush(Pool, Array);
+ DoPush(Pool, Array);
return Array.back();
}
@@ -228,36 +228,36 @@ namespace NSc {
return IsArray() && Array.size() > key ? Array[key] : TValue::DefaultValue();
}
- TValue* GetNoAdd(size_t key) {
- return IsArray() && Array.size() > key ? &Array[key] : nullptr;
+ TValue* GetNoAdd(size_t key) {
+ return IsArray() && Array.size() > key ? &Array[key] : nullptr;
}
- TValue& GetOrAdd(size_t key) {
+ TValue& GetOrAdd(size_t key) {
SetArray();
for (size_t i = Array.size(); i <= key; ++i) {
- DoPush(Pool, Array);
+ DoPush(Pool, Array);
}
return Array[key];
}
- TValue& Back() {
+ TValue& Back() {
SetArray();
if (Array.empty()) {
- DoPush(Pool, Array);
+ DoPush(Pool, Array);
}
return Array.back();
}
- TValue& Insert(size_t key) {
+ TValue& Insert(size_t key) {
SetArray();
if (Array.size() <= key) {
- return GetOrAdd(key);
+ return GetOrAdd(key);
} else {
- Array.insert(Array.begin() + key, TValue(Pool));
+ Array.insert(Array.begin() + key, TValue(Pool));
Array[key].CopyOnWrite = false;
return Array[key];
}
@@ -282,28 +282,28 @@ namespace NSc {
return it != Dict.end() ? it->second : TValue::DefaultValue();
}
- TValue* GetNoAdd(TStringBuf key) {
+ TValue* GetNoAdd(TStringBuf key) {
if (!IsDict()) {
- return nullptr;
+ return nullptr;
}
- return Dict.FindPtr(key);
+ return Dict.FindPtr(key);
}
- TValue& Add(TStringBuf key) {
+ TValue& Add(TStringBuf key) {
SetDict();
- TDict::iterator it = Dict.insert(std::make_pair(Pool->AppendBuf(key), TValue(Pool))).first;
+ TDict::iterator it = Dict.insert(std::make_pair(Pool->AppendBuf(key), TValue(Pool))).first;
it->second.CopyOnWrite = false;
return it->second;
}
- TValue& GetOrAdd(TStringBuf key) {
+ TValue& GetOrAdd(TStringBuf key) {
SetDict();
TDict::insert_ctx ctx;
TDict::iterator it = Dict.find(key, ctx);
if (it == Dict.end()) {
- it = Dict.insert_direct(std::make_pair(Pool->AppendBuf(key), TValue(Pool)), ctx);
+ it = Dict.insert_direct(std::make_pair(Pool->AppendBuf(key), TValue(Pool)), ctx);
it->second.CopyOnWrite = false;
}
@@ -331,9 +331,9 @@ namespace NSc {
return new (p->Pool.Allocate<TScCore>()) TScCore(p);
}
- TValue::TValue() {
- auto p = TPoolPtr(new NDefinitions::TPool);
- TheCore = NewCore(p);
+ TValue::TValue() {
+ auto p = TPoolPtr(new NDefinitions::TPool);
+ TheCore = NewCore(p);
}
TValue::TValue(double t)
@@ -397,19 +397,19 @@ namespace NSc {
}
TValue::TValue(TValue& v)
- : TheCore(v.TheCore)
+ : TheCore(v.TheCore)
, CopyOnWrite(v.CopyOnWrite)
{
}
TValue::TValue(const TValue& v)
- : TheCore(v.TheCore)
+ : TheCore(v.TheCore)
, CopyOnWrite(true)
{
}
TValue::TValue(TValue&& v) noexcept
- : TheCore(std::move(v.TheCore))
+ : TheCore(std::move(v.TheCore))
, CopyOnWrite(v.CopyOnWrite)
{}
@@ -529,8 +529,8 @@ namespace NSc {
TValue& TValue::operator=(const TValue& v) & {
if (!Same(*this, v)) {
- //Extend TheCore lifetime not to trigger possible v deletion via parent-child chain
- auto tmpCore = TheCore;
+ //Extend TheCore lifetime not to trigger possible v deletion via parent-child chain
+ auto tmpCore = TheCore;
TheCore = v.TheCore;
CopyOnWrite = true;
}
@@ -539,8 +539,8 @@ namespace NSc {
TValue& TValue::operator=(TValue&& v) & noexcept {
if (!Same(*this, v)) {
- //Extend TheCore lifetime not to trigger possible v deletion via parent-child chain
- auto tmpCore = TheCore;
+ //Extend TheCore lifetime not to trigger possible v deletion via parent-child chain
+ auto tmpCore = TheCore;
TheCore = std::move(v.TheCore);
CopyOnWrite = v.CopyOnWrite;
}
@@ -556,18 +556,18 @@ namespace NSc {
}
TValue& TValue::GetOrAddUnsafe(size_t idx) {
- return CoreMutable().GetOrAdd(idx);
+ return CoreMutable().GetOrAdd(idx);
}
TValue& TValue::GetOrAdd(TStringBuf idx) {
- return CoreMutable().GetOrAdd(idx);
+ return CoreMutable().GetOrAdd(idx);
}
const TValue& TValue::Get(size_t idx) const {
return Core().Get(idx);
}
- TValue* TValue::GetNoAdd(size_t idx) {
+ TValue* TValue::GetNoAdd(size_t idx) {
return CoreMutable().GetNoAdd(idx);
}
@@ -575,12 +575,12 @@ namespace NSc {
return Core().Get(idx);
}
- TValue* TValue::GetNoAdd(TStringBuf key) {
+ TValue* TValue::GetNoAdd(TStringBuf key) {
return CoreMutable().GetNoAdd(key);
}
TValue& TValue::Back() {
- return CoreMutable().Back();
+ return CoreMutable().Back();
}
const TValue& TValue::Back() const {
@@ -604,7 +604,7 @@ namespace NSc {
}
TValue& TValue::InsertUnsafe(size_t idx) {
- return CoreMutable().Insert(idx);
+ return CoreMutable().Insert(idx);
}
template <class TIt>
@@ -623,7 +623,7 @@ namespace NSc {
}
TValue& TValue::Push() {
- return CoreMutable().Push();
+ return CoreMutable().Push();
}
TValue TValue::Pop() {
@@ -663,22 +663,22 @@ namespace NSc {
}
TValue& TValue::SetNumber(double i) {
- CoreMutableForSet().SetNumber(i);
+ CoreMutableForSet().SetNumber(i);
return *this;
}
TValue& TValue::SetIntNumber(i64 n) {
- CoreMutableForSet().SetIntNumber(n);
+ CoreMutableForSet().SetIntNumber(n);
return *this;
}
TValue& TValue::SetBool(bool val) {
- CoreMutableForSet().SetBool(val);
+ CoreMutableForSet().SetBool(val);
return *this;
}
TValue& TValue::SetString(TStringBuf s) {
- CoreMutableForSet().SetString(s);
+ CoreMutableForSet().SetString(s);
return *this;
}
@@ -767,13 +767,13 @@ namespace NSc {
}
TValue::TValue(TPoolPtr& p)
- : TheCore(NewCore(p))
+ : TheCore(NewCore(p))
{
}
TValue::TScCore& TValue::CoreMutable() {
if (Y_UNLIKELY(!TheCore)) {
- *this = TValue();
+ *this = TValue();
} else if (Y_UNLIKELY(CopyOnWrite) && Y_UNLIKELY(TheCore->RefCount() > 1)) {
*this = Clone();
}
@@ -783,22 +783,22 @@ namespace NSc {
return *TheCore;
}
- TValue::TScCore& TValue::CoreMutableForSet() {
- if (Y_UNLIKELY(!TheCore) || Y_UNLIKELY(CopyOnWrite) && Y_UNLIKELY(TheCore->RefCount() > 1)) {
- *this = TValue();
- }
-
- CopyOnWrite = false;
-
- return *TheCore;
- }
-
+ TValue::TScCore& TValue::CoreMutableForSet() {
+ if (Y_UNLIKELY(!TheCore) || Y_UNLIKELY(CopyOnWrite) && Y_UNLIKELY(TheCore->RefCount() > 1)) {
+ *this = TValue();
+ }
+
+ CopyOnWrite = false;
+
+ return *TheCore;
+ }
+
const TValue::TScCore& TValue::Core() const {
return TheCore ? *TheCore : DefaultCore();
}
TValue& TValue::SetNull() {
- CoreMutableForSet().SetNull();
+ CoreMutableForSet().SetNull();
return *this;
}
diff --git a/library/cpp/scheme/scimpl_protobuf.cpp b/library/cpp/scheme/scimpl_protobuf.cpp
index 0c99122c69..849428a7ef 100644
--- a/library/cpp/scheme/scimpl_protobuf.cpp
+++ b/library/cpp/scheme/scimpl_protobuf.cpp
@@ -23,7 +23,7 @@ namespace NSc {
try {
if (field->is_repeated()) {
if (field->is_map() && mapAsDict) {
- auto& elem = v[field->name()];
+ auto& elem = v[field->name()];
for (int i2 = 0; i2 < r->FieldSize(msg, field); ++i2) {
auto val = FromRepeatedField(msg, field, i2);
if (val.IsDict()) {
diff --git a/library/cpp/scheme/scimpl_select.rl6 b/library/cpp/scheme/scimpl_select.rl6
index 11aa549b78..20d2e4eb35 100644
--- a/library/cpp/scheme/scimpl_select.rl6
+++ b/library/cpp/scheme/scimpl_select.rl6
@@ -216,13 +216,13 @@ namespace NSc {
return DefaultValue();
}
- TValue* TValue::TrySelectOrAdd(TStringBuf path) {
+ TValue* TValue::TrySelectOrAdd(TStringBuf path) {
TSelectorCtx<TSelector<TValue, TGetNext<false> > > ctx(*this, path);
if (ctx.SelectPath()) {
- return ctx.Selector.Current;
+ return ctx.Selector.Current;
} else {
- return nullptr;
+ return nullptr;
}
}
diff --git a/library/cpp/scheme/tests/fuzz_json/lib/fuzz_json.cpp b/library/cpp/scheme/tests/fuzz_json/lib/fuzz_json.cpp
index 7c16527c23..f34571d967 100644
--- a/library/cpp/scheme/tests/fuzz_json/lib/fuzz_json.cpp
+++ b/library/cpp/scheme/tests/fuzz_json/lib/fuzz_json.cpp
@@ -1,90 +1,90 @@
#include "fuzz_json.h"
-#include "util/generic/fwd.h"
+#include "util/generic/fwd.h"
#include <library/cpp/scheme/scheme.h>
#include <util/stream/null.h>
-namespace {
- static constexpr size_t MAX_DEPTH = 4;
- static constexpr size_t MAX_PATH_LEN = 256;
- static constexpr size_t MAX_ITERATIONS = 4;
-
- void SplitOnDepth(const TStringBuf src, const size_t depth, const size_t maxPathLen,
- TStringBuf& left, TStringBuf& right)
- {
- size_t pos = 0;
- size_t prevPos = 0;
- for(size_t i = 0; i < depth; ++i) {
- if (pos > maxPathLen) {
- break;
- }
- prevPos = pos;
- pos = src.find_first_of(TStringBuf("/]"), pos + 1);
- if (pos == TStringBuf::npos) {
- break;
- }
- }
- if (pos == TStringBuf::npos && prevPos > 0) {
- pos = prevPos;
- }
- if (src.length() > maxPathLen) {
- if (pos == TStringBuf::npos || pos > maxPathLen) {
- pos = maxPathLen;
- }
- }
- if (pos == TStringBuf::npos || pos == 0) {
- left = src;
- right = TStringBuf();
- } else {
- src.SplitAt(pos + 1, left, right);
- }
- }
-
- TString tmp;
- //Limit max array size in the path to 256
- TStringBuf ProcessPath(TStringBuf path) {
- size_t pos = 0;
- while(pos != TStringBuf::npos) {
- pos = path.find(']', pos + 1);
- if (pos == TStringBuf::npos) {
- continue;
- }
- size_t open = path.rfind('[', pos);
- if (open == TStringBuf::npos) {
- continue;
- }
- bool allDigit = true;
- for(size_t i = open + 1; i < pos; ++i) {
- if (path[i] < '0' || path[i] > '9') {
- allDigit = false;
- break;
- }
- }
- if (!allDigit) {
- continue;
- }
- if (pos - open > 4) {
- TString str = TString::Join(path.Head(open + 1), "256", path.Tail(pos));
- tmp = std::move(str);
- path = tmp;
- pos = (open + 1) + 3;
- continue;
- }
- }
- return path;
- }
-}
-
+namespace {
+ static constexpr size_t MAX_DEPTH = 4;
+ static constexpr size_t MAX_PATH_LEN = 256;
+ static constexpr size_t MAX_ITERATIONS = 4;
+
+ void SplitOnDepth(const TStringBuf src, const size_t depth, const size_t maxPathLen,
+ TStringBuf& left, TStringBuf& right)
+ {
+ size_t pos = 0;
+ size_t prevPos = 0;
+ for(size_t i = 0; i < depth; ++i) {
+ if (pos > maxPathLen) {
+ break;
+ }
+ prevPos = pos;
+ pos = src.find_first_of(TStringBuf("/]"), pos + 1);
+ if (pos == TStringBuf::npos) {
+ break;
+ }
+ }
+ if (pos == TStringBuf::npos && prevPos > 0) {
+ pos = prevPos;
+ }
+ if (src.length() > maxPathLen) {
+ if (pos == TStringBuf::npos || pos > maxPathLen) {
+ pos = maxPathLen;
+ }
+ }
+ if (pos == TStringBuf::npos || pos == 0) {
+ left = src;
+ right = TStringBuf();
+ } else {
+ src.SplitAt(pos + 1, left, right);
+ }
+ }
+
+ TString tmp;
+ //Limit max array size in the path to 256
+ TStringBuf ProcessPath(TStringBuf path) {
+ size_t pos = 0;
+ while(pos != TStringBuf::npos) {
+ pos = path.find(']', pos + 1);
+ if (pos == TStringBuf::npos) {
+ continue;
+ }
+ size_t open = path.rfind('[', pos);
+ if (open == TStringBuf::npos) {
+ continue;
+ }
+ bool allDigit = true;
+ for(size_t i = open + 1; i < pos; ++i) {
+ if (path[i] < '0' || path[i] > '9') {
+ allDigit = false;
+ break;
+ }
+ }
+ if (!allDigit) {
+ continue;
+ }
+ if (pos - open > 4) {
+ TString str = TString::Join(path.Head(open + 1), "256", path.Tail(pos));
+ tmp = std::move(str);
+ path = tmp;
+ pos = (open + 1) + 3;
+ continue;
+ }
+ }
+ return path;
+ }
+}
+
namespace NSc::NUt {
-
-
+
+
void FuzzJson(TStringBuf wire) {
if (wire.size() < 2) {
return;
}
-
- ProcessPath("[123][1234][12][2134][12312312][1][12]");
+
+ ProcessPath("[123][1234][12][2134][12312312][1][12]");
ui8 len1 = wire[0];
ui8 len2 = wire[1];
wire.Skip(2);
@@ -94,22 +94,22 @@ namespace NSc::NUt {
NSc::TValue val2 = NSc::TValue::FromJson(json2);
NSc::TValue val3;
val3.MergeUpdate(val1);
-
- size_t i = 0;
- while (!wire.empty()) {
- TStringBuf path;
- SplitOnDepth(wire, MAX_DEPTH, MAX_PATH_LEN, path, wire);
- path = ProcessPath(path);
- if (auto* target = val3.TrySelectOrAdd(path)) {
- target->MergeUpdate(val2);
- }
- ++i;
- // Release memory since there are up to MAX_DICT_SIZE * MAX_DEPTH elements
- if (i > MAX_ITERATIONS) {
- Cnull << val3.ToJson();
- val3 = NSc::TValue();
- }
- }
+
+ size_t i = 0;
+ while (!wire.empty()) {
+ TStringBuf path;
+ SplitOnDepth(wire, MAX_DEPTH, MAX_PATH_LEN, path, wire);
+ path = ProcessPath(path);
+ if (auto* target = val3.TrySelectOrAdd(path)) {
+ target->MergeUpdate(val2);
+ }
+ ++i;
+ // Release memory since there are up to MAX_DICT_SIZE * MAX_DEPTH elements
+ if (i > MAX_ITERATIONS) {
+ Cnull << val3.ToJson();
+ val3 = NSc::TValue();
+ }
+ }
Cnull << val3.ToJson();
}
}
diff --git a/library/cpp/scheme/tests/fuzz_ops/lib/fuzz_ops.cpp b/library/cpp/scheme/tests/fuzz_ops/lib/fuzz_ops.cpp
index 8a7facba24..a100d3a631 100644
--- a/library/cpp/scheme/tests/fuzz_ops/lib/fuzz_ops.cpp
+++ b/library/cpp/scheme/tests/fuzz_ops/lib/fuzz_ops.cpp
@@ -29,9 +29,9 @@ namespace NSc::NUt {
if (!ApplyNextAction(st, *act)) {
break;
}
- if (!NSc::TValue::DefaultValue().IsNull()) {
- std::terminate();
- }
+ if (!NSc::TValue::DefaultValue().IsNull()) {
+ std::terminate();
+ }
}
}
}
diff --git a/library/cpp/scheme/tests/fuzz_ops/lib/vm_apply.cpp b/library/cpp/scheme/tests/fuzz_ops/lib/vm_apply.cpp
index ada7b8854f..563187f9f4 100644
--- a/library/cpp/scheme/tests/fuzz_ops/lib/vm_apply.cpp
+++ b/library/cpp/scheme/tests/fuzz_ops/lib/vm_apply.cpp
@@ -77,22 +77,22 @@ namespace NSc::NUt {
Y_FAIL(); \
}
-#define Y_GEN_PTR_OP(op, arg, st, act) \
- if (auto* r = (op)) { \
- switch (act.GetRef(arg).Type) { \
- case TRef::T_CREATE_BACK: \
- Y_GEN_TRY_OP(st.TryPushBack(*r)) \
- break; \
- case TRef::T_CREATE_FRONT: \
- Y_GEN_TRY_OP(st.TryPushFront(*r)) \
- break; \
- case TRef::T_REF__POS: \
- st.LRef(act.GetRef(arg).Pos) = *r; \
- break; \
- default: \
- Y_FAIL(); \
- } \
- }
+#define Y_GEN_PTR_OP(op, arg, st, act) \
+ if (auto* r = (op)) { \
+ switch (act.GetRef(arg).Type) { \
+ case TRef::T_CREATE_BACK: \
+ Y_GEN_TRY_OP(st.TryPushBack(*r)) \
+ break; \
+ case TRef::T_CREATE_FRONT: \
+ Y_GEN_TRY_OP(st.TryPushFront(*r)) \
+ break; \
+ case TRef::T_REF__POS: \
+ st.LRef(act.GetRef(arg).Pos) = *r; \
+ break; \
+ default: \
+ Y_FAIL(); \
+ } \
+ }
bool ApplyNextAction(TVMState& st, TVMAction act) {
switch (act.Type) {
@@ -228,7 +228,7 @@ namespace NSc::NUt {
return true;
case VMA_ARRAY_GET_NO_ADD__IDX_REF:
- Y_GEN_PTR_OP(st.Current().GetNoAdd(act.GetIdx(0)), 1, st, act);
+ Y_GEN_PTR_OP(st.Current().GetNoAdd(act.GetIdx(0)), 1, st, act);
return true;
case VMA_DICT_CLEAR:
@@ -260,7 +260,7 @@ namespace NSc::NUt {
return true;
case VMA_DICT_GET_NO_ADD__IDX_REF:
- Y_GEN_PTR_OP(st.Current().GetNoAdd(act.GetKey(0)), 1, st, act);
+ Y_GEN_PTR_OP(st.Current().GetNoAdd(act.GetKey(0)), 1, st, act);
return true;
case VMA_MERGE_UPDATE__POS:
@@ -288,7 +288,7 @@ namespace NSc::NUt {
return true;
case VMA_SELECT_OR_ADD__PATH_REF:
- Y_GEN_PTR_OP(st.Current().TrySelectOrAdd(act.GetPath(0)), 1, st, act);
+ Y_GEN_PTR_OP(st.Current().TrySelectOrAdd(act.GetPath(0)), 1, st, act);
return true;
case VMA_SELECT_AND_DELETE__PATH_REF:
diff --git a/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp b/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp
index 2a06cf110d..5376456540 100644
--- a/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp
+++ b/library/cpp/scheme/tests/ut/scheme_merge_ut.cpp
@@ -164,7 +164,7 @@ Y_UNIT_TEST_SUITE(TSchemeMergeTest) {
v["a"] = NSc::TValue::FromJson("[0.125,0.12,0.1,0.08,0.06]");
UNIT_ASSERT_JSON_EQ_JSON(v, "{a:[0.125,0.12,0.1,0.08,0.06]}");
- NSc::TValue a = v.TrySelectOrAdd("a")->MergeUpdateJson("[1,2,3]");
+ NSc::TValue a = v.TrySelectOrAdd("a")->MergeUpdateJson("[1,2,3]");
UNIT_ASSERT_JSON_EQ_JSON(a, "[1,2,3]");
UNIT_ASSERT_JSON_EQ_JSON(v, "{a:[1,2,3]}");
diff --git a/library/cpp/scheme/tests/ut/scheme_path_ut.cpp b/library/cpp/scheme/tests/ut/scheme_path_ut.cpp
index 0d4d79d483..9d9fd2cf63 100644
--- a/library/cpp/scheme/tests/ut/scheme_path_ut.cpp
+++ b/library/cpp/scheme/tests/ut/scheme_path_ut.cpp
@@ -15,7 +15,7 @@ Y_UNIT_TEST_SUITE(TSchemePathTest) {
UNIT_ASSERT(!v.PathExists(path));
UNIT_ASSERT(NSc::TValue::PathValid(path));
UNIT_ASSERT(NSc::TValue::Same(v.TrySelect(path), NSc::Null()));
- *v.TrySelectOrAdd(path) = 1;
+ *v.TrySelectOrAdd(path) = 1;
NSc::NUt::AssertSchemeJson(expected, v);
UNIT_ASSERT(v.PathExists(path));
UNIT_ASSERT(1 == v.TrySelectOrAdd(path)->GetNumber());
@@ -33,19 +33,19 @@ Y_UNIT_TEST_SUITE(TSchemePathTest) {
UNIT_ASSERT(v.PathExists(""));
UNIT_ASSERT(v.PathExists("//"));
- UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//")));
+ UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//")));
NSc::NUt::AssertSchemeJson("null", v);
UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null()));
NSc::NUt::AssertSchemeJson("null", v);
v.SetDict();
- UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//")));
+ UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//")));
NSc::NUt::AssertSchemeJson("{}", v);
UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null()));
NSc::NUt::AssertSchemeJson("{}", v);
v.SetArray();
- UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//")));
+ UNIT_ASSERT(NSc::TValue::Same(v, *v.TrySelectOrAdd("//")));
NSc::NUt::AssertSchemeJson("[]", v);
UNIT_ASSERT(NSc::TValue::Same(v.TrySelectAndDelete("//"), NSc::Null()));
NSc::NUt::AssertSchemeJson("[]", v);
@@ -63,7 +63,7 @@ Y_UNIT_TEST_SUITE(TSchemePathTest) {
Y_UNIT_TEST(TestSelectAndMerge) {
NSc::TValue v;
- v.TrySelectOrAdd("blender/enabled")->MergeUpdateJson("1");
+ v.TrySelectOrAdd("blender/enabled")->MergeUpdateJson("1");
UNIT_ASSERT_VALUES_EQUAL(NSc::TValue::FromJson("1").ToJson(), "1");
UNIT_ASSERT_VALUES_EQUAL(v.ToJson(), "{\"blender\":{\"enabled\":1}}");
}
@@ -97,61 +97,61 @@ Y_UNIT_TEST_SUITE(TSchemePathTest) {
{
NSc::TValue val;
- *val.TrySelectOrAdd("") = 100;
+ *val.TrySelectOrAdd("") = 100;
const TString res = R"=(100)=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
{
NSc::TValue val;
- *val.TrySelectOrAdd("a") = 100;
+ *val.TrySelectOrAdd("a") = 100;
const TString res = R"=({"a":100})=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
{
NSc::TValue val;
- *val.TrySelectOrAdd(R"=(////)=") = 100;
+ *val.TrySelectOrAdd(R"=(////)=") = 100;
const TString res = R"=(100)=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
{
NSc::TValue val;
- *val.TrySelectOrAdd(R"=()=") = 100;
+ *val.TrySelectOrAdd(R"=()=") = 100;
const TString res = R"=(100)=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
{
NSc::TValue val;
- *val.TrySelectOrAdd(R"=("")=") = 100;
+ *val.TrySelectOrAdd(R"=("")=") = 100;
const TString res = R"=({"":100})=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
{
NSc::TValue val;
- *val.TrySelectOrAdd(R"=("[1]")=") = 100;
+ *val.TrySelectOrAdd(R"=("[1]")=") = 100;
const TString res = R"=({"[1]":100})=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
{
NSc::TValue val;
- *val.TrySelectOrAdd(R"=("\"\"")=") = 100;
+ *val.TrySelectOrAdd(R"=("\"\"")=") = 100;
const TString res = R"=({"\"\"":100})=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
{
NSc::TValue val;
- *val.TrySelectOrAdd(R"=("/10/")=") = 100;
+ *val.TrySelectOrAdd(R"=("/10/")=") = 100;
const TString res = R"=({"/10/":100})=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
{
NSc::TValue val;
- *val.TrySelectOrAdd(R"=(/"[10]"//""/"\"/10/\""///)=") = 100;
+ *val.TrySelectOrAdd(R"=(/"[10]"//""/"\"/10/\""///)=") = 100;
const TString res = R"=({"[10]":{"":{"\"/10/\"":100}}})=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
{
NSc::TValue val;
- *val.TrySelectOrAdd(R"=(/"[10]"//""/"\"/10/\""///)=") = 100;
+ *val.TrySelectOrAdd(R"=(/"[10]"//""/"\"/10/\""///)=") = 100;
const TString res = R"=({"[10]":{"":{"\"/10/\"":100}}})=";
UNIT_ASSERT_VALUES_EQUAL(val.ToJson(), res);
}
diff --git a/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp b/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp
index e711a0d092..5379ef6164 100644
--- a/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp
+++ b/library/cpp/scheme/tests/ut/scheme_proto_ut.cpp
@@ -27,7 +27,7 @@ Y_UNIT_TEST_SUITE(TSchemeProtoTest) {
if (mapAsDict) {
v[key] = value;
} else {
- auto& newElement = v.Push();
+ auto& newElement = v.Push();
newElement["key"] = key;
newElement["value"] = value;
}
diff --git a/library/cpp/scheme/tests/ut/scheme_ut.cpp b/library/cpp/scheme/tests/ut/scheme_ut.cpp
index 1a5d07c31b..0ddefa7fea 100644
--- a/library/cpp/scheme/tests/ut/scheme_ut.cpp
+++ b/library/cpp/scheme/tests/ut/scheme_ut.cpp
@@ -317,12 +317,12 @@ Y_UNIT_TEST_SUITE(TSchemeTest) {
}
Y_UNIT_TEST(TestAssignmentDictChild) {
- {
- NSc::TValue v;
- {
- NSc::TValue b;
- v["a"] = b;
- }
+ {
+ NSc::TValue v;
+ {
+ NSc::TValue b;
+ v["a"] = b;
+ }
v = v["a"];
}
{
@@ -331,7 +331,7 @@ Y_UNIT_TEST_SUITE(TSchemeTest) {
NSc::TValue b;
v["a"] = b;
}
- v = v.Get("a");
+ v = v.Get("a");
}
{
NSc::TValue v;
@@ -341,8 +341,8 @@ Y_UNIT_TEST_SUITE(TSchemeTest) {
}
v = std::move(v["a"]);
}
- }
-
+ }
+
Y_UNIT_TEST(TestInsert) {
NSc::TValue v;
v.Insert(0, "b");
@@ -767,18 +767,18 @@ Y_UNIT_TEST_SUITE(TSchemeTest) {
UNIT_ASSERT(w.IsDict());
UNIT_ASSERT_VALUES_EQUAL(w.Get("foo").GetString(), "baz");
}
- UNIT_ASSERT(NSc::TValue::DefaultValue().IsNull());
- }
-
- //SPI-25156
- Y_UNIT_TEST(TestMoveNotCorruptingDefault) {
- using namespace NSc;
- TValue w = TValue::FromJson("{foo:bar}");
- TValue v = std::move(w);
- w["foo"] = "baz"; // no crash here
- UNIT_ASSERT(NSc::TValue::DefaultValue().IsNull());
+ UNIT_ASSERT(NSc::TValue::DefaultValue().IsNull());
}
+ //SPI-25156
+ Y_UNIT_TEST(TestMoveNotCorruptingDefault) {
+ using namespace NSc;
+ TValue w = TValue::FromJson("{foo:bar}");
+ TValue v = std::move(w);
+ w["foo"] = "baz"; // no crash here
+ UNIT_ASSERT(NSc::TValue::DefaultValue().IsNull());
+ }
+
Y_UNIT_TEST(TestCopyFrom) {
{
TString sa = "[1,2]";
@@ -845,34 +845,34 @@ Y_UNIT_TEST_SUITE(TSchemeTest) {
}
}
- Y_UNIT_TEST(TestCopyingDictIntoSelf) { //Found by fuzzing
- NSc::TValue a;
- NSc::TValue b = a.GetOrAdd("aa");
- b.CopyFrom(a);
- NSc::TValue target = NSc::TValue::FromJsonThrow("{\"aa\":null}");
- UNIT_ASSERT_VALUES_EQUAL(b, target);
- UNIT_ASSERT_VALUES_EQUAL(a, target);
- }
-
- Y_UNIT_TEST(TestCopyingDictIntoSelfByRef) { //Found by fuzzing
- NSc::TValue a;
- NSc::TValue& b = a.GetOrAdd("aa");
- b.CopyFrom(a);
- UNIT_ASSERT_VALUES_EQUAL(b, NSc::TValue::FromJsonThrow("{\"aa\":null}"));
- UNIT_ASSERT_VALUES_EQUAL(a, NSc::TValue::FromJsonThrow("{\"aa\": {\"aa\": null}}"));
- }
-
+ Y_UNIT_TEST(TestCopyingDictIntoSelf) { //Found by fuzzing
+ NSc::TValue a;
+ NSc::TValue b = a.GetOrAdd("aa");
+ b.CopyFrom(a);
+ NSc::TValue target = NSc::TValue::FromJsonThrow("{\"aa\":null}");
+ UNIT_ASSERT_VALUES_EQUAL(b, target);
+ UNIT_ASSERT_VALUES_EQUAL(a, target);
+ }
+
+ Y_UNIT_TEST(TestCopyingDictIntoSelfByRef) { //Found by fuzzing
+ NSc::TValue a;
+ NSc::TValue& b = a.GetOrAdd("aa");
+ b.CopyFrom(a);
+ UNIT_ASSERT_VALUES_EQUAL(b, NSc::TValue::FromJsonThrow("{\"aa\":null}"));
+ UNIT_ASSERT_VALUES_EQUAL(a, NSc::TValue::FromJsonThrow("{\"aa\": {\"aa\": null}}"));
+ }
+
Y_UNIT_TEST(TestGetNoAdd) {
NSc::TValue v = NSc::NUt::AssertFromJson("{a:[null,-1,2,3.4],b:3,c:{d:5}}");
- UNIT_ASSERT(v.GetNoAdd("a") != nullptr);
- UNIT_ASSERT(v.GetNoAdd("b") != nullptr);
- UNIT_ASSERT(v.GetNoAdd("c") != nullptr);
- UNIT_ASSERT(v.GetNoAdd("d") == nullptr);
- UNIT_ASSERT(v.GetNoAdd("value") == nullptr);
-
- NSc::TValue* child = v.GetNoAdd("c");
- UNIT_ASSERT(child != nullptr);
- (*child)["e"]["f"] = 42;
+ UNIT_ASSERT(v.GetNoAdd("a") != nullptr);
+ UNIT_ASSERT(v.GetNoAdd("b") != nullptr);
+ UNIT_ASSERT(v.GetNoAdd("c") != nullptr);
+ UNIT_ASSERT(v.GetNoAdd("d") == nullptr);
+ UNIT_ASSERT(v.GetNoAdd("value") == nullptr);
+
+ NSc::TValue* child = v.GetNoAdd("c");
+ UNIT_ASSERT(child != nullptr);
+ (*child)["e"]["f"] = 42;
const NSc::TValue expectedResult = NSc::NUt::AssertFromJson("{a:[null,-1,2,3.4],b:3,c:{d:5,e:{f:42}}}");
UNIT_ASSERT_VALUES_EQUAL(v, expectedResult);
}
diff --git a/library/cpp/string_utils/quote/quote.cpp b/library/cpp/string_utils/quote/quote.cpp
index e523350b80..efbdd36903 100644
--- a/library/cpp/string_utils/quote/quote.cpp
+++ b/library/cpp/string_utils/quote/quote.cpp
@@ -169,13 +169,13 @@ TString CGIEscapeRet(const TStringBuf url) {
return to;
}
-TString& AppendCgiEscaped(const TStringBuf value, TString& to) {
- const size_t origLength = to.length();
- to.ReserveAndResize(origLength + CgiEscapeBufLen(value.size()));
- to.resize(CGIEscape(to.begin() + origLength, value.data(), value.size()) - to.data());
- return to;
-}
-
+TString& AppendCgiEscaped(const TStringBuf value, TString& to) {
+ const size_t origLength = to.length();
+ to.ReserveAndResize(origLength + CgiEscapeBufLen(value.size()));
+ to.resize(CGIEscape(to.begin() + origLength, value.data(), value.size()) - to.data());
+ return to;
+}
+
// More general version of CGIEscape. The optional safe parameter specifies
// additional characters that should not be quoted — its default value is '/'.
diff --git a/library/cpp/string_utils/quote/quote.h b/library/cpp/string_utils/quote/quote.h
index 3b7221154e..4116126364 100644
--- a/library/cpp/string_utils/quote/quote.h
+++ b/library/cpp/string_utils/quote/quote.h
@@ -15,7 +15,7 @@ inline char* CGIEscape(char* to, const TStringBuf from) {
}
void CGIEscape(TString& url);
TString CGIEscapeRet(const TStringBuf url);
-TString& AppendCgiEscaped(const TStringBuf value, TString& to);
+TString& AppendCgiEscaped(const TStringBuf value, TString& to);
inline TStringBuf CgiEscapeBuf(char* to, const TStringBuf from) {
return TStringBuf(to, CGIEscape(to, from.data(), from.size()));
diff --git a/library/cpp/string_utils/quote/quote_ut.cpp b/library/cpp/string_utils/quote/quote_ut.cpp
index 6c552b279e..ca33293dca 100644
--- a/library/cpp/string_utils/quote/quote_ut.cpp
+++ b/library/cpp/string_utils/quote/quote_ut.cpp
@@ -28,23 +28,23 @@ Y_UNIT_TEST_SUITE(TCGIEscapeTest) {
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;
- AppendCgiEscaped("!@#$%^&*(){}[]\" ", param);
- UNIT_ASSERT_VALUES_EQUAL(param, TString("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
-
- TString param2 = "&param=";
- AppendCgiEscaped("!@#$%^&*(){}[]\" ", param2);
- UNIT_ASSERT_VALUES_EQUAL(param2,
- TString("&param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
-
- param2.append("&param_param=");
- AppendCgiEscaped("!@#$%^&*(){}[]\" ", param2);
- UNIT_ASSERT_VALUES_EQUAL(param2,
- TString("&param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+&param_param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
- }
-
+
+ Y_UNIT_TEST(StrokaAppendRet) {
+ TString param;
+ AppendCgiEscaped("!@#$%^&*(){}[]\" ", param);
+ UNIT_ASSERT_VALUES_EQUAL(param, TString("!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
+
+ TString param2 = "&param=";
+ AppendCgiEscaped("!@#$%^&*(){}[]\" ", param2);
+ UNIT_ASSERT_VALUES_EQUAL(param2,
+ TString("&param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
+
+ param2.append("&param_param=");
+ AppendCgiEscaped("!@#$%^&*(){}[]\" ", param2);
+ UNIT_ASSERT_VALUES_EQUAL(param2,
+ TString("&param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+&param_param=!@%23$%25^%26*%28%29%7B%7D%5B%5D%22+"));
+ }
+
}
Y_UNIT_TEST_SUITE(TCGIUnescapeTest) {
diff --git a/library/cpp/threading/light_rw_lock/lightrwlock.h b/library/cpp/threading/light_rw_lock/lightrwlock.h
index 931a1817bc..d1ce08fe62 100644
--- a/library/cpp/threading/light_rw_lock/lightrwlock.h
+++ b/library/cpp/threading/light_rw_lock/lightrwlock.h
@@ -83,21 +83,21 @@ namespace NS_LightRWLock {
int prev = __atomic_fetch_and(&item, ~(1 << bit), __ATOMIC_SEQ_CST);
return (prev & (1 << bit)) != 0 ? 1 : 0;
}
-#endif
-
-#if defined(_x86_64_) || defined(_i386_) || defined (__aarch64__) || defined (__powerpc64__)
- static bool AtomicLockHighByte(volatile int& item) {
- union TA {
- int x;
- char y[4];
- };
-
- volatile TA* ptr = reinterpret_cast<volatile TA*>(&item);
- char zero = 0;
- return __atomic_compare_exchange_n(&(ptr->y[3]), &zero, (char)128, true,
- __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
- }
-
+#endif
+
+#if defined(_x86_64_) || defined(_i386_) || defined (__aarch64__) || defined (__powerpc64__)
+ static bool AtomicLockHighByte(volatile int& item) {
+ union TA {
+ int x;
+ char y[4];
+ };
+
+ volatile TA* ptr = reinterpret_cast<volatile TA*>(&item);
+ char zero = 0;
+ return __atomic_compare_exchange_n(&(ptr->y[3]), &zero, (char)128, true,
+ __ATOMIC_SEQ_CST, __ATOMIC_RELAXED);
+ }
+
#endif
template <typename TInt>
diff --git a/library/cpp/unicode/punycode/ut/ya.make b/library/cpp/unicode/punycode/ut/ya.make
index 74272102a8..0857d52041 100644
--- a/library/cpp/unicode/punycode/ut/ya.make
+++ b/library/cpp/unicode/punycode/ut/ya.make
@@ -1,9 +1,9 @@
UNITTEST_FOR(library/cpp/unicode/punycode)
OWNER(
- g:base
- g:middle
- g:upper
+ g:base
+ g:middle
+ g:upper
)
SRCS(
diff --git a/library/cpp/unicode/punycode/ya.make b/library/cpp/unicode/punycode/ya.make
index 62b41b07b7..866e49ab21 100644
--- a/library/cpp/unicode/punycode/ya.make
+++ b/library/cpp/unicode/punycode/ya.make
@@ -1,9 +1,9 @@
LIBRARY()
OWNER(
- g:base
- g:middle
- g:upper
+ g:base
+ g:middle
+ g:upper
)
PEERDIR(
diff --git a/library/cpp/xml/init/ptr.h b/library/cpp/xml/init/ptr.h
index 7387c7cc40..4839941f25 100644
--- a/library/cpp/xml/init/ptr.h
+++ b/library/cpp/xml/init/ptr.h
@@ -38,15 +38,15 @@ namespace NXml {
DEF_PTR(xmlNodeSet, xmlXPathFreeNodeSet);
// xmlSchemaParserCtxtPtr ctxt;
- DEF_HOLDER(xmlSchemaParserCtxt, xmlSchemaFreeParserCtxt);
+ DEF_HOLDER(xmlSchemaParserCtxt, xmlSchemaFreeParserCtxt);
DEF_PTR(xmlSchemaParserCtxt, xmlSchemaFreeParserCtxt);
// xmlSchemaPtr schema;
- DEF_HOLDER(xmlSchema, xmlSchemaFree);
+ DEF_HOLDER(xmlSchema, xmlSchemaFree);
DEF_PTR(xmlSchema, xmlSchemaFree);
// xmlSchemaValidCtxt ctxt;
- DEF_HOLDER(xmlSchemaValidCtxt, xmlSchemaFreeValidCtxt);
+ DEF_HOLDER(xmlSchemaValidCtxt, xmlSchemaFreeValidCtxt);
DEF_PTR(xmlSchemaValidCtxt, xmlSchemaFreeValidCtxt);
// xmlSaveCtxtPtr