Change-Id: Ibff9a5e0f0771e4cf12b4dc3985661a01195e265
Reviewed-on: https://gerrit.libreoffice.org/77482
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
(cherry picked from commit
56ffe3c0a1261cd98a3d42b8b08d5f8eb013ead4)
Correctly pack mdds 1.5.0.
Turns out the earlier mdds 1.5.0 package was not correctly packaged.
I've fixed that now, and re-published the 1.5.0 package, which does
contain the patch from Lubos.
Change-Id: I1ff7d6568568860f7cccd3be3bc29aaaebe7fd73
Reviewed-on: https://gerrit.libreoffice.org/77483
Tested-by: Jenkins
Reviewed-by: Kohei Yoshida <kohei@libreoffice.org>
(cherry picked from commit
1c59fed7c43654736775580799f1165e8b8740a0)
Fix linking of newly created element in liborcus 0.15.0
After
56ffe3c0a1261cd98a3d42b8b08d5f8eb013ead4 "Switch mdds to 1.5.0 and
liborcus to 0.15.0", CppunitTest_sc_dataprovider started to fail in ASan builds
with
> ERROR: AddressSanitizer: new-delete-type-mismatch on 0x6060005b9340 in thread T4 (XML Fetch Threa):
> object passed to delete has wrong type:
> size of the allocated type: 56 bytes;
> size of the deallocated type: 16 bytes.
> #0 in operator delete(void*, unsigned long) at llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
> #1 in orcus::xml_map_tree::element::~element() at workdir/UnpackedTarball/liborcus/src/liborcus/xml_map_tree.cpp:238:13
[...]
> #25 in std::unique_ptr<orcus::orcus_xml::impl, std::default_delete<orcus::orcus_xml::impl> >::~unique_ptr()
> #26 in orcus::orcus_xml::~orcus_xml() at workdir/UnpackedTarball/liborcus/src/liborcus/orcus_xml.cpp:530:26
> #27 in ScOrcusXMLContextImpl::importXML(ScOrcusImportXMLParam const&) at sc/source/filter/orcus/xmlcontext.cxx:286:5
[...]
> 0x6060005b9340 is located 0 bytes inside of 56-byte region [0x6060005b9340,0x6060005b9378)
> allocated by thread T4 (XML Fetch Threa) here:
> #0 in operator new(unsigned long) at llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
> #1 in orcus::xml_map_tree::element::element(char const*, orcus::pstring const&, orcus::xml_map_tree::element_type, orcus::xml_map_tree::reference_type) at workdir/UnpackedTarball/liborcus/src/liborcus/xml_map_tree.cpp:203:26
> #2 in std::unique_ptr<orcus::xml_map_tree::element, std::default_delete<orcus::xml_map_tree::element> > orcus::make_unique<orcus::xml_map_tree::element, char const*&, orcus::pstring, orcus::xml_map_tree::element_type, orcus::xml_map_tree::reference_type>(char const*&, orcus::pstring&&, orcus::xml_map_tree::element_type&&, orcus::xml_map_tree::reference_type&&) at workdir/UnpackedTarball/liborcus/src/liborcus/../../include/orcus/global.hpp:61:35
> #3 in orcus::xml_map_tree::element::get_or_create_child(orcus::string_pool&, char const*, orcus::pstring const&) at workdir/UnpackedTarball/liborcus/src/liborcus/xml_map_tree.cpp:271:9
> #4 in orcus::xml_map_tree::get_linked_node(orcus::pstring const&, orcus::xml_map_tree::reference_type) at workdir/UnpackedTarball/liborcus/src/liborcus/xml_map_tree.cpp:722:31
[...]
Change-Id: Iad8e06ead6f2655a3e26ceeab368e9b50028402f
Reviewed-on: https://gerrit.libreoffice.org/77519
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit
ffdc97898b145c9b0cebd22f0393da2c27e17a47)
external/liborcus/version.patch.0 is gone
...since
56ffe3c0a1261cd98a3d42b8b08d5f8eb013ead4 "Switch mdds to 1.5.0 and
liborcus to 0.15.0."
Change-Id: I03c5336bbaf65a13f883a30a3fc4238b140a9cef
Reviewed-on: https://gerrit.libreoffice.org/77521
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit
6c286f807c03321a79f8aaa98c6a785da005d619)
Gbp-Pq: Name Switch-mdds-to-1.5.0-and-liborcus-to-0.15.0.diff
)
$(call gb_LinkTarget_add_libs,$(1),\
- -L$(call gb_UnpackedTarball_get_dir,liborcus)/src/liborcus/.libs -lorcus-0.14 \
+ -L$(call gb_UnpackedTarball_get_dir,liborcus)/src/liborcus/.libs -lorcus-0.15 \
)
$(if $(SYSTEM_BOOST), \
)
$(call gb_LinkTarget_add_libs,$(1),\
- -L$(call gb_UnpackedTarball_get_dir,liborcus)/src/parser/.libs -lorcus-parser-0.14 \
+ -L$(call gb_UnpackedTarball_get_dir,liborcus)/src/parser/.libs -lorcus-parser-0.15 \
)
endef
+++ /dev/null
-From 1967be013804f4f578b53659d7ef459b4c35de9f Mon Sep 17 00:00:00 2001
-From: Kohei Yoshida <kohei.yoshida@gmail.com>
-Date: Wed, 7 Nov 2018 21:08:40 -0500
-Subject: [PATCH] Prevent unsigned integer underflow.
-
-(cherry picked from commit 40bbce85048b77c545103af124f3d9831dd4a458)
----
- src/parser/parser_base.cpp | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/parser/parser_base.cpp b/src/parser/parser_base.cpp
-index 586d495f..9d426efb 100644
---- a/src/parser/parser_base.cpp
-+++ b/src/parser/parser_base.cpp
-@@ -120,7 +120,8 @@ double parser_base::parse_double()
-
- size_t parser_base::remaining_size() const
- {
-- return std::distance(mp_char, mp_end) - 1;
-+ size_t n = std::distance(mp_char, mp_end);
-+ return n ? (n - 1) : 0;
- }
-
- std::ptrdiff_t parser_base::offset() const
---
-2.17.1
-
$(eval $(call gb_ExternalPackage_use_external_project,liborcus,liborcus))
ifeq ($(OS),MACOSX)
-$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.14.0.dylib,src/liborcus/.libs/liborcus-0.14.0.dylib))
-$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.14.0.dylib,src/parser/.libs/liborcus-parser-0.14.0.dylib))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.15.0.dylib,src/liborcus/.libs/liborcus-0.15.0.dylib))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.15.0.dylib,src/parser/.libs/liborcus-parser-0.15.0.dylib))
else ifeq ($(DISABLE_DYNLOADING),)
-$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.14.so.0,src/liborcus/.libs/liborcus-0.14.so.0.0.0))
-$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.14.so.0,src/parser/.libs/liborcus-parser-0.14.so.0.0.0))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.15.so.0,src/liborcus/.libs/liborcus-0.15.so.0.0.0))
+$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.15.so.0,src/parser/.libs/liborcus-parser-0.15.so.0.0.0))
endif
# vim: set noet sw=4 ts=4:
$(MAKE) \
$(if $(filter MACOSX,$(OS)),\
&& $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \
- $(EXTERNAL_WORKDIR)/src/liborcus/.libs/liborcus-0.14.0.dylib \
- $(EXTERNAL_WORKDIR)/src/parser/.libs/liborcus-parser-0.14.0.dylib \
+ $(EXTERNAL_WORKDIR)/src/liborcus/.libs/liborcus-0.15.0.dylib \
+ $(EXTERNAL_WORKDIR)/src/parser/.libs/liborcus-parser-0.15.0.dylib \
) \
)
$(eval $(call gb_Library_use_externals,orcus-parser,\
boost_headers \
+ boost_filesystem \
boost_system \
mdds_headers \
zlib \
$(eval $(call gb_Library_set_include,orcus-parser,\
-I$(call gb_UnpackedTarball_get_dir,liborcus)/include \
+ -I$(call gb_UnpackedTarball_get_dir,liborcus)/src/include \
$$(INCLUDE) \
))
$(eval $(call gb_Library_set_include,orcus,\
-I$(call gb_UnpackedTarball_get_dir,liborcus)/include \
+ -I$(call gb_UnpackedTarball_get_dir,liborcus)/src/include \
$$(INCLUDE) \
))
UnpackedTarball/liborcus/src/liborcus/info \
UnpackedTarball/liborcus/src/liborcus/interface \
UnpackedTarball/liborcus/src/liborcus/json_document_tree \
+ UnpackedTarball/liborcus/src/liborcus/json_map_tree \
+ UnpackedTarball/liborcus/src/liborcus/json_structure_mapper \
+ UnpackedTarball/liborcus/src/liborcus/json_structure_tree \
UnpackedTarball/liborcus/src/liborcus/json_util \
UnpackedTarball/liborcus/src/liborcus/measurement \
UnpackedTarball/liborcus/src/liborcus/odf_helper \
UnpackedTarball/liborcus/src/liborcus/orcus_gnumeric \
UnpackedTarball/liborcus/src/liborcus/orcus_import_ods \
UnpackedTarball/liborcus/src/liborcus/orcus_import_xlsx \
+ UnpackedTarball/liborcus/src/liborcus/orcus_json \
UnpackedTarball/liborcus/src/liborcus/orcus_ods \
UnpackedTarball/liborcus/src/liborcus/orcus_xls_xml \
UnpackedTarball/liborcus/src/liborcus/orcus_xlsx \
UnpackedTarball/liborcus/src/liborcus/orcus_xml \
+ UnpackedTarball/liborcus/src/liborcus/orcus_xml_map_def \
UnpackedTarball/liborcus/src/liborcus/session_context \
UnpackedTarball/liborcus/src/liborcus/spreadsheet_iface_util \
+ UnpackedTarball/liborcus/src/liborcus/spreadsheet_impl_types \
UnpackedTarball/liborcus/src/liborcus/spreadsheet_interface \
UnpackedTarball/liborcus/src/liborcus/spreadsheet_types \
UnpackedTarball/liborcus/src/liborcus/string_helper \
$(eval $(call gb_UnpackedTarball_update_autoconf_configs,liborcus))
-# * external/liborcus/version.patch.0 covered by upstream
-# <https://gitlab.com/orcus/orcus/commit/0dfa88f2adca7887dbe44bdb7025985777c89673> "Remove unused
-# VERSION file":
$(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
- external/liborcus/0001-workaround-a-linking-problem-on-windows.patch \
external/liborcus/rpath.patch.0 \
external/liborcus/gcc9.patch.0 \
- external/liborcus/version.patch.0 \
external/liborcus/libtool.patch.0 \
- external/liborcus/0001-Prevent-unsigned-integer-underflow.patch \
+ external/liborcus/create-element.patch.0 \
))
ifeq ($(OS),WNT)
--- /dev/null
+--- src/liborcus/xml_map_tree.cpp
++++ src/liborcus/xml_map_tree.cpp
+@@ -723,35 +723,28 @@
+ 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
++ if (!created)
+ {
+ // 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.");
+- }
+-
+ }
++
++ // 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.");
++ }
+
+ ret.elem_stack.push_back(elem);
+ ret.node = elem;
+++ /dev/null
---- configure
-+++ configure
-@@ -21055,7 +21055,7 @@
-
- fi
-
--ac_config_files="$ac_config_files Makefile liborcus-$ORCUS_API_VERSION.pc:liborcus.pc.in liborcus-spreadsheet-model-$ORCUS_API_VERSION.pc:liborcus-spreadsheet-model.pc.in VERSION include/Makefile include/orcus/Makefile include/orcus/detail/Makefile include/orcus/mso/Makefile include/orcus/spreadsheet/Makefile src/Makefile src/liborcus/Makefile src/liborcus/constants.inl src/mso/Makefile src/parser/Makefile src/python/Makefile src/spreadsheet/Makefile parser_handlers/Makefile benchmark/Makefile doc_example/Makefile"
-+ac_config_files="$ac_config_files Makefile liborcus-$ORCUS_API_VERSION.pc:liborcus.pc.in liborcus-spreadsheet-model-$ORCUS_API_VERSION.pc:liborcus-spreadsheet-model.pc.in include/Makefile include/orcus/Makefile include/orcus/detail/Makefile include/orcus/mso/Makefile include/orcus/spreadsheet/Makefile src/Makefile src/liborcus/Makefile src/liborcus/constants.inl src/mso/Makefile src/parser/Makefile src/python/Makefile src/spreadsheet/Makefile parser_handlers/Makefile benchmark/Makefile doc_example/Makefile"
-
- cat >confcache <<\_ACEOF
- # This file is a shell script that caches the results of configure
$(eval $(call gb_UnpackedTarball_set_patchlevel,mdds,0))
$(eval $(call gb_UnpackedTarball_add_patches,mdds,\
- external/mdds/use-position-hint-also-back.patch \
))
# vim: set noet sw=4 ts=4:
+++ /dev/null
-From 726e2f02d14833bde2f7eef9677f5564c485a992 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= <l.lunak@centrum.cz>
-Date: Fri, 17 May 2019 13:55:20 +0200
-Subject: [PATCH] use position hint also when it is past the actual position
-
-The m_blocks data structure is a vector. It means that it can be
-also walked back, instead of resetting and starting from the very
-start.
-
-Allows a noticeable performance improvement in
-https://gerrit.libreoffice.org/#/c/72424/ .
----
- include/mdds/multi_type_vector_def.inl | 21 ++++++++++++++++++++-
- 1 file changed, 20 insertions(+), 1 deletion(-)
-
-diff --git a/include/mdds/multi_type_vector_def.inl b/include/mdds/multi_type_vector_def.inl
-index 22a0ee2..09894e6 100644
---- include/mdds/multi_type_vector_def.inl
-+++ include/mdds/multi_type_vector_def.inl
-@@ -861,7 +861,26 @@ void multi_type_vector<_CellBlockFunc, _EventFunc>::get_block_position(
-
- if (pos < start_row)
- {
-- // Position hint is past the insertion position. Reset.
-+ // Position hint is past the insertion position.
-+ // Walk back if that seems efficient.
-+ if (pos > start_row / 2)
-+ {
-+ for (size_type i = block_index; i > 0;)
-+ {
-+ --i;
-+ const block& blk = m_blocks[i];
-+ start_row -= blk.m_size;
-+ if (pos >= start_row)
-+ {
-+ // Row is in this block.
-+ block_index = i;
-+ return;
-+ }
-+ // Specified row is not in this block.
-+ }
-+ assert(start_row == 0);
-+ }
-+ // Otherwise reset.
- start_row = 0;
- block_index = 0;
- }
---
-2.16.4
-
const mdds::mtv::element_t element_type_cellnote = mdds::mtv::element_type_user_start + 5;
/// Mapped standard element types (for convenience).
-const mdds::mtv::element_t element_type_numeric = mdds::mtv::element_type_numeric;
+const mdds::mtv::element_t element_type_numeric = mdds::mtv::element_type_double;
const mdds::mtv::element_t element_type_empty = mdds::mtv::element_type_empty;
-const mdds::mtv::element_t element_type_uint16 = mdds::mtv::element_type_ushort;
+const mdds::mtv::element_t element_type_uint16 = mdds::mtv::element_type_uint16;
/// Custom element blocks.
typedef mdds::mtv::noncopyable_managed_element_block<element_type_formula, ScFormulaCell> formula_block;
/// Mapped standard element blocks (for convenience).
-typedef mdds::mtv::numeric_element_block numeric_block;
-typedef mdds::mtv::ushort_element_block uint16_block;
+typedef mdds::mtv::double_element_block numeric_block;
+typedef mdds::mtv::uint16_element_block uint16_block;
/// This needs to be in the same namespace as CellTextAttr.
MDDS_MTV_DEFINE_ELEMENT_CALLBACKS(CellTextAttr, element_type_celltextattr, CellTextAttr(), celltextattr_block)
{
ScAddress maPos;
std::vector<OString> maFieldPaths;
+ std::vector<OString> maRowGroups;
};
typedef std::vector<CellLink> CellLinksType;
aRangeLink.maPos = ScAddress(0,0,0);
aRangeLink.maFieldPaths.push_back("/bookstore/book/title");
aRangeLink.maFieldPaths.push_back("/bookstore/book/author");
+ aRangeLink.maRowGroups.push_back("/bookstore/book");
aParam.maRangeLinks.push_back(aRangeLink);
createFileURL("test1.", "xml", aFileURL);
{
case mdds::mtm::element_numeric:
{
- numeric_element_block::const_iterator it = numeric_element_block::begin(*node.data);
- numeric_element_block::const_iterator itEnd = numeric_element_block::end(*node.data);
+ double_element_block::const_iterator it = double_element_block::begin(*node.data);
+ double_element_block::const_iterator itEnd = double_element_block::end(*node.data);
for (; it != itEnd; ++it, ++miPos)
*miPos = *it;
}
{
case mdds::mtm::element_numeric:
{
- numeric_element_block::const_iterator it = numeric_element_block::begin(*node.data);
- numeric_element_block::const_iterator itEnd = numeric_element_block::end(*node.data);
+ double_element_block::const_iterator it = double_element_block::begin(*node.data);
+ double_element_block::const_iterator itEnd = double_element_block::end(*node.data);
for (; it != itEnd; ++it, ++miPos)
{
if (GetDoubleErrorValue(*miPos) == FormulaError::ElementNaN)
virtual orcus::spreadsheet::range_size_t get_sheet_size() const override;
+ virtual void fill_down_cells(orcus::spreadsheet::row_t row, orcus::spreadsheet::col_t col, orcus::spreadsheet::row_t range_size) override;
+
SCTAB getIndex() const { return mnTab; }
const sc::SharedFormulaGroups& getSharedFormulaGroups() const;
case orcus::spreadsheet::formula_grammar_t::ods:
eGrammar = formula::FormulaGrammar::GRAM_ODFF;
break;
- case orcus::spreadsheet::formula_grammar_t::xlsx_2007:
- case orcus::spreadsheet::formula_grammar_t::xlsx_2010:
+ case orcus::spreadsheet::formula_grammar_t::xlsx:
eGrammar = formula::FormulaGrammar::GRAM_OOXML;
break;
case orcus::spreadsheet::formula_grammar_t::gnumeric:
return ret;
}
+void ScOrcusSheet::fill_down_cells(os::row_t /*row*/, os::col_t /*col*/, os::row_t /*range_size*/)
+{
+ // TODO : implement this.
+}
+
const sc::SharedFormulaGroups& ScOrcusSheet::getSharedFormulaGroups() const
{
return maFormulaGroups;
try
{
- std::string content = orcus::load_file_content(path);
+ orcus::file_content content(path);
ScOrcusFactory aFactory(rDoc);
ScOrcusStyles aStyles(aFactory);
- orcus::import_ods::read_styles(content.c_str(), content.size(), &aStyles);
+ orcus::import_ods::read_styles(content.data(), content.size(), &aStyles);
}
catch (const std::exception& e)
{
std::for_each(rLink.maFieldPaths.begin(), rLink.maFieldPaths.end(), InsertFieldPath(filter));
+ std::for_each(rLink.maRowGroups.begin(), rLink.maRowGroups.end(),
+ [&filter] (const OString& rRowGroup)
+ {
+ filter.set_range_row_group(rRowGroup.getStr());
+ }
+ );
+
filter.commit_range();
}
- std::string content = orcus::load_file_content(path);
+ orcus::file_content content(path);
filter.read_stream(content.data(), content.size());
aFactory.finalize();
// Go through all its child elements.
getFieldLinks(aRangeLink, aParam.maNamespaces, *mxLbTree, *rEntry);
+ // Add the anchor node as a grouping node, which will be used as a
+ // row position increment point.
+ OUString aThisEntry = getXPath(*mxLbTree, *rEntry, aParam.maNamespaces);
+ aRangeLink.maRowGroups.push_back(
+ OUStringToOString(aThisEntry, RTL_TEXTENCODING_UTF8));
+
aParam.maRangeLinks.push_back(aRangeLink);
}
}
struct matrix_trait
{
typedef string_block string_element_block;
- typedef mdds::mtv::ushort_element_block integer_element_block;
+ typedef mdds::mtv::uint16_element_block integer_element_block;
typedef mdds::mtv::custom_block_func1<string_block> element_block_func;
};