diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/xml.cpp | 14 | ||||
-rw-r--r-- | src/utils/xml.h | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index eae3567ef..099457af3 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -79,7 +79,8 @@ static void xmlErrorLogger(void *ctx A_UNUSED, const char *msg, ...) namespace XML { Document::Document(const std::string &filename, const bool useResman) : - mDoc(nullptr) + mDoc(nullptr), + mIsValid(false) { #ifdef USE_FUZZER if (Fuzzer::conditionTerminate(filename.c_str())) @@ -134,7 +135,8 @@ namespace XML } Document::Document(const char *const data, const int size) : - mDoc(data ? xmlParseMemory(data, size) : nullptr) + mDoc(data ? xmlParseMemory(data, size) : nullptr), + mIsValid(true) { } @@ -241,7 +243,7 @@ namespace XML return def; } - XmlNodePtr findFirstChildByName(const XmlNodePtr parent, + XmlNodePtr findFirstChildByName(const XmlNodePtrConst parent, const char *const name) { for_each_xml_child_node(child, parent) @@ -272,11 +274,11 @@ namespace XML bool Document::validateXml(const std::string &fileName) { - xmlDocPtr doc = xmlReadFile(fileName.c_str(), + const xmlDocPtr doc = xmlReadFile(fileName.c_str(), nullptr, XML_PARSE_PEDANTIC); - const bool valid(doc); + const bool valid1(doc); xmlFreeDoc(doc); - if (!valid) + if (!valid1) return false; std::ifstream file; diff --git a/src/utils/xml.h b/src/utils/xml.h index 9ed433ad5..85fa82270 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -150,7 +150,7 @@ namespace XML /** * Finds the first child node with the given name */ - XmlNodePtr findFirstChildByName(const XmlNodePtr parent, + XmlNodePtr findFirstChildByName(const XmlNodePtrConst parent, const char *const name) A_WARN_UNUSED; void initXML(); |