diff options
Diffstat (limited to 'external/liborcus')
27 files changed, 1461 insertions, 0 deletions
diff --git a/external/liborcus/ExternalPackage_liborcus.mk b/external/liborcus/ExternalPackage_liborcus.mk new file mode 100644 index 000000000..13d61a8fe --- /dev/null +++ b/external/liborcus/ExternalPackage_liborcus.mk @@ -0,0 +1,22 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalPackage_ExternalPackage,liborcus,liborcus)) + +$(eval $(call gb_ExternalPackage_use_external_project,liborcus,liborcus)) + +ifeq ($(OS),MACOSX) +$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.17.0.dylib,src/liborcus/.libs/liborcus-0.17.0.dylib)) +$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.17.0.dylib,src/parser/.libs/liborcus-parser-0.17.0.dylib)) +else ifeq ($(DISABLE_DYNLOADING),) +$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-0.17.so.0,src/liborcus/.libs/liborcus-0.17.so.0.0.0)) +$(eval $(call gb_ExternalPackage_add_file,liborcus,$(LIBO_LIB_FOLDER)/liborcus-parser-0.17.so.0,src/parser/.libs/liborcus-parser-0.17.so.0.0.0)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/liborcus/ExternalProject_liborcus.mk b/external/liborcus/ExternalProject_liborcus.mk new file mode 100644 index 000000000..e7f929a28 --- /dev/null +++ b/external/liborcus/ExternalProject_liborcus.mk @@ -0,0 +1,122 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalProject_ExternalProject,liborcus)) + +$(eval $(call gb_ExternalProject_use_autoconf,liborcus,build)) + +$(eval $(call gb_ExternalProject_use_externals,liborcus, \ + boost_headers \ + boost_filesystem \ + boost_iostreams \ + boost_system \ + mdds_headers \ + zlib \ +)) + +$(eval $(call gb_ExternalProject_register_targets,liborcus,\ + build \ +)) + +# Must be built with debug GNU C++ library if --enable-dbgutil has +# caused the LO code to be built thus. + +# The LIBS setting for Android is needed to get the orcus-xml-dump +# executable to build successfully. We obviously don't actually need +# that executable on Android, but we don't want to bother with +# patching out building it for Android. + +#$(if $(filter MSC,$(COM)),CPPFLAGS+="-DBOOST_ALL_NO_LIB") CXXFLAGS+="$(BOOST_CXXFLAGS)) + +liborcus_LIBS= +ifneq ($(SYSTEM_ZLIB),) +liborcus_LIBS+=-lz +endif +ifneq ($(SYSTEM_BOOST),) +liborcus_LIBS+=$(BOOST_SYSTEM_LIB) $(BOOST_IOSTREAMS_LIB) $(BOOST_FILESYSTEM_LIB) +else +liborcus_LIBS+=-L$(gb_StaticLibrary_WORKDIR) -lboost_system -lboost_iostreams -lboost_filesystem +endif +ifeq ($(OS),ANDROID) +liborcus_LIBS+=$(gb_STDLIBS) +endif + +liborcus_CPPCLAGS=$(CPPFLAGS) +ifeq ($(SYSTEM_ZLIB),) +liborcus_CPPFLAGS+=$(ZLIB_CFLAGS) +endif +# +# OSes that use the GNU C++ library need to use -D_GLIBCXX_DEBUG in +# sync with the rest of LibreOffice, i.e. depending on +# --enable-dbgutil. Note that although Android doesn't use the GNU C +# library (glibc), the NDK does offer the GNU C++ library as one of +# the C++ libraries available, and we use it. +# +liborcus_CPPFLAGS+=$(gb_COMPILERDEFS_STDLIB_DEBUG) + +liborcus_CXXFLAGS=$(CXXFLAGS) $(gb_VISIBILITY_FLAGS) $(gb_VISIBILITY_FLAGS_CXX) $(CXXFLAGS_CXX11) -DBOOST_SYSTEM_NO_DEPRECATED +liborcus_LDFLAGS=$(LDFLAGS) $(gb_LTOFLAGS) +liborcus_CXXFLAGS+=$(call gb_ExternalProject_get_build_flags,liborcus) +liborcus_LDFLAGS+=$(call gb_ExternalProject_get_link_flags,liborcus) +ifeq ($(COM),MSC) +liborcus_CXXFLAGS+=$(BOOST_CXXFLAGS) +endif +ifeq ($(SYSTEM_BOOST),) +liborcus_CXXFLAGS+=${BOOST_CPPFLAGS} +else +liborcus_LDFLAGS+=$(BOOST_LDFLAGS) +endif +ifneq (,$(PTHREAD_LIBS)) +liborcus_LDFLAGS+=$(PTHREAD_LIBS) +endif + +ifeq ($(OS),LINUX) +liborcus_LDFLAGS+=-Wl,-z,origin -Wl,-rpath,\$$$$ORIGIN +endif + +$(call gb_ExternalProject_get_state_target,liborcus,build) : + $(call gb_Trace_StartRange,liborcus,EXTERNAL) + $(call gb_ExternalProject_run,build,\ + $(if $(liborcus_LIBS),LIBS='$(liborcus_LIBS)') \ + $(if $(liborcus_CXXFLAGS),CXXFLAGS='$(liborcus_CXXFLAGS)') \ + $(if $(liborcus_CPPFLAGS),CPPFLAGS='$(liborcus_CPPFLAGS) $(gb_EMSCRIPTEN_CPPFLAGS) $(gb_EMSCRIPTEN_EXCEPT)') \ + $(if $(liborcus_LDFLAGS),LDFLAGS='$(liborcus_LDFLAGS) $(gb_EMSCRIPTEN_EXCEPT)') \ + MDDS_CFLAGS='$(MDDS_CFLAGS)' \ + MDDS_LIBS=' ' \ + MAKE=$(MAKE) $(gb_RUN_CONFIGURE) ./configure \ + --with-pic \ + $(if $(DISABLE_DYNLOADING), \ + --enable-static --disable-shared \ + , \ + --enable-shared --disable-static \ + ) \ + $(if $(ENABLE_DEBUG),--enable-debug,--disable-debug) \ + --disable-spreadsheet-model \ + --without-tools \ + --disable-python \ + --disable-werror \ + $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \ + $(if $(SYSTEM_BOOST),,\ + --with-boost=$(WORKDIR)/UnpackedTarball/boost \ + boost_cv_lib_iostreams=yes \ + boost_cv_lib_system=yes \ + boost_cv_lib_filesystem=yes \ + ) \ + $(gb_CONFIGURE_PLATFORMS) \ + && $(if $(verbose),V=1) \ + $(MAKE) \ + $(if $(filter MACOSX,$(OS)),\ + && $(PERL) $(SRCDIR)/solenv/bin/macosx-change-install-names.pl shl OOO \ + $(EXTERNAL_WORKDIR)/src/liborcus/.libs/liborcus-0.17.0.dylib \ + $(EXTERNAL_WORKDIR)/src/parser/.libs/liborcus-parser-0.17.0.dylib \ + ) \ + ) + $(call gb_Trace_EndRange,liborcus,EXTERNAL) + +# vim: set noet sw=4 ts=4: diff --git a/external/liborcus/Library_orcus-parser.mk b/external/liborcus/Library_orcus-parser.mk new file mode 100644 index 000000000..f26657756 --- /dev/null +++ b/external/liborcus/Library_orcus-parser.mk @@ -0,0 +1,73 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,orcus-parser)) + +$(eval $(call gb_Library_use_unpacked,orcus-parser,liborcus)) + +$(eval $(call gb_Library_use_externals,orcus-parser,\ + boost_headers \ + boost_filesystem \ + boost_system \ + mdds_headers \ + zlib \ +)) + +$(eval $(call gb_Library_set_warnings_disabled,orcus-parser)) + +$(eval $(call gb_Library_set_precompiled_header,orcus-parser,external/liborcus/inc/pch/precompiled_orcus-parser)) + +$(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_add_defs,orcus-parser,\ + -DBOOST_ALL_NO_LIB \ + -D__ORCUS_PSR_BUILDING_DLL \ +)) + +# Needed when building against MSVC in C++17 mode, as +# workdir/UnpackedTarball/liborcus/include/orcus/global.hpp uses std::unary_function: +$(eval $(call gb_Library_add_defs,orcus-parser, \ + -D_HAS_AUTO_PTR_ETC=1 \ +)) + +$(eval $(call gb_Library_set_generated_cxx_suffix,orcus-parser,cpp)) + +$(eval $(call gb_Library_add_generated_exception_objects,orcus-parser,\ + UnpackedTarball/liborcus/src/parser/base64 \ + UnpackedTarball/liborcus/src/parser/cell_buffer \ + UnpackedTarball/liborcus/src/parser/css_parser_base \ + UnpackedTarball/liborcus/src/parser/css_types \ + UnpackedTarball/liborcus/src/parser/csv_parser_base \ + UnpackedTarball/liborcus/src/parser/exception \ + UnpackedTarball/liborcus/src/parser/json_global \ + UnpackedTarball/liborcus/src/parser/json_parser_base \ + UnpackedTarball/liborcus/src/parser/json_parser_thread \ + UnpackedTarball/liborcus/src/parser/parser_base \ + UnpackedTarball/liborcus/src/parser/parser_global \ + UnpackedTarball/liborcus/src/parser/pstring \ + UnpackedTarball/liborcus/src/parser/sax_parser_base \ + UnpackedTarball/liborcus/src/parser/sax_token_parser \ + UnpackedTarball/liborcus/src/parser/sax_token_parser_thread \ + UnpackedTarball/liborcus/src/parser/stream \ + UnpackedTarball/liborcus/src/parser/string_pool \ + UnpackedTarball/liborcus/src/parser/tokens \ + UnpackedTarball/liborcus/src/parser/types \ + UnpackedTarball/liborcus/src/parser/utf8 \ + UnpackedTarball/liborcus/src/parser/xml_namespace \ + UnpackedTarball/liborcus/src/parser/xml_writer \ + UnpackedTarball/liborcus/src/parser/yaml_parser_base \ + UnpackedTarball/liborcus/src/parser/zip_archive \ + UnpackedTarball/liborcus/src/parser/zip_archive_stream \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/liborcus/Library_orcus.mk b/external/liborcus/Library_orcus.mk new file mode 100644 index 000000000..3c318797a --- /dev/null +++ b/external/liborcus/Library_orcus.mk @@ -0,0 +1,148 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,orcus)) + +$(eval $(call gb_Library_use_unpacked,orcus,liborcus)) + +$(eval $(call gb_Library_use_externals,orcus,\ + boost_headers \ + boost_filesystem \ + boost_iostreams \ + boost_system \ + mdds_headers \ + zlib \ +)) + +$(eval $(call gb_Library_set_warnings_disabled,orcus)) + +$(eval $(call gb_Library_set_precompiled_header,orcus,external/liborcus/inc/pch/precompiled_orcus)) + +$(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) \ +)) + +$(eval $(call gb_Library_add_defs,orcus,\ + -DBOOST_ALL_NO_LIB \ + -D__ORCUS_BUILDING_DLL \ + -D__ORCUS_GNUMERIC \ + -D__ORCUS_ODS \ + -D__ORCUS_XLSX \ + -D__ORCUS_XLS_XML \ +)) + +# Needed when building against MSVC in C++17 mode, as +# workdir/UnpackedTarball/liborcus/src/liborcus/css_document_tree.cpp uses std::unary_function: +$(eval $(call gb_Library_add_defs,orcus, \ + -D_HAS_AUTO_PTR_ETC=1 \ +)) + +$(eval $(call gb_Library_use_libraries,orcus,\ + orcus-parser \ +)) + +$(eval $(call gb_Library_set_generated_cxx_suffix,orcus,cpp)) + +$(eval $(call gb_Library_add_generated_exception_objects,orcus,\ + UnpackedTarball/liborcus/src/liborcus/config \ + UnpackedTarball/liborcus/src/liborcus/css_document_tree \ + UnpackedTarball/liborcus/src/liborcus/css_selector \ + UnpackedTarball/liborcus/src/liborcus/detection_result \ + UnpackedTarball/liborcus/src/liborcus/dom_tree \ + UnpackedTarball/liborcus/src/liborcus/format_detection \ + UnpackedTarball/liborcus/src/liborcus/formula_result \ + UnpackedTarball/liborcus/src/liborcus/global \ + UnpackedTarball/liborcus/src/liborcus/gnumeric_cell_context \ + UnpackedTarball/liborcus/src/liborcus/gnumeric_context \ + UnpackedTarball/liborcus/src/liborcus/gnumeric_detection_handler \ + UnpackedTarball/liborcus/src/liborcus/gnumeric_handler \ + UnpackedTarball/liborcus/src/liborcus/gnumeric_helper \ + UnpackedTarball/liborcus/src/liborcus/gnumeric_namespace_types \ + UnpackedTarball/liborcus/src/liborcus/gnumeric_sheet_context \ + UnpackedTarball/liborcus/src/liborcus/gnumeric_tokens \ + 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/odf_namespace_types \ + UnpackedTarball/liborcus/src/liborcus/odf_number_formatting_context \ + UnpackedTarball/liborcus/src/liborcus/odf_para_context \ + UnpackedTarball/liborcus/src/liborcus/odf_styles \ + UnpackedTarball/liborcus/src/liborcus/odf_styles_context \ + UnpackedTarball/liborcus/src/liborcus/odf_tokens \ + UnpackedTarball/liborcus/src/liborcus/ods_content_xml_context \ + UnpackedTarball/liborcus/src/liborcus/ods_content_xml_handler \ + UnpackedTarball/liborcus/src/liborcus/ods_dde_links_context \ + UnpackedTarball/liborcus/src/liborcus/ods_session_data \ + UnpackedTarball/liborcus/src/liborcus/ooxml_content_types \ + UnpackedTarball/liborcus/src/liborcus/ooxml_global \ + UnpackedTarball/liborcus/src/liborcus/ooxml_namespace_types \ + UnpackedTarball/liborcus/src/liborcus/ooxml_schemas \ + UnpackedTarball/liborcus/src/liborcus/ooxml_tokens \ + UnpackedTarball/liborcus/src/liborcus/ooxml_types \ + UnpackedTarball/liborcus/src/liborcus/opc_context \ + UnpackedTarball/liborcus/src/liborcus/opc_reader \ + UnpackedTarball/liborcus/src/liborcus/orcus_csv \ + 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_impl \ + 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 \ + UnpackedTarball/liborcus/src/liborcus/xls_xml_context \ + UnpackedTarball/liborcus/src/liborcus/xls_xml_detection_handler \ + UnpackedTarball/liborcus/src/liborcus/xls_xml_handler \ + UnpackedTarball/liborcus/src/liborcus/xls_xml_namespace_types \ + UnpackedTarball/liborcus/src/liborcus/xls_xml_tokens \ + UnpackedTarball/liborcus/src/liborcus/xlsx_autofilter_context \ + UnpackedTarball/liborcus/src/liborcus/xlsx_conditional_format_context \ + UnpackedTarball/liborcus/src/liborcus/xlsx_context \ + UnpackedTarball/liborcus/src/liborcus/xlsx_drawing_context \ + UnpackedTarball/liborcus/src/liborcus/xlsx_handler \ + UnpackedTarball/liborcus/src/liborcus/xlsx_helper \ + UnpackedTarball/liborcus/src/liborcus/xlsx_pivot_context \ + UnpackedTarball/liborcus/src/liborcus/xlsx_revision_context \ + UnpackedTarball/liborcus/src/liborcus/xlsx_session_data \ + UnpackedTarball/liborcus/src/liborcus/xlsx_sheet_context \ + UnpackedTarball/liborcus/src/liborcus/xlsx_table_context \ + UnpackedTarball/liborcus/src/liborcus/xlsx_types \ + UnpackedTarball/liborcus/src/liborcus/xlsx_workbook_context \ + UnpackedTarball/liborcus/src/liborcus/xml_context_base \ + UnpackedTarball/liborcus/src/liborcus/xml_context_global \ + UnpackedTarball/liborcus/src/liborcus/xml_element_validator \ + UnpackedTarball/liborcus/src/liborcus/xml_empty_context \ + UnpackedTarball/liborcus/src/liborcus/xml_map_tree \ + UnpackedTarball/liborcus/src/liborcus/xml_simple_stream_handler \ + UnpackedTarball/liborcus/src/liborcus/xml_stream_handler \ + UnpackedTarball/liborcus/src/liborcus/xml_stream_parser \ + UnpackedTarball/liborcus/src/liborcus/xml_structure_mapper \ + UnpackedTarball/liborcus/src/liborcus/xml_structure_tree \ + UnpackedTarball/liborcus/src/liborcus/xml_util \ + UnpackedTarball/liborcus/src/liborcus/xpath_parser \ + UnpackedTarball/liborcus/src/liborcus/yaml_document_tree \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/liborcus/Makefile b/external/liborcus/Makefile new file mode 100644 index 000000000..e4968cf85 --- /dev/null +++ b/external/liborcus/Makefile @@ -0,0 +1,7 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/liborcus/Module_liborcus.mk b/external/liborcus/Module_liborcus.mk new file mode 100644 index 000000000..e75b983ba --- /dev/null +++ b/external/liborcus/Module_liborcus.mk @@ -0,0 +1,32 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Module_Module,liborcus)) + +$(eval $(call gb_Module_add_targets,liborcus,\ + UnpackedTarball_liborcus \ +)) + +ifeq ($(COM),MSC) + +$(eval $(call gb_Module_add_targets,liborcus,\ + Library_orcus \ + Library_orcus-parser \ +)) + +else # !MSC + +$(eval $(call gb_Module_add_targets,liborcus,\ + ExternalPackage_liborcus \ + ExternalProject_liborcus \ +)) + +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/liborcus/README b/external/liborcus/README new file mode 100644 index 000000000..54e882663 --- /dev/null +++ b/external/liborcus/README @@ -0,0 +1,2 @@ +[https://gitlab.com/orcus/orcus] +"Collection of parsers and import filters for spreadsheet documents." diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk new file mode 100644 index 000000000..27668819a --- /dev/null +++ b/external/liborcus/UnpackedTarball_liborcus.mk @@ -0,0 +1,52 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_UnpackedTarball_UnpackedTarball,liborcus)) + +$(eval $(call gb_UnpackedTarball_set_tarball,liborcus,$(ORCUS_TARBALL))) + +$(eval $(call gb_UnpackedTarball_set_patchlevel,liborcus,1)) + +$(eval $(call gb_UnpackedTarball_update_autoconf_configs,liborcus)) + +# forcepoint-83.patch.1 merged as +# https://gitlab.com/orcus/orcus/-/commit/9f6400b8192e39fefd475a96222713e9e9c60038 +# forcepoint-84.patch.1 merged as +# https://gitlab.com/orcus/orcus/-/commit/223defe95d6f20f1bc5fd22fecc80a79a9519028 +# forcepoint-87.patch.1 merged as +# https://gitlab.com/orcus/orcus/-/commit/a718524ca424fb8a7e7931345a118342d1d4a507 +# forcepoint-88.patch.1 merged as +# https://gitlab.com/orcus/orcus/-/commit/0a99ca6d50af51f1b0a151fdcac5e12ec9b01bf8 +# forcepoint-95.patch.1 submitted as +# https://gitlab.com/orcus/orcus/-/merge_requests/124 + +$(eval $(call gb_UnpackedTarball_add_patches,liborcus,\ + external/liborcus/rpath.patch.0 \ + external/liborcus/gcc9.patch.0 \ + external/liborcus/libtool.patch.0 \ + external/liborcus/fix-pch.patch.0 \ + external/liborcus/liborcus_newline.patch.1 \ + external/liborcus/std-get-busted.patch.1 \ + external/liborcus/forcepoint-83.patch.1 \ + external/liborcus/forcepoint-84.patch.1 \ + external/liborcus/forcepoint-87.patch.1 \ + external/liborcus/forcepoint-88.patch.1 \ + external/liborcus/forcepoint-95.patch.1 \ + external/liborcus/include.patch.0 \ + external/liborcus/overrun.patch.0 \ +)) + +ifeq ($(OS),WNT) +$(eval $(call gb_UnpackedTarball_add_patches,liborcus,\ + external/liborcus/windows-constants-hack.patch \ + external/liborcus/win_path_utf16.patch \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/liborcus/fix-pch.patch.0 b/external/liborcus/fix-pch.patch.0 new file mode 100644 index 000000000..42a9d52d9 --- /dev/null +++ b/external/liborcus/fix-pch.patch.0 @@ -0,0 +1,11 @@ +--- src/liborcus/gnumeric_cell_context.cpp.sav 2018-05-27 18:18:56.000000000 +0200 ++++ src/liborcus/gnumeric_cell_context.cpp 2019-10-13 10:43:24.587258400 +0200 +@@ -248,7 +248,7 @@ + range.last.column = col + mp_cell_data->array_cols - 1; + range.last.row = row + mp_cell_data->array_rows - 1; + +- iface::import_array_formula* af = mp_sheet->get_array_formula(); ++ spreadsheet::iface::import_array_formula* af = mp_sheet->get_array_formula(); + if (af) + { + af->set_range(range); diff --git a/external/liborcus/forcepoint-83.patch.1 b/external/liborcus/forcepoint-83.patch.1 new file mode 100644 index 000000000..644c0dcff --- /dev/null +++ b/external/liborcus/forcepoint-83.patch.1 @@ -0,0 +1,38 @@ +From 4d58816e995a562f26f3cc5006ae9ddd46b1bbed Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> +Date: Wed, 23 Mar 2022 16:44:00 +0000 +Subject: [PATCH] forcepoint#83 Invalid read of size 1 + +==343916== Invalid read of size 1 +==343916== at 0x11A7B2F0: orcus::parser_base::cur_char() const (parser_base.hpp:79) +==343916== by 0x11B7B112: orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper, orcus::sax_parser_default_config>::element_open(long) (sax_parser.hpp:258) +==343916== by 0x11B7A2C7: orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper, orcus::sax_parser_default_config>::element() (sax_parser.hpp:246) +==343916== by 0x11B7A197: orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper, orcus::sax_parser_default_config>::body() (sax_parser.hpp:214) +==343916== by 0x11B79FD9: orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper, orcus::sax_parser_default_config>::parse() (sax_parser.hpp:182) +==343916== by 0x11B79F8B: orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::parse() (sax_ns_parser.hpp:277) +==343916== by 0x11B79768: orcus::sax_token_parser<orcus::xml_stream_handler>::parse() (sax_token_parser.hpp:215) +==343916== by 0x11B79406: orcus::xml_stream_parser::parse() (xml_stream_parser.cpp:68) +==343916== by 0x11BE3805: orcus::orcus_xlsx::detect(unsigned char const*, unsigned long) (orcus_xlsx.cpp:188) +==343916== by 0x11AB2482: orcus::detect(unsigned char const*, unsigned long) (format_detection.cpp:60) +==343916== by 0x30E60945: (anonymous namespace)::OrcusFormatDetect::detect(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>&) (filterdetect.cxx:83) +==343916== by 0x30E60ABE: non-virtual thunk to (anonymous namespace)::OrcusFormatDetect::detect(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>&) (filterdetect.cxx:0) +--- + include/orcus/sax_parser.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/orcus/sax_parser.hpp b/include/orcus/sax_parser.hpp +index 15e8d917..2e707568 100644 +--- a/include/orcus/sax_parser.hpp ++++ b/include/orcus/sax_parser.hpp +@@ -255,7 +255,7 @@ void sax_parser<_Handler,_Config>::element_open(std::ptrdiff_t begin_pos) + while (true) + { + skip_space_and_control(); +- char c = cur_char(); ++ char c = cur_char_checked(); + if (c == '/') + { + // Self-closing element: <element/> +-- +2.35.1 + diff --git a/external/liborcus/forcepoint-84.patch.1 b/external/liborcus/forcepoint-84.patch.1 new file mode 100644 index 000000000..bbe05340b --- /dev/null +++ b/external/liborcus/forcepoint-84.patch.1 @@ -0,0 +1,38 @@ +From ec469f774bb91302c4df21eff1314dfd508d37c8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> +Date: Wed, 23 Mar 2022 20:04:31 +0000 +Subject: [PATCH] forcepoint#84 Invalid read of size 1 + +==356879== Invalid read of size 1 +==356879== at 0x11EC50B0: orcus::parser_base::cur_char() const (parser_base.hpp:79) +==356879== by 0x11EDD736: orcus::sax::parser_base::value(std::basic_string_view<char, std::char_traits<char> >&, bool) (sax_parser_base.cpp:303) +==356879== by 0x11B7C3D5: orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper, orcus::sax_parser_default_config>::attribute() (sax_parser.hpp:563) +==356879== by 0x11B7B35E: orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper, orcus::sax_parser_default_config>::element_open(long) (sax_parser.hpp:292) +==356879== by 0x11B7A2F7: orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper, orcus::sax_parser_default_config>::element() (sax_parser.hpp:246) +==356879== by 0x11B7A1C7: orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper, orcus::sax_parser_default_config>::body() (sax_parser.hpp:214) +==356879== by 0x11B7A009: orcus::sax_parser<orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::handler_wrapper, orcus::sax_parser_default_config>::parse() (sax_parser.hpp:182) +==356879== by 0x11B79FBB: orcus::sax_ns_parser<orcus::sax_token_parser<orcus::xml_stream_handler>::handler_wrapper>::parse() (sax_ns_parser.hpp:277) +==356879== by 0x11B79798: orcus::sax_token_parser<orcus::xml_stream_handler>::parse() (sax_token_parser.hpp:215) +==356879== by 0x11B79436: orcus::xml_stream_parser::parse() (xml_stream_parser.cpp:68) +==356879== by 0x11BE3855: orcus::orcus_xlsx::detect(unsigned char const*, unsigned long) (orcus_xlsx.cpp:188) +==356879== by 0x11AB2492: orcus::detect(unsigned char const*, unsigned long) (format_detection.cpp:60) +--- + src/parser/sax_parser_base.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/parser/sax_parser_base.cpp b/src/parser/sax_parser_base.cpp +index 46acb81d..1cee821e 100644 +--- a/src/parser/sax_parser_base.cpp ++++ b/src/parser/sax_parser_base.cpp +@@ -300,7 +300,7 @@ void parser_base::value_with_encoded_char(cell_buffer& buf, std::string_view& st + + bool parser_base::value(std::string_view& str, bool decode) + { +- char c = cur_char(); ++ char c = cur_char_checked(); + if (c != '"' && c != '\'') + throw malformed_xml_error("value must be quoted", offset()); + +-- +2.35.1 + diff --git a/external/liborcus/forcepoint-87.patch.1 b/external/liborcus/forcepoint-87.patch.1 new file mode 100644 index 000000000..c1a58dde5 --- /dev/null +++ b/external/liborcus/forcepoint-87.patch.1 @@ -0,0 +1,27 @@ +From e4f3741197a3af6d434850d388483b523138a214 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> +Date: Thu, 24 Mar 2022 21:31:14 +0000 +Subject: [PATCH] forcepoint#87 Assertion `mp_char <= mp_end' failed + +soffice.bin: ../../include/orcus/parser_base.hpp:65: bool orcus::parser_base::has_char() const: Assertion `mp_char <= mp_end' failed. +--- + src/parser/sax_parser_base.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/parser/sax_parser_base.cpp b/src/parser/sax_parser_base.cpp +index 46acb81d..cb7a9c04 100644 +--- a/src/parser/sax_parser_base.cpp ++++ b/src/parser/sax_parser_base.cpp +@@ -295,7 +295,8 @@ void parser_base::value_with_encoded_char(cell_buffer& buf, std::string_view& st + + // Skip the closing quote. + assert(!has_char() || cur_char() == quote_char); +- next(); ++ if (has_char()) ++ next(); + } + + bool parser_base::value(std::string_view& str, bool decode) +-- +2.35.1 + diff --git a/external/liborcus/forcepoint-88.patch.1 b/external/liborcus/forcepoint-88.patch.1 new file mode 100644 index 000000000..19d96f4d8 --- /dev/null +++ b/external/liborcus/forcepoint-88.patch.1 @@ -0,0 +1,42 @@ +From 8c9537fe46b85acde0a7a183cee9066919c6b619 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com> +Date: Fri, 25 Mar 2022 10:10:17 +0000 +Subject: [PATCH] forcepoint#88 assigned temp std::string return to string_view + +it's out of scope when used + +=ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffcaf91b111 at pc 0x000000486ec4 bp 0x7ffcaf91aed0 sp 0x7ffcaf91a680 +READ of size 2 at 0x7ffcaf91b111 thread T0 + #0 0x486ec3 in __interceptor_memcpy.part.0 (instdir/program/soffice.bin+0x486ec3) + #1 0x7fa6c4471b77 in std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, long) (/lib64/libstdc++.so.6+0x143b77) + #2 0x7fa6c4463ae3 in std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, long) (/lib64/libstdc++.so.6+0x135ae3) + #3 0x7fa6b4027a26 in std::basic_ostream<char, std::char_traits<char> >& std::operator<<<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string_view<char, std::char_traits<char> >) /usr/bin/../lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/string_view:669:14 + #4 0x7fa6b426792b in orcus::xml_element_printer::print_namespace(std::ostream&, char const*) const workdir/UnpackedTarball/liborcus/src/liborcus/xml_util.cpp:35:12 + #5 0x7fa6b4267c68 in orcus::xml_element_printer::print_element(std::ostream&, char const*, unsigned long) const workdir/UnpackedTarball/liborcus/src/liborcus/xml_util.cpp:46:5 + #6 0x7fa6b41c1956 in orcus::xml_context_base::print_element(std::ostream&, std::pair<char const*, unsigned long> const&) const workdir/UnpackedTarball/liborcus/src/liborcus/xml_context_base.cpp:280:20 +--- + src/liborcus/xml_util.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/liborcus/xml_util.cpp b/src/liborcus/xml_util.cpp +index 906d321d..ff270d4a 100644 +--- a/src/liborcus/xml_util.cpp ++++ b/src/liborcus/xml_util.cpp +@@ -29,10 +29,10 @@ void xml_element_printer::print_namespace(std::ostream& os, xmlns_id_t ns) const + if (mp_ns_cxt) + { + std::string_view alias = mp_ns_cxt->get_alias(ns); +- if (alias.empty()) +- alias = mp_ns_cxt->get_short_name(ns); +- +- os << alias; ++ if (!alias.empty()) ++ os << alias; ++ else ++ os << mp_ns_cxt->get_short_name(ns); + } + else + os << ns; +-- +2.35.1 + diff --git a/external/liborcus/forcepoint-95.patch.1 b/external/liborcus/forcepoint-95.patch.1 new file mode 100644 index 000000000..93dc82229 --- /dev/null +++ b/external/liborcus/forcepoint-95.patch.1 @@ -0,0 +1,11 @@ +--- a/include/orcus/sax_parser.hpp 2022-03-30 10:54:44.043568760 +0100 ++++ b/include/orcus/sax_parser.hpp 2022-03-30 10:54:55.645037322 +0100 +@@ -547,7 +547,7 @@ + + skip_space_and_control(); + +- char c = cur_char(); ++ char c = cur_char_checked(); + if (c != '=') + { + std::ostringstream os; diff --git a/external/liborcus/gcc9.patch.0 b/external/liborcus/gcc9.patch.0 new file mode 100644 index 000000000..f89b1dddc --- /dev/null +++ b/external/liborcus/gcc9.patch.0 @@ -0,0 +1,28 @@ +--- include/orcus/types.hpp ++++ include/orcus/types.hpp +@@ -7,6 +7,14 @@ + + #ifndef INCLUDED_ORCUS_TYPES_HPP + #define INCLUDED_ORCUS_TYPES_HPP ++ ++#ifdef __GNUC__ ++#pragma GCC diagnostic push ++#pragma GCC diagnostic ignored "-Wpragmas" // for old GCC ++#pragma GCC diagnostic ignored "-Wunknown-warning-option" // for Clang ++#pragma GCC diagnostic ignored "-Wdeprecated-copy" ++#pragma GCC diagnostic ignored "-Wshadow" ++#endif + + #include <cstdlib> + #include <vector> +@@ -145,6 +152,10 @@ + typedef ::std::vector<xml_token_attr_t> xml_attrs_t; + + } ++ ++#ifdef __GNUC__ ++#pragma GCC diagnostic pop ++#endif + + #endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/external/liborcus/inc/pch/precompiled_orcus-parser.cxx b/external/liborcus/inc/pch/precompiled_orcus-parser.cxx new file mode 100644 index 000000000..b93db182c --- /dev/null +++ b/external/liborcus/inc/pch/precompiled_orcus-parser.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "precompiled_orcus-parser.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/external/liborcus/inc/pch/precompiled_orcus-parser.hxx b/external/liborcus/inc/pch/precompiled_orcus-parser.hxx new file mode 100644 index 000000000..a8047d5c9 --- /dev/null +++ b/external/liborcus/inc/pch/precompiled_orcus-parser.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + This file has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2020-09-21 15:21:18 using: + ./bin/update_pch external/liborcus orcus-parser --cutoff=1 --exclude:system --include:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./external/liborcus/inc/pch/precompiled_orcus-parser.hxx "make external/liborcus.build" --find-conflicts +*/ + +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <cassert> +#include <cctype> +#include <cmath> +#include <codecvt> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <deque> +#include <fstream> +#include <iostream> +#include <limits> +#include <locale> +#include <memory> +#include <sstream> +#include <tuple> +#include <unordered_map> +#include <unordered_set> +#include <vector> +#include <zconf.h> +#include <zlib.h> +#include <boost/archive/iterators/base64_from_binary.hpp> +#include <boost/archive/iterators/binary_from_base64.hpp> +#include <boost/archive/iterators/transform_width.hpp> +#include <boost/filesystem.hpp> +#include <boost/interprocess/file_mapping.hpp> +#include <boost/interprocess/mapped_region.hpp> +#include <boost/pool/object_pool.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <mdds/global.hpp> +#include <mdds/sorted_string_map.hpp> +#include <orcus/base64.hpp> +#include <orcus/cell_buffer.hpp> +#include <orcus/css_parser_base.hpp> +#include <orcus/css_types.hpp> +#include <orcus/csv_parser_base.hpp> +#include <orcus/detail/parser_token_buffer.hpp> +#include <orcus/exception.hpp> +#include <orcus/global.hpp> +#include <orcus/json_global.hpp> +#include <orcus/json_parser.hpp> +#include <orcus/json_parser_base.hpp> +#include <orcus/json_parser_thread.hpp> +#include <orcus/parser_base.hpp> +#include <orcus/parser_global.hpp> +#include <orcus/sax_parser_base.hpp> +#include <orcus/sax_token_parser.hpp> +#include <orcus/sax_token_parser_thread.hpp> +#include <orcus/stream.hpp> +#include <orcus/string_pool.hpp> +#include <orcus/tokens.hpp> +#include <orcus/types.hpp> +#include <orcus/xml_namespace.hpp> +#include <orcus/xml_writer.hpp> +#include <orcus/yaml_parser_base.hpp> +#include <orcus/zip_archive.hpp> +#include <orcus/zip_archive_stream.hpp> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/external/liborcus/inc/pch/precompiled_orcus.cxx b/external/liborcus/inc/pch/precompiled_orcus.cxx new file mode 100644 index 000000000..03b0cdf02 --- /dev/null +++ b/external/liborcus/inc/pch/precompiled_orcus.cxx @@ -0,0 +1,12 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "precompiled_orcus.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/external/liborcus/inc/pch/precompiled_orcus.hxx b/external/liborcus/inc/pch/precompiled_orcus.hxx new file mode 100644 index 000000000..9543b44eb --- /dev/null +++ b/external/liborcus/inc/pch/precompiled_orcus.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +/* + This file has been autogenerated by update_pch.sh. It is possible to edit it + manually (such as when an include file has been moved/renamed/removed). All such + manual changes will be rewritten by the next run of update_pch.sh (which presumably + also fixes all possible problems, so it's usually better to use it). + + Generated on 2020-09-21 15:21:19 using: + ./bin/update_pch external/liborcus orcus --cutoff=1 --exclude:system --include:module --include:local + + If after updating build fails, use the following command to locate conflicting headers: + ./bin/update_pch_bisect ./external/liborcus/inc/pch/precompiled_orcus.hxx "make external/liborcus.build" --find-conflicts +*/ + +#if PCH_LEVEL >= 1 +#include <algorithm> +#include <cassert> +#include <codecvt> +#include <cstdio> +#include <cstdlib> +#include <cstring> +#include <deque> +#include <fstream> +#include <functional> +#include <iostream> +#include <iterator> +#include <limits> +#include <locale> +#include <map> +#include <memory> +#include <ostream> +#include <sstream> +#include <string> +#include <unordered_map> +#include <unordered_set> +#include <vector> +#include <boost/current_function.hpp> +#include <boost/filesystem.hpp> +#include <boost/iostreams/filter/gzip.hpp> +#include <boost/iostreams/filtering_stream.hpp> +#include <boost/optional.hpp> +#include <boost/pool/object_pool.hpp> +#endif // PCH_LEVEL >= 1 +#if PCH_LEVEL >= 2 +#endif // PCH_LEVEL >= 2 +#if PCH_LEVEL >= 3 +#include <mdds/global.hpp> +#include <mdds/sorted_string_map.hpp> +#include <orcus/config.hpp> +#include <orcus/css_document_tree.hpp> +#include <orcus/css_parser.hpp> +#include <orcus/css_selector.hpp> +#include <orcus/csv_parser.hpp> +#include <orcus/dom_tree.hpp> +#include <orcus/exception.hpp> +#include <orcus/format_detection.hpp> +#include <orcus/global.hpp> +#include <orcus/info.hpp> +#include <orcus/interface.hpp> +#include <orcus/json_document_tree.hpp> +#include <orcus/json_global.hpp> +#include <orcus/json_parser.hpp> +#include <orcus/json_structure_tree.hpp> +#include <orcus/measurement.hpp> +#include <orcus/orcus_csv.hpp> +#include <orcus/orcus_gnumeric.hpp> +#include <orcus/orcus_import_ods.hpp> +#include <orcus/orcus_import_xlsx.hpp> +#include <orcus/orcus_json.hpp> +#include <orcus/orcus_ods.hpp> +#include <orcus/orcus_xls_xml.hpp> +#include <orcus/orcus_xlsx.hpp> +#include <orcus/orcus_xml.hpp> +#include <orcus/parser_base.hpp> +#include <orcus/parser_global.hpp> +#include <orcus/sax_ns_parser.hpp> +#include <orcus/sax_parser.hpp> +#include <orcus/sax_parser_base.hpp> +#include <orcus/sax_token_parser.hpp> +#include <orcus/spreadsheet/export_interface.hpp> +#include <orcus/spreadsheet/import_interface.hpp> +#include <orcus/spreadsheet/import_interface_pivot.hpp> +#include <orcus/spreadsheet/import_interface_view.hpp> +#include <orcus/spreadsheet/styles.hpp> +#include <orcus/spreadsheet/types.hpp> +#include <orcus/stream.hpp> +#include <orcus/string_pool.hpp> +#include <orcus/threaded_sax_token_parser.hpp> +#include <orcus/tokens.hpp> +#include <orcus/xml_namespace.hpp> +#include <orcus/xml_structure_tree.hpp> +#include <orcus/xml_writer.hpp> +#include <orcus/yaml_document_tree.hpp> +#include <orcus/yaml_parser.hpp> +#include <orcus/zip_archive.hpp> +#include <orcus/zip_archive_stream.hpp> +#endif // PCH_LEVEL >= 3 +#if PCH_LEVEL >= 4 +#endif // PCH_LEVEL >= 4 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/external/liborcus/include.patch.0 b/external/liborcus/include.patch.0 new file mode 100644 index 000000000..1131d04d3 --- /dev/null +++ b/external/liborcus/include.patch.0 @@ -0,0 +1,20 @@ +--- include/orcus/base64.hpp ++++ include/orcus/base64.hpp +@@ -9,6 +9,7 @@ + #define __ORCUS_BASE64_HPP__ + + #include "env.hpp" ++#include <stdint.h> + #include <vector> + #include <string> + +--- include/orcus/types.hpp ++++ include/orcus/types.hpp +@@ -16,6 +16,7 @@ + #pragma GCC diagnostic ignored "-Wshadow" + #endif + ++#include <stdint.h> + #include <cstdlib> + #include <vector> + #include <string> diff --git a/external/liborcus/liborcus_newline.patch.1 b/external/liborcus/liborcus_newline.patch.1 new file mode 100644 index 000000000..5b2038d5c --- /dev/null +++ b/external/liborcus/liborcus_newline.patch.1 @@ -0,0 +1,17 @@ +Add newline at end of KRHangulMapping.h + +without this, compiling output of GCC 11 -E -fdirectives-only fails with: + +ooxml_tokens.inl:3524:32: error: stray '#' in program + +https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100392 + +--- liborcus/src/liborcus/ooxml_tokens.inl.orig 2021-05-01 18:12:37.490131155 +0200 ++++ liborcus/src/liborcus/ooxml_tokens.inl 2021-05-01 18:12:50.994119453 +0200 +@@ -3521,4 +3521,4 @@ + "zoomToFit" // 3517 + }; + +-size_t token_name_count = 3518; +\ No newline at end of file ++size_t token_name_count = 3518; diff --git a/external/liborcus/libtool.patch.0 b/external/liborcus/libtool.patch.0 new file mode 100644 index 000000000..663dbd809 --- /dev/null +++ b/external/liborcus/libtool.patch.0 @@ -0,0 +1,11 @@ +--- ltmain.sh.orig 2020-09-09 21:20:23.069433984 -0400 ++++ ltmain.sh 2020-09-09 21:27:13.168073996 -0400 +@@ -7373,7 +7373,7 @@ + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ +- -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) ++ -specs=*|-fsanitize=*|-fuse-ld=*|--ld-path=*|-static-*|-fcilkplus) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" diff --git a/external/liborcus/overrun.patch.0 b/external/liborcus/overrun.patch.0 new file mode 100644 index 000000000..de2097e32 --- /dev/null +++ b/external/liborcus/overrun.patch.0 @@ -0,0 +1,63 @@ +--- src/parser/sax_token_parser.cpp ++++ src/parser/sax_token_parser.cpp +@@ -10,6 +10,7 @@ + + #include <mdds/sorted_string_map.hpp> + #include <cctype> ++#include <limits> + + namespace orcus { + +@@ -329,6 +330,28 @@ + m_elem.raw_name = elem.name; + } + ++static uint8_t readUint8(char const * begin, char const * end, char const ** endptr) { ++ unsigned n = 0; ++ char const * p = begin; ++ for (; p != end; ++p) { ++ char const c = *p; ++ if (c < '0' || c > '9') { ++ break; ++ } ++ n = 10 * n + (c - '0'); ++ if (n > std::numeric_limits<uint8_t>::max()) { ++ *endptr = nullptr; ++ return 0; ++ } ++ } ++ if (p == begin) { ++ *endptr = nullptr; ++ return 0; ++ } ++ *endptr = p; ++ return n; ++} ++ + void sax_token_handler_wrapper_base::attribute(std::string_view name, std::string_view val) + { + decl_attr_type dat = decl_attr::get().find(name.data(), name.size()); +@@ -340,18 +362,18 @@ + const char* p = val.data(); + const char* p_end = p + val.size(); + +- char* endptr = nullptr; +- long v = std::strtol(p, &endptr, 10); ++ const char* endptr = nullptr; ++ uint8_t v = readUint8(p, p_end, &endptr); + +- if (!endptr || endptr >= p_end || *endptr != '.') ++ if (!endptr || endptr == p_end || *endptr != '.') + break; + + m_declaration.version_major = v; + p = endptr + 1; + +- v = std::strtol(p, &endptr, 10); ++ v = readUint8(p, p_end, &endptr); + +- if (!endptr || endptr > p_end) ++ if (!endptr) + break; + + m_declaration.version_minor = v; diff --git a/external/liborcus/rpath.patch.0 b/external/liborcus/rpath.patch.0 new file mode 100644 index 000000000..e7a33e693 --- /dev/null +++ b/external/liborcus/rpath.patch.0 @@ -0,0 +1,10 @@ +--- configure ++++ configure +@@ -14007,6 +14007,7 @@ + esac + ;; + esac ++hardcode_libdir_flag_spec_CXX= + ;; + + lynxos*) diff --git a/external/liborcus/std-get-busted.patch.1 b/external/liborcus/std-get-busted.patch.1 new file mode 100644 index 000000000..40b839f65 --- /dev/null +++ b/external/liborcus/std-get-busted.patch.1 @@ -0,0 +1,418 @@ +From f917ed284c52ae12fb0d752c17141f355158470e Mon Sep 17 00:00:00 2001 +From: Kohei Yoshida <kohei.yoshida@gmail.com> +Date: Tue, 2 Nov 2021 22:07:51 -0400 +Subject: [PATCH] std::get<T>(...) may be flaky with some version of clang. + +As workaround, use boost::variant and boost::get. + +c.f. https://stackoverflow.com/questions/52521388/stdvariantget-does-not-compile-with-apple-llvm-10-0 +--- + include/orcus/config.hpp | 4 ++-- + include/orcus/css_selector.hpp | 5 +++-- + include/orcus/json_parser_thread.hpp | 4 ++-- + include/orcus/sax_token_parser_thread.hpp | 5 +++-- + include/orcus/spreadsheet/pivot.hpp | 7 ++++--- + include/orcus/threaded_json_parser.hpp | 8 ++++---- + include/orcus/threaded_sax_token_parser.hpp | 8 ++++---- + src/liborcus/css_document_tree.cpp | 2 +- + src/liborcus/css_selector.cpp | 12 ++++++------ + src/liborcus/orcus_csv.cpp | 4 ++-- + src/orcus_csv_main.cpp | 2 +- + src/orcus_test_csv.cpp | 8 ++++---- + src/orcus_test_xlsx.cpp | 4 ++-- + src/parser/json_parser_thread.cpp | 8 ++++---- + src/python/sheet_rows.cpp | 3 +++ + 15 files changed, 45 insertions(+), 39 deletions(-) + +diff --git a/include/orcus/config.hpp b/include/orcus/config.hpp +index 17743e6a..fe9a7d81 100644 +--- a/include/orcus/config.hpp ++++ b/include/orcus/config.hpp +@@ -12,7 +12,7 @@ + #include "orcus/types.hpp" + + #include <string> +-#include <variant> ++#include <boost/variant.hpp> + + namespace orcus { + +@@ -37,7 +37,7 @@ struct ORCUS_DLLPUBLIC config + }; + + // TODO: add config for other formats as needed. +- using data_type = std::variant<csv_config>; ++ using data_type = boost::variant<csv_config>; + + /** + * Enable or disable runtime debug output to stdout or stderr. +diff --git a/include/orcus/css_selector.hpp b/include/orcus/css_selector.hpp +index 1e41d544..dafeddf5 100644 +--- a/include/orcus/css_selector.hpp ++++ b/include/orcus/css_selector.hpp +@@ -12,11 +12,12 @@ + #include "css_types.hpp" + + #include <ostream> +-#include <variant> + #include <vector> + #include <unordered_set> + #include <unordered_map> + ++#include <boost/variant.hpp> ++ + namespace orcus { + + struct ORCUS_DLLPUBLIC css_simple_selector_t +@@ -73,7 +74,7 @@ struct ORCUS_DLLPUBLIC css_selector_t + */ + struct ORCUS_DLLPUBLIC css_property_value_t + { +- using value_type = std::variant<std::string_view, css::rgba_color_t, css::hsla_color_t>; ++ using value_type = boost::variant<std::string_view, css::rgba_color_t, css::hsla_color_t>; + + css::property_value_t type; + value_type value; +diff --git a/include/orcus/json_parser_thread.hpp b/include/orcus/json_parser_thread.hpp +index 8328ef11..565008da 100644 +--- a/include/orcus/json_parser_thread.hpp ++++ b/include/orcus/json_parser_thread.hpp +@@ -14,7 +14,7 @@ + #include <memory> + #include <vector> + #include <ostream> +-#include <variant> ++#include <boost/variant.hpp> + + namespace orcus { + +@@ -47,7 +47,7 @@ enum class parse_token_t + + struct ORCUS_PSR_DLLPUBLIC parse_token + { +- using value_type = std::variant<std::string_view, parse_error_value_t, double>; ++ using value_type = boost::variant<std::string_view, parse_error_value_t, double>; + + parse_token_t type; + value_type value; +diff --git a/include/orcus/sax_token_parser_thread.hpp b/include/orcus/sax_token_parser_thread.hpp +index b3645735..e0842013 100644 +--- a/include/orcus/sax_token_parser_thread.hpp ++++ b/include/orcus/sax_token_parser_thread.hpp +@@ -12,10 +12,11 @@ + #include "types.hpp" + + #include <memory> +-#include <variant> + #include <vector> + #include <ostream> + ++#include <boost/variant.hpp> ++ + namespace orcus { + + class tokens; +@@ -36,7 +37,7 @@ enum class parse_token_t + + struct ORCUS_PSR_DLLPUBLIC parse_token + { +- using value_type = std::variant<std::string_view, parse_error_value_t, const xml_token_element_t*>; ++ using value_type = boost::variant<std::string_view, parse_error_value_t, const xml_token_element_t*>; + + parse_token_t type; + value_type value; +diff --git a/include/orcus/spreadsheet/pivot.hpp b/include/orcus/spreadsheet/pivot.hpp +index dee25596..fa091160 100644 +--- a/include/orcus/spreadsheet/pivot.hpp ++++ b/include/orcus/spreadsheet/pivot.hpp +@@ -15,9 +15,10 @@ + #include <memory> + #include <vector> + #include <limits> +-#include <variant> + #include <optional> + ++#include <boost/variant.hpp> ++ + namespace ixion { + + struct abs_range_t; +@@ -36,7 +37,7 @@ using pivot_cache_indices_t = std::vector<size_t>; + + struct ORCUS_SPM_DLLPUBLIC pivot_cache_record_value_t + { +- using value_type = std::variant<bool, double, std::size_t, std::string_view, date_time_t>; ++ using value_type = boost::variant<bool, double, std::size_t, std::string_view, date_time_t>; + + enum class record_type + { +@@ -66,7 +67,7 @@ using pivot_cache_record_t = std::vector<pivot_cache_record_value_t>; + + struct ORCUS_SPM_DLLPUBLIC pivot_cache_item_t + { +- using value_type = std::variant<bool, double, std::string_view, date_time_t, error_value_t>; ++ using value_type = boost::variant<bool, double, std::string_view, date_time_t, error_value_t>; + + enum class item_type + { +diff --git a/include/orcus/threaded_json_parser.hpp b/include/orcus/threaded_json_parser.hpp +index 51cdaced..3bf6e591 100644 +--- a/include/orcus/threaded_json_parser.hpp ++++ b/include/orcus/threaded_json_parser.hpp +@@ -151,23 +151,23 @@ void threaded_json_parser<_Handler>::process_tokens(json::parse_tokens_t& tokens + m_handler.null(); + break; + case json::parse_token_t::number: +- m_handler.number(std::get<double>(t.value)); ++ m_handler.number(boost::get<double>(t.value)); + break; + case json::parse_token_t::object_key: + { +- auto s = std::get<std::string_view>(t.value); ++ auto s = boost::get<std::string_view>(t.value); + m_handler.object_key(s.data(), s.size(), false); + break; + } + case json::parse_token_t::string: + { +- auto s = std::get<std::string_view>(t.value); ++ auto s = boost::get<std::string_view>(t.value); + m_handler.string(s.data(), s.size(), false); + break; + } + case json::parse_token_t::parse_error: + { +- auto v = std::get<parse_error_value_t>(t.value); ++ auto v = boost::get<parse_error_value_t>(t.value); + throw json::parse_error(std::string{v.str}, v.offset); + } + case json::parse_token_t::unknown: +diff --git a/include/orcus/threaded_sax_token_parser.hpp b/include/orcus/threaded_sax_token_parser.hpp +index 59ea967a..1b389be2 100644 +--- a/include/orcus/threaded_sax_token_parser.hpp ++++ b/include/orcus/threaded_sax_token_parser.hpp +@@ -131,25 +131,25 @@ void threaded_sax_token_parser<_Handler>::process_tokens(const sax::parse_tokens + { + case sax::parse_token_t::start_element: + { +- const auto* elem = std::get<const xml_token_element_t*>(t.value); ++ const auto* elem = boost::get<const xml_token_element_t*>(t.value); + m_handler.start_element(*elem); + break; + } + case sax::parse_token_t::end_element: + { +- const auto* elem = std::get<const xml_token_element_t*>(t.value); ++ const auto* elem = boost::get<const xml_token_element_t*>(t.value); + m_handler.end_element(*elem); + break; + } + case sax::parse_token_t::characters: + { +- auto s = std::get<std::string_view>(t.value); ++ auto s = boost::get<std::string_view>(t.value); + m_handler.characters(s, false); + break; + } + case sax::parse_token_t::parse_error: + { +- auto v = std::get<parse_error_value_t>(t.value); ++ auto v = boost::get<parse_error_value_t>(t.value); + throw sax::malformed_xml_error(std::string{v.str}, v.offset); + } + default: +diff --git a/src/liborcus/css_document_tree.cpp b/src/liborcus/css_document_tree.cpp +index 46bf7e91..4b44edff 100644 +--- a/src/liborcus/css_document_tree.cpp ++++ b/src/liborcus/css_document_tree.cpp +@@ -317,7 +317,7 @@ public: + { + // String value needs interning. + css_property_value_t interned = v; +- auto s = std::get<std::string_view>(v.value); ++ auto s = boost::get<std::string_view>(v.value); + interned.value = m_sp.intern(s).first; + m_dest.push_back(interned); + break; +diff --git a/src/liborcus/css_selector.cpp b/src/liborcus/css_selector.cpp +index b7b63f37..de522062 100644 +--- a/src/liborcus/css_selector.cpp ++++ b/src/liborcus/css_selector.cpp +@@ -155,7 +155,7 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + { + case css::property_value_t::hsl: + { +- auto c = std::get<css::hsla_color_t>(v.value); ++ auto c = boost::get<css::hsla_color_t>(v.value); + os << "hsl(" + << (int)c.hue << sep + << (int)c.saturation << sep +@@ -165,7 +165,7 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + } + case css::property_value_t::hsla: + { +- auto c = std::get<css::hsla_color_t>(v.value); ++ auto c = boost::get<css::hsla_color_t>(v.value); + os << "hsla(" + << (int)c.hue << sep + << (int)c.saturation << sep +@@ -176,7 +176,7 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + } + case css::property_value_t::rgb: + { +- auto c = std::get<css::rgba_color_t>(v.value); ++ auto c = boost::get<css::rgba_color_t>(v.value); + os << "rgb(" + << (int)c.red << sep + << (int)c.green << sep +@@ -186,7 +186,7 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + } + case css::property_value_t::rgba: + { +- auto c = std::get<css::rgba_color_t>(v.value); ++ auto c = boost::get<css::rgba_color_t>(v.value); + os << "rgba(" + << (int)c.red << sep + << (int)c.green << sep +@@ -196,10 +196,10 @@ std::ostream& operator<< (std::ostream& os, const css_property_value_t& v) + break; + } + case css::property_value_t::string: +- os << std::get<std::string_view>(v.value); ++ os << boost::get<std::string_view>(v.value); + break; + case css::property_value_t::url: +- os << "url(" << std::get<std::string_view>(v.value) << ")"; ++ os << "url(" << boost::get<std::string_view>(v.value) << ")"; + break; + case css::property_value_t::none: + default: +diff --git a/src/liborcus/orcus_csv.cpp b/src/liborcus/orcus_csv.cpp +index 5c71bcf5..637308ab 100644 +--- a/src/liborcus/orcus_csv.cpp ++++ b/src/liborcus/orcus_csv.cpp +@@ -63,7 +63,7 @@ public: + // 0. + if (m_row >= mp_sheet->get_sheet_size().rows) + { +- auto csv = std::get<config::csv_config>(m_app_config.data); ++ auto csv = boost::get<config::csv_config>(m_app_config.data); + + if (!csv.split_to_multiple_sheets) + throw max_row_size_reached(); +@@ -93,7 +93,7 @@ public: + + void cell(const char* p, size_t n, bool transient) + { +- auto csv = std::get<config::csv_config>(m_app_config.data); ++ auto csv = boost::get<config::csv_config>(m_app_config.data); + + if (m_sheet == 0 && size_t(m_row) < csv.header_row_size) + { +diff --git a/src/orcus_csv_main.cpp b/src/orcus_csv_main.cpp +index 4f6d7173..446f2684 100644 +--- a/src/orcus_csv_main.cpp ++++ b/src/orcus_csv_main.cpp +@@ -45,7 +45,7 @@ public: + + virtual void map_to_config(config& opt, const po::variables_map& vm) override + { +- auto csv = std::get<config::csv_config>(opt.data); ++ auto csv = boost::get<config::csv_config>(opt.data); + + if (vm.count("row-header")) + csv.header_row_size = vm["row-header"].as<size_t>(); +diff --git a/src/orcus_test_csv.cpp b/src/orcus_test_csv.cpp +index 310ace9d..0b9ba994 100644 +--- a/src/orcus_test_csv.cpp ++++ b/src/orcus_test_csv.cpp +@@ -95,8 +95,8 @@ void test_csv_import_split_sheet() + std::cout << "checking " << path << "..." << std::endl; + + config conf(format_t::csv); +- std::get<config::csv_config>(conf.data).header_row_size = 0; +- std::get<config::csv_config>(conf.data).split_to_multiple_sheets = true; ++ boost::get<config::csv_config>(conf.data).header_row_size = 0; ++ boost::get<config::csv_config>(conf.data).split_to_multiple_sheets = true; + + // Set the row size to 11 to make sure the split occurs. + spreadsheet::range_size_t ss{11, 4}; +@@ -126,7 +126,7 @@ void test_csv_import_split_sheet() + path = dir; + path.append("input.csv"); + doc.clear(); +- std::get<config::csv_config>(conf.data).header_row_size = 1; ++ boost::get<config::csv_config>(conf.data).header_row_size = 1; + { + spreadsheet::import_factory factory(doc); + orcus_csv app(&factory); +@@ -149,7 +149,7 @@ void test_csv_import_split_sheet() + + // Re-import it again, but this time disable the splitting. The data should + // get trucated on the first sheet. +- std::get<config::csv_config>(conf.data).split_to_multiple_sheets = false; ++ boost::get<config::csv_config>(conf.data).split_to_multiple_sheets = false; + + path = dir; + path.append("input.csv"); +diff --git a/src/orcus_test_xlsx.cpp b/src/orcus_test_xlsx.cpp +index 807c61e4..632fb1e7 100644 +--- a/src/orcus_test_xlsx.cpp ++++ b/src/orcus_test_xlsx.cpp +@@ -1154,8 +1154,8 @@ void test_xlsx_pivot_group_by_numbers() + for (const pivot_cache_item_t& item : fld->items) + { + assert(item.type == pivot_cache_item_t::item_type::numeric); +- assert(*fld->min_value <= std::get<double>(item.value)); +- assert(std::get<double>(item.value) <= *fld->max_value); ++ assert(*fld->min_value <= boost::get<double>(item.value)); ++ assert(boost::get<double>(item.value) <= *fld->max_value); + } + + // This field is also gruop field with 7 numeric intervals of width 2. +diff --git a/src/parser/json_parser_thread.cpp b/src/parser/json_parser_thread.cpp +index 36bbe6e6..65fb6255 100644 +--- a/src/parser/json_parser_thread.cpp ++++ b/src/parser/json_parser_thread.cpp +@@ -237,19 +237,19 @@ std::ostream& operator<< (std::ostream& os, const parse_tokens_t& tokens) + os << "- null" << endl; + break; + case parse_token_t::number: +- os << "- number (v=" << std::get<double>(t.value) << ")" << endl; ++ os << "- number (v=" << boost::get<double>(t.value) << ")" << endl; + break; + case parse_token_t::object_key: +- os << "- object_key (v=" << std::get<std::string_view>(t.value) << ")" << endl; ++ os << "- object_key (v=" << boost::get<std::string_view>(t.value) << ")" << endl; + break; + case parse_token_t::parse_error: + { +- auto v = std::get<parse_error_value_t>(t.value); ++ auto v = boost::get<parse_error_value_t>(t.value); + os << "- parse_error (v=" << v.str << ", offset=" << v.offset << ")" << endl; + break; + } + case parse_token_t::string: +- os << "- string (" << std::get<std::string_view>(t.value) << ")" << endl; ++ os << "- string (" << boost::get<std::string_view>(t.value) << ")" << endl; + break; + case parse_token_t::unknown: + os << "- unknown" << endl; +diff --git a/src/python/sheet_rows.cpp b/src/python/sheet_rows.cpp +index be495894..0d21ba71 100644 +--- a/src/python/sheet_rows.cpp ++++ b/src/python/sheet_rows.cpp +@@ -135,7 +135,10 @@ PyObject* sheet_rows_iternext(PyObject* self) + break; + } + case ixion::celltype_t::unknown: ++ { ++ PyErr_SetString(PyExc_RuntimeError, "Unknown cell type."); + break; ++ } + } + + if (!obj) +-- +2.25.1 + diff --git a/external/liborcus/win_path_utf16.patch b/external/liborcus/win_path_utf16.patch new file mode 100644 index 000000000..0a6781e72 --- /dev/null +++ b/external/liborcus/win_path_utf16.patch @@ -0,0 +1,33 @@ +diff --git a/src/parser/stream.cpp b/src/parser/stream.cpp +index 00395f59ff25..8f385fb8965a 100644 +--- a/src/parser/stream.cpp ++++ b/src/parser/stream.cpp +@@ -147,6 +147,14 @@ std::tuple<std::string_view, size_t, size_t> find_line_with_offset(std::string_v + return std::make_tuple(line, line_num, offset_on_line); + } + ++#ifdef _WIN32 ++std::wstring to_wstring(std::string_view s) ++{ ++ std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> conversion; ++ return conversion.from_bytes(s.data(), s.data() + s.size()); ++} ++#endif ++ + } // anonymous namespace + + struct file_content::impl +@@ -162,8 +170,13 @@ struct file_content::impl + impl() : content_size(0), content(nullptr) {} + + impl(std::string_view filepath) : ++#ifdef _WIN32 ++ content_size(fs::file_size(to_wstring(filepath))), ++ mapped_file(to_wstring(filepath).c_str(), bip::read_only), ++#else + content_size(fs::file_size(std::string{filepath}.c_str())), + mapped_file(std::string{filepath}.c_str(), bip::read_only), ++#endif + mapped_region(mapped_file, bip::read_only, 0, content_size), + content(nullptr) + { diff --git a/external/liborcus/windows-constants-hack.patch b/external/liborcus/windows-constants-hack.patch new file mode 100644 index 000000000..e86c74a72 --- /dev/null +++ b/external/liborcus/windows-constants-hack.patch @@ -0,0 +1,15 @@ +diff --git a/src/liborcus/info.cpp b/src/liborcus/info.cpp +index ae571f5..539ce18 100644 +--- a/src/liborcus/info.cpp ++++ b/src/liborcus/info.cpp +@@ -7,7 +7,9 @@ + + #include "orcus/info.hpp" + +-#include "constants.inl" ++#define ORCUS_MAJOR_VERSION 0 ++#define ORCUS_MINOR_VERSION 17 ++#define ORCUS_MICRO_VERSION 2 + + namespace orcus { + |