tests: Fix some Coverity issues
This commit is contained in:
parent
d6f7766172
commit
2537cccad3
@ -32,9 +32,11 @@ static bool load_file_in_memory(const char* path, char*& data, size_t& size)
|
||||
if (!file) return false;
|
||||
|
||||
fseek(file, 0, SEEK_END);
|
||||
size = static_cast<size_t>(ftell(file));
|
||||
long length = ftell(file);
|
||||
fseek(file, 0, SEEK_SET);
|
||||
|
||||
CHECK(length >= 0);
|
||||
size = static_cast<size_t>(length);
|
||||
data = new char[size];
|
||||
|
||||
CHECK(fread(data, 1, size, file) == size);
|
||||
|
@ -644,7 +644,7 @@ TEST_XML(dom_node_remove_child, "<node><n1/><n2/><n3/><child><n4/></child></node
|
||||
|
||||
TEST_XML(dom_node_remove_child_complex, "<node id='1'><n1 id1='1' id2='2'/><n2/><n3/><child><n4/></child></node>")
|
||||
{
|
||||
doc.child(STR("node")).remove_child(STR("n1"));
|
||||
CHECK(doc.child(STR("node")).remove_child(STR("n1")));
|
||||
|
||||
CHECK_NODE(doc, STR("<node id=\"1\"><n2 /><n3 /><child><n4 /></child></node>"));
|
||||
|
||||
@ -1040,7 +1040,7 @@ TEST_XML(dom_node_append_buffer_remove, "<node>test</node>")
|
||||
|
||||
CHECK_NODE(doc, STR("<node>test</node>"));
|
||||
|
||||
doc.remove_child(STR("node"));
|
||||
CHECK(doc.remove_child(STR("node")));
|
||||
|
||||
CHECK(!doc.first_child());
|
||||
}
|
||||
|
@ -1085,14 +1085,24 @@ TEST_XML(dom_unspecified_bool_coverage, "<node attr='value'>text</node>")
|
||||
{
|
||||
xml_node node = doc.first_child();
|
||||
|
||||
CHECK(node);
|
||||
static_cast<void (*)(xml_node***)>(node)(0);
|
||||
|
||||
CHECK(node.first_attribute());
|
||||
static_cast<void (*)(xml_attribute***)>(node.first_attribute())(0);
|
||||
|
||||
CHECK(node.text());
|
||||
static_cast<void (*)(xml_text***)>(node.text())(0);
|
||||
|
||||
#ifndef PUGIXML_NO_XPATH
|
||||
xpath_query q(STR("/node"));
|
||||
|
||||
CHECK(q);
|
||||
static_cast<void (*)(xpath_query***)>(q)(0);
|
||||
static_cast<void (*)(xpath_node***)>(q.evaluate_node(doc))(0);
|
||||
|
||||
xpath_node qn = q.evaluate_node(doc);
|
||||
|
||||
CHECK(qn);
|
||||
static_cast<void (*)(xpath_node***)>(qn)(0);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user