0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-27 13:33:17 +08:00

Add coverity annotations

This commit is contained in:
cecilios 2018-11-16 17:33:39 +01:00 committed by Arseny Kapoulkine
parent fa686f004a
commit 7d2436ec2f

View File

@ -4688,6 +4688,7 @@ PUGI__NS_BEGIN
char_t* buffer = 0;
size_t length = 0;
// coverity[var_deref_model]
if (!impl::convert_buffer(buffer, length, buffer_encoding, contents, size, is_mutable)) return impl::make_parse_result(status_out_of_memory);
// delete original buffer if we performed a conversion
@ -10083,6 +10084,7 @@ PUGI__NS_BEGIN
bool once =
(axis == axis_attribute && _test == nodetest_name) ||
(!_right && eval_once(axis_type, eval)) ||
// coverity[mixed_enums]
(_right && !_right->_next && _right->_test == predicate_constant_one);
xpath_node_set_raw ns;
@ -10863,6 +10865,7 @@ PUGI__NS_BEGIN
if (_next)
_next->optimize(alloc);
// coverity[var_deref_model]
optimize_self(alloc);
}
@ -10923,6 +10926,7 @@ PUGI__NS_BEGIN
// Use optimized path for @attr = 'value' or @attr = $value
if (_type == ast_op_equal &&
_left && _right && // workaround for clang static analyzer and Coverity (_left and _right are never null for ast_op_equal)
// coverity[mixed_enums]
_left->_type == ast_step && _left->_axis == axis_attribute && _left->_test == nodetest_name && !_left->_left && !_left->_right &&
(_right->_type == ast_string_constant || (_right->_type == ast_variable && _right->_rettype == xpath_type_string)))
{