Fix compilation and tests after merge.
This commit is contained in:
parent
a19da1c246
commit
6c11a0c693
@ -5602,7 +5602,10 @@ namespace pugi
|
|||||||
if (!proto) return xml_attribute();
|
if (!proto) return xml_attribute();
|
||||||
if (!impl::allow_insert_attribute(type())) return xml_attribute();
|
if (!impl::allow_insert_attribute(type())) return xml_attribute();
|
||||||
|
|
||||||
xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
|
impl::xml_allocator& alloc = impl::get_allocator(_root);
|
||||||
|
if (!alloc.reserve()) return xml_attribute();
|
||||||
|
|
||||||
|
xml_attribute a(impl::allocate_attribute(alloc));
|
||||||
if (!a) return xml_attribute();
|
if (!a) return xml_attribute();
|
||||||
|
|
||||||
impl::append_attribute(a._attr, _root);
|
impl::append_attribute(a._attr, _root);
|
||||||
@ -5616,7 +5619,10 @@ namespace pugi
|
|||||||
if (!proto) return xml_attribute();
|
if (!proto) return xml_attribute();
|
||||||
if (!impl::allow_insert_attribute(type())) return xml_attribute();
|
if (!impl::allow_insert_attribute(type())) return xml_attribute();
|
||||||
|
|
||||||
xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
|
impl::xml_allocator& alloc = impl::get_allocator(_root);
|
||||||
|
if (!alloc.reserve()) return xml_attribute();
|
||||||
|
|
||||||
|
xml_attribute a(impl::allocate_attribute(alloc));
|
||||||
if (!a) return xml_attribute();
|
if (!a) return xml_attribute();
|
||||||
|
|
||||||
impl::prepend_attribute(a._attr, _root);
|
impl::prepend_attribute(a._attr, _root);
|
||||||
@ -5631,7 +5637,10 @@ namespace pugi
|
|||||||
if (!impl::allow_insert_attribute(type())) return xml_attribute();
|
if (!impl::allow_insert_attribute(type())) return xml_attribute();
|
||||||
if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
|
if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
|
||||||
|
|
||||||
xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
|
impl::xml_allocator& alloc = impl::get_allocator(_root);
|
||||||
|
if (!alloc.reserve()) return xml_attribute();
|
||||||
|
|
||||||
|
xml_attribute a(impl::allocate_attribute(alloc));
|
||||||
if (!a) return xml_attribute();
|
if (!a) return xml_attribute();
|
||||||
|
|
||||||
impl::insert_attribute_after(a._attr, attr._attr, _root);
|
impl::insert_attribute_after(a._attr, attr._attr, _root);
|
||||||
@ -5646,7 +5655,10 @@ namespace pugi
|
|||||||
if (!impl::allow_insert_attribute(type())) return xml_attribute();
|
if (!impl::allow_insert_attribute(type())) return xml_attribute();
|
||||||
if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
|
if (!attr || !impl::is_attribute_of(attr._attr, _root)) return xml_attribute();
|
||||||
|
|
||||||
xml_attribute a(impl::allocate_attribute(impl::get_allocator(_root)));
|
impl::xml_allocator& alloc = impl::get_allocator(_root);
|
||||||
|
if (!alloc.reserve()) return xml_attribute();
|
||||||
|
|
||||||
|
xml_attribute a(impl::allocate_attribute(alloc));
|
||||||
if (!a) return xml_attribute();
|
if (!a) return xml_attribute();
|
||||||
|
|
||||||
impl::insert_attribute_before(a._attr, attr._attr, _root);
|
impl::insert_attribute_before(a._attr, attr._attr, _root);
|
||||||
@ -6010,7 +6022,7 @@ namespace pugi
|
|||||||
for (xml_node_struct* i = _root; i; i = i->parent)
|
for (xml_node_struct* i = _root; i; i = i->parent)
|
||||||
{
|
{
|
||||||
offset += (i != _root);
|
offset += (i != _root);
|
||||||
offset += i->name ? impl::strlength(i->name) : 0;
|
offset += (impl::has_name(i) && i->contents) ? impl::strlength(i->contents) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
string_t result;
|
string_t result;
|
||||||
@ -6021,12 +6033,12 @@ namespace pugi
|
|||||||
if (j != _root)
|
if (j != _root)
|
||||||
result[--offset] = delimiter;
|
result[--offset] = delimiter;
|
||||||
|
|
||||||
if (j->name && *j->name)
|
if (impl::has_name(j) && j->contents && *j->contents)
|
||||||
{
|
{
|
||||||
size_t length = impl::strlength(j->name);
|
size_t length = impl::strlength(j->contents);
|
||||||
|
|
||||||
offset -= length;
|
offset -= length;
|
||||||
memcpy(&result[offset], j->name, length * sizeof(char_t));
|
memcpy(&result[offset], j->contents, length * sizeof(char_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1115,6 +1115,11 @@ TEST(dom_node_append_buffer_out_of_memory_nodes)
|
|||||||
|
|
||||||
test_runner::_memory_fail_threshold = 32768 + 128 + data.length() * sizeof(char_t) + 32;
|
test_runner::_memory_fail_threshold = 32768 + 128 + data.length() * sizeof(char_t) + 32;
|
||||||
|
|
||||||
|
#ifdef PUGIXML_COMPACT
|
||||||
|
// ... and some space for hash table
|
||||||
|
test_runner::_memory_fail_threshold += 2048;
|
||||||
|
#endif
|
||||||
|
|
||||||
xml_document doc;
|
xml_document doc;
|
||||||
CHECK_ALLOC_FAIL(CHECK(doc.append_buffer(data.c_str(), data.length() * sizeof(char_t), parse_fragment).status == status_out_of_memory));
|
CHECK_ALLOC_FAIL(CHECK(doc.append_buffer(data.c_str(), data.length() * sizeof(char_t), parse_fragment).status == status_out_of_memory));
|
||||||
|
|
||||||
@ -1131,9 +1136,9 @@ TEST(dom_node_append_buffer_out_of_memory_nodes)
|
|||||||
|
|
||||||
TEST(dom_node_append_buffer_out_of_memory_name)
|
TEST(dom_node_append_buffer_out_of_memory_name)
|
||||||
{
|
{
|
||||||
test_runner::_memory_fail_threshold = 32768 + 128;
|
test_runner::_memory_fail_threshold = 32768 + 4096;
|
||||||
|
|
||||||
char data[128] = {0};
|
char data[4096] = {0};
|
||||||
|
|
||||||
xml_document doc;
|
xml_document doc;
|
||||||
CHECK(doc.append_child(STR("root")));
|
CHECK(doc.append_child(STR("root")));
|
||||||
@ -1459,6 +1464,11 @@ TEST(dom_node_copy_attribute_copyless)
|
|||||||
// the document is parsed in-place so there should only be 1 page worth of allocations
|
// the document is parsed in-place so there should only be 1 page worth of allocations
|
||||||
test_runner::_memory_fail_threshold = 32768 + 128;
|
test_runner::_memory_fail_threshold = 32768 + 128;
|
||||||
|
|
||||||
|
#ifdef PUGIXML_COMPACT
|
||||||
|
// ... and some space for hash table
|
||||||
|
test_runner::_memory_fail_threshold += 2048;
|
||||||
|
#endif
|
||||||
|
|
||||||
xml_document doc;
|
xml_document doc;
|
||||||
CHECK(doc.load_buffer_inplace(&datacopy[0], datacopy.size() * sizeof(char_t), parse_full));
|
CHECK(doc.load_buffer_inplace(&datacopy[0], datacopy.size() * sizeof(char_t), parse_full));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user