Skip to content

Commit 623b4f5

Browse files
committed
clang-tidy: use auto
Found with modernize-use-auto Signed-off-by: Rosen Penev <rosenp@gmail.com>
1 parent 2f3c5af commit 623b4f5

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

examples/dom_parser/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void print_node(const xmlpp::Node* node, unsigned int indentation = 0)
6666
{
6767
std::cout << indent << "content = " << nodeContent->get_content() << std::endl;
6868
}
69-
else if(const xmlpp::Element* nodeElement = dynamic_cast<const xmlpp::Element*>(node))
69+
else if(auto nodeElement = dynamic_cast<const xmlpp::Element*>(node))
7070
{
7171
//A normal Element node:
7272

examples/dom_xinclude/main.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void print_node(const xmlpp::Node* node, unsigned int indentation = 0)
6565
{
6666
std::cout << indent << "content = " << nodeContent->get_content() << std::endl;
6767
}
68-
else if (const xmlpp::Element* nodeElement = dynamic_cast<const xmlpp::Element*>(node))
68+
else if (auto nodeElement = dynamic_cast<const xmlpp::Element*>(node))
6969
{
7070
//A normal Element node:
7171
std::cout << indent << " Element line = " << node->get_line() << std::endl;

libxml++/nodes/node.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ ustring Node::get_namespace_prefix() const
463463
else if (impl_->type == XML_ATTRIBUTE_DECL)
464464
{
465465
//impl_ is actually of type xmlAttribute, instead of just xmlNode.
466-
const xmlAttribute* const attr = reinterpret_cast<const xmlAttribute*>(impl_);
466+
auto attr = reinterpret_cast<const xmlAttribute*>(impl_);
467467
return attr->prefix ? (const char*)attr->prefix : "";
468468
}
469469
else if(impl_->ns && impl_->ns->prefix)

libxml++/parsers/domparser.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ namespace {
180180
char * buffer,
181181
int len)
182182
{
183-
std::istream *in = static_cast<std::istream*>(context);
183+
auto in = static_cast<std::istream*>(context);
184184
in->read(buffer, len);
185185
return in->gcount();
186186
}

libxml++/parsers/saxparser.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ namespace {
215215
char * buffer,
216216
int len)
217217
{
218-
std::istream *in = static_cast<std::istream*>(context);
218+
auto in = static_cast<std::istream*>(context);
219219
in->read(buffer, len);
220220
return in->gcount();
221221
}

libxml++/validators/dtdvalidator.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void DtdValidator::validate(const Document* document)
164164
xmlResetLastError();
165165
initialize_context();
166166

167-
const bool res = (bool)xmlValidateDtd(pimpl_->context, (xmlDoc*)document->cobj(),
167+
const auto res = (bool)xmlValidateDtd(pimpl_->context, (xmlDoc*)document->cobj(),
168168
pimpl_->dtd->cobj());
169169

170170
if (!res)

0 commit comments

Comments
 (0)