diff options
author | glebx777 <glebx777@yandex-team.ru> | 2022-02-10 16:49:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:44 +0300 |
commit | 573561e4ea1e5fcbf31e871b7f81ece0051c6bf2 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 | |
parent | ab9150ae9d81b97b19a2a6a8b903f9a40791c8b4 (diff) | |
download | ydb-573561e4ea1e5fcbf31e871b7f81ece0051c6bf2.tar.gz |
Restoring authorship annotation for <glebx777@yandex-team.ru>. Commit 2 of 2.
-rw-r--r-- | library/cpp/cgiparam/cgiparam.cpp | 16 | ||||
-rw-r--r-- | library/cpp/cgiparam/cgiparam.h | 2 | ||||
-rw-r--r-- | library/cpp/cgiparam/cgiparam_ut.cpp | 46 | ||||
-rw-r--r-- | library/cpp/http/io/headers.cpp | 8 | ||||
-rw-r--r-- | library/cpp/http/io/headers.h | 4 | ||||
-rw-r--r-- | library/cpp/logger/element.h | 2 | ||||
-rw-r--r-- | library/cpp/uri/uri.cpp | 2 | ||||
-rw-r--r-- | util/generic/array_ref.h | 8 | ||||
-rw-r--r-- | util/generic/yexception.h | 32 | ||||
-rw-r--r-- | util/generic/yexception_ut.cpp | 36 | ||||
-rw-r--r-- | util/stream/fwd.h | 2 | ||||
-rw-r--r-- | util/stream/tempbuf.cpp | 2 | ||||
-rw-r--r-- | util/stream/tempbuf.h | 10 |
13 files changed, 85 insertions, 85 deletions
diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp index bb63abd7be..f3277b8e4b 100644 --- a/library/cpp/cgiparam/cgiparam.cpp +++ b/library/cpp/cgiparam/cgiparam.cpp @@ -125,14 +125,14 @@ void TCgiParameters::ScanAddUnescaped(const TStringBuf query) { DoScan<false>(query, f); } -void TCgiParameters::ScanAddAllUnescaped(const TStringBuf query) { - auto f = [this](const TStringBuf key, const TStringBuf val) { - this->InsertUnescaped(key, val); - }; - - DoScan<true>(query, f); -} - +void TCgiParameters::ScanAddAllUnescaped(const TStringBuf query) { + auto f = [this](const TStringBuf key, const TStringBuf val) { + this->InsertUnescaped(key, val); + }; + + DoScan<true>(query, f); +} + void TCgiParameters::ScanAddAll(const TStringBuf query) { TAddEscaped f = {this}; diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h index 7d29150877..87d1ab0ad4 100644 --- a/library/cpp/cgiparam/cgiparam.h +++ b/library/cpp/cgiparam/cgiparam.h @@ -43,7 +43,7 @@ public: void Scan(const TStringBuf cgiParStr, bool form = true); void ScanAdd(const TStringBuf cgiParStr); void ScanAddUnescaped(const TStringBuf cgiParStr); - void ScanAddAllUnescaped(const TStringBuf cgiParStr); + void ScanAddAllUnescaped(const TStringBuf cgiParStr); void ScanAddAll(const TStringBuf cgiParStr); /// Returns the string representation of all the stored parameters diff --git a/library/cpp/cgiparam/cgiparam_ut.cpp b/library/cpp/cgiparam/cgiparam_ut.cpp index 140da4ee5c..a562342084 100644 --- a/library/cpp/cgiparam/cgiparam_ut.cpp +++ b/library/cpp/cgiparam/cgiparam_ut.cpp @@ -88,29 +88,29 @@ Y_UNIT_TEST_SUITE(TCgiParametersTest) { UNIT_ASSERT_VALUES_EQUAL(c.Print(), "aaa=1&bbb=&ccc=1&ccc=3&ccc=2"); } - Y_UNIT_TEST(TestScanAddAllUnescaped1) { - TCgiParameters c; - c.ScanAddAllUnescaped("ccc=1&aaa=1&ccc=3&bbb&ccc=2"); - - UNIT_ASSERT_VALUES_EQUAL(c.Print(), "aaa=1&bbb=&ccc=1&ccc=3&ccc=2"); - } - - Y_UNIT_TEST(TestScanAddAllUnescaped2) { - TCgiParameters c; - c.ScanAddAllUnescaped("text=something&null"); - - UNIT_ASSERT_VALUES_EQUAL(c.size(), 2u); - UNIT_ASSERT_VALUES_EQUAL(c.Get("text"), "something"); - UNIT_ASSERT(c.Get("null").empty()); - } - - Y_UNIT_TEST(TestScanAddAllUnescaped3) { - TCgiParameters c; - c.ScanAddAllUnescaped("text=%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D1%82%2C"); - - UNIT_ASSERT_VALUES_EQUAL(c.Get("text"), "%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D1%82%2C"); - } - + Y_UNIT_TEST(TestScanAddAllUnescaped1) { + TCgiParameters c; + c.ScanAddAllUnescaped("ccc=1&aaa=1&ccc=3&bbb&ccc=2"); + + UNIT_ASSERT_VALUES_EQUAL(c.Print(), "aaa=1&bbb=&ccc=1&ccc=3&ccc=2"); + } + + Y_UNIT_TEST(TestScanAddAllUnescaped2) { + TCgiParameters c; + c.ScanAddAllUnescaped("text=something&null"); + + UNIT_ASSERT_VALUES_EQUAL(c.size(), 2u); + UNIT_ASSERT_VALUES_EQUAL(c.Get("text"), "something"); + UNIT_ASSERT(c.Get("null").empty()); + } + + Y_UNIT_TEST(TestScanAddAllUnescaped3) { + TCgiParameters c; + c.ScanAddAllUnescaped("text=%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D1%82%2C"); + + UNIT_ASSERT_VALUES_EQUAL(c.Get("text"), "%D0%9F%D1%80%D0%B8%D0%B2%D0%B5%D1%82%2C"); + } + Y_UNIT_TEST(TestEraseAll) { TCgiParameters c; c.ScanAddAll("par=1&aaa=1&par=2&bbb&par=3"); diff --git a/library/cpp/http/io/headers.cpp b/library/cpp/http/io/headers.cpp index 180b939de4..4ec27a29e8 100644 --- a/library/cpp/http/io/headers.cpp +++ b/library/cpp/http/io/headers.cpp @@ -67,11 +67,11 @@ const THttpInputHeader* THttpHeaders::FindHeader(const TStringBuf header) const for (const auto& hdr : Headers_) { if (AsciiCompareIgnoreCase(hdr.Name(), header) == 0) { return &hdr; - } - } + } + } return nullptr; -} - +} + void THttpHeaders::RemoveHeader(const TStringBuf header) { for (auto h = Headers_.begin(); h != Headers_.end(); ++h) { if (AsciiCompareIgnoreCase(h->Name(), header) == 0) { diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h index e480b7ecb1..a71793d1c6 100644 --- a/library/cpp/http/io/headers.h +++ b/library/cpp/http/io/headers.h @@ -99,9 +99,9 @@ public: AddOrReplaceHeader(THttpInputHeader(std::move(name), ToString(value))); } - // Проверяет, есть ли такой заголовок + // Проверяет, есть ли такой заголовок bool HasHeader(TStringBuf header) const; - + /// Удаляет заголовок, если он есть. void RemoveHeader(TStringBuf header); diff --git a/library/cpp/logger/element.h b/library/cpp/logger/element.h index 5dad1d8e84..fc9bff851f 100644 --- a/library/cpp/logger/element.h +++ b/library/cpp/logger/element.h @@ -9,7 +9,7 @@ class TLog; /* * better do not use directly */ -class TLogElement: public TTempBufOutput { +class TLogElement: public TTempBufOutput { public: TLogElement(const TLog* parent); TLogElement(const TLog* parent, ELogPriority priority); diff --git a/library/cpp/uri/uri.cpp b/library/cpp/uri/uri.cpp index cdf48e5323..56a9a4e5ef 100644 --- a/library/cpp/uri/uri.cpp +++ b/library/cpp/uri/uri.cpp @@ -258,7 +258,7 @@ namespace NUri { bool pathop = true; - TTempBufOutput out(p0.length() + p1.length() + 4); + TTempBufOutput out(p0.length() + p1.length() + 4); out << p0; if ('/' != p0.back()) out << "/../"; diff --git a/util/generic/array_ref.h b/util/generic/array_ref.h index adecc340db..1ac60ac7d3 100644 --- a/util/generic/array_ref.h +++ b/util/generic/array_ref.h @@ -273,8 +273,8 @@ template <class T> constexpr TArrayRef<T> MakeArrayRef(T* data, size_t size) { return TArrayRef<T>(data, size); } - -template <class T> + +template <class T> constexpr TArrayRef<T> MakeArrayRef(T* begin, T* end) { - return TArrayRef<T>(begin, end); -} + return TArrayRef<T>(begin, end); +} diff --git a/util/generic/yexception.h b/util/generic/yexception.h index c77cd96db1..b0c604e8c4 100644 --- a/util/generic/yexception.h +++ b/util/generic/yexception.h @@ -22,21 +22,21 @@ class TBackTrace; namespace NPrivateException { - class TTempBufCuttingWrapperOutput: public IOutputStream { - public: - TTempBufCuttingWrapperOutput(TTempBuf& tempbuf) - : TempBuf_(tempbuf) - { - } - - void DoWrite(const void* data, size_t len) override { - TempBuf_.Append(data, Min(len, TempBuf_.Left())); - } - - private: - TTempBuf& TempBuf_; - }; - + class TTempBufCuttingWrapperOutput: public IOutputStream { + public: + TTempBufCuttingWrapperOutput(TTempBuf& tempbuf) + : TempBuf_(tempbuf) + { + } + + void DoWrite(const void* data, size_t len) override { + TempBuf_.Append(data, Min(len, TempBuf_.Left())); + } + + private: + TTempBuf& TempBuf_; + }; + class yexception: public std::exception { public: yexception(); @@ -51,7 +51,7 @@ namespace NPrivateException { template <class T> inline void Append(const T& t) { - TTempBufCuttingWrapperOutput tempBuf(Buf_); + TTempBufCuttingWrapperOutput tempBuf(Buf_); static_cast<IOutputStream&>(tempBuf) << t; ZeroTerminate(); } diff --git a/util/generic/yexception_ut.cpp b/util/generic/yexception_ut.cpp index a724c7dcdb..cb3e29fed8 100644 --- a/util/generic/yexception_ut.cpp +++ b/util/generic/yexception_ut.cpp @@ -11,8 +11,8 @@ static inline void Throw2DontMove() { #include <library/cpp/testing/unittest/registar.h> #include <util/generic/algorithm.h> -#include <util/memory/tempbuf.h> -#include <util/random/mersenne.h> +#include <util/memory/tempbuf.h> +#include <util/random/mersenne.h> #include <util/stream/output.h> #include <util/string/subst.h> @@ -50,7 +50,7 @@ class TExceptionTest: public TTestBase { UNIT_TEST(TestEnsureWithBackTrace2) UNIT_TEST(TestRethrowAppend) UNIT_TEST(TestMacroOverload) - UNIT_TEST(TestMessageCrop) + UNIT_TEST(TestMessageCrop) UNIT_TEST(TestTIoSystemErrorSpecialMethods) UNIT_TEST(TestCurrentExceptionTypeNameMethod) UNIT_TEST_SUITE_END(); @@ -280,22 +280,22 @@ private: UNIT_ASSERT(e.AsStrBuf().Contains("10 > 20")); } } - - void TestMessageCrop() { - TTempBuf tmp; - size_t size = tmp.Size() * 1.5; - TString s; - s.reserve(size); - TMersenne<ui64> generator(42); - for (int j = 0; j < 50; ++j) { - for (size_t i = 0; i < size; ++i) { - s += static_cast<char>('a' + generator() % 26); - } - yexception e; - e << s; + + void TestMessageCrop() { + TTempBuf tmp; + size_t size = tmp.Size() * 1.5; + TString s; + s.reserve(size); + TMersenne<ui64> generator(42); + for (int j = 0; j < 50; ++j) { + for (size_t i = 0; i < size; ++i) { + s += static_cast<char>('a' + generator() % 26); + } + yexception e; + e << s; UNIT_ASSERT_EQUAL(e.AsStrBuf(), s.substr(0, tmp.Size() - 1)); - } - } + } + } void TestTIoSystemErrorSpecialMethods() { TString testStr{"systemError"}; diff --git a/util/stream/fwd.h b/util/stream/fwd.h index ba3d8acd06..307676c6a7 100644 --- a/util/stream/fwd.h +++ b/util/stream/fwd.h @@ -38,7 +38,7 @@ class TStringStream; class TTeeOutput; -class TTempBufOutput; +class TTempBufOutput; struct TEol; diff --git a/util/stream/tempbuf.cpp b/util/stream/tempbuf.cpp index 3529953687..801a1fabb0 100644 --- a/util/stream/tempbuf.cpp +++ b/util/stream/tempbuf.cpp @@ -6,7 +6,7 @@ namespace { } } -void TTempBufOutput::DoWrite(const void* data, size_t len) { +void TTempBufOutput::DoWrite(const void* data, size_t len) { if (Y_LIKELY(len <= Left())) { Append(data, len); } else { diff --git a/util/stream/tempbuf.h b/util/stream/tempbuf.h index 3020db3a2b..a6dc001025 100644 --- a/util/stream/tempbuf.h +++ b/util/stream/tempbuf.h @@ -4,17 +4,17 @@ #include <util/memory/tempbuf.h> -class TTempBufOutput: public IOutputStream, public TTempBuf { +class TTempBufOutput: public IOutputStream, public TTempBuf { public: - inline TTempBufOutput() = default; + inline TTempBufOutput() = default; - explicit TTempBufOutput(size_t size) + explicit TTempBufOutput(size_t size) : TTempBuf(size) { } - TTempBufOutput(TTempBufOutput&&) noexcept = default; - TTempBufOutput& operator=(TTempBufOutput&&) noexcept = default; + TTempBufOutput(TTempBufOutput&&) noexcept = default; + TTempBufOutput& operator=(TTempBufOutput&&) noexcept = default; protected: void DoWrite(const void* data, size_t len) override; |