aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp
diff options
context:
space:
mode:
authorchegoryu <chegoryu@yandex-team.ru>2022-02-10 16:49:47 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:47 +0300
commit767f05356832cfac686778897626e124d257dbc8 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp
parente4b93027b4c6dbd741ebd637f0b5db1d583ee93f (diff)
downloadydb-767f05356832cfac686778897626e124d257dbc8.tar.gz
Restoring authorship annotation for <chegoryu@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp')
-rw-r--r--library/cpp/getopt/small/modchooser.cpp22
-rw-r--r--library/cpp/getopt/ut/modchooser_ut.cpp48
-rw-r--r--library/cpp/http/io/headers.h10
-rw-r--r--library/cpp/http/io/headers_ut.cpp34
-rw-r--r--library/cpp/protobuf/json/json2proto.cpp2
-rw-r--r--library/cpp/protobuf/json/json2proto.h16
-rw-r--r--library/cpp/protobuf/json/ut/json2proto_ut.cpp48
7 files changed, 90 insertions, 90 deletions
diff --git a/library/cpp/getopt/small/modchooser.cpp b/library/cpp/getopt/small/modchooser.cpp
index 8aaea9c9d6..2fa5cfd070 100644
--- a/library/cpp/getopt/small/modchooser.cpp
+++ b/library/cpp/getopt/small/modchooser.cpp
@@ -206,7 +206,7 @@ int TModChooser::Run(const int argc, const char** argv) const {
if (shiftArgs) {
TString firstArg;
- TVector<const char*> nargv(Reserve(argc));
+ TVector<const char*> nargv(Reserve(argc));
if (PrintShortCommandInUsage) {
firstArg = modeIter->second->Name;
@@ -219,26 +219,26 @@ int TModChooser::Run(const int argc, const char** argv) const {
for (int i = 2; i < argc; ++i) {
nargv.push_back(argv[i]);
}
- // According to the standard, "argv[argc] shall be a null pointer" (5.1.2.2.1).
- // http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1336
- nargv.push_back(nullptr);
+ // According to the standard, "argv[argc] shall be a null pointer" (5.1.2.2.1).
+ // http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1336
+ nargv.push_back(nullptr);
- return (*modeIter->second->Main)(nargv.size() - 1, nargv.data());
+ return (*modeIter->second->Main)(nargv.size() - 1, nargv.data());
} else {
return (*modeIter->second->Main)(argc, argv);
}
}
int TModChooser::Run(const TVector<TString>& argv) const {
- TVector<const char*> nargv(Reserve(argv.size() + 1));
+ TVector<const char*> nargv(Reserve(argv.size() + 1));
for (auto& arg : argv) {
nargv.push_back(arg.c_str());
}
- // According to the standard, "argv[argc] shall be a null pointer" (5.1.2.2.1).
- // http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1336
- nargv.push_back(nullptr);
-
- return Run(nargv.size() - 1, nargv.data());
+ // According to the standard, "argv[argc] shall be a null pointer" (5.1.2.2.1).
+ // http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1336
+ nargv.push_back(nullptr);
+
+ return Run(nargv.size() - 1, nargv.data());
}
size_t TModChooser::TMode::CalculateFullNameLen() const {
diff --git a/library/cpp/getopt/ut/modchooser_ut.cpp b/library/cpp/getopt/ut/modchooser_ut.cpp
index fee4298270..a14c8a5853 100644
--- a/library/cpp/getopt/ut/modchooser_ut.cpp
+++ b/library/cpp/getopt/ut/modchooser_ut.cpp
@@ -4,33 +4,33 @@
#include <util/stream/str.h>
-void ValidateArgcArgv(int argc, const char** argv) {
- UNIT_ASSERT_EQUAL(argc, 1);
- UNIT_ASSERT_EQUAL(argv[argc], nullptr);
-}
-
-int One(int argc, const char** argv) {
- ValidateArgcArgv(argc, argv);
+void ValidateArgcArgv(int argc, const char** argv) {
+ UNIT_ASSERT_EQUAL(argc, 1);
+ UNIT_ASSERT_EQUAL(argv[argc], nullptr);
+}
+
+int One(int argc, const char** argv) {
+ ValidateArgcArgv(argc, argv);
return 1;
}
-int Two(int argc, const char** argv) {
- ValidateArgcArgv(argc, argv);
+int Two(int argc, const char** argv) {
+ ValidateArgcArgv(argc, argv);
return 2;
}
-int Three(int argc, const char** argv) {
- ValidateArgcArgv(argc, argv);
+int Three(int argc, const char** argv) {
+ ValidateArgcArgv(argc, argv);
return 3;
}
-int Four(int argc, const char** argv) {
- ValidateArgcArgv(argc, argv);
+int Four(int argc, const char** argv) {
+ ValidateArgcArgv(argc, argv);
return 4;
}
-int Five(int argc, const char** argv) {
- ValidateArgcArgv(argc, argv);
+int Five(int argc, const char** argv) {
+ ValidateArgcArgv(argc, argv);
return 5;
}
@@ -46,25 +46,25 @@ Y_UNIT_TEST_SUITE(TModChooserTest) {
chooser.AddMode(NAMES[idx], FUNCTIONS[idx], NAMES[idx]);
}
- // test argc, argv
+ // test argc, argv
for (size_t idx = 0; idx < Y_ARRAY_SIZE(NAMES); ++idx) {
int argc = 2;
- const char* argv[] = {"UNITTEST", NAMES[idx], nullptr};
+ const char* argv[] = {"UNITTEST", NAMES[idx], nullptr};
UNIT_ASSERT_EQUAL(static_cast<int>(idx) + 1, chooser.Run(argc, argv));
}
-
- // test TVector<TString> argv
- for (size_t idx = 0; idx < Y_ARRAY_SIZE(NAMES); ++idx) {
- const TVector<TString> argv = {"UNITTEST", NAMES[idx]};
- UNIT_ASSERT_EQUAL(static_cast<int>(idx) + 1, chooser.Run(argv));
- }
+
+ // test TVector<TString> argv
+ for (size_t idx = 0; idx < Y_ARRAY_SIZE(NAMES); ++idx) {
+ const TVector<TString> argv = {"UNITTEST", NAMES[idx]};
+ UNIT_ASSERT_EQUAL(static_cast<int>(idx) + 1, chooser.Run(argv));
+ }
}
Y_UNIT_TEST(TestHelpMessage) {
TModChooser chooser;
int argc = 2;
- const char* argv[] = {"UNITTEST", "-?", nullptr};
+ const char* argv[] = {"UNITTEST", "-?", nullptr};
chooser.Run(argc, argv);
}
diff --git a/library/cpp/http/io/headers.h b/library/cpp/http/io/headers.h
index 7b164c1cbc..a71793d1c6 100644
--- a/library/cpp/http/io/headers.h
+++ b/library/cpp/http/io/headers.h
@@ -94,11 +94,11 @@ public:
/// заголовок на новый.
void AddOrReplaceHeader(const THttpInputHeader& header);
- template <typename ValueType>
- void AddOrReplaceHeader(TString name, const ValueType& value) {
- AddOrReplaceHeader(THttpInputHeader(std::move(name), ToString(value)));
- }
-
+ template <typename ValueType>
+ void AddOrReplaceHeader(TString name, const ValueType& value) {
+ AddOrReplaceHeader(THttpInputHeader(std::move(name), ToString(value)));
+ }
+
// Проверяет, есть ли такой заголовок
bool HasHeader(TStringBuf header) const;
diff --git a/library/cpp/http/io/headers_ut.cpp b/library/cpp/http/io/headers_ut.cpp
index a0b0ef1d50..1d23ef8fdc 100644
--- a/library/cpp/http/io/headers_ut.cpp
+++ b/library/cpp/http/io/headers_ut.cpp
@@ -54,7 +54,7 @@ class THttpHeadersTest: public TTestBase {
private:
typedef void (*TAddHeaderFunction)(THttpHeaders&, TStringBuf name, TStringBuf value);
- typedef void (*TAddOrReplaceHeaderFunction)(THttpHeaders&, TStringBuf name, TStringBuf value);
+ typedef void (*TAddOrReplaceHeaderFunction)(THttpHeaders&, TStringBuf name, TStringBuf value);
public:
void TestAddOperation1Arg();
@@ -73,16 +73,16 @@ private:
headers.AddHeader(TString(name), TString(value));
}
- static void AddOrReplaceHeaderImpl1Arg(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
- headers.AddOrReplaceHeader(THttpInputHeader(TString(name), TString(value)));
- }
-
- static void AddOrReplaceHeaderImpl2Args(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
- headers.AddOrReplaceHeader(TString(name), TString(value));
- }
-
+ static void AddOrReplaceHeaderImpl1Arg(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
+ headers.AddOrReplaceHeader(THttpInputHeader(TString(name), TString(value)));
+ }
+
+ static void AddOrReplaceHeaderImpl2Args(THttpHeaders& headers, TStringBuf name, TStringBuf value) {
+ headers.AddOrReplaceHeader(TString(name), TString(value));
+ }
+
void DoTestAddOperation(TAddHeaderFunction);
- void DoTestAddOrReplaceOperation(TAddHeaderFunction, TAddOrReplaceHeaderFunction);
+ void DoTestAddOrReplaceOperation(TAddHeaderFunction, TAddOrReplaceHeaderFunction);
};
UNIT_TEST_SUITE_REGISTRATION(THttpHeadersTest);
@@ -95,10 +95,10 @@ void THttpHeadersTest::TestAddOperation2Args() {
}
void THttpHeadersTest::TestAddOrReplaceOperation1Arg() {
- DoTestAddOrReplaceOperation(AddHeaderImpl1Arg, AddOrReplaceHeaderImpl1Arg);
+ DoTestAddOrReplaceOperation(AddHeaderImpl1Arg, AddOrReplaceHeaderImpl1Arg);
}
void THttpHeadersTest::TestAddOrReplaceOperation2Args() {
- DoTestAddOrReplaceOperation(AddHeaderImpl2Args, AddOrReplaceHeaderImpl2Args);
+ DoTestAddOrReplaceOperation(AddHeaderImpl2Args, AddOrReplaceHeaderImpl2Args);
}
void THttpHeadersTest::DoTestAddOperation(TAddHeaderFunction addHeader) {
@@ -124,19 +124,19 @@ void THttpHeadersTest::DoTestAddOperation(TAddHeaderFunction addHeader) {
}
// Sorry, but AddOrReplaceHeader replaces only first occurence
-void THttpHeadersTest::DoTestAddOrReplaceOperation(TAddHeaderFunction addHeader, TAddOrReplaceHeaderFunction addOrReplaceHeader) {
+void THttpHeadersTest::DoTestAddOrReplaceOperation(TAddHeaderFunction addHeader, TAddOrReplaceHeaderFunction addOrReplaceHeader) {
THttpHeaders h1;
addHeader(h1, "h1", "v1");
- addOrReplaceHeader(h1, "h2", "v1");
- addOrReplaceHeader(h1, "h2", "v2");
- addOrReplaceHeader(h1, "h2", "v3");
+ addOrReplaceHeader(h1, "h2", "v1");
+ addOrReplaceHeader(h1, "h2", "v2");
+ addOrReplaceHeader(h1, "h2", "v3");
addHeader(h1, "h2", "v4");
addHeader(h1, "h3", "v1");
addHeader(h1, "h3", "v2");
- addOrReplaceHeader(h1, "h3", "v3");
+ addOrReplaceHeader(h1, "h3", "v3");
THeadersExistence h2;
diff --git a/library/cpp/protobuf/json/json2proto.cpp b/library/cpp/protobuf/json/json2proto.cpp
index 9a13f0abd0..640c10f5a5 100644
--- a/library/cpp/protobuf/json/json2proto.cpp
+++ b/library/cpp/protobuf/json/json2proto.cpp
@@ -408,7 +408,7 @@ namespace NProtobufJson {
void MergeJson2Proto(const TStringBuf& json, google::protobuf::Message& proto, const TJson2ProtoConfig& config) {
NJson::TJsonReaderConfig jsonCfg;
jsonCfg.DontValidateUtf8 = true;
- jsonCfg.AllowComments = config.AllowComments;
+ jsonCfg.AllowComments = config.AllowComments;
NJson::TJsonValue jsonValue;
ReadJsonTree(json, &jsonCfg, &jsonValue, /* throwOnError = */ true);
diff --git a/library/cpp/protobuf/json/json2proto.h b/library/cpp/protobuf/json/json2proto.h
index 84402245b0..4c33498dfa 100644
--- a/library/cpp/protobuf/json/json2proto.h
+++ b/library/cpp/protobuf/json/json2proto.h
@@ -93,11 +93,11 @@ namespace NProtobufJson {
return *this;
}
- TSelf& SetAllowComments(bool value) {
- AllowComments = value;
- return *this;
- }
-
+ TSelf& SetAllowComments(bool value) {
+ AllowComments = value;
+ return *this;
+ }
+
TSelf& SetAllowUnknownFields(bool value) {
AllowUnknownFields = value;
return *this;
@@ -141,9 +141,9 @@ namespace NProtobufJson {
/// Custom spliter non array value to repeated fields.
TValueVectorizer ValueVectorizer;
-
- /// Allow js-style comments (both // and /**/)
- bool AllowComments = false;
+
+ /// Allow js-style comments (both // and /**/)
+ bool AllowComments = false;
};
/// @throw yexception
diff --git a/library/cpp/protobuf/json/ut/json2proto_ut.cpp b/library/cpp/protobuf/json/ut/json2proto_ut.cpp
index 24964ea652..0dfe57bc7a 100644
--- a/library/cpp/protobuf/json/ut/json2proto_ut.cpp
+++ b/library/cpp/protobuf/json/ut/json2proto_ut.cpp
@@ -1120,28 +1120,28 @@ Y_UNIT_TEST(TestEmptyStringForCastFromString) {
UNIT_ASSERT_EQUAL("", proto.GetOneString());
} // TestEmptyStringForCastFromString
-Y_UNIT_TEST(TestAllowComments) {
- constexpr TStringBuf json = R"(
-{
- "I32": 4, // comment1
-/*
- comment2
- {}
- qwer
-*/
- "I64": 3423
-}
-
-)";
-
- TJson2ProtoConfig config;
- TFlatOptional proto;
- UNIT_ASSERT_EXCEPTION_CONTAINS(Json2Proto(json, proto, config), yexception, "Error: Missing a name for object member");
-
- config.SetAllowComments(true);
- UNIT_ASSERT_NO_EXCEPTION(Json2Proto(json, proto, config));
- UNIT_ASSERT_VALUES_EQUAL(proto.GetI32(), 4);
- UNIT_ASSERT_VALUES_EQUAL(proto.GetI64(), 3423);
-} // TestAllowComments
-
+Y_UNIT_TEST(TestAllowComments) {
+ constexpr TStringBuf json = R"(
+{
+ "I32": 4, // comment1
+/*
+ comment2
+ {}
+ qwer
+*/
+ "I64": 3423
+}
+
+)";
+
+ TJson2ProtoConfig config;
+ TFlatOptional proto;
+ UNIT_ASSERT_EXCEPTION_CONTAINS(Json2Proto(json, proto, config), yexception, "Error: Missing a name for object member");
+
+ config.SetAllowComments(true);
+ UNIT_ASSERT_NO_EXCEPTION(Json2Proto(json, proto, config));
+ UNIT_ASSERT_VALUES_EQUAL(proto.GetI32(), 4);
+ UNIT_ASSERT_VALUES_EQUAL(proto.GetI64(), 3423);
+} // TestAllowComments
+
} // TJson2ProtoTest