From 623b4f5ec1bc1a70ee89f4fcbe9ff1c436022837 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 1 Jul 2022 21:34:27 -0700 Subject: [PATCH] clang-tidy: use auto Found with modernize-use-auto Signed-off-by: Rosen Penev --- examples/dom_parser/main.cc | 2 +- examples/dom_xinclude/main.cc | 2 +- libxml++/nodes/node.cc | 2 +- libxml++/parsers/domparser.cc | 2 +- libxml++/parsers/saxparser.cc | 2 +- libxml++/validators/dtdvalidator.cc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/dom_parser/main.cc b/examples/dom_parser/main.cc index edb4b0d0..ae78b733 100644 --- a/examples/dom_parser/main.cc +++ b/examples/dom_parser/main.cc @@ -66,7 +66,7 @@ void print_node(const xmlpp::Node* node, unsigned int indentation = 0) { std::cout << indent << "content = " << nodeContent->get_content() << std::endl; } - else if(const xmlpp::Element* nodeElement = dynamic_cast(node)) + else if(auto nodeElement = dynamic_cast(node)) { //A normal Element node: diff --git a/examples/dom_xinclude/main.cc b/examples/dom_xinclude/main.cc index 8603a268..8017e0b6 100644 --- a/examples/dom_xinclude/main.cc +++ b/examples/dom_xinclude/main.cc @@ -65,7 +65,7 @@ void print_node(const xmlpp::Node* node, unsigned int indentation = 0) { std::cout << indent << "content = " << nodeContent->get_content() << std::endl; } - else if (const xmlpp::Element* nodeElement = dynamic_cast(node)) + else if (auto nodeElement = dynamic_cast(node)) { //A normal Element node: std::cout << indent << " Element line = " << node->get_line() << std::endl; diff --git a/libxml++/nodes/node.cc b/libxml++/nodes/node.cc index ca39e236..c6ce949b 100644 --- a/libxml++/nodes/node.cc +++ b/libxml++/nodes/node.cc @@ -463,7 +463,7 @@ ustring Node::get_namespace_prefix() const else if (impl_->type == XML_ATTRIBUTE_DECL) { //impl_ is actually of type xmlAttribute, instead of just xmlNode. - const xmlAttribute* const attr = reinterpret_cast(impl_); + auto attr = reinterpret_cast(impl_); return attr->prefix ? (const char*)attr->prefix : ""; } else if(impl_->ns && impl_->ns->prefix) diff --git a/libxml++/parsers/domparser.cc b/libxml++/parsers/domparser.cc index ad4c9608..e2eeb9a3 100644 --- a/libxml++/parsers/domparser.cc +++ b/libxml++/parsers/domparser.cc @@ -180,7 +180,7 @@ namespace { char * buffer, int len) { - std::istream *in = static_cast(context); + auto in = static_cast(context); in->read(buffer, len); return in->gcount(); } diff --git a/libxml++/parsers/saxparser.cc b/libxml++/parsers/saxparser.cc index 0cf60a5f..328bbcb5 100644 --- a/libxml++/parsers/saxparser.cc +++ b/libxml++/parsers/saxparser.cc @@ -215,7 +215,7 @@ namespace { char * buffer, int len) { - std::istream *in = static_cast(context); + auto in = static_cast(context); in->read(buffer, len); return in->gcount(); } diff --git a/libxml++/validators/dtdvalidator.cc b/libxml++/validators/dtdvalidator.cc index 703c2c74..f456f1e7 100644 --- a/libxml++/validators/dtdvalidator.cc +++ b/libxml++/validators/dtdvalidator.cc @@ -164,7 +164,7 @@ void DtdValidator::validate(const Document* document) xmlResetLastError(); initialize_context(); - const bool res = (bool)xmlValidateDtd(pimpl_->context, (xmlDoc*)document->cobj(), + const auto res = (bool)xmlValidateDtd(pimpl_->context, (xmlDoc*)document->cobj(), pimpl_->dtd->cobj()); if (!res)