diff --git a/src/pugixml/pugiconfig.hpp b/src/pugixml/pugiconfig.hpp index 2f982ea1..55060bc7 100644 --- a/src/pugixml/pugiconfig.hpp +++ b/src/pugixml/pugiconfig.hpp @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.11 + * pugixml parser - version 1.12 * -------------------------------------------------------- - * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2022, 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 @@ -27,7 +27,7 @@ // #define PUGIXML_NO_STL // Uncomment this to disable exceptions -#define PUGIXML_NO_EXCEPTIONS +# define PUGIXML_NO_EXCEPTIONS // Set this to control attributes for public classes/functions, i.e.: // #define PUGIXML_API __declspec(dllexport) // to export all public symbols from DLL @@ -52,7 +52,7 @@ #endif /** - * Copyright (c) 2006-2020 Arseny Kapoulkine + * Copyright (c) 2006-2022 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/src/pugixml/pugixml.cpp b/src/pugixml/pugixml.cpp index efdcdf69..60b55da3 100644 --- a/src/pugixml/pugixml.cpp +++ b/src/pugixml/pugixml.cpp @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.11 + * pugixml parser - version 1.12 * -------------------------------------------------------- - * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2022, 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 @@ -132,8 +132,10 @@ using std::memset; #endif // In some environments MSVC is a compiler but the CRT lacks certain MSVC-specific features -#if defined(_MSC_VER) && !defined(__S3E__) +#if defined(_MSC_VER) && !defined(__S3E__) && !defined(_WIN32_WCE) # define PUGI__MSVC_CRT_VERSION _MSC_VER +#elif defined(_WIN32_WCE) +# define PUGI__MSVC_CRT_VERSION 1310 // MSVC7.1 #endif // Not all platforms have snprintf; we define a wrapper that uses snprintf if possible. This only works with buffers with a known size. @@ -526,7 +528,8 @@ PUGI__NS_BEGIN xml_memory_page* page = xml_memory_page::construct(memory); assert(page); - page->allocator = _root->allocator; + assert(this == _root->allocator); + page->allocator = this; return page; } @@ -4732,7 +4735,7 @@ PUGI__NS_BEGIN // we need to get length of entire file to load it in memory; the only (relatively) sane way to do it is via seek/tell trick PUGI__FN xml_parse_status get_file_size(FILE* file, size_t& out_result) { - #if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 && !defined(_WIN32_WCE) + #if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 // there are 64-bit versions of fseek/ftell, let's use them typedef __int64 length_type; @@ -6735,7 +6738,7 @@ namespace pugi return const_cast(&_wrap); // BCC5 workaround } - PUGI__FN const xml_node_iterator& xml_node_iterator::operator++() + PUGI__FN xml_node_iterator& xml_node_iterator::operator++() { assert(_wrap._root); _wrap._root = _wrap._root->next_sibling; @@ -6749,7 +6752,7 @@ namespace pugi return temp; } - PUGI__FN const xml_node_iterator& xml_node_iterator::operator--() + PUGI__FN xml_node_iterator& xml_node_iterator::operator--() { _wrap = _wrap._root ? _wrap.previous_sibling() : _parent.last_child(); return *this; @@ -6796,7 +6799,7 @@ namespace pugi return const_cast(&_wrap); // BCC5 workaround } - PUGI__FN const xml_attribute_iterator& xml_attribute_iterator::operator++() + PUGI__FN xml_attribute_iterator& xml_attribute_iterator::operator++() { assert(_wrap._attr); _wrap._attr = _wrap._attr->next_attribute; @@ -6810,7 +6813,7 @@ namespace pugi return temp; } - PUGI__FN const xml_attribute_iterator& xml_attribute_iterator::operator--() + PUGI__FN xml_attribute_iterator& xml_attribute_iterator::operator--() { _wrap = _wrap._attr ? _wrap.previous_attribute() : _parent.last_attribute(); return *this; @@ -6857,7 +6860,7 @@ namespace pugi return const_cast(&_wrap); // BCC5 workaround } - PUGI__FN const xml_named_node_iterator& xml_named_node_iterator::operator++() + PUGI__FN xml_named_node_iterator& xml_named_node_iterator::operator++() { assert(_wrap._root); _wrap = _wrap.next_sibling(_name); @@ -6871,7 +6874,7 @@ namespace pugi return temp; } - PUGI__FN const xml_named_node_iterator& xml_named_node_iterator::operator--() + PUGI__FN xml_named_node_iterator& xml_named_node_iterator::operator--() { if (_wrap._root) _wrap = _wrap.previous_sibling(_name); @@ -7091,8 +7094,12 @@ namespace pugi #endif // move allocation state - doc->_root = other->_root; - doc->_busy_size = other->_busy_size; + // note that other->_root may point to the embedded document page, in which case we should keep original (empty) state + if (other->_root != PUGI__GETPAGE(other)) + { + doc->_root = other->_root; + doc->_busy_size = other->_busy_size; + } // move buffer state doc->buffer = other->buffer; @@ -8265,7 +8272,7 @@ PUGI__NS_BEGIN } // gets mantissa digits in the form of 0.xxxxx with 0. implied and the exponent -#if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 && !defined(_WIN32_WCE) +#if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400 PUGI__FN void convert_number_to_mantissa_exponent(double value, char (&buffer)[32], char** out_mantissa, int* out_exponent) { // get base values @@ -11822,15 +11829,17 @@ PUGI__NS_BEGIN lexeme_t l = _lexer.current(); _lexer.next(); - if (++_depth > xpath_ast_depth_limit) - return error_rec(); - if (l == lex_double_slash) { n = alloc_node(ast_step, n, axis_descendant_or_self, nodetest_type_node, 0); if (!n) return 0; + + ++_depth; } + if (++_depth > xpath_ast_depth_limit) + return error_rec(); + n = parse_step(n); if (!n) return 0; } @@ -12995,7 +13004,7 @@ namespace pugi #endif /** - * Copyright (c) 2006-2020 Arseny Kapoulkine + * Copyright (c) 2006-2022 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/src/pugixml/pugixml.hpp b/src/pugixml/pugixml.hpp index 7e2ce777..579f1439 100644 --- a/src/pugixml/pugixml.hpp +++ b/src/pugixml/pugixml.hpp @@ -1,7 +1,7 @@ /** - * pugixml parser - version 1.11 + * pugixml parser - version 1.12 * -------------------------------------------------------- - * Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com) + * Copyright (C) 2006-2022, 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 @@ -11,10 +11,10 @@ * Copyright (C) 2003, by Kristen Wegner (kristen@tima.net) */ -#ifndef PUGIXML_VERSION // Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons // Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits -# define PUGIXML_VERSION 1110 +#ifndef PUGIXML_VERSION +# define PUGIXML_VERSION 1120 // 1.12 #endif // Include user configuration file (this can define various configuration macros) @@ -312,6 +312,8 @@ namespace pugi It begin() const { return _begin; } It end() const { return _end; } + bool empty() const { return _begin == _end; } + private: It _begin, _end; }; @@ -851,10 +853,10 @@ namespace pugi xml_node& operator*() const; xml_node* operator->() const; - const xml_node_iterator& operator++(); + xml_node_iterator& operator++(); xml_node_iterator operator++(int); - const xml_node_iterator& operator--(); + xml_node_iterator& operator--(); xml_node_iterator operator--(int); }; @@ -893,10 +895,10 @@ namespace pugi xml_attribute& operator*() const; xml_attribute* operator->() const; - const xml_attribute_iterator& operator++(); + xml_attribute_iterator& operator++(); xml_attribute_iterator operator++(int); - const xml_attribute_iterator& operator--(); + xml_attribute_iterator& operator--(); xml_attribute_iterator operator--(int); }; @@ -929,10 +931,10 @@ namespace pugi xml_node& operator*() const; xml_node* operator->() const; - const xml_named_node_iterator& operator++(); + xml_named_node_iterator& operator++(); xml_named_node_iterator operator++(int); - const xml_named_node_iterator& operator--(); + xml_named_node_iterator& operator--(); xml_named_node_iterator operator--(int); private: @@ -1474,7 +1476,7 @@ namespace std #endif /** - * Copyright (c) 2006-2020 Arseny Kapoulkine + * Copyright (c) 2006-2022 Arseny Kapoulkine * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation diff --git a/src/xpath_vtab.cc b/src/xpath_vtab.cc index 9c15cb26..05f6bda1 100644 --- a/src/xpath_vtab.cc +++ b/src/xpath_vtab.cc @@ -109,7 +109,7 @@ CREATE TABLE xpath ( pugi::xml_document c_doc; pugi::xpath_node_set c_results; - cursor(sqlite3_vtab* vt) : base({vt}){}; + cursor(sqlite3_vtab* vt) : base({vt}) {} ~cursor() { @@ -122,26 +122,25 @@ CREATE TABLE xpath ( checkin_query(this->c_xpath, std::move(this->c_query)); return SQLITE_OK; - }; + } int next() { this->c_rowid += 1; return SQLITE_OK; - }; + } int eof() { - return this->c_rowid >= (int64_t) this->c_results.size(); - }; + return this->c_rowid >= (int64_t) this->c_results.size(); } int get_rowid(sqlite3_int64& rowid_out) { rowid_out = this->c_rowid; return SQLITE_OK; - }; + } }; int get_column(const cursor& vc, sqlite3_context* ctx, int col)