mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-12-23 19:31:44 +00:00
pugixml: update
This commit is contained in:
parent
f95b016e1f
commit
bc3d278dd8
@ -388,7 +388,7 @@ JSON for Modern C++
|
||||
|
||||
An XML processing library
|
||||
|
||||
* Copyright: 2006–2018 by Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
|
||||
* Copyright: 2006–2019 by Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
|
||||
* License: MIT (see `doc/licenses/pugixml-MIT.txt`)
|
||||
* URL: http://pugixml.org/
|
||||
* Corresponding files: `lib/pugixml/*`
|
||||
|
@ -1 +1 @@
|
||||
e584ea337ede5b33d3e3f2165352a233b67b7fab https://github.com/zeux/pugixml.git
|
||||
9fcae40bb5577381a37c493a34633f7948fab208 https://github.com/zeux/pugixml.git
|
||||
|
@ -1,7 +1,7 @@
|
||||
pugixml 1.9 - an XML processing library
|
||||
|
||||
Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
Report bugs and download new versions at http://pugixml.org/
|
||||
Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
Report bugs and download new versions at https://pugixml.org/
|
||||
|
||||
This is the distribution of pugixml, which is a C++ XML processing library,
|
||||
which consists of a DOM-like interface with rich traversal/modification
|
||||
@ -28,7 +28,7 @@ The distribution contains the following folders:
|
||||
|
||||
This library is distributed under the MIT License:
|
||||
|
||||
Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
Copyright (c) 2006-2019 Arseny Kapoulkine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* pugixml parser - version 1.9
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at http://pugixml.org/
|
||||
* Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
@ -49,7 +49,7 @@
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
* Copyright (c) 2006-2019 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* pugixml parser - version 1.9
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at http://pugixml.org/
|
||||
* Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
@ -1861,7 +1861,7 @@ PUGI__NS_BEGIN
|
||||
enum chartypex_t
|
||||
{
|
||||
ctx_special_pcdata = 1, // Any symbol >= 0 and < 32 (except \t, \r, \n), &, <, >
|
||||
ctx_special_attr = 2, // Any symbol >= 0 and < 32 (except \t), &, <, >, "
|
||||
ctx_special_attr = 2, // Any symbol >= 0 and < 32, &, <, >, "
|
||||
ctx_start_symbol = 4, // Any symbol > 127, a-z, A-Z, _
|
||||
ctx_digit = 8, // 0-9
|
||||
ctx_symbol = 16 // Any symbol > 127, a-z, A-Z, 0-9, _, -, .
|
||||
@ -1869,7 +1869,7 @@ PUGI__NS_BEGIN
|
||||
|
||||
static const unsigned char chartypex_table[256] =
|
||||
{
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 0, 2, 3, 3, 2, 3, 3, // 0-15
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 2, 3, 3, // 0-15
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // 16-31
|
||||
0, 0, 2, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 16, 16, 0, // 32-47
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 3, 0, 3, 0, // 48-63
|
||||
@ -4656,7 +4656,7 @@ PUGI__NS_BEGIN
|
||||
PUGI__FN bool set_value_convert(String& dest, Header& header, uintptr_t header_mask, float value)
|
||||
{
|
||||
char buf[128];
|
||||
PUGI__SNPRINTF(buf, "%.9g", value);
|
||||
PUGI__SNPRINTF(buf, "%.9g", double(value));
|
||||
|
||||
return set_value_ascii(dest, header, header_mask, buf);
|
||||
}
|
||||
@ -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
|
||||
@ -8069,7 +8070,7 @@ PUGI__NS_BEGIN
|
||||
typedef uint32_t UI; // BCC5 workaround
|
||||
union { float f; UI i; } u;
|
||||
u.i = 0x7fc00000;
|
||||
return u.f;
|
||||
return double(u.f);
|
||||
#else
|
||||
// fallback
|
||||
const volatile double zero = 0.0;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -10871,13 +10874,14 @@ PUGI__NS_BEGIN
|
||||
// Rewrite [position()=expr] with [expr]
|
||||
// Note that this step has to go before classification to recognize [position()=1]
|
||||
if ((_type == ast_filter || _type == ast_predicate) &&
|
||||
_right && // workaround for clang static analyzer (_right is never null for ast_filter/ast_predicate)
|
||||
_right->_type == ast_op_equal && _right->_left->_type == ast_func_position && _right->_right->_rettype == xpath_type_number)
|
||||
{
|
||||
_right = _right->_right;
|
||||
}
|
||||
|
||||
// Classify filter/predicate ops to perform various optimizations during evaluation
|
||||
if (_type == ast_filter || _type == ast_predicate)
|
||||
if ((_type == ast_filter || _type == ast_predicate) && _right) // workaround for clang static analyzer (_right is never null for ast_filter/ast_predicate)
|
||||
{
|
||||
assert(_test == predicate_default);
|
||||
|
||||
@ -10893,8 +10897,8 @@ PUGI__NS_BEGIN
|
||||
// The former is a full form of //foo, the latter is much faster since it executes the node test immediately
|
||||
// Do a similar kind of rewrite for self/descendant/descendant-or-self axes
|
||||
// Note that we only rewrite positionally invariant steps (//foo[1] != /descendant::foo[1])
|
||||
if (_type == ast_step && (_axis == axis_child || _axis == axis_self || _axis == axis_descendant || _axis == axis_descendant_or_self) && _left &&
|
||||
_left->_type == ast_step && _left->_axis == axis_descendant_or_self && _left->_test == nodetest_type_node && !_left->_right &&
|
||||
if (_type == ast_step && (_axis == axis_child || _axis == axis_self || _axis == axis_descendant || _axis == axis_descendant_or_self) &&
|
||||
_left && _left->_type == ast_step && _left->_axis == axis_descendant_or_self && _left->_test == nodetest_type_node && !_left->_right &&
|
||||
is_posinv_step())
|
||||
{
|
||||
if (_axis == axis_child || _axis == axis_descendant)
|
||||
@ -10906,7 +10910,9 @@ PUGI__NS_BEGIN
|
||||
}
|
||||
|
||||
// Use optimized lookup table implementation for translate() with constant arguments
|
||||
if (_type == ast_func_translate && _right->_type == ast_string_constant && _right->_next->_type == ast_string_constant)
|
||||
if (_type == ast_func_translate &&
|
||||
_right && // workaround for clang static analyzer (_right is never null for ast_func_translate)
|
||||
_right->_type == ast_string_constant && _right->_next->_type == ast_string_constant)
|
||||
{
|
||||
unsigned char* table = translate_table_generate(alloc, _right->_data.string, _right->_next->_data.string);
|
||||
|
||||
@ -10919,6 +10925,8 @@ 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)))
|
||||
{
|
||||
@ -12013,74 +12021,61 @@ namespace pugi
|
||||
|
||||
size_t size_ = static_cast<size_t>(end_ - begin_);
|
||||
|
||||
if (size_ <= 1)
|
||||
// use internal buffer for 0 or 1 elements, heap buffer otherwise
|
||||
xpath_node* storage = (size_ <= 1) ? _storage : static_cast<xpath_node*>(impl::xml_memory::allocate(size_ * sizeof(xpath_node)));
|
||||
|
||||
if (!storage)
|
||||
{
|
||||
// deallocate old buffer
|
||||
if (_begin != &_storage) impl::xml_memory::deallocate(_begin);
|
||||
|
||||
// use internal buffer
|
||||
if (begin_ != end_) _storage = *begin_;
|
||||
|
||||
_begin = &_storage;
|
||||
_end = &_storage + size_;
|
||||
_type = type_;
|
||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||
return;
|
||||
#else
|
||||
throw std::bad_alloc();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// make heap copy
|
||||
xpath_node* storage = static_cast<xpath_node*>(impl::xml_memory::allocate(size_ * sizeof(xpath_node)));
|
||||
|
||||
if (!storage)
|
||||
{
|
||||
#ifdef PUGIXML_NO_EXCEPTIONS
|
||||
return;
|
||||
#else
|
||||
throw std::bad_alloc();
|
||||
#endif
|
||||
}
|
||||
// deallocate old buffer
|
||||
if (_begin != _storage)
|
||||
impl::xml_memory::deallocate(_begin);
|
||||
|
||||
// size check is necessary because for begin_ = end_ = nullptr, memcpy is UB
|
||||
if (size_)
|
||||
memcpy(storage, begin_, size_ * sizeof(xpath_node));
|
||||
|
||||
// deallocate old buffer
|
||||
if (_begin != &_storage) impl::xml_memory::deallocate(_begin);
|
||||
|
||||
// finalize
|
||||
_begin = storage;
|
||||
_end = storage + size_;
|
||||
_type = type_;
|
||||
}
|
||||
_begin = storage;
|
||||
_end = storage + size_;
|
||||
_type = type_;
|
||||
}
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
PUGI__FN void xpath_node_set::_move(xpath_node_set& rhs) PUGIXML_NOEXCEPT
|
||||
{
|
||||
_type = rhs._type;
|
||||
_storage = rhs._storage;
|
||||
_begin = (rhs._begin == &rhs._storage) ? &_storage : rhs._begin;
|
||||
_storage[0] = rhs._storage[0];
|
||||
_begin = (rhs._begin == rhs._storage) ? _storage : rhs._begin;
|
||||
_end = _begin + (rhs._end - rhs._begin);
|
||||
|
||||
rhs._type = type_unsorted;
|
||||
rhs._begin = &rhs._storage;
|
||||
rhs._end = rhs._begin;
|
||||
rhs._begin = rhs._storage;
|
||||
rhs._end = rhs._storage;
|
||||
}
|
||||
#endif
|
||||
|
||||
PUGI__FN xpath_node_set::xpath_node_set(): _type(type_unsorted), _begin(&_storage), _end(&_storage)
|
||||
PUGI__FN xpath_node_set::xpath_node_set(): _type(type_unsorted), _begin(_storage), _end(_storage)
|
||||
{
|
||||
}
|
||||
|
||||
PUGI__FN xpath_node_set::xpath_node_set(const_iterator begin_, const_iterator end_, type_t type_): _type(type_unsorted), _begin(&_storage), _end(&_storage)
|
||||
PUGI__FN xpath_node_set::xpath_node_set(const_iterator begin_, const_iterator end_, type_t type_): _type(type_unsorted), _begin(_storage), _end(_storage)
|
||||
{
|
||||
_assign(begin_, end_, type_);
|
||||
}
|
||||
|
||||
PUGI__FN xpath_node_set::~xpath_node_set()
|
||||
{
|
||||
if (_begin != &_storage)
|
||||
if (_begin != _storage)
|
||||
impl::xml_memory::deallocate(_begin);
|
||||
}
|
||||
|
||||
PUGI__FN xpath_node_set::xpath_node_set(const xpath_node_set& ns): _type(type_unsorted), _begin(&_storage), _end(&_storage)
|
||||
PUGI__FN xpath_node_set::xpath_node_set(const xpath_node_set& ns): _type(type_unsorted), _begin(_storage), _end(_storage)
|
||||
{
|
||||
_assign(ns._begin, ns._end, ns._type);
|
||||
}
|
||||
@ -12095,7 +12090,7 @@ namespace pugi
|
||||
}
|
||||
|
||||
#ifdef PUGIXML_HAS_MOVE
|
||||
PUGI__FN xpath_node_set::xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT: _type(type_unsorted), _begin(&_storage), _end(&_storage)
|
||||
PUGI__FN xpath_node_set::xpath_node_set(xpath_node_set&& rhs) PUGIXML_NOEXCEPT: _type(type_unsorted), _begin(_storage), _end(_storage)
|
||||
{
|
||||
_move(rhs);
|
||||
}
|
||||
@ -12104,7 +12099,7 @@ namespace pugi
|
||||
{
|
||||
if (this == &rhs) return *this;
|
||||
|
||||
if (_begin != &_storage)
|
||||
if (_begin != _storage)
|
||||
impl::xml_memory::deallocate(_begin);
|
||||
|
||||
_move(rhs);
|
||||
@ -12771,7 +12766,7 @@ namespace pugi
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
* Copyright (c) 2006-2019 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
@ -1,8 +1,8 @@
|
||||
/**
|
||||
* pugixml parser - version 1.9
|
||||
* --------------------------------------------------------
|
||||
* Copyright (C) 2006-2018, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at http://pugixml.org/
|
||||
* Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
|
||||
* Report bugs and download new versions at https://pugixml.org/
|
||||
*
|
||||
* This library is distributed under the MIT License. See notice at the end
|
||||
* of this file.
|
||||
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#ifndef PUGIXML_VERSION
|
||||
// Define version macro; evaluates to major * 100 + minor so that it's safe to use in less-than comparisons
|
||||
// Define version macro; evaluates to major * 100 + minor * 10 + patch so that it's safe to use in less-than comparisons
|
||||
# define PUGIXML_VERSION 190
|
||||
#endif
|
||||
|
||||
@ -1251,6 +1251,12 @@ namespace pugi
|
||||
};
|
||||
|
||||
#ifndef PUGIXML_NO_EXCEPTIONS
|
||||
#if defined(_MSC_VER)
|
||||
// C4275 can be ignored in Visual C++ if you are deriving
|
||||
// from a type in the Standard C++ Library
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4275)
|
||||
#endif
|
||||
// XPath exception class
|
||||
class PUGIXML_CLASS xpath_exception: public std::exception
|
||||
{
|
||||
@ -1267,6 +1273,9 @@ namespace pugi
|
||||
// Get parse result
|
||||
const xpath_parse_result& result() const;
|
||||
};
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// XPath node class (either xml_node or xml_attribute)
|
||||
@ -1372,7 +1381,7 @@ namespace pugi
|
||||
private:
|
||||
type_t _type;
|
||||
|
||||
xpath_node _storage;
|
||||
xpath_node _storage[1];
|
||||
|
||||
xpath_node* _begin;
|
||||
xpath_node* _end;
|
||||
@ -1436,7 +1445,7 @@ namespace std
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Copyright (c) 2006-2018 Arseny Kapoulkine
|
||||
* Copyright (c) 2006-2019 Arseny Kapoulkine
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
|
Loading…
Reference in New Issue
Block a user