0
0
mirror of https://github.com/zeux/pugixml.git synced 2026-01-18 17:21:30 +01:00

Fix minor stylistic/"analysis" nits

- Explicitly ignore strcpy_insitu return value in node_copy_string; if it
fails, we must be out of memory and we leave the relevant destination
fields empty, similarly to other OOMs during copying

- Use the same code for eval_number of string/node set; these are slightly
different semantically, as eval_string is an implicit conversion, but the
code ends up the same.

Closes #674, #675.
This commit is contained in:
Arseny Kapoulkine
2025-05-15 12:13:30 +03:00
parent c4cca93ad1
commit 5a1892b321

View File

@@ -4473,7 +4473,10 @@ PUGI_IMPL_NS_BEGIN
source_header |= xml_memory_page_contents_shared_mask;
}
else
strcpy_insitu(dest, header, header_mask, source, strlength(source));
{
// if strcpy_insitu fails (out of memory) we just leave the destination name/value empty
(void)strcpy_insitu(dest, header, header_mask, source, strlength(source));
}
}
}
@@ -11117,13 +11120,7 @@ PUGI_IMPL_NS_BEGIN
return eval_boolean(c, stack) ? 1 : 0;
case xpath_type_string:
{
xpath_allocator_capture cr(stack.result);
return convert_string_to_number(eval_string(c, stack).c_str());
}
case xpath_type_node_set:
case xpath_type_node_set: // implicit conversion to string
{
xpath_allocator_capture cr(stack.result);