aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgorokhov <gorokhov@yandex-team.ru>2022-02-10 16:50:58 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:58 +0300
commit5b479cd45d96f09fdae5acb40d9b50b9a58ad374 (patch)
tree3dacd0a3029c3952d224317fa6e5c18498a1c903
parentcdf09d3c9b04abf0ddc62045aa1ce08eabb12a76 (diff)
downloadydb-5b479cd45d96f09fdae5acb40d9b50b9a58ad374.tar.gz
Restoring authorship annotation for <gorokhov@yandex-team.ru>. Commit 1 of 2.
-rw-r--r--library/cpp/cgiparam/cgiparam.cpp30
-rw-r--r--library/cpp/cgiparam/cgiparam.h2
-rw-r--r--library/cpp/cgiparam/cgiparam_ut.cpp20
3 files changed, 26 insertions, 26 deletions
diff --git a/library/cpp/cgiparam/cgiparam.cpp b/library/cpp/cgiparam/cgiparam.cpp
index f3277b8e4b..17e0468069 100644
--- a/library/cpp/cgiparam/cgiparam.cpp
+++ b/library/cpp/cgiparam/cgiparam.cpp
@@ -30,22 +30,22 @@ bool TCgiParameters::Erase(const TStringBuf name, size_t pos) {
return false;
}
-bool TCgiParameters::Erase(const TStringBuf name, const TStringBuf val) {
- const auto pair = equal_range(name);
-
- bool found = false;
+bool TCgiParameters::Erase(const TStringBuf name, const TStringBuf val) {
+ const auto pair = equal_range(name);
+
+ bool found = false;
for (auto it = pair.first; it != pair.second;) {
- if (val == it->second) {
- it = erase(it);
- found = true;
- } else {
- ++it;
- }
- }
-
- return found;
-}
-
+ if (val == it->second) {
+ it = erase(it);
+ found = true;
+ } else {
+ ++it;
+ }
+ }
+
+ return found;
+}
+
size_t TCgiParameters::EraseAll(const TStringBuf name) {
size_t num = 0;
diff --git a/library/cpp/cgiparam/cgiparam.h b/library/cpp/cgiparam/cgiparam.h
index 87d1ab0ad4..fd5be5ba92 100644
--- a/library/cpp/cgiparam/cgiparam.h
+++ b/library/cpp/cgiparam/cgiparam.h
@@ -120,7 +120,7 @@ public:
void JoinUnescaped(const TStringBuf key, char sep, TStringBuf val = TStringBuf());
bool Erase(const TStringBuf name, size_t numOfValue = 0);
- bool Erase(const TStringBuf name, const TStringBuf val);
+ bool Erase(const TStringBuf name, const TStringBuf val);
inline const char* FormField(const TStringBuf name, size_t numOfValue = 0) const {
const_iterator it = Find(name, numOfValue);
diff --git a/library/cpp/cgiparam/cgiparam_ut.cpp b/library/cpp/cgiparam/cgiparam_ut.cpp
index a562342084..89496fa009 100644
--- a/library/cpp/cgiparam/cgiparam_ut.cpp
+++ b/library/cpp/cgiparam/cgiparam_ut.cpp
@@ -120,16 +120,16 @@ Y_UNIT_TEST_SUITE(TCgiParametersTest) {
}
Y_UNIT_TEST(TestErase) {
- TCgiParameters c;
- c.ScanAddAll("par=1&aaa=1&par=2&bbb&par=3&par=1");
-
- c.Erase("par", 1);
- UNIT_ASSERT_VALUES_EQUAL(c.Print(), "aaa=1&bbb=&par=1&par=3&par=1");
-
- c.Erase("par", "1");
- UNIT_ASSERT_VALUES_EQUAL(c.Print(), "aaa=1&bbb=&par=3");
- }
-
+ TCgiParameters c;
+ c.ScanAddAll("par=1&aaa=1&par=2&bbb&par=3&par=1");
+
+ c.Erase("par", 1);
+ UNIT_ASSERT_VALUES_EQUAL(c.Print(), "aaa=1&bbb=&par=1&par=3&par=1");
+
+ c.Erase("par", "1");
+ UNIT_ASSERT_VALUES_EQUAL(c.Print(), "aaa=1&bbb=&par=3");
+ }
+
Y_UNIT_TEST(TestReplaceUnescaped1) {
TCgiParameters c;
c.ScanAddAll("many_keys=1&aaa=1&many_keys=2&bbb&many_keys=3");