From 9b9a414ab63d896560dc501266100695b9704c06 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine@gmail.com" Date: Fri, 7 Dec 2012 06:35:53 +0000 Subject: Compatibility fixes (fixed warnings in gcc, msvc7, fixed errors in bcc, cw, msvc6) git-svn-id: http://pugixml.googlecode.com/svn/trunk@939 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 12 ++++++------ src/pugixml.hpp | 2 +- tests/test_dom_modify.cpp | 2 +- tests/test_dom_traverse.cpp | 2 ++ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index b8d3275..7e5c2a1 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -4554,14 +4554,14 @@ namespace pugi if (!extra) return impl::make_parse_result(status_out_of_memory); // save name; name of the root has to be NULL before parsing - otherwise closing node mismatches will not be detected at the top level - char_t* name = _root->name; + char_t* rootname = _root->name; _root->name = 0; // parse - xml_parse_result res = load_buffer_impl(doc, _root, const_cast(contents), size, options, encoding, false, false, &extra->buffer); + xml_parse_result res = impl::load_buffer_impl(doc, _root, const_cast(contents), size, options, encoding, false, false, &extra->buffer); // restore name - _root->name = name; + _root->name = rootname; // add extra buffer to the list extra->next = doc->extra_buffers; @@ -5307,21 +5307,21 @@ namespace pugi { reset(); - return load_buffer_impl(static_cast(_root), _root, const_cast(contents), size, options, encoding, false, false, &_buffer); + return impl::load_buffer_impl(static_cast(_root), _root, const_cast(contents), size, options, encoding, false, false, &_buffer); } PUGI__FN xml_parse_result xml_document::load_buffer_inplace(void* contents, size_t size, unsigned int options, xml_encoding encoding) { reset(); - return load_buffer_impl(static_cast(_root), _root, contents, size, options, encoding, true, false, &_buffer); + return impl::load_buffer_impl(static_cast(_root), _root, contents, size, options, encoding, true, false, &_buffer); } PUGI__FN xml_parse_result xml_document::load_buffer_inplace_own(void* contents, size_t size, unsigned int options, xml_encoding encoding) { reset(); - return load_buffer_impl(static_cast(_root), _root, contents, size, options, encoding, true, true, &_buffer); + return impl::load_buffer_impl(static_cast(_root), _root, contents, size, options, encoding, true, true, &_buffer); } PUGI__FN void xml_document::save(xml_writer& writer, const char_t* indent, unsigned int flags, xml_encoding encoding) const diff --git a/src/pugixml.hpp b/src/pugixml.hpp index a736f53..09be990 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -830,7 +830,7 @@ namespace pugi status_bad_end_element, // Parsing error occurred while parsing end element tag status_end_element_mismatch,// There was a mismatch of start-end tags (closing tag had incorrect name, some tag was not closed or there was an excessive closing tag) - status_append_invalid_root, // Unable to append nodes since root type is not node_element or node_document (exclusive to xml_node::append_buffer) + status_append_invalid_root // Unable to append nodes since root type is not node_element or node_document (exclusive to xml_node::append_buffer) }; // Parsing result diff --git a/tests/test_dom_modify.cpp b/tests/test_dom_modify.cpp index 8295c4c..620504a 100644 --- a/tests/test_dom_modify.cpp +++ b/tests/test_dom_modify.cpp @@ -1019,7 +1019,7 @@ TEST(dom_node_append_buffer_out_of_memory_buffer) { test_runner::_memory_fail_threshold = 32768 + 128; - const char data[128] = {}; + char data[128] = {0}; xml_document doc; CHECK(doc.append_buffer(data, sizeof(data)).status == status_out_of_memory); diff --git a/tests/test_dom_traverse.cpp b/tests/test_dom_traverse.cpp index 1af8572..d699c5e 100644 --- a/tests/test_dom_traverse.cpp +++ b/tests/test_dom_traverse.cpp @@ -545,6 +545,8 @@ TEST(dom_node_find_child_by_attribute_null) xml_node node2 = doc.append_child(STR("a")); xml_node node3 = doc.append_child(STR("a")); + (void)node0; + // this adds an attribute with null name and/or value in the internal representation node1.append_attribute(STR("")); node2.append_attribute(STR("id")); -- cgit v1.2.3