diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/xml | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/xml')
-rw-r--r-- | library/cpp/xml/document/xml-document.cpp | 2 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-document_ut.cpp | 26 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-options_ut.cpp | 8 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-textreader.cpp | 20 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-textreader.h | 4 | ||||
-rw-r--r-- | library/cpp/xml/document/xml-textreader_ut.cpp | 14 |
6 files changed, 37 insertions, 37 deletions
diff --git a/library/cpp/xml/document/xml-document.cpp b/library/cpp/xml/document/xml-document.cpp index 18a554d732..eb2729f8db 100644 --- a/library/cpp/xml/document/xml-document.cpp +++ b/library/cpp/xml/document/xml-document.cpp @@ -308,7 +308,7 @@ namespace NXml { static int XmlWriteToOstream(void* context, const char* buffer, int len) { // possibly use to save doc as well - IOutputStream* out = (IOutputStream*)context; + IOutputStream* out = (IOutputStream*)context; out->Write(buffer, len); return len; } diff --git a/library/cpp/xml/document/xml-document_ut.cpp b/library/cpp/xml/document/xml-document_ut.cpp index 9f537b75c4..78e9cdf52b 100644 --- a/library/cpp/xml/document/xml-document_ut.cpp +++ b/library/cpp/xml/document/xml-document_ut.cpp @@ -3,8 +3,8 @@ #include "xml-document.h" -Y_UNIT_TEST_SUITE(TestXmlDocument) { - Y_UNIT_TEST(Iteration) { +Y_UNIT_TEST_SUITE(TestXmlDocument) { + Y_UNIT_TEST(Iteration) { NXml::TDocument xml( "<?xml version=\"1.0\"?>\n" "<root>qq<a><b></b></a>ww<c></c></root>", @@ -18,7 +18,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { UNIT_ASSERT_EQUAL(n.Name(), "c"); } - Y_UNIT_TEST(ParseString) { + Y_UNIT_TEST(ParseString) { NXml::TDocument xml( "<?xml version=\"1.0\"?>\n" "<root>\n" @@ -35,7 +35,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { NXml::TConstNode text = root.Node("text"); UNIT_ASSERT_EQUAL(text.Value<TString>(), "Некоторый текст"); } - Y_UNIT_TEST(SerializeString) { + Y_UNIT_TEST(SerializeString) { NXml::TDocument xml("frob", NXml::TDocument::RootName); xml.Root().SetAttr("xyzzy", "Frobozz"); xml.Root().SetAttr("kulness", 0.3); @@ -63,7 +63,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { "<frob xyzzy=\"привет =)\"/>\n"); } } - Y_UNIT_TEST(XPathNs) { + Y_UNIT_TEST(XPathNs) { using namespace NXml; TDocument xml( "<?xml version=\"1.0\"?>\n" @@ -91,7 +91,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { UNIT_ASSERT_EXCEPTION(root.Node("text", false, *ctxt), yexception); UNIT_ASSERT_EQUAL(root.Node("h:text", false, *ctxt).Value<TString>(), "Некоторый текст"); } - Y_UNIT_TEST(XmlNodes) { + Y_UNIT_TEST(XmlNodes) { using namespace NXml; TDocument xml("<?xml version=\"1.0\"?>\n" "<root>qq<a><b>asdfg</b></a>ww<c></c></root>", @@ -151,14 +151,14 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { UNIT_ASSERT_EXCEPTION(node.Value<TString>(), yexception); UNIT_ASSERT_EXCEPTION(node.IsText(), yexception); } - Y_UNIT_TEST(DefVal) { + Y_UNIT_TEST(DefVal) { using namespace NXml; TDocument xml("<?xml version=\"1.0\"?>\n" "<root><a></a></root>", NXml::TDocument::String); UNIT_ASSERT_EQUAL(xml.Root().Node("a", true).Node("b", true).Value<int>(3), 3); } - Y_UNIT_TEST(NodesVsXPath) { + Y_UNIT_TEST(NodesVsXPath) { using namespace NXml; TDocument xml("<?xml version=\"1.0\"?>\n" "<root><a x=\"y\"></a></root>", @@ -166,7 +166,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { UNIT_ASSERT_EXCEPTION(xml.Root().Nodes("/root/a/@x"), yexception); UNIT_ASSERT_VALUES_EQUAL(xml.Root().XPath("/root/a/@x").Size(), 1); } - Y_UNIT_TEST(NodeIsFirst) { + Y_UNIT_TEST(NodeIsFirst) { using namespace NXml; TDocument xml("<?xml version=\"1.0\"?>\n" "<root><a x=\"y\">first</a>" @@ -175,7 +175,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { UNIT_ASSERT_EXCEPTION(xml.Root().Node("/root/a/@x"), yexception); UNIT_ASSERT_STRINGS_EQUAL(xml.Root().Node("/root/a").Value<TString>(), "first"); } - Y_UNIT_TEST(CopyNode) { + Y_UNIT_TEST(CopyNode) { using namespace NXml; // default-construct empty node TNode empty; @@ -204,7 +204,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { "<root><a><node><b>bold</b><i>ita</i></node></a></root>\n"); } - Y_UNIT_TEST(RenderNode) { + Y_UNIT_TEST(RenderNode) { using namespace NXml; { // no namespaces @@ -236,7 +236,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { } } - Y_UNIT_TEST(ReuseXPathContext) { + Y_UNIT_TEST(ReuseXPathContext) { using namespace NXml; TDocument xml( @@ -279,7 +279,7 @@ Y_UNIT_TEST_SUITE(TestXmlDocument) { UNIT_ASSERT_EQUAL(ys[0].Value<int>(), 20); } - Y_UNIT_TEST(Html) { + Y_UNIT_TEST(Html) { using namespace NXml; TDocument htmlChunk("video", TDocument::RootName); diff --git a/library/cpp/xml/document/xml-options_ut.cpp b/library/cpp/xml/document/xml-options_ut.cpp index 9be16baf3d..63f2ed4f59 100644 --- a/library/cpp/xml/document/xml-options_ut.cpp +++ b/library/cpp/xml/document/xml-options_ut.cpp @@ -2,19 +2,19 @@ #include <library/cpp/testing/unittest/registar.h> -Y_UNIT_TEST_SUITE(TestXmlOptions) { - Y_UNIT_TEST(SetHuge) { +Y_UNIT_TEST_SUITE(TestXmlOptions) { + Y_UNIT_TEST(SetHuge) { NXml::TOptions opts; opts.Set(NXml::EOption::Huge); UNIT_ASSERT_EQUAL(XML_PARSE_HUGE, opts.GetMask()); } - Y_UNIT_TEST(VariadicContructor) { + Y_UNIT_TEST(VariadicContructor) { NXml::TOptions opts(NXml::EOption::Huge, NXml::EOption::Compact, NXml::EOption::SAX1); UNIT_ASSERT_EQUAL(XML_PARSE_HUGE | XML_PARSE_COMPACT | XML_PARSE_SAX1, opts.GetMask()); } - Y_UNIT_TEST(Chaining) { + Y_UNIT_TEST(Chaining) { NXml::TOptions opts; opts diff --git a/library/cpp/xml/document/xml-textreader.cpp b/library/cpp/xml/document/xml-textreader.cpp index b946f1fbf2..557fe9d3d4 100644 --- a/library/cpp/xml/document/xml-textreader.cpp +++ b/library/cpp/xml/document/xml-textreader.cpp @@ -7,7 +7,7 @@ #include <util/system/compiler.h> namespace NXml { - TTextReader::TTextReader(IInputStream& stream, const TOptions& options) + TTextReader::TTextReader(IInputStream& stream, const TOptions& options) : Stream(stream) , IsError(false) { @@ -169,12 +169,12 @@ namespace NXml { // It is almost "noexcept" (std::bad_alloc may happen when saving exception message to new TString). // Waiting for std::exception_ptr and std::rethrow_exception from C++11 in Arcadia to make it really "noexcept". int TTextReader::ReadFromInputStreamCallback(void* context, char* buffer, int len) { - Y_ASSERT(len >= 0); + Y_ASSERT(len >= 0); TTextReader* reader = static_cast<TTextReader*>(context); int result = -1; - // Exception may be thrown by IInputStream::Read(). + // Exception may be thrown by IInputStream::Read(). // It is caught unconditionally because exceptions cannot safely pass through libxml2 plain C code // (no destructors, no RAII, raw pointers, so in case of stack unwinding some memory gets leaked). @@ -191,7 +191,7 @@ namespace NXml { void TTextReader::OnLibxmlError(void* arg, const char* msg, xmlParserSeverities severity, xmlTextReaderLocatorPtr locator) { TTextReader* reader = static_cast<TTextReader*>(arg); - Y_ASSERT(reader != nullptr); + Y_ASSERT(reader != nullptr); TStringStream& out = reader->LogError(); @@ -247,7 +247,7 @@ namespace NXml { } void TTextReader::CheckForExceptions() const { - if (Y_LIKELY(!IsError)) { + if (Y_LIKELY(!IsError)) { return; } @@ -266,28 +266,28 @@ namespace NXml { } bool TTextReader::BoolResult(int value) const { - if (Y_UNLIKELY(value == -1)) { + if (Y_UNLIKELY(value == -1)) { ThrowException(); } return (value != 0); } int TTextReader::IntResult(int value) const { - if (Y_UNLIKELY(value == -1)) { + if (Y_UNLIKELY(value == -1)) { ThrowException(); } return value; } char TTextReader::CharResult(int value) const { - if (Y_UNLIKELY(value == -1)) { + if (Y_UNLIKELY(value == -1)) { ThrowException(); } return static_cast<char>(value); } TStringBuf TTextReader::ConstStringResult(const xmlChar* value) const { - if (Y_UNLIKELY(value == nullptr)) { + if (Y_UNLIKELY(value == nullptr)) { ThrowException(); } return CAST2CHAR(value); @@ -299,7 +299,7 @@ namespace NXml { } TString TTextReader::TempStringResult(TCharPtr value) const { - if (Y_UNLIKELY(value == nullptr)) { + if (Y_UNLIKELY(value == nullptr)) { ThrowException(); } return TString(CAST2CHAR(value.Get())); diff --git a/library/cpp/xml/document/xml-textreader.h b/library/cpp/xml/document/xml-textreader.h index ab4c329d26..a1309c1019 100644 --- a/library/cpp/xml/document/xml-textreader.h +++ b/library/cpp/xml/document/xml-textreader.h @@ -77,7 +77,7 @@ namespace NXml { }; public: - TTextReader(IInputStream& stream, const TOptions& options = TOptions()); + TTextReader(IInputStream& stream, const TOptions& options = TOptions()); ~TTextReader(); /** @@ -313,7 +313,7 @@ namespace NXml { TString TempStringOrEmptyResult(TCharPtr value) const; private: - IInputStream& Stream; + IInputStream& Stream; mutable bool IsError; mutable TStringStream ErrorBuffer; diff --git a/library/cpp/xml/document/xml-textreader_ut.cpp b/library/cpp/xml/document/xml-textreader_ut.cpp index 6232dfe47e..81e11e3348 100644 --- a/library/cpp/xml/document/xml-textreader_ut.cpp +++ b/library/cpp/xml/document/xml-textreader_ut.cpp @@ -29,8 +29,8 @@ namespace { } } -Y_UNIT_TEST_SUITE(TestXmlTextReader) { - Y_UNIT_TEST(BasicExample) { +Y_UNIT_TEST_SUITE(TestXmlTextReader) { + Y_UNIT_TEST(BasicExample) { const TString xml = "<?xml version=\"1.0\"?>\n" "<example toto=\"1\">\n" " <examplechild id=\"1\">\n" @@ -134,7 +134,7 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { "" "</root>"; - Y_UNIT_TEST(ParseXmlSimple) { + Y_UNIT_TEST(ParseXmlSimple) { struct TCountry { TString Name; TVector<TString> Cities; @@ -150,7 +150,7 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { c.Name = node.FirstChild("name").Value<TString>(); const NXml::TConstNodes cityNodes = node.Nodes("cities/city"); - for (auto cityNode : cityNodes) { + for (auto cityNode : cityNodes) { c.Cities.push_back(cityNode.Value<TString>()); } }; @@ -179,7 +179,7 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { UNIT_ASSERT_EQUAL(ukraine.Cities[0], "Киев"); } - Y_UNIT_TEST(ParseXmlDeepLevel) { + Y_UNIT_TEST(ParseXmlDeepLevel) { TVector<TString> cities; auto handler = [&cities](NXml::TConstNode node) { @@ -195,7 +195,7 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { UNIT_ASSERT_EQUAL(cities[3], "Киев"); } - Y_UNIT_TEST(ParseXmlException) { + Y_UNIT_TEST(ParseXmlException) { // Check that exception properly passes through plain C code of libxml, // no leaks are detected by valgrind. auto handler = [](NXml::TConstNode node) { @@ -251,7 +251,7 @@ Y_UNIT_TEST_SUITE(TestXmlTextReader) { "" "</Companies>"; - Y_UNIT_TEST(NamespaceHell) { + Y_UNIT_TEST(NamespaceHell) { using TNS = NXml::TNamespaceForXPath; const NXml::TNamespacesForXPath ns = { TNS{"b", "http://maps.yandex.ru/backa/1.x"}, |