Hello community, here is the log from the commit of package liborcus for openSUSE:Factory checked in at 2019-08-28 16:00:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/liborcus (Old) and /work/SRC/openSUSE:Factory/.liborcus.new.7948 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "liborcus" Wed Aug 28 16:00:49 2019 rev:30 rq:725491 version:0.15.1 Changes: -------- --- /work/SRC/openSUSE:Factory/liborcus/liborcus.changes 2019-08-22 15:11:30.582442075 +0200 +++ /work/SRC/openSUSE:Factory/.liborcus.new.7948/liborcus.changes 2019-08-28 16:00:55.490805528 +0200 @@ -1,0 +2,9 @@ +Fri Aug 23 07:23:57 UTC 2019 - Tomáš Chvátal <[email protected]> + +- Update to 0.15.1: + * minor bugfixes after the 0.15.0 was released +- Remove merged patches + * fix-linking.patch + * 32bit.patch + +------------------------------------------------------------------- Old: ---- 32bit.patch fix-linking.patch liborcus-0.15.0.tar.xz New: ---- liborcus-0.15.1.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ liborcus.spec ++++++ --- /var/tmp/diff_new_pack.aCWsc0/_old 2019-08-28 16:00:56.646805354 +0200 +++ /var/tmp/diff_new_pack.aCWsc0/_new 2019-08-28 16:00:56.650805353 +0200 @@ -18,15 +18,13 @@ %define libname liborcus-0_15-0 Name: liborcus -Version: 0.15.0 +Version: 0.15.1 Release: 0 Summary: Spreadsheet file processing library License: MPL-2.0 Group: Productivity/Publishing/Word URL: https://gitlab.com/orcus/orcus/ Source: http://kohei.us/files/orcus/src/%{name}-%{version}.tar.xz -Patch0: fix-linking.patch -Patch1: 32bit.patch BuildRequires: coreutils BuildRequires: libstdc++-devel BuildRequires: pkgconfig @@ -91,7 +89,6 @@ %prep %setup -q -%autopatch -p1 %build %if 0%{?suse_version} < 1500 ++++++ liborcus-0.15.0.tar.xz -> liborcus-0.15.1.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/CHANGELOG new/liborcus-0.15.1/CHANGELOG --- old/liborcus-0.15.0/CHANGELOG 2019-08-09 01:38:34.000000000 +0200 +++ new/liborcus-0.15.1/CHANGELOG 2019-08-21 03:41:24.000000000 +0200 @@ -1,9 +1,31 @@ +orcus 0.15.1 + +* switched xml_map_tree to using boost::object_pool to manage the life + cycles of the objects within xml_map_tree, to avoid memory + fragmentation. + +* fixed incorrect handling of newly created elements in xml_map_tree. + +* fixed segfault caused by double deletion of allocated memory for + xml_map_tree::element, which seemed to happen only on 32-bit gcc builds. + +* fixed weird test failures related to equality check of two double-precision + values, caused probably by aggressive compiler optimization which only seems + to get triggered in 32-bit gcc builds. + +orcus 0.15.0 + +* spreadsheet interface + + * import_sheet::fill_down_cells() has been added as a required method, to + allow the import filter code to duplicate cell value downward in one step. + * json parser * added test cases from JSONTestSuite. * fixed a bug on parsing an empty array containing one or more blank - chracters between the brackets. + characters between the brackets. * sax parser @@ -17,7 +39,7 @@ * orcus-xml - * revised its cli internface to make use of boost's program_options. + * revised its cli interface to make use of boost's program_options. * orcus-xml-dump's functionality has been combined into orcus-xml. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/ChangeLog new/liborcus-0.15.1/ChangeLog --- old/liborcus-0.15.0/ChangeLog 2019-08-09 01:52:06.000000000 +0200 +++ new/liborcus-0.15.1/ChangeLog 2019-08-22 05:23:03.000000000 +0200 @@ -1,3 +1,162 @@ +2019-08-21 Kohei Yoshida <[email protected]> [83ee4f09e489010a1bc8dfbcd4011d2ccf279996] + + Add method doc to fill_down_cells(). + + +2019-08-20 Kohei Yoshida <[email protected]> [d1a7c6bfd64c6102ff4d59c253a743db6e8a04d3] + + Finish up CHANGELOG for the upcoming 0.15.1 release. + + +2019-08-20 Kohei Yoshida <[email protected]> [865e660e33585c9ab1bd2aac6fe3b73927218a7f] + + linkable is a struct, not a class. + + +2019-08-20 Kohei Yoshida <[email protected]> [f3538986f9ff18b5371a0ec8e049567b0c3b7f8e] + + Up the version to 0.15.1. + + +2019-08-20 Kohei Yoshida <[email protected]> [b1fdb3d0f1f7165c047566b51bfbaf4dc530e882] + + Use object pool on range_reference as well. I think this is the last one. + + +2019-08-20 Kohei Yoshida <[email protected]> [dd9f6ff67cb34897c3360a40c80bc3122fdcf6ab] + + Switch to using object_pool on element instances as well. + + +2019-08-20 Kohei Yoshida <[email protected]> [2d887329526558fe3c3f75087831805120c0b111] + + Switch element constructor to using std::tuple. + + This is in preparation for using object pool on element. + +2019-08-20 Kohei Yoshida <[email protected]> [f1e8dc4c62ebd2bc5639347336d0948e6db321e9] + + Use object pool for attribute instances. + + One caveat is that boost::object_pool's construct() can only support up to + 3 arguments. One workaround is to switch to using std::tuple to reduce + the number of arguments to one then call construct() on that, which is exactly + what I'm doing here. + +2019-08-19 Kohei Yoshida <[email protected]> [170c7893524e6244296f0e349002264ab2cd2394] + + get_or_create_child can now simply return the element pointer. + + +2019-08-19 Kohei Yoshida <[email protected]> [05e12ad685594d3b8d517c9146b53e1b14c0522b] + + Move the reference data up into linkable, and clean up the code a bit. + + +2019-08-19 Kohei Yoshida <[email protected]> [2bfd5f90bf7bab783dbf1e7e1cbc6b0a679ca7af] + + Refactor the linked element handling code for clarity. + + +2019-08-16 Kohei Yoshida <[email protected]> [ba80955aeb32bb86ea8cc2765530bab9e0b51c87] + + Use object_pool for cell_reference and field_in_range instances as well. + + +2019-08-16 Kohei Yoshida <[email protected]> [2b1417f6a2d5655c954204c126daf3524403a5e5] + + Use object_pool for element_store_type objects. + + +2019-08-15 Kohei Yoshida <[email protected]> [5cbce8c9ada219f18c7a707a435b0574f6396693] + + Add some changes which will go into the next release (0.15.1 most likely). + + +2019-08-15 Stephan Bergmann <[email protected]> [1e024e37c59574965e1b07bc5097c014d4625227] + + Fix linking of newly created element + + (see downstream <https://gerrit.libreoffice.org/#/c/77519/> "Fix linking of + newly created element in liborcus 0.15.0") + +2019-08-15 Kohei Yoshida <[email protected]> [6a40c30658a8727d87ae0ac244c95d6e18dde75a] + + Sigh... Another typo. + + +2019-08-15 Kohei Yoshida <[email protected]> [aa7a5e3f802d9e80c27147cea706927cb7e2be11] + + Let's mention the new required method in the import_sheet interface. + + +2019-08-15 Kohei Yoshida <[email protected]> [6e4160af14491cabf4a018df6463161cf57b25a6] + + Fix a typo. So much intern() calls affect my English spelling. + + +2019-08-15 Kohei Yoshida <[email protected]> [4c12dc4e02d824c81dce401f8aba76b1cae3e92c] + + Add the 0.15.0 tag line. That version is out in the wild now. + + +2019-08-14 Kohei Yoshida <[email protected]> [56514d538a0b018e910ce4d0f134bfb38a5f82b9] + + Unused private member. + + +2019-08-14 Kohei Yoshida <[email protected]> [1b11a47a3681015afda7f04b21f798e416ed6a84] + + Let's not forget the override keyword here... + + +2019-08-14 Kohei Yoshida <[email protected]> [fff0bdf3b9d214d4e406f91d085f38d4a372f389] + + Properly initialize these values, and keep valgrind memcheck happy. + + +2019-08-13 Kohei Yoshida <[email protected]> [32ff7b049033ab6b40ebfe7f900df29bfddb27e8] + + element.child_elements is valid only for unlinked element type. + + +2019-08-13 Kohei Yoshida <[email protected]> [edfa29e40a7d1b937f95d66e35ceff4d73e71ebb] + + Really kill orcus-xml-dump. + + +2019-08-13 Kohei Yoshida <[email protected]> [1846f57da57794abe3e64d447f8d5611a279a37c] + + Let's use volatile keyword here too. It's a simpler solution. + + This reverts commit 00e1d67350e7d85c05e8b1f8f49a265af78f85e3, and add + volatile keyword to prevent aggressive compiler optimization. + +2019-08-13 Kohei Yoshida <[email protected]> [6698019746b562b173cf1bb849e4e85fb0044461] + + Use of volatile keyword here fixes the test failure on 32-bit debian. + + Perhaps the compiler is too aggressive on optimizing the double values + causing the equality check to fail? + +2019-08-13 Kohei Yoshida <[email protected]> [a55f15cb9fd63a9b37e2c181c57e90c570292948] + + Use std::deque here to avoid strange segfault issue on 32-bit debian... + + The original code (with vector) for some reason crashes only on 32-bit + debian platforms. No such issue with deque. + +2019-08-13 Kohei Yoshida <[email protected]> [00e1d67350e7d85c05e8b1f8f49a265af78f85e3] + + Use a more reliable method to compare two double-precision values. + + This hits especially hard on 32-bit platforms. + +2019-08-08 Kohei Yoshida <[email protected]> [7306fdbc47574bfdff4341e69173447c45148341] + + Add links to the 0.15.0 packages. + + 2019-08-08 Kohei Yoshida <[email protected]> [cac3852073f54d14a8fae0b6cd03e4e79df66df8] Up the version to 0.15.0. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/Makefile.am new/liborcus-0.15.1/Makefile.am --- old/liborcus-0.15.0/Makefile.am 2019-08-06 04:13:54.000000000 +0200 +++ new/liborcus-0.15.1/Makefile.am 2019-08-14 05:34:30.000000000 +0200 @@ -55,7 +55,6 @@ bin/orcus-test.sh \ bin/orcus-xls-xml.sh \ bin/orcus-xlsx.sh \ - bin/orcus-xml-dump.sh \ bin/orcus-xml.sh \ bin/orcus-yaml.sh \ bin/orcus-zip-dump.sh \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/Makefile.in new/liborcus-0.15.1/Makefile.in --- old/liborcus-0.15.0/Makefile.in 2019-08-09 01:39:26.000000000 +0200 +++ new/liborcus-0.15.1/Makefile.in 2019-08-22 05:18:06.000000000 +0200 @@ -457,7 +457,6 @@ bin/orcus-test.sh \ bin/orcus-xls-xml.sh \ bin/orcus-xlsx.sh \ - bin/orcus-xml-dump.sh \ bin/orcus-xml.sh \ bin/orcus-yaml.sh \ bin/orcus-zip-dump.sh \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/README.md new/liborcus-0.15.1/README.md --- old/liborcus-0.15.0/README.md 2019-02-22 23:20:33.000000000 +0100 +++ new/liborcus-0.15.1/README.md 2019-08-09 02:46:10.000000000 +0200 @@ -38,6 +38,8 @@ | Version | API Version | Release Date | Download | Checksum | File Size (bytes) | |---------|-------------|--------------|----------|----------|-------------------| +| 0.15.0 | 0.15 | 2019-08-08 | [liborcus-0.15.0.tar.xz](http://kohei.us/files/orcus/src/liborcus-0.15.0.tar.xz) | sha256sum: aa27c1c90dd84ba9e3f75e61dad11c8623fb6c0e21cef9c617a807840d25cd1a | 1975908 | +| | | | [liborcus-0.15.0.tar.gz](http://kohei.us/files/orcus/src/liborcus-0.15.0.tar.gz) | sha256sum: 06ec7567896d76ca579efada794cc281a5d6b427195def01cbcfd79795e8a944 | 2585966 | | 0.14.1 | 0.14 | 2018-09-14 | [liborcus-0.14.1.tar.xz](http://kohei.us/files/orcus/src/liborcus-0.14.1.tar.xz) | sha256sum: f2d1dc840fa6a5358d956a7cb746c36b857d92190de0ac5b40b2841ed408daab | 1894680 | | | | | [liborcus-0.14.1.tar.gz](http://kohei.us/files/orcus/src/liborcus-0.14.1.tar.gz) | sha256sum: 3f48cfbc21ad74787218284939c04d42cb836c73bc393f27f538b668e4d78a5f | 2454001 | | 0.14.0 | 0.14 | 2018-08-23 | [liborcus-0.14.0.tar.xz](http://kohei.us/files/orcus/src/liborcus-0.14.0.tar.xz) | sha256sum: 54d4ef3898e6296587c90f24577b017fa2d400812d7d86feb371924dd6abc91c | 1891648 | diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/bin/orcus-xml-dump.sh new/liborcus-0.15.1/bin/orcus-xml-dump.sh --- old/liborcus-0.15.0/bin/orcus-xml-dump.sh 2018-05-27 18:08:55.000000000 +0200 +++ new/liborcus-0.15.1/bin/orcus-xml-dump.sh 1970-01-01 01:00:00.000000000 +0100 @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -PROGDIR=`dirname $0` -source $PROGDIR/orcus-common-func.sh -orcus_exec orcus-xml-dump "$PWD" "$@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/configure new/liborcus-0.15.1/configure --- old/liborcus-0.15.0/configure 2019-08-09 01:39:28.000000000 +0200 +++ new/liborcus-0.15.1/configure 2019-08-22 05:18:08.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for liborcus 0.15.0. +# Generated by GNU Autoconf 2.69 for liborcus 0.15.1. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='liborcus' PACKAGE_TARNAME='liborcus' -PACKAGE_VERSION='0.15.0' -PACKAGE_STRING='liborcus 0.15.0' +PACKAGE_VERSION='0.15.1' +PACKAGE_STRING='liborcus 0.15.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1430,7 +1430,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures liborcus 0.15.0 to adapt to many kinds of systems. +\`configure' configures liborcus 0.15.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1501,7 +1501,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of liborcus 0.15.0:";; + short | recursive ) echo "Configuration of liborcus 0.15.1:";; esac cat <<\_ACEOF @@ -1654,7 +1654,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -liborcus configure 0.15.0 +liborcus configure 0.15.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2303,7 +2303,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by liborcus $as_me 0.15.0, which was +It was created by liborcus $as_me 0.15.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3170,7 +3170,7 @@ # Define the identity of the package. PACKAGE='liborcus' - VERSION='0.15.0' + VERSION='0.15.1' cat >>confdefs.h <<_ACEOF @@ -17544,7 +17544,7 @@ ORCUS_API_VERSION=0.15 ORCUS_MAJOR_VERSION=0 ORCUS_MINOR_VERSION=15 -ORCUS_MICRO_VERSION=0 +ORCUS_MICRO_VERSION=1 @@ -21685,7 +21685,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by liborcus $as_me 0.15.0, which was +This file was extended by liborcus $as_me 0.15.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21751,7 +21751,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -liborcus config.status 0.15.0 +liborcus config.status 0.15.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/configure.ac new/liborcus-0.15.1/configure.ac --- old/liborcus-0.15.0/configure.ac 2019-08-09 01:38:52.000000000 +0200 +++ new/liborcus-0.15.1/configure.ac 2019-08-20 23:30:46.000000000 +0200 @@ -8,7 +8,7 @@ # =================== m4_define([orcus_major_version], [0]) m4_define([orcus_minor_version], [15]) -m4_define([orcus_micro_version], [0]) +m4_define([orcus_micro_version], [1]) m4_define([orcus_version], [orcus_major_version.orcus_minor_version.orcus_micro_version]) # =============== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/include/orcus/spreadsheet/import_interface.hpp new/liborcus-0.15.1/include/orcus/spreadsheet/import_interface.hpp --- old/liborcus-0.15.0/include/orcus/spreadsheet/import_interface.hpp 2019-03-09 14:44:07.000000000 +0100 +++ new/liborcus-0.15.1/include/orcus/spreadsheet/import_interface.hpp 2019-08-22 05:15:23.000000000 +0200 @@ -771,6 +771,15 @@ virtual void set_format(row_t row_start, col_t col_start, row_t row_end, col_t col_end, size_t xf_index) = 0; + /** + * Duplicate the value of the source cell to one or more cells located + * immediately below it. + * + * @param src_row row ID of the source cell + * @param src_col column ID of the source cell + * @param range_size number of cells below the source cell to copy the + * source cell value to. It must be at least one. + */ virtual void fill_down_cells(row_t src_row, col_t src_col, row_t range_size) = 0; /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/src/liborcus/common_test.cpp new/liborcus-0.15.1/src/liborcus/common_test.cpp --- old/liborcus-0.15.0/src/liborcus/common_test.cpp 2019-02-13 23:06:19.000000000 +0100 +++ new/liborcus-0.15.1/src/liborcus/common_test.cpp 2019-08-14 04:36:15.000000000 +0200 @@ -130,7 +130,8 @@ for (const check& c : checks) { - double observed = convert(c.original, c.from, c.to); + // without volatile, sometimes the following assert evaluates to false on 32-bit debian platforms. + volatile double observed = convert(c.original, c.from, c.to); assert(observed == c.expected); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/src/liborcus/orcus_xml.cpp new/liborcus-0.15.1/src/liborcus/orcus_xml.cpp --- old/liborcus-0.15.0/src/liborcus/orcus_xml.cpp 2019-03-09 14:44:07.000000000 +0100 +++ new/liborcus-0.15.1/src/liborcus/orcus_xml.cpp 2019-08-14 05:34:30.000000000 +0200 @@ -292,11 +292,13 @@ scope(const xml_map_tree::element& _elem) : element(_elem), opened(false) { - end_child_pos = element.child_elements->end(); current_child_pos = end_child_pos; if (element.elem_type == xml_map_tree::element_unlinked) + { current_child_pos = element.child_elements->begin(); + end_child_pos = element.child_elements->end(); + } } }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/src/liborcus/xls_xml_context.cpp new/liborcus-0.15.1/src/liborcus/xls_xml_context.cpp --- old/liborcus-0.15.0/src/liborcus/xls_xml_context.cpp 2019-03-15 02:04:54.000000000 +0100 +++ new/liborcus-0.15.1/src/liborcus/xls_xml_context.cpp 2019-08-15 05:21:27.000000000 +0200 @@ -708,7 +708,6 @@ m_cur_row(0), m_cur_col(0), m_cur_prop_col(0), m_cur_merge_down(0), m_cur_merge_across(0), - m_active_pane(spreadsheet::sheet_pane_t::unspecified), m_cc_data(session_cxt, tokens, *this) { m_cur_array_range.first.column = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/src/liborcus/xls_xml_context.hpp new/liborcus-0.15.1/src/liborcus/xls_xml_context.hpp --- old/liborcus-0.15.0/src/liborcus/xls_xml_context.hpp 2018-11-01 01:55:15.000000000 +0100 +++ new/liborcus-0.15.1/src/liborcus/xls_xml_context.hpp 2019-08-15 05:21:29.000000000 +0200 @@ -271,7 +271,6 @@ named_expressions_type m_named_exps_sheet; selection m_cursor_selection; /// cursor selection in a single pane. split_pane m_split_pane; - spreadsheet::sheet_pane_t m_active_pane; std::unique_ptr<style_type> m_current_style; std::unique_ptr<style_type> m_default_style; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/src/liborcus/xml_map_tree.cpp new/liborcus-0.15.1/src/liborcus/xml_map_tree.cpp --- old/liborcus-0.15.0/src/liborcus/xml_map_tree.cpp 2019-07-17 22:49:32.000000000 +0200 +++ new/liborcus-0.15.1/src/liborcus/xml_map_tree.cpp 2019-08-20 23:30:11.000000000 +0200 @@ -16,6 +16,7 @@ #include <cassert> #include <algorithm> +#include <iostream> using namespace std; @@ -23,19 +24,6 @@ namespace { -template<typename T> -class find_by_name : std::unary_function<std::unique_ptr<T>, bool> -{ - xmlns_id_t m_ns; - pstring m_name; -public: - find_by_name(xmlns_id_t ns, const pstring& name) : m_ns(ns), m_name(name) {} - bool operator() (const std::unique_ptr<T>& e) const - { - return m_ns == e->ns && m_name == e->name; - } -}; - class xpath_parser { const xmlns_context& m_cxt; @@ -155,93 +143,39 @@ xml_map_tree::range_reference::range_reference(const cell_position& _pos) : pos(_pos), row_position(0) {} -xml_map_tree::linkable::linkable(xmlns_id_t _ns, const pstring& _name, linkable_node_type _node_type) : - ns(_ns), name(_name), node_type(_node_type) {} - -xml_map_tree::attribute::attribute(xmlns_id_t _ns, const pstring& _name, reference_type _ref_type) : - linkable(_ns, _name, node_attribute), ref_type(_ref_type) +xml_map_tree::linkable::linkable( + xml_map_tree& parent, xmlns_id_t _ns, const pstring& _name, linkable_node_type _node_type, reference_type _ref_type) : + ns(_ns), name(_name), node_type(_node_type), ref_type(_ref_type) { - switch (ref_type) - { - case reference_cell: - cell_ref = new cell_reference; - break; - case reference_range_field: - field_ref = new field_in_range; - break; - default: - throw general_error("unexpected reference type in the constructor of attribute."); - } + parent.create_ref_store(*this); } -xml_map_tree::attribute::~attribute() -{ - switch (ref_type) - { - case reference_cell: - delete cell_ref; - break; - case reference_range_field: - delete field_ref; - break; - default: - assert(!"unexpected reference type in the destructor of attribute."); - } -} +xml_map_tree::attribute::attribute(args_type args) : + linkable(std::get<0>(args), std::get<1>(args), std::get<2>(args), node_attribute, std::get<3>(args)) {} + +xml_map_tree::attribute::~attribute() {} -xml_map_tree::element::element( - xmlns_id_t _ns, const pstring& _name, element_type _elem_type, reference_type _ref_type) : - linkable(_ns, _name, node_element), - elem_type(_elem_type), - ref_type(_ref_type), +xml_map_tree::element::element(args_type args) : + linkable(std::get<0>(args), std::get<1>(args), std::get<2>(args), node_element, std::get<4>(args)), + elem_type(std::get<3>(args)), + child_elements(nullptr), range_parent(nullptr), row_group(nullptr), row_group_position(0) { - if (elem_type == element_unlinked) - { - child_elements = new element_store_type; - return; - } - - assert(elem_type == element_linked); - - switch (ref_type) - { - case reference_cell: - cell_ref = new cell_reference; - break; - case reference_range_field: - field_ref = new field_in_range; - break; - default: - throw general_error("unexpected reference type in the constructor of element."); - } -} + xml_map_tree& parent = std::get<0>(args); -xml_map_tree::element::~element() -{ if (elem_type == element_unlinked) { - delete child_elements; + child_elements = parent.m_element_store_pool.construct(); return; } assert(elem_type == element_linked); - - switch (ref_type) - { - case reference_cell: - delete cell_ref; - break; - case reference_range_field: - delete field_ref; - break; - default: - assert(!"unexpected reference type in the destructor of element."); - } } +xml_map_tree::element::~element() {} + xml_map_tree::element* xml_map_tree::element::get_child(xmlns_id_t _ns, const pstring& _name) { if (elem_type != element_unlinked) @@ -250,29 +184,96 @@ assert(child_elements); auto it = std::find_if( - child_elements->begin(), child_elements->end(), find_by_name<element>(_ns, _name)); + child_elements->begin(), child_elements->end(), + [&_ns,&_name](const element* p) -> bool + { + return p->ns == _ns && p->name == _name; + } + ); - return it == child_elements->end() ? nullptr : it->get(); + return it == child_elements->end() ? nullptr : *it; } -std::pair<xml_map_tree::element*, bool> xml_map_tree::element::get_or_create_child( - string_pool& _name_pool, xmlns_id_t _ns, const pstring& _name) +xml_map_tree::element* xml_map_tree::element::get_or_create_child( + xml_map_tree& parent, xmlns_id_t _ns, const pstring& _name) { - using ret_type = std::pair<xml_map_tree::element*, bool>; - auto it = std::find_if( - child_elements->begin(), child_elements->end(), find_by_name<element>(_ns, _name)); + child_elements->begin(), child_elements->end(), + [&_ns,&_name](const element* p) -> bool + { + return p->ns == _ns && p->name == _name; + } + ); if (it != child_elements->end()) - return ret_type(it->get(), false); + return *it; + + string_pool& sp = parent.m_names; // Insert a new element of this name. child_elements->push_back( - orcus::make_unique<element>( - _ns, _name_pool.intern(_name.get(), _name.size()).first, - element_unlinked, reference_unknown)); + parent.m_element_pool.construct( + element::args_type( + parent, + _ns, + sp.intern(_name.get(), _name.size()).first, + element_unlinked, + reference_unknown + ) + ) + ); + + return child_elements->back(); +} + +xml_map_tree::element* xml_map_tree::element::get_or_create_linked_child( + xml_map_tree& parent, xmlns_id_t _ns, const pstring& _name, reference_type _ref_type) +{ + auto it = std::find_if( + child_elements->begin(), child_elements->end(), + [&_ns,&_name](const element* p) -> bool + { + return p->ns == _ns && p->name == _name; + } + ); + + if (it != child_elements->end()) + { + // Specified child element already exists. Make sure it's unlinked. + element* elem = *it; + if (elem->ref_type != reference_unknown || elem->elem_type != element_unlinked) + throw xpath_error("This element is already linked. You can't link the same element twice."); + + elem->link_reference(parent, _ref_type); + return elem; + } + + string_pool& sp = parent.m_names; + + // Insert a new linked element of this name. + child_elements->push_back( + parent.m_element_pool.construct( + element::args_type( + parent, + _ns, + sp.intern(_name.get(), _name.size()).first, + element_linked, + _ref_type + ) + ) + ); + + return child_elements->back(); +} + +void xml_map_tree::element::link_reference(xml_map_tree& parent, reference_type _ref_type) +{ + if (elem_type == element_unlinked) + parent.m_element_store_pool.destroy(child_elements); - return ret_type(child_elements->back().get(), true); + elem_type = element_linked; + ref_type = _ref_type; + parent.create_ref_store(*this); } bool xml_map_tree::element::unlinked_attribute_anchor() const @@ -309,7 +310,7 @@ return nullptr; } - element* p = m_parent.mp_root.get(); + element* p = m_parent.mp_root; if (p->ns != ns || p->name != name) { // Names differ. @@ -555,7 +556,7 @@ #if ORCUS_DEBUG_XML_MAP_TREE cout << "xml_map_tree::get_link: xpath = '" << xpath << "'" << endl; #endif - const linkable* cur_node = mp_root.get(); + const linkable* cur_node = mp_root; xpath_parser parser(m_xmlns_cxt, xpath.get(), xpath.size()); @@ -579,13 +580,18 @@ const element* elem = static_cast<const element*>(cur_node); const attribute_store_type& attrs = elem->attributes; auto it = std::find_if( - attrs.begin(), attrs.end(), find_by_name<attribute>(token.ns, token.name)); + attrs.begin(), attrs.end(), + [&token](const attribute* p) -> bool + { + return p->ns == token.ns && p->name == token.name; + } + ); if (it == attrs.end()) // No such attribute exists. return nullptr; - return it->get(); + return *it; } // See if an element of this name exists below the current element. @@ -602,13 +608,17 @@ auto it = std::find_if( elem->child_elements->begin(), elem->child_elements->end(), - find_by_name<element>(token.ns, token.name)); + [&token](const element* p) -> bool + { + return p->ns == token.ns && p->name == token.name; + } + ); if (it == elem->child_elements->end()) // No such child element exists. return nullptr; - cur_node = it->get(); + cur_node = *it; } if (cur_node->node_type != node_element || static_cast<const element*>(cur_node)->elem_type == element_unlinked) @@ -646,10 +656,26 @@ it = m_field_refs.insert( it, range_ref_map_type::value_type( - pos_safe, orcus::make_unique<range_reference>(pos_safe))); + pos_safe, + m_range_reference_pool.construct(pos_safe))); } - return it->second.get(); + return it->second; +} + +void xml_map_tree::create_ref_store(linkable& node) +{ + switch (node.ref_type) + { + case xml_map_tree::reference_cell: + node.cell_ref = m_cell_reference_pool.construct(); + break; + case xml_map_tree::reference_range_field: + node.field_ref = m_field_in_range_pool.construct(); + break; + case xml_map_tree::reference_unknown: + break; + } } xml_map_tree::linked_node_type xml_map_tree::get_linked_node(const pstring& xpath, reference_type ref_type) @@ -673,12 +699,18 @@ if (token.attribute) throw xpath_error("root element cannot be an attribute."); - mp_root = orcus::make_unique<element>( - token.ns, m_names.intern(token.name).first, - element_unlinked, reference_unknown); + mp_root = m_element_pool.construct( + element::args_type( + *this, + token.ns, + m_names.intern(token.name).first, + element_unlinked, + reference_unknown + ) + ); } - ret.elem_stack.push_back(mp_root.get()); + ret.elem_stack.push_back(mp_root); element* cur_element = ret.elem_stack.back(); assert(cur_element); assert(cur_element->child_elements); @@ -690,7 +722,7 @@ if (token.attribute) throw xpath_error("attribute must always be at the end of the path."); - cur_element = cur_element->get_or_create_child(m_names, token.ns, token.name).first; + cur_element = cur_element->get_or_create_child(*this, token.ns, token.name); ret.elem_stack.push_back(cur_element); token = token_next; } @@ -706,53 +738,31 @@ // Check if an attribute of the same name already exists. auto it = std::find_if( - attrs.begin(), attrs.end(), find_by_name<attribute>(token.ns, token.name)); + attrs.begin(), attrs.end(), + [&token](const attribute* p) -> bool + { + return p->ns == token.ns && p->name == token.name; + } + ); + if (it != attrs.end()) throw xpath_error("This attribute is already linked. You can't link the same attribute twice."); - attrs.push_back( - orcus::make_unique<attribute>( - token.ns, m_names.intern(token.name.get(), token.name.size()).first, ref_type)); + attribute* p = m_attribute_pool.construct( + attribute::args_type( + *this, + token.ns, + m_names.intern(token.name.get(), token.name.size()).first, + ref_type + ) + ); - ret.node = attrs.back().get(); + attrs.push_back(p); + ret.node = attrs.back(); } else { - // Check if an element of the same name already exists. - auto r = cur_element->get_or_create_child(m_names, token.ns, token.name); - element* elem = r.first; - bool created = r.second; - - if (created) - { - // No element of that name exists. - elem->elem_type = element_linked; - elem->ref_type = ref_type; - } - else - { - // This element already exists. Check if this is already linked. - if (elem->ref_type != reference_unknown || elem->elem_type != element_unlinked) - throw xpath_error("This element is already linked. You can't link the same element twice."); - - // Turn this existing non-linked element into a linked one. - delete elem->child_elements; - elem->elem_type = element_linked; - elem->ref_type = ref_type; - switch (ref_type) - { - case reference_cell: - elem->cell_ref = new cell_reference; - break; - case reference_range_field: - elem->field_ref = new field_in_range; - break; - default: - throw general_error("Unknown reference type in xml_map_tree::get_element_stack."); - } - - } - + element* elem = cur_element->get_or_create_linked_child(*this, token.ns, token.name, ref_type); ret.elem_stack.push_back(elem); ret.node = elem; } @@ -779,12 +789,18 @@ if (token.attribute) throw xpath_error("root element cannot be an attribute."); - mp_root = orcus::make_unique<element>( - token.ns, m_names.intern(token.name).first, - element_unlinked, reference_unknown); + mp_root = m_element_pool.construct( + element::args_type( + *this, + token.ns, + m_names.intern(token.name).first, + element_unlinked, + reference_unknown + ) + ); } - element* cur_element = mp_root.get(); + element* cur_element = mp_root; assert(cur_element->child_elements); for (token = parser.next(); !token.name.empty(); token = parser.next()) @@ -793,7 +809,7 @@ if (token.attribute) throw xpath_error("attribute was not expected."); - cur_element = cur_element->get_or_create_child(m_names, token.ns, token.name).first; + cur_element = cur_element->get_or_create_child(*this, token.ns, token.name); } assert(cur_element); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/src/liborcus/xml_map_tree.hpp new/liborcus-0.15.1/src/liborcus/xml_map_tree.hpp --- old/liborcus-0.15.0/src/liborcus/xml_map_tree.hpp 2019-07-17 22:49:32.000000000 +0200 +++ new/liborcus-0.15.1/src/liborcus/xml_map_tree.hpp 2019-08-21 03:41:24.000000000 +0200 @@ -20,8 +20,11 @@ #include <ostream> #include <map> #include <vector> +#include <deque> #include <memory> +#include <boost/pool/object_pool.hpp> + namespace orcus { class xmlns_repository; @@ -77,9 +80,9 @@ struct element; struct linkable; - typedef std::vector<std::unique_ptr<element>> element_store_type; - typedef std::vector<element*> element_list_type; - typedef std::vector<const element*> const_element_list_type; + using element_store_type = std::deque<element*>; + using element_list_type = std::vector<element*>; + using const_element_list_type = std::vector<const element*>; struct range_reference { @@ -107,11 +110,11 @@ struct field_in_range { - range_reference* ref; - spreadsheet::col_t column_pos; + range_reference* ref = nullptr; + spreadsheet::col_t column_pos = -1; }; - typedef std::map<cell_position, std::unique_ptr<range_reference>> range_ref_map_type; + typedef std::map<cell_position, range_reference*> range_ref_map_type; enum linkable_node_type { node_unknown, node_element, node_attribute }; enum reference_type { reference_unknown, reference_cell, reference_range_field }; @@ -122,39 +125,36 @@ xmlns_id_t ns; pstring name; linkable_node_type node_type; + reference_type ref_type; + + union + { + cell_reference* cell_ref = nullptr; + field_in_range* field_ref; + }; mutable pstring ns_alias; // namespace alias used in the content stream. linkable(const linkable&) = delete; linkable& operator=(const linkable&) = delete; - linkable(xmlns_id_t _ns, const pstring& _name, linkable_node_type _node_type); + linkable(xml_map_tree& parent, xmlns_id_t _ns, const pstring& _name, linkable_node_type _node_type, reference_type _ref_type); }; struct attribute : public linkable { - reference_type ref_type; - union { - cell_reference* cell_ref; - field_in_range* field_ref; - }; + using args_type = std::tuple<xml_map_tree&, xmlns_id_t, const pstring&, reference_type>; - attribute(xmlns_id_t _ns, const pstring& _name, reference_type _ref_type); + attribute(args_type args); ~attribute(); }; - typedef std::vector<std::unique_ptr<attribute>> attribute_store_type; + using attribute_store_type = std::deque<attribute*>; struct element : public linkable { element_type elem_type; - reference_type ref_type; - - union { - element_store_type* child_elements; - cell_reference* cell_ref; - field_in_range* field_ref; - }; + element_store_type* child_elements; mutable element_position stream_pos; // position of this element in the content stream @@ -178,12 +178,20 @@ std::vector<spreadsheet::col_t> linked_range_fields; - element(xmlns_id_t _ns, const pstring& _name, element_type _elem_type, reference_type _ref_type); + using args_type = std::tuple<xml_map_tree&, xmlns_id_t, const pstring&, element_type, reference_type>; + + element(args_type args); ~element(); element* get_child(xmlns_id_t _ns, const pstring& _name); - std::pair<element*, bool> get_or_create_child(string_pool& _name_pool, xmlns_id_t _ns, const pstring& _name); + element* get_or_create_child( + xml_map_tree& parent, xmlns_id_t _ns, const pstring& _name); + + element* get_or_create_linked_child( + xml_map_tree& parent, xmlns_id_t _ns, const pstring& _name, reference_type _ref_type); + + void link_reference(xml_map_tree& parent, reference_type _ref_type); /** * Unlinked attribute anchor is an element that's not linked but has @@ -195,6 +203,8 @@ bool unlinked_attribute_anchor() const; }; + friend struct linkable; + public: /** @@ -244,6 +254,8 @@ private: range_reference* get_range_reference(const cell_position& pos); + void create_ref_store(linkable& node); + struct linked_node_type { element_list_type elem_stack; @@ -282,7 +294,14 @@ /** pool of element names. */ mutable string_pool m_names; - std::unique_ptr<element> mp_root; + boost::object_pool<element_store_type> m_element_store_pool; + boost::object_pool<cell_reference> m_cell_reference_pool; + boost::object_pool<range_reference> m_range_reference_pool; + boost::object_pool<field_in_range> m_field_in_range_pool; + boost::object_pool<attribute> m_attribute_pool; + boost::object_pool<element> m_element_pool; + + element* mp_root; }; std::ostream& operator<< (std::ostream& os, const xml_map_tree::linkable& link); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/src/liborcus/xml_stream_parser.hpp new/liborcus-0.15.1/src/liborcus/xml_stream_parser.hpp --- old/liborcus-0.15.0/src/liborcus/xml_stream_parser.hpp 2019-03-09 14:44:07.000000000 +0100 +++ new/liborcus-0.15.1/src/liborcus/xml_stream_parser.hpp 2019-08-15 05:19:21.000000000 +0200 @@ -59,7 +59,7 @@ xmlns_repository& ns_repo, const tokens& tokens, const char* content, size_t size); virtual ~xml_stream_parser() override; - virtual void parse(); + virtual void parse() override; }; class threaded_xml_stream_parser : public xml_stream_parser_base @@ -72,7 +72,7 @@ xmlns_repository& ns_repo, const tokens& tokens, const char* content, size_t size); virtual ~threaded_xml_stream_parser() override; - virtual void parse(); + virtual void parse() override; void swap_string_pool(string_pool& pool); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liborcus-0.15.0/src/parser/parser_global_test.cpp new/liborcus-0.15.1/src/parser/parser_global_test.cpp --- old/liborcus-0.15.0/src/parser/parser_global_test.cpp 2019-01-08 02:07:20.000000000 +0100 +++ new/liborcus-0.15.1/src/parser/parser_global_test.cpp 2019-08-14 04:38:03.000000000 +0200 @@ -41,7 +41,7 @@ for (const test_case& test_data : test_cases) { const char* str = test_data.str; - double val = orcus::parse_numeric(str, std::strlen(test_data.str)); + volatile double val = orcus::parse_numeric(str, std::strlen(test_data.str)); if (std::isnan(test_data.val)) { assert(std::isnan(val));
