diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-06 23:34:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-07 19:23:40 +0300 |
commit | 36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch) | |
tree | 190156cb88b13a38a6d13c69ee0742cc078065a1 /src/utils/xml | |
parent | f1518dd8476c968a43fa57cfb06198e290a4f77a (diff) | |
download | mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2 mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip |
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/utils/xml')
-rw-r--r-- | src/utils/xml/libxml.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/utils/xml/libxml.cpp b/src/utils/xml/libxml.cpp index 32e0cc556..840c28edd 100644 --- a/src/utils/xml/libxml.cpp +++ b/src/utils/xml/libxml.cpp @@ -51,7 +51,7 @@ static void xmlErrorLogger(void *ctx A_UNUSED, const char *msg A_UNUSED, ...) static void xmlErrorLogger(void *ctx A_UNUSED, const char *msg, ...) { - if (!msg) + if (msg == nullptr) return; size_t size = 1024; @@ -68,7 +68,7 @@ static void xmlErrorLogger(void *ctx A_UNUSED, const char *msg, ...) buf[size] = 0; va_end(ap); - if (logger) + if (logger != nullptr) logger->log_r("%s", buf); else puts(buf); @@ -131,12 +131,12 @@ namespace XML } } - if (data) + if (data != nullptr) { mDoc = xmlParseMemory(data, size); delete [] data; - if (!mDoc) + if (mDoc == nullptr) { reportAlways("Error parsing XML file %s", filename.c_str()); } @@ -150,20 +150,20 @@ namespace XML } Document::Document(const char *const data, const int size) : - mDoc(data ? xmlParseMemory(data, size) : nullptr), + mDoc(data != nullptr ? xmlParseMemory(data, size) : nullptr), mIsValid(true) { } Document::~Document() { - if (mDoc) + if (mDoc != nullptr) xmlFreeDoc(mDoc); } XmlNodePtr Document::rootNode() { - return mDoc ? xmlDocGetRootElement(mDoc) : nullptr; + return mDoc != nullptr ? xmlDocGetRootElement(mDoc) : nullptr; } int getProperty(XmlNodeConstPtr node, @@ -173,7 +173,7 @@ namespace XML int &ret = def; xmlChar *const prop = XmlGetProp(node, name); - if (prop) + if (prop != nullptr) { ret = atoi(reinterpret_cast<const char*>(prop)); xmlFree(prop); @@ -191,7 +191,7 @@ namespace XML int &ret = def; xmlChar *const prop = XmlGetProp(node, name); - if (prop) + if (prop != nullptr) { ret = atoi(reinterpret_cast<char*>(prop)); xmlFree(prop); @@ -210,7 +210,7 @@ namespace XML double &ret = def; xmlChar *const prop = XmlGetProp(node, name); - if (prop) + if (prop != nullptr) { ret = atof(reinterpret_cast<char*>(prop)); xmlFree(prop); @@ -224,7 +224,7 @@ namespace XML const std::string &def) { xmlChar *const prop = XmlGetProp(node, name); - if (prop) + if (prop != nullptr) { std::string val = reinterpret_cast<char*>(prop); xmlFree(prop); @@ -239,7 +239,7 @@ namespace XML const std::string &def) { std::string str = getProperty(node, name, def); - if (!translator) + if (translator == nullptr) return str; return translator->getStr(str); @@ -268,7 +268,7 @@ namespace XML XmlNodePtr findFirstChildByName(XmlNodeConstPtrConst parent, const char *const name) { - if (!parent) + if (parent == nullptr) return nullptr; for_each_xml_child_node(child, parent) { @@ -300,7 +300,7 @@ namespace XML { const xmlDocPtr doc = xmlReadFile(fileName.c_str(), nullptr, XML_PARSE_PEDANTIC); - const bool valid1(doc); + const bool valid1(doc != nullptr); xmlFreeDoc(doc); if (!valid1) return false; |