download.lst | 8 external/boost/include/boost/convert.hpp | 28 external/boost/include/boost/convert/stream.hpp | 28 external/poppler/0001-Revert-Remove-gdir-we-have-std-filesystem.patch.1 | 503 ++++++++++ external/poppler/StaticLibrary_poppler.mk | 3 external/poppler/UnpackedTarball_poppler.mk | 11 external/poppler/char_traits.patch | 11 external/poppler/clang-std-ranges.patch.1 | 439 ++++++++ external/poppler/disable-freetype.patch.1 | 11 external/poppler/disable-nss-and-gpgmepp.patch.1 | 76 - external/poppler/gcc7-EntityInfo.patch.1 | 8 external/poppler/gcc7-GfxFont.patch.1 | 8 external/poppler/inc/pch/precompiled_poppler.hxx | 10 external/poppler/pch.patch.0 | 11 external/poppler/poppler-config.patch.1 | 28 external/poppler/requires.patch.1 | 10 external/poppler/std_charconv.patch.1 | 30 external/poppler/std_numbers.patch.1 | 30 external/poppler/std_optional.patch.1 | 13 external/poppler/std_span.patch.1 | 111 ++ external/poppler/std_string.patch.1 | 110 ++ include/o3tl/span.hxx | 8 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 14 sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx | 17 24 files changed, 1380 insertions(+), 146 deletions(-)
New commits: commit 1ddaad9cdd26c457e95a1dda8b689a320916c3fe Author: Xisco Fauli <[email protected]> AuthorDate: Thu Aug 7 00:44:36 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:49 2026 +0100 poppler: upgrade to 25.08 Downloaded from https://poppler.freedesktop.org/poppler-25.08.0.tar.xz Change-Id: Ifdc52a9b6d1412d3fe70baa2e9fb367a476c05fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189028 Reviewed-by: Xisco Fauli <[email protected]> Tested-by: Jenkins (cherry picked from commit 3fe840e33667c12d615774cd0a3a5aaa97f7b547) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189209 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit cfa27267440e1b1da53752e7f73baaaade1c3a5f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194038 Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit b460d749de6759c69575f9011bc2db6b4f0ea355) diff --git a/download.lst b/download.lst index ab8826fadf45..c7845686988a 100644 --- a/download.lst +++ b/download.lst @@ -522,8 +522,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := c504a9066dbdfebe377ad53cec641fd971ee96c4e1e8ca74e6c9c03d46d817ae -POPPLER_TARBALL := poppler-25.07.0.tar.xz +POPPLER_SHA256SUM := 425ed4d4515a093bdcdbbaac6876f20617451edc710df6a4fd6c45dd67eb418d +POPPLER_TARBALL := poppler-25.08.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines commit 33bd9fd55bef12d3a583f93199a73cb7b51ff237 Author: Xisco Fauli <[email protected]> AuthorDate: Fri Jul 4 22:27:45 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:49 2026 +0100 poppler: upgrade to 25.07 Downloaded from https://poppler.freedesktop.org/poppler-25.07.0.tar.xz Change-Id: Ia38e14845351ba5300613fd4ecd055bea45150e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187429 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> (cherry picked from commit 406bcd8066cd94dfb2e39454fe32543eafd01428) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189176 Reviewed-by: Thorsten Behrens <[email protected]> Tested-by: Thorsten Behrens <[email protected]> (cherry picked from commit 9eee51102e6fd3bf2c7b4a9e8f848d58fe81c072) diff --git a/download.lst b/download.lst index 6b8c20ddb063..ab8826fadf45 100644 --- a/download.lst +++ b/download.lst @@ -522,8 +522,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := 8199532d38984fab46dbd0020ec9c40f20e928e33e9b4cc6043572603a821d83 -POPPLER_TARBALL := poppler-25.06.0.tar.xz +POPPLER_SHA256SUM := c504a9066dbdfebe377ad53cec641fd971ee96c4e1e8ca74e6c9c03d46d817ae +POPPLER_TARBALL := poppler-25.07.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines diff --git a/external/poppler/std_span.patch.1 b/external/poppler/std_span.patch.1 index 757243674da8..2e27b1812115 100644 --- a/external/poppler/std_span.patch.1 +++ b/external/poppler/std_span.patch.1 @@ -48,3 +48,64 @@ replace C++20 std::span with o3tl::span //------------------------------------------------------------------------ +--- poppler/fofi/FoFiBase.h.orig 2025-08-08 10:53:11.909805257 +0200 ++++ poppler/fofi/FoFiBase.h 2025-08-08 10:53:32.743052104 +0200 +@@ -30,7 +30,8 @@ + #include <cstddef> + #include <optional> + #include <vector> +-#include <span> ++#include <o3tl/span.hxx> ++namespace std { using o3tl::span; } + + //------------------------------------------------------------------------ + +--- poppler/fofi/FoFiType1C.cc.orig 2025-08-08 11:07:35.921045067 +0200 ++++ poppler/fofi/FoFiType1C.cc 2025-08-08 11:07:41.092126443 +0200 +@@ -1820,7 +1820,7 @@ + // some tools embed Type 1C fonts with an extra whitespace char at + // the beginning + if (!file.empty() && file[0] != '\x01') { +- file = file.subspan(1); ++ file = std::span(file.data() + 1, file.size() - 1); + } + + // find the indexes +--- poppler/poppler/PSOutputDev.cc.orig2 2025-08-08 11:14:15.458117801 +0200 ++++ poppler/poppler/PSOutputDev.cc 2025-08-08 11:14:35.087228506 +0200 +@@ -2360,7 +2360,7 @@ + // convert it to a Type 1 font + std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { +- if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(std::span(fontBuf.value()), faceIndex)) { ++ if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(std::span<unsigned char>(fontBuf.value()), faceIndex)) { + if (ffTT->isOpenTypeCFF()) { + ffTT->convertToType1(psName->c_str(), nullptr, true, outputFunc, outputStream); + } +@@ -2382,7 +2382,7 @@ + // convert it to a Type 42 font + std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { +- if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(std::span(fontBuf.value()), faceIndex)) { ++ if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(std::span<unsigned char>(fontBuf.value()), faceIndex)) { + std::vector<int> codeToGID = ((Gfx8BitFont *)font)->getCodeToGIDMap(ffTT.get()); + ffTT->convertToType42(psName->c_str(), ((Gfx8BitFont *)font)->getHasEncoding() ? ((Gfx8BitFont *)font)->getEncoding() : nullptr, codeToGID, outputFunc, outputStream); + if (!codeToGID.empty()) { +@@ -2516,7 +2516,7 @@ + // convert it to a Type 0 font + std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { +- if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(std::span(fontBuf.value()), faceIndex)) { ++ if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(std::span<unsigned char>(fontBuf.value()), faceIndex)) { + if (level >= psLevel3) { + // Level 3: use a CID font + ffTT->convertToCIDType2(psName->c_str(), ((GfxCIDFont *)font)->getCIDToGID(), needVerticalMetrics, outputFunc, outputStream); +@@ -2554,7 +2554,7 @@ + // convert it to a Type 0 font + std::optional<std::vector<unsigned char>> fontBuf = font->readEmbFontFile(xref); + if (fontBuf) { +- if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(std::span(fontBuf.value()), faceIndex)) { ++ if (std::unique_ptr<FoFiTrueType> ffTT = FoFiTrueType::make(std::span<unsigned char>(fontBuf.value()), faceIndex)) { + if (ffTT->isOpenTypeCFF()) { + if (level >= psLevel3) { + // Level 3: use a CID font diff --git a/external/poppler/std_string.patch.1 b/external/poppler/std_string.patch.1 index 3cf77b101f43..0570defa1919 100644 --- a/external/poppler/std_string.patch.1 +++ b/external/poppler/std_string.patch.1 @@ -3,8 +3,8 @@ remove C++20 starts_with --- poppler/goo/GooString.h.orig 2025-01-09 11:15:13.174300578 +0100 +++ poppler/goo/GooString.h 2025-01-09 11:17:39.568825610 +0100 @@ -237,11 +237,16 @@ + int cmp(const std::string &str) const { return compare(str); } int cmp(const char *sA) const { return compare(sA); } - int cmpN(const char *sA, int n) const { return compare(0, n, sA); } - // Return true if strings starts with prefix - using std::string::starts_with; commit c17934a65b902fbdd61dc8119f620f683fe7ca4a Author: Xisco Fauli <[email protected]> AuthorDate: Wed Jun 4 10:33:51 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:49 2026 +0100 poppler: uggrade to 25.06 Downloaded from https://poppler.freedesktop.org/poppler-25.06.0.tar.xz Change-Id: I2a24b6126d24255ac89c9e1e218b86d275f698f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186182 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> (cherry picked from commit 81fe441ce3533285ee1a4265c5c289a19d15fb13) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189207 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> (cherry picked from commit e739e07a45647057e50f7240a5a3bff82a7984ad) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194036 Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit a413e82dfc5331a7841b699fe7c18efa64e6d3d8) diff --git a/download.lst b/download.lst index 507faaa38b47..6b8c20ddb063 100644 --- a/download.lst +++ b/download.lst @@ -522,8 +522,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := 9b1627c5b76816ac5e4052a03f5b605ba40b45cf06b02cadd0479620b499ab38 -POPPLER_TARBALL := poppler-25.05.0.tar.xz +POPPLER_SHA256SUM := 8199532d38984fab46dbd0020ec9c40f20e928e33e9b4cc6043572603a821d83 +POPPLER_TARBALL := poppler-25.06.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines diff --git a/external/poppler/clang-std-ranges.patch.1 b/external/poppler/clang-std-ranges.patch.1 index 58f06466ef16..3552d6ddbacd 100644 --- a/external/poppler/clang-std-ranges.patch.1 +++ b/external/poppler/clang-std-ranges.patch.1 @@ -341,7 +341,7 @@ In file included from /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linu +++ poppler/poppler/Annot.cc 2025-01-09 17:40:14.021036519 +0100 @@ -7499,7 +7499,11 @@ - bool Annots::removeAnnot(Annot *annot) + bool Annots::removeAnnot(const std::shared_ptr<Annot> &annot) { +#if 0//ndef __clang__ auto idx = std::ranges::find(annots, annot); commit 57eb3a368c4b7d7c56374f721df1bee4f836c5d2 Author: Xisco Fauli <[email protected]> AuthorDate: Mon May 5 10:03:10 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:49 2026 +0100 poppler: uggrade to 25.05 Downloaded from https://poppler.freedesktop.org/poppler-25.05.0.tar.xz Change-Id: Icd2b318cc01bedc5baeb4445a463a136ed6d7c48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184953 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> (cherry picked from commit 0ee2636304ac049f21415c67e92040f7d6c14d35) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189174 Tested-by: Thorsten Behrens <[email protected]> Reviewed-by: Thorsten Behrens <[email protected]> (cherry picked from commit e3e2ee3b9bc136462f4c7ac582579b838fd525de) diff --git a/download.lst b/download.lst index 4921cde09c82..507faaa38b47 100644 --- a/download.lst +++ b/download.lst @@ -522,8 +522,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := b010c596dce127fba88532fd2f1043e55ea30601767952d0f2c0a80e7dc0da3d -POPPLER_TARBALL := poppler-25.04.0.tar.xz +POPPLER_SHA256SUM := 9b1627c5b76816ac5e4052a03f5b605ba40b45cf06b02cadd0479620b499ab38 +POPPLER_TARBALL := poppler-25.05.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk index daf4ad0ed26c..43ddc7b0c138 100644 --- a/external/poppler/UnpackedTarball_poppler.mk +++ b/external/poppler/UnpackedTarball_poppler.mk @@ -24,6 +24,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,poppler,\ external/poppler/std_numbers.patch.1 \ external/poppler/std_optional.patch.1 \ external/poppler/clang-std-ranges.patch.1 \ + external/poppler/requires.patch.1 \ external/poppler/poppler-config.patch.1 \ )) diff --git a/external/poppler/poppler-config.patch.1 b/external/poppler/poppler-config.patch.1 index a12fb0107098..ecb0b6aca839 100644 --- a/external/poppler/poppler-config.patch.1 +++ b/external/poppler/poppler-config.patch.1 @@ -164,7 +164,7 @@ index 0fbd336a..451213f8 100644 +/* #undef WORDS_BIGENDIAN */ + +/* Define as const if the declaration of iconv() needs const. */ -+#define ICONV_CONST ++#define ICONV_CONST + +/* Generate OPI comments in PS output. */ +#define OPI_SUPPORT 1 @@ -179,7 +179,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_NAME "poppler" + +/* Define to the full name and version of this package. */ -+#define PACKAGE_STRING "poppler 25.01.0" ++#define PACKAGE_STRING "poppler 25.05.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "poppler" @@ -188,7 +188,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_URL "" + +/* Define to the version of this package. */ -+#define PACKAGE_VERSION "25.01.0" ++#define PACKAGE_VERSION "25.05.0" + +/* Poppler data dir */ +#define POPPLER_DATADIR "/usr/local/share/poppler" @@ -206,7 +206,7 @@ index 0fbd336a..451213f8 100644 +/* #undef USE_FLOAT */ + +/* Version number of package */ -+#define VERSION "25.01.0" ++#define VERSION "25.05.0" + +#if defined(__APPLE__) +#elif defined (_WIN32) @@ -290,7 +290,7 @@ index 0fbd336a..451213f8 100644 + +/* Defines the poppler version. */ +#ifndef POPPLER_VERSION -+#define POPPLER_VERSION "25.01.0" ++#define POPPLER_VERSION "25.05.0" +#endif + +/* Use single precision arithmetic in the Splash backend */ @@ -437,9 +437,9 @@ index 0fbd336a..451213f8 100644 + +#include "poppler-global.h" + -+#define POPPLER_VERSION "25.01.0" ++#define POPPLER_VERSION "25.05.0" +#define POPPLER_VERSION_MAJOR 25 -+#define POPPLER_VERSION_MINOR 1 ++#define POPPLER_VERSION_MINOR 5 +#define POPPLER_VERSION_MICRO 0 + +namespace poppler diff --git a/external/poppler/requires.patch.1 b/external/poppler/requires.patch.1 new file mode 100644 index 000000000000..a66f9ed815bc --- /dev/null +++ b/external/poppler/requires.patch.1 @@ -0,0 +1,10 @@ +--- poppler/poppler/Object.h.orig 2025-08-07 19:00:01.178536031 +0200 ++++ poppler/poppler/Object.h 2025-08-07 19:00:48.012895971 +0200 +@@ -270,7 +270,6 @@ + dict = dictA; + } + template<typename StreamType> +- requires(std::is_base_of_v<Stream, StreamType>) + explicit Object(std::unique_ptr<StreamType> &&streamA) + { + assert(streamA); commit 637c4392824ad89225be7877bdf02113235b5d35 Author: Christian Lohmaier <[email protected]> AuthorDate: Tue Apr 22 15:59:23 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:49 2026 +0100 poppler: avoid more std::ranges afer update to 25.04.0 Not supported by macOS 12.7 / XCode 14.2 Change-Id: I114190ddc9e36c2660c78a4ea2eb1e7797dadf13 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184444 Tested-by: Jenkins Reviewed-by: Christian Lohmaier <[email protected]> Reviewed-by: Xisco Fauli <[email protected]> (cherry picked from commit 8cdbe3666440f81aa71539e8d38d5a93eec17b26) (cherry picked from commit a899becaac0c03a2f3586d7c0245a544e6f307de) diff --git a/external/poppler/clang-std-ranges.patch.1 b/external/poppler/clang-std-ranges.patch.1 index c07e57370eb1..58f06466ef16 100644 --- a/external/poppler/clang-std-ranges.patch.1 +++ b/external/poppler/clang-std-ranges.patch.1 @@ -392,3 +392,48 @@ In file included from /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linu Object NameTree::lookup(const GooString *name) { +diff -ur poppler.org/poppler/TextOutputDev.cc poppler/poppler/TextOutputDev.cc +--- poppler.org/poppler/TextOutputDev.cc 2025-04-22 15:42:57.000000000 +0200 ++++ poppler/poppler/TextOutputDev.cc 2025-04-22 15:49:06.000000000 +0200 +@@ -2419,7 +2419,11 @@ + } + } + } ++#if 0//ndef __clang__ + std::ranges::sort(words, &TextWord::cmpYX); ++#else ++ std::sort(words.begin(), words.end(), &TextWord::cmpYX); ++#endif + + } else { + for (flow = text->flows; flow; flow = flow->next) { +@@ -4402,9 +4406,17 @@ + // if all lines in the region have the same rotation, use it; + // otherwise, use the page's primary rotation + if (oneRot) { ++#if 0//ndef __clang__ + std::ranges::sort(frags, &TextLineFrag::cmpYXLineRot); ++#else ++ std::sort(frags.begin(), frags.end(), &TextLineFrag::cmpYXLineRot); ++#endif + } else { ++#if 0//ndef __clang__ + std::ranges::sort(frags, &TextLineFrag::cmpYXPrimaryRot); ++#else ++ std::sort(frags.begin(), frags.end(), &TextLineFrag::cmpYXPrimaryRot); ++#endif + } + for (auto it = frags.begin(); it != frags.end();) { + double delta = maxIntraLineDelta * it->line->words->fontSize; +@@ -5416,7 +5428,11 @@ + frags.back().computeCoords(true); + } + } ++#if 0//ndef __clang__ + std::ranges::sort(frags, &TextLineFrag::cmpYXPrimaryRot); ++#else ++ std::sort(frags.begin(), frags.end(), &TextLineFrag::cmpYXPrimaryRot); ++#endif + for (auto it = frags.begin(); it != frags.end();) { + double delta = maxIntraLineDelta * it->line->words->fontSize; + double base = it->base; commit 7455f3d9013c1a4c4c39bc0a4a2f99a7631cb4b5 Author: Michael Stahl <[email protected]> AuthorDate: Fri Apr 25 20:37:57 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:49 2026 +0100 poppler: remove <filesystem> and tweak some optional code Not supported by baseline GCC Change-Id: I466814903b2946ce82dcfede1643adad7a714b2f (cherry picked from commit 77809703689b3407b26c0d39078f03e543b73e8e) diff --git a/external/poppler/0001-Revert-Remove-gdir-we-have-std-filesystem.patch.1 b/external/poppler/0001-Revert-Remove-gdir-we-have-std-filesystem.patch.1 new file mode 100644 index 000000000000..44848b9501ab --- /dev/null +++ b/external/poppler/0001-Revert-Remove-gdir-we-have-std-filesystem.patch.1 @@ -0,0 +1,503 @@ +From a753625a91dc468021339978782c198238a70292 Mon Sep 17 00:00:00 2001 +From: Michael Stahl <[email protected]> +Date: Fri, 25 Apr 2025 20:34:55 +0200 +Subject: [PATCH] Revert "Remove gdir, we have std::filesystem" + +This reverts commit b50390f748b59cb0a64b912636ecf6527bd0d12a. +--- + goo/gdir.h | 96 +++++++++++++++++++++++++++++ + goo/gfile.cc | 104 ++++++++++++++++++++++++++++++++ + poppler/GlobalParams.cc | 74 ++++++++++++++--------- + poppler/GlobalParams.h | 15 +++-- + poppler/GlobalParamsWin.cc | 2 +- + poppler/NSSCryptoSignBackend.cc | 11 ++-- + 6 files changed, 261 insertions(+), 41 deletions(-) + create mode 100644 goo/gdir.h + +diff --git a/goo/gdir.h b/goo/gdir.h +new file mode 100644 +index 00000000..76068791 +--- /dev/null ++++ b/goo/gdir.h +@@ -0,0 +1,96 @@ ++//======================================================================== ++// ++// gfile.h ++// ++// Miscellaneous file and directory name manipulation. ++// ++// Copyright 1996-2003 Glyph & Cog, LLC ++// ++//======================================================================== ++ ++//======================================================================== ++// ++// Modified under the Poppler project - http://poppler.freedesktop.org ++// ++// All changes made under the Poppler project to this file are licensed ++// under GPL version 2 or later ++// ++// Copyright (C) 2006 Kristian Høgsberg <[email protected]> ++// Copyright (C) 2009, 2011, 2012, 2017, 2018, 2021, 2022 Albert Astals Cid <[email protected]> ++// Copyright (C) 2009 Kovid Goyal <[email protected]> ++// Copyright (C) 2013 Adam Reichold <[email protected]> ++// Copyright (C) 2013, 2017 Adrian Johnson <[email protected]> ++// Copyright (C) 2014 Bogdan Cristea <[email protected]> ++// Copyright (C) 2014 Peter Breitenlohner <[email protected]> ++// Copyright (C) 2017 Christoph Cullmann <[email protected]> ++// Copyright (C) 2017 Thomas Freitag <[email protected]> ++// Copyright (C) 2018 Mojca Miklavec <[email protected]> ++// Copyright (C) 2019 Christian Persch <[email protected]> ++// ++// To see a description of the changes please see the Changelog file that ++// came with your tarball or type make ChangeLog if you are building from git ++// ++//======================================================================== ++ ++#ifndef GDIR_H ++#define GDIR_H ++ ++#include "poppler-config.h" ++ ++#include <memory> ++ ++class GooString; ++ ++#if defined(_WIN32) ++# include <windows.h> ++#else ++# include <dirent.h> ++#endif ++ ++//------------------------------------------------------------------------ ++// GDir and GDirEntry ++//------------------------------------------------------------------------ ++ ++class GDirEntry ++{ ++public: ++ GDirEntry(const char *dirPath, const char *nameA, bool doStat); ++ ~GDirEntry(); ++ ++ GDirEntry(const GDirEntry &other) = delete; ++ GDirEntry &operator=(const GDirEntry &other) = delete; ++ ++ const GooString *getName() const { return name; } ++ const GooString *getFullPath() const { return fullPath; } ++ bool isDir() const { return dir; } ++ ++private: ++ GooString *name; // dir/file name ++ GooString *fullPath; ++ bool dir; // is it a directory? ++}; ++ ++class GDir ++{ ++public: ++ explicit GDir(const char *name, bool doStatA = true); ++ ~GDir(); ++ ++ GDir(const GDir &other) = delete; ++ GDir &operator=(const GDir &other) = delete; ++ ++ std::unique_ptr<GDirEntry> getNextEntry(); ++ void rewind(); ++ ++private: ++ GooString *path; // directory path ++ bool doStat; // call stat() for each entry? ++#if defined(_WIN32) ++ WIN32_FIND_DATAA ffd; ++ HANDLE hnd; ++#else ++ DIR *dir; // the DIR structure from opendir() ++#endif ++}; ++ ++#endif +diff --git a/goo/gfile.cc b/goo/gfile.cc +index 499550a6..fb42e028 100644 +--- a/goo/gfile.cc ++++ b/goo/gfile.cc +@@ -48,6 +48,7 @@ + #include <limits> + #include "GooString.h" + #include "gfile.h" ++#include "gdir.h" + + // Some systems don't define this, so just make it something reasonably + // large. +@@ -433,3 +434,106 @@ bool GooFile::modificationTimeChangedSinceOpen() const + } + + #endif // _WIN32 ++ ++//------------------------------------------------------------------------ ++// GDir and GDirEntry ++//------------------------------------------------------------------------ ++ ++GDirEntry::GDirEntry(const char *dirPath, const char *nameA, bool doStat) ++{ ++#ifdef _WIN32 ++ DWORD fa; ++#else ++ struct stat st; ++#endif ++ ++ name = new GooString(nameA); ++ dir = false; ++ fullPath = new GooString(dirPath); ++ appendToPath(fullPath, nameA); ++ if (doStat) { ++#ifdef _WIN32 ++ fa = GetFileAttributesA(fullPath->c_str()); ++ dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY)); ++#else ++ if (stat(fullPath->c_str(), &st) == 0) { ++ dir = S_ISDIR(st.st_mode); ++ } ++#endif ++ } ++} ++ ++GDirEntry::~GDirEntry() ++{ ++ delete fullPath; ++ delete name; ++} ++ ++GDir::GDir(const char *name, bool doStatA) ++{ ++ path = new GooString(name); ++ doStat = doStatA; ++#ifdef _WIN32 ++ std::unique_ptr<GooString> tmp = path->copy(); ++ tmp->append("/*.*"); ++ hnd = FindFirstFileA(tmp->c_str(), &ffd); ++#else ++ dir = opendir(name); ++#endif ++} ++ ++GDir::~GDir() ++{ ++ delete path; ++#ifdef _WIN32 ++ if (hnd != INVALID_HANDLE_VALUE) { ++ FindClose(hnd); ++ hnd = INVALID_HANDLE_VALUE; ++ } ++#else ++ if (dir) { ++ closedir(dir); ++ } ++#endif ++} ++ ++std::unique_ptr<GDirEntry> GDir::getNextEntry() ++{ ++#ifdef _WIN32 ++ if (hnd != INVALID_HANDLE_VALUE) { ++ auto e = std::make_unique<GDirEntry>(path->c_str(), ffd.cFileName, doStat); ++ if (!FindNextFileA(hnd, &ffd)) { ++ FindClose(hnd); ++ hnd = INVALID_HANDLE_VALUE; ++ } ++ return e; ++ } ++#else ++ struct dirent *ent; ++ if (dir) { ++ do { ++ ent = readdir(dir); ++ } while (ent && (!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))); ++ if (ent) { ++ return std::make_unique<GDirEntry>(path->c_str(), ent->d_name, doStat); ++ } ++ } ++#endif ++ ++ return {}; ++} ++ ++void GDir::rewind() ++{ ++#ifdef _WIN32 ++ if (hnd != INVALID_HANDLE_VALUE) ++ FindClose(hnd); ++ std::unique_ptr<GooString> tmp = path->copy(); ++ tmp->append("/*.*"); ++ hnd = FindFirstFileA(tmp->c_str(), &ffd); ++#else ++ if (dir) { ++ rewinddir(dir); ++ } ++#endif ++} +diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc +index 82e2f023..294124ee 100644 +--- a/poppler/GlobalParams.cc ++++ b/poppler/GlobalParams.cc +@@ -62,7 +62,6 @@ + #include <cstring> + #include <cstdio> + #include <cctype> +-#include <filesystem> + #ifdef _WIN32 + # include <shlobj.h> + # include <mbstring.h> +@@ -73,8 +72,10 @@ + # include <android/system_fonts.h> + #endif + #include "goo/glibc.h" ++#include "goo/gmem.h" + #include "goo/GooString.h" + #include "goo/gfile.h" ++#include "goo/gdir.h" + #include "Error.h" + #include "NameToCharCode.h" + #include "CharCodeToUnicode.h" +@@ -409,7 +410,7 @@ const SysFontInfo *SysFontList::find(const std::string &name, bool fixedWidth, b + // parsing + //------------------------------------------------------------------------ + +-GlobalParams::GlobalParams(const std::string &customPopplerDataDir) : popplerDataDir(customPopplerDataDir) ++GlobalParams::GlobalParams(const char *customPopplerDataDir) : popplerDataDir(customPopplerDataDir) + { + // scan the encoding in reverse because we want the lowest-numbered + // index for each char name ('space' is encoded twice) +@@ -466,30 +467,49 @@ GlobalParams::GlobalParams(const std::string &customPopplerDataDir) : popplerDat + + void GlobalParams::scanEncodingDirs() + { +- std::string dataRoot = !popplerDataDir.empty() ? popplerDataDir : std::string { POPPLER_DATADIR }; ++ GDir *dir; ++ std::unique_ptr<GDirEntry> entry; ++ const char *dataRoot = popplerDataDir ? popplerDataDir : POPPLER_DATADIR; + +- std::error_code ec; // if ec is set, we also get the end iterator, so that's kind of okay. If not creating with a error code, we get an exception if poppler data is missing +- for (const auto &entry : std::filesystem::directory_iterator { dataRoot + "/nameToUnicode", ec }) { +- if (entry.is_regular_file()) { +- parseNameToUnicode(entry.path()); ++ // allocate buffer large enough to append "/nameToUnicode" ++ size_t bufSize = strlen(dataRoot) + strlen("/nameToUnicode") + 1; ++ char *dataPathBuffer = new char[bufSize]; ++ ++ snprintf(dataPathBuffer, bufSize, "%s/nameToUnicode", dataRoot); ++ dir = new GDir(dataPathBuffer, true); ++ while (entry = dir->getNextEntry(), entry != nullptr) { ++ if (!entry->isDir()) { ++ parseNameToUnicode(entry->getFullPath()); + } + } ++ delete dir; + +- for (const auto &entry : std::filesystem::directory_iterator { dataRoot + "/cidToUnicode", ec }) { +- addCIDToUnicode(entry.path().filename().string(), entry.path().string()); ++ snprintf(dataPathBuffer, bufSize, "%s/cidToUnicode", dataRoot); ++ dir = new GDir(dataPathBuffer, false); ++ while (entry = dir->getNextEntry(), entry != nullptr) { ++ addCIDToUnicode(entry->getName(), entry->getFullPath()); + } ++ delete dir; + +- for (const auto &entry : std::filesystem::directory_iterator { dataRoot + "/unicodeMap", ec }) { +- addUnicodeMap(entry.path().filename().string(), entry.path().string()); ++ snprintf(dataPathBuffer, bufSize, "%s/unicodeMap", dataRoot); ++ dir = new GDir(dataPathBuffer, false); ++ while (entry = dir->getNextEntry(), entry != nullptr) { ++ addUnicodeMap(entry->getName(), entry->getFullPath()); + } ++ delete dir; + +- for (const auto &entry : std::filesystem::directory_iterator { dataRoot + "/cMap", ec }) { +- addCMapDir(entry.path().filename().string(), entry.path().string()); +- toUnicodeDirs.push_back(entry.path().string()); ++ snprintf(dataPathBuffer, bufSize, "%s/cMap", dataRoot); ++ dir = new GDir(dataPathBuffer, false); ++ while (entry = dir->getNextEntry(), entry != nullptr) { ++ addCMapDir(entry->getName(), entry->getFullPath()); ++ toUnicodeDirs.push_back(entry->getFullPath()->copy()); + } ++ delete dir; ++ ++ delete[] dataPathBuffer; + } + +-void GlobalParams::parseNameToUnicode(const std::filesystem::path &name) ++void GlobalParams::parseNameToUnicode(const GooString *name) + { + char *tok1, *tok2; + FILE *f; +@@ -498,8 +518,8 @@ void GlobalParams::parseNameToUnicode(const std::filesystem::path &name) + Unicode u; + char *tokptr; + +- if (!(f = openFile(name.string().c_str(), "r"))) { +- error(errIO, -1, "Couldn't open 'nameToUnicode' file '{0:s}'", name.string().c_str()); ++ if (!(f = openFile(name->c_str(), "r"))) { ++ error(errIO, -1, "Couldn't open 'nameToUnicode' file '{0:t}'", name); + return; + } + line = 1; +@@ -510,26 +530,26 @@ void GlobalParams::parseNameToUnicode(const std::filesystem::path &name) + sscanf(tok1, "%x", &u); + nameToUnicodeText->add(tok2, u); + } else { +- error(errConfig, -1, "Bad line in 'nameToUnicode' file ({0:s}:{1:d})", name.string().c_str(), line); ++ error(errConfig, -1, "Bad line in 'nameToUnicode' file ({0:t}:{1:d})", name, line); + } + ++line; + } + fclose(f); + } + +-void GlobalParams::addCIDToUnicode(std::string &&collection, std::string &&fileName) ++void GlobalParams::addCIDToUnicode(const GooString *collection, const GooString *fileName) + { +- cidToUnicodes[collection] = fileName; ++ cidToUnicodes[collection->toStr()] = fileName->toStr(); + } + +-void GlobalParams::addUnicodeMap(std::string &&encodingName, std::string &&fileName) ++void GlobalParams::addUnicodeMap(const GooString *encodingName, const GooString *fileName) + { +- unicodeMaps[encodingName] = fileName; ++ unicodeMaps[encodingName->toStr()] = fileName->toStr(); + } + +-void GlobalParams::addCMapDir(std::string &&collection, std::string &&dir) ++void GlobalParams::addCMapDir(const GooString *collection, const GooString *dir) + { +- cMapDirs.emplace(collection, dir); ++ cMapDirs.emplace(collection->toStr(), dir->toStr()); + } + + bool GlobalParams::parseYesNo2(const char *token, bool *flag) +@@ -634,8 +654,8 @@ FILE *GlobalParams::findToUnicodeFile(const GooString *name) + FILE *f; + + globalParamsLocker(); +- for (const std::string &dir : toUnicodeDirs) { +- fileName = appendToPath(new GooString(dir), name->c_str()); ++ for (const std::unique_ptr<GooString> &dir : toUnicodeDirs) { ++ fileName = appendToPath(dir->copy().release(), name->c_str()); + f = openFile(fileName->c_str(), "r"); + delete fileName; + if (f) { +@@ -1543,7 +1563,7 @@ GlobalParamsIniter::GlobalParamsIniter(ErrorCallback errorCallback) + const std::scoped_lock lock { mutex }; + + if (count == 0) { +- globalParams = std::make_unique<GlobalParams>(customDataDir); ++ globalParams = std::make_unique<GlobalParams>(!customDataDir.empty() ? customDataDir.c_str() : nullptr); + + setErrorCallback(errorCallback); + } +diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h +index 3bd9d7b6..1bb69d15 100644 +--- a/poppler/GlobalParams.h ++++ b/poppler/GlobalParams.h +@@ -52,7 +52,6 @@ + #include <mutex> + #include <optional> + #include <vector> +-#include <filesystem> + + class GooString; + class NameToCharCode; +@@ -113,7 +112,7 @@ class POPPLER_PRIVATE_EXPORT GlobalParams + { + public: + // Initialize the global parameters +- explicit GlobalParams(const std::string &customPopplerDataDir = {}); ++ explicit GlobalParams(const char *customPopplerDataDir = nullptr); + + ~GlobalParams(); + +@@ -169,12 +168,12 @@ public: + static bool parseYesNo2(const char *token, bool *flag); + + private: +- void parseNameToUnicode(const std::filesystem::path &name); ++ void parseNameToUnicode(const GooString *name); + + void scanEncodingDirs(); +- void addCIDToUnicode(std::string &&collection, std::string &&fileName); +- void addUnicodeMap(std::string &&encodingName, std::string &&fileName); +- void addCMapDir(std::string &&collection, std::string &&dir); ++ void addCIDToUnicode(const GooString *collection, const GooString *fileName); ++ void addUnicodeMap(const GooString *encodingName, const GooString *fileName); ++ void addCMapDir(const GooString *collection, const GooString *dir); + + //----- static tables + +@@ -198,7 +197,7 @@ private: + std::unordered_map<std::string, std::string> unicodeMaps; + // list of CMap dirs, indexed by collection + std::unordered_multimap<std::string, std::string> cMapDirs; +- std::vector<std::string> toUnicodeDirs; // list of ToUnicode CMap dirs ++ std::vector<std::unique_ptr<GooString>> toUnicodeDirs; // list of ToUnicode CMap dirs + bool baseFontsInitialized; + #ifdef _WIN32 + // windows font substitutes (for CID fonts) +@@ -224,7 +223,7 @@ private: + mutable std::recursive_mutex unicodeMapCacheMutex; + mutable std::recursive_mutex cMapCacheMutex; + +- std::string popplerDataDir; ++ const char *popplerDataDir; + }; + + class POPPLER_PRIVATE_EXPORT GlobalParamsIniter +diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc +index c838bfa6..2d45ec59 100644 +--- a/poppler/GlobalParamsWin.cc ++++ b/poppler/GlobalParamsWin.cc +@@ -378,7 +378,7 @@ void GlobalParams::setupBaseFonts(const char *dir) + sysFonts->scanWindowsFonts(winFontDir); + } + +- std::string dataRoot = !popplerDataDir.empty() ? popplerDataDir : std::string { POPPLER_DATADIR }; ++ const char *dataRoot = popplerDataDir ? popplerDataDir : POPPLER_DATADIR; + const std::string fileName = std::string(dataRoot).append("/cidfmap"); + + // try to open file +diff --git a/poppler/NSSCryptoSignBackend.cc b/poppler/NSSCryptoSignBackend.cc +index eeea26ee..f1c75a77 100644 +--- a/poppler/NSSCryptoSignBackend.cc ++++ b/poppler/NSSCryptoSignBackend.cc +@@ -28,12 +28,12 @@ + + #include "CryptoSignBackend.h" + #include "NSSCryptoSignBackend.h" ++#include "goo/gdir.h" + #include "goo/gmem.h" + + #include <array> + #include <optional> + #include <vector> +-#include <filesystem> + + #include <Error.h> + +@@ -618,10 +618,11 @@ static std::optional<std::string> getDefaultFirefoxCertDB() + const std::string firefoxPath = std::string(env) + "/.mozilla/firefox/"; + #endif + +- std::error_code ec; // ensures directory_iterator doesn't throw exceptions +- for (const auto &entry : std::filesystem::directory_iterator { firefoxPath, ec }) { +- if (entry.is_directory() && entry.path().string().find("default") != std::string::npos) { +- return entry.path().string(); ++ GDir firefoxDir(firefoxPath.c_str()); ++ std::unique_ptr<GDirEntry> entry; ++ while (entry = firefoxDir.getNextEntry(), entry != nullptr) { ++ if (entry->isDir() && entry->getName()->toStr().find("default") != std::string::npos) { ++ return entry->getFullPath()->toStr(); + } + } + return {}; +-- +2.49.0 + diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk index e5b1ed05c6c4..daf4ad0ed26c 100644 --- a/external/poppler/UnpackedTarball_poppler.mk +++ b/external/poppler/UnpackedTarball_poppler.mk @@ -14,6 +14,7 @@ $(eval $(call gb_UnpackedTarball_set_tarball,poppler,$(POPPLER_TARBALL),,poppler $(eval $(call gb_UnpackedTarball_set_patchlevel,poppler,0)) $(eval $(call gb_UnpackedTarball_add_patches,poppler,\ + external/poppler/0001-Revert-Remove-gdir-we-have-std-filesystem.patch.1 \ external/poppler/disable-freetype.patch.1 \ external/poppler/gcc7-EntityInfo.patch.1 \ external/poppler/gcc7-GfxFont.patch.1 \ @@ -21,6 +22,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,poppler,\ external/poppler/std_string.patch.1 \ external/poppler/std_span.patch.1 \ external/poppler/std_numbers.patch.1 \ + external/poppler/std_optional.patch.1 \ external/poppler/clang-std-ranges.patch.1 \ external/poppler/poppler-config.patch.1 \ )) diff --git a/external/poppler/std_optional.patch.1 b/external/poppler/std_optional.patch.1 new file mode 100644 index 000000000000..5a49e7f1e643 --- /dev/null +++ b/external/poppler/std_optional.patch.1 @@ -0,0 +1,13 @@ +Form.cc:2517:24: error: could not convert ‘gstr’ from ‘GooString’ to ‘std::optional<GooString>’ + +--- poppler/poppler/Form.cc.orig2 2025-04-25 20:55:50.411236258 +0200 ++++ poppler/poppler/Form.cc 2025-04-25 20:55:53.108246143 +0200 +@@ -2514,7 +2514,7 @@ + } while (++pos < len); + if (signature_type == CryptoSign::SignatureType::g10c_pgp_signature_detached) { + // Padding here is done as pgp packets, so keep no need to try to unmangle it +- return gstr; ++ return std::optional<GooString>{std::move(gstr)}; + } else { + if (gstr.getChar(0) == '3' && gstr.getChar(1) == '0') { + if (gstr.getChar(2) == '8' && gstr.getChar(3) == '0') { commit 2d338ab4fc1b74e88d699ed743969298ce85b8d7 Author: Xisco Fauli <[email protected]> AuthorDate: Wed Apr 2 16:27:00 2025 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:48 2026 +0100 poppler: upgrade to 25.04.0 After 032d035220702523cf10d924fd436c9e6c83d24c "Enforce error checking on stream::reset" the return from reset has to be checked, otherwise it fails with error: ignoring return value of ‘bool ImageStream::reset()’, declared with attribute ‘nodiscard’ [-Werror=unused-result] Downloaded from https://poppler.freedesktop.org/poppler-25.04.0.tar.xz Change-Id: I5c6022b11c307f4293e4b2ea566e811053e3ab6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183632 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> (cherry picked from commit 4f13305178c1bf88dffceb42ec15d0944b808a5c) (cherry picked from commit ff25307363469dcdca8b4ceba6446b5af2d2216c) diff --git a/download.lst b/download.lst index cb3854e1bac8..4921cde09c82 100644 --- a/download.lst +++ b/download.lst @@ -522,8 +522,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := 21234cb2a9647d73c752ce4031e65a79d11a511a835f2798284c2497b8701dee -POPPLER_TARBALL := poppler-25.02.0.tar.xz +POPPLER_SHA256SUM := b010c596dce127fba88532fd2f1043e55ea30601767952d0f2c0a80e7dc0da3d +POPPLER_TARBALL := poppler-25.04.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines diff --git a/external/poppler/clang-std-ranges.patch.1 b/external/poppler/clang-std-ranges.patch.1 index d7736089e9a8..c07e57370eb1 100644 --- a/external/poppler/clang-std-ranges.patch.1 +++ b/external/poppler/clang-std-ranges.patch.1 @@ -311,8 +311,8 @@ In file included from /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linu } lines.push_back(std::move(words)); -@@ -5456,7 +5460,11 @@ - for (word = rawWords; word; word = word->next) { +@@ -5385,7 +5385,11 @@ + for (TextWord *word = rawWords; word; word = word->next) { s.clear(); uText.resize(word->len()); +#if 0//ndef __clang__ diff --git a/external/poppler/std_span.patch.1 b/external/poppler/std_span.patch.1 index c61f1269a876..757243674da8 100644 --- a/external/poppler/std_span.patch.1 +++ b/external/poppler/std_span.patch.1 @@ -9,9 +9,9 @@ replace C++20 std::span with o3tl::span -#include <span> +#include <o3tl/span.hxx> +namespace std { using o3tl::span; } + #include <optional> #include "poppler-config.h" - #include "poppler_private_export.h" --- poppler/poppler/UTF.h.orig2 2025-01-09 11:48:18.197644776 +0100 +++ poppler/poppler/UTF.h 2025-01-09 11:53:11.688558686 +0100 @@ -23,7 +23,8 @@ diff --git a/external/poppler/std_string.patch.1 b/external/poppler/std_string.patch.1 index 3c3ef6dcf564..3cf77b101f43 100644 --- a/external/poppler/std_string.patch.1 +++ b/external/poppler/std_string.patch.1 @@ -28,14 +28,14 @@ remove C++20 starts_with +++ poppler/poppler/UTF.h 2025-01-09 11:25:30.852367770 +0100 @@ -54,13 +54,13 @@ // check whether string starts with Big-Endian byte order mark - inline bool hasUnicodeByteOrderMark(const std::string &s) + inline bool hasUnicodeByteOrderMark(std::string_view s) { - return s.starts_with(unicodeByteOrderMark); + return s.size() >= unicodeByteOrderMark.size() && 0 == s.compare(0, unicodeByteOrderMark.size(), unicodeByteOrderMark); } // check whether string starts with Little-Endian byte order mark - inline bool hasUnicodeByteOrderMarkLE(const std::string &s) + inline bool hasUnicodeByteOrderMarkLE(std::string_view s) { - return s.starts_with(unicodeByteOrderMarkLE); + return s.size() >= unicodeByteOrderMarkLE.size() && 0 == s.compare(0, unicodeByteOrderMarkLE.size(), unicodeByteOrderMarkLE); @@ -90,7 +90,7 @@ remove C++20 starts_with +++ poppler/poppler/UTF.h 2025-01-09 15:47:32.502434901 +0100 @@ -74,7 +74,7 @@ // check whether string starts with Big-Endian byte order mark and string length is even - inline bool hasUnicodeByteOrderMarkAndLengthIsEven(const std::string &s) + inline bool hasUnicodeByteOrderMarkAndLengthIsEven(std::string_view s) { - return s.starts_with(unicodeByteOrderMark) && s.length() % 2 == 0; + return hasUnicodeByteOrderMark(s) && s.length() % 2 == 0; diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index b0bc1c493a9d..2806f40b8682 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -212,7 +212,8 @@ static void writeJpeg_( OutputBuffer& o_rOutputBuf, Stream* str ) #else str = ((DCTStream *)str)->getRawStream(); #endif - str->reset(); + if (!str->reset()) + return; o_rOutputBuf.clear(); ExtractJpegData(str, o_rOutputBuf); @@ -248,7 +249,8 @@ static void writePbm_(OutputBuffer& o_rOutputBuf, Stream* str, int width, int he o_rOutputBuf.resize(header_size); // initialize stream - str->reset(); + if (!str->reset()) + return; // copy the raw stream if( bInvert ) @@ -305,7 +307,8 @@ static void writePpm_( OutputBuffer& o_rOutputBuf, width, colorMap->getNumPixelComps(), colorMap->getBits())); - imgStr->reset(); + if (!imgStr->reset()) + return; for( int y=0; y<height; ++y) { diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx index 798555fe2f54..c0547e761e59 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx @@ -214,7 +214,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, int nLineSize = (width + 7)/8; aScanlines.reserve( nLineSize * height + height ); - str->reset(); + if (!str->reset()) + return; for( int y = 0; y < height; y++ ) { // determine filter type (none) for this scanline @@ -252,7 +253,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, width, colorMap->getNumPixelComps(), colorMap->getBits())); - imgStr->reset(); + if (!imgStr->reset()) + return; // create scan line data buffer OutputBuffer aScanlines; @@ -289,7 +291,9 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, maskColorMap->getNumPixelComps(), maskColorMap->getBits())); - imgStrMask->reset(); + if (!imgStrMask->reset()) + return; + for( int y = 0; y < maskHeight; ++y ) { pm = imgStrMask->getLine(); @@ -337,7 +341,8 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, width, colorMap->getNumPixelComps(), colorMap->getBits())); - imgStr->reset(); + if (!imgStr->reset()) + return; // create scan line data buffer OutputBuffer aScanlines; @@ -371,7 +376,9 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, std::unique_ptr<ImageStream> imgStrMask( new ImageStream(maskStr, maskWidth, 1, 1)); - imgStrMask->reset(); + if (!imgStrMask->reset()) + return; + for( int y = 0; y < maskHeight; ++y ) { for( int x = 0; x < maskWidth; ++x ) commit ed3514663de255540f7f3f17f28186fefa2046c5 Author: Xisco Fauli <[email protected]> AuthorDate: Tue Feb 25 14:09:16 2025 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:48 2026 +0100 related tdf#165433: poppler: upgrade to 25.02.0 Downloaded from https://poppler.freedesktop.org/poppler-25.02.0.tar.xz Change-Id: I22cf1bd4dc3d27cabd8ce291d3bafd962d3f45f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182169 Reviewed-by: Xisco Fauli <[email protected]> Tested-by: Jenkins (cherry picked from commit 12c1596b0fd152399bed90f3d26014a32efc24e3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184639 Reviewed-by: Christian Lohmaier <[email protected]> (cherry picked from commit 4d76de24b0f2a77008b8ba220cddb6048f9b01cb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194032 Reviewed-by: Michael Stahl <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit eae3eb860f477d12870aefe9e9721d1207070fea) diff --git a/download.lst b/download.lst index 5671dbeb7189..cb3854e1bac8 100644 --- a/download.lst +++ b/download.lst @@ -522,8 +522,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := 7eefc122207bbbd72a303c5e0743f4941e8ae861e24dcf0501e18ce1d1414112 -POPPLER_TARBALL := poppler-25.01.0.tar.xz +POPPLER_SHA256SUM := 21234cb2a9647d73c752ce4031e65a79d11a511a835f2798284c2497b8701dee +POPPLER_TARBALL := poppler-25.02.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk index e560c22bab76..e5b1ed05c6c4 100644 --- a/external/poppler/UnpackedTarball_poppler.mk +++ b/external/poppler/UnpackedTarball_poppler.mk @@ -23,7 +23,6 @@ $(eval $(call gb_UnpackedTarball_add_patches,poppler,\ external/poppler/std_numbers.patch.1 \ external/poppler/clang-std-ranges.patch.1 \ external/poppler/poppler-config.patch.1 \ - external/poppler/pch.patch.0 \ )) ifneq ($(filter -fsanitize=%,$(CC)),) diff --git a/external/poppler/inc/pch/precompiled_poppler.hxx b/external/poppler/inc/pch/precompiled_poppler.hxx index 50944b80daef..c835b4423018 100644 --- a/external/poppler/inc/pch/precompiled_poppler.hxx +++ b/external/poppler/inc/pch/precompiled_poppler.hxx @@ -13,11 +13,11 @@ 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 2023-06-18 21:15:26 using: - ./bin/update_pch external/poppler poppler --cutoff=1 --exclude:system --include:module --include:local + Generated on 2025-02-25 16:55:58 using: + ./bin/update_pch ./external/poppler poppler --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/poppler/inc/pch/precompiled_poppler.hxx "make external/poppler.build" --find-conflicts + ./bin/update_pch_bisect ././external/poppler/inc/pch/precompiled_poppler.hxx "make ./external/poppler.build" --find-conflicts */ #include <sal/config.h> @@ -55,9 +55,10 @@ #include <cstdlib> #include <cstring> #include <ctime> +#include <filesystem> +#include <functional> #include <gbase64.h> #include <gbasename.h> -#include <gdir.h> #include <gfile.h> #include <glibc.h> #include <gmem.h> @@ -89,7 +90,6 @@ #include <goo/JpegWriter.h> #include <goo/PNGWriter.h> #include <goo/TiffWriter.h> -#include <goo/gdir.h> #include <goo/gfile.h> #include <goo/glibc.h> #include <goo/gmem.h> diff --git a/external/poppler/pch.patch.0 b/external/poppler/pch.patch.0 deleted file mode 100644 index 9ffeeb8421f5..000000000000 --- a/external/poppler/pch.patch.0 +++ /dev/null @@ -1,11 +0,0 @@ ---- ./goo/gdir.h.sav 2021-01-02 17:54:42.000000000 +0100 -+++ ./goo/gdir.h 2021-11-03 15:16:04.306277081 +0100 -@@ -37,6 +37,8 @@ - - #include <memory> - -+#include "gfile.h" -+ - class GooString; - - #if defined(_WIN32) commit 801d46f6001ac5210b9d78c9d51e60d474324c15 Author: Michael Stahl <[email protected]> AuthorDate: Tue Jan 7 18:45:34 2025 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:48 2026 +0100 poppler: upgrade to release 25.01 Fixes CVE-2024-56378 - remove disable-nss-and-gpgmepp.patch.1 and instead build CryptoSignBackend.cc which appears to have working ifdefs now - run the update_pch script - add clang-std-rotate.patch.1 because jenkins failed Change-Id: I7fcdd10766287e83dc666041644f129378584d91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179903 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit e28c5a2c93477d167eb449f08eca220cb3b26b31) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179958 Tested-by: Michael Stahl <[email protected]> (cherry picked from commit 3bb689dfbac211696029c767250e841f67711088) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180040 Tested-by: allotropia jenkins <[email protected]> (cherry picked from commit be6774fd28da7aab58647c9f0f869c92ce4425ef) diff --git a/download.lst b/download.lst index 236a137eb8ae..5671dbeb7189 100644 --- a/download.lst +++ b/download.lst @@ -522,8 +522,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := 97453fbddf0c9a9eafa0ea45ac710d3d49bcf23a62e864585385d3c0b4403174 -POPPLER_TARBALL := poppler-24.08.0.tar.xz +POPPLER_SHA256SUM := 7eefc122207bbbd72a303c5e0743f4941e8ae861e24dcf0501e18ce1d1414112 +POPPLER_TARBALL := poppler-25.01.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines diff --git a/external/poppler/StaticLibrary_poppler.mk b/external/poppler/StaticLibrary_poppler.mk index f36cecc9aca6..45d926e64c2c 100644 --- a/external/poppler/StaticLibrary_poppler.mk +++ b/external/poppler/StaticLibrary_poppler.mk @@ -21,6 +21,7 @@ $(eval $(call gb_StaticLibrary_use_externals,poppler,\ $(eval $(call gb_StaticLibrary_set_warnings_disabled,poppler)) +# note: the "fofi" and "goo" subdirs are required for the PCH $(eval $(call gb_StaticLibrary_set_include,poppler,\ -I$(WORKDIR)/UnpackedTarball/poppler \ -I$(WORKDIR)/UnpackedTarball/poppler/fofi \ @@ -88,6 +89,7 @@ $(eval $(call gb_StaticLibrary_add_generated_exception_objects,poppler,\ UnpackedTarball/poppler/poppler/CertificateInfo \ UnpackedTarball/poppler/poppler/CharCodeToUnicode \ UnpackedTarball/poppler/poppler/CMap \ + UnpackedTarball/poppler/poppler/CryptoSignBackend \ UnpackedTarball/poppler/poppler/DCTStream \ UnpackedTarball/poppler/poppler/DateInfo \ UnpackedTarball/poppler/poppler/Decrypt \ diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk index 3edb6e068f79..e560c22bab76 100644 --- a/external/poppler/UnpackedTarball_poppler.mk +++ b/external/poppler/UnpackedTarball_poppler.mk @@ -15,12 +15,13 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,poppler,0)) $(eval $(call gb_UnpackedTarball_add_patches,poppler,\ external/poppler/disable-freetype.patch.1 \ - external/poppler/disable-nss-and-gpgmepp.patch.1 \ external/poppler/gcc7-EntityInfo.patch.1 \ external/poppler/gcc7-GfxFont.patch.1 \ external/poppler/std_charconv.patch.1 \ external/poppler/std_string.patch.1 \ external/poppler/std_span.patch.1 \ + external/poppler/std_numbers.patch.1 \ + external/poppler/clang-std-ranges.patch.1 \ external/poppler/poppler-config.patch.1 \ external/poppler/pch.patch.0 \ )) diff --git a/external/poppler/clang-std-ranges.patch.1 b/external/poppler/clang-std-ranges.patch.1 new file mode 100644 index 000000000000..d7736089e9a8 --- /dev/null +++ b/external/poppler/clang-std-ranges.patch.1 @@ -0,0 +1,394 @@ +clang jenkins bot fails with: + +In file included from /home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/poppler/splash/SplashFontEngine.cc:38: +In file included from /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/algorithm:60: +In file included from /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_algobase.h:65: +In file included from /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_iterator_base_types.h:71: +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/iterator_concepts.h:982:13: error: no matching function for call to '__begin' + = decltype(ranges::__cust_access::__begin(std::declval<_Tp&>())); + ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/ranges_base.h:595:5: note: in instantiation of template type alias '__range_iter_t' requested here + using iterator_t = std::__detail::__range_iter_t<_Tp>; + ^ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/ranges_util.h:121:36: note: in instantiation of template type alias 'iterator_t' requested here + requires contiguous_iterator<iterator_t<_Derived>> + ^ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/ranges_util.h:228:29: note: in instantiation of template class 'std::ranges::view_interface<std::ranges::subrange<SplashFont **, SplashFont **, std::ranges::subrange_kind::sized>>' requested here + class subrange : public view_interface<subrange<_It, _Sent, _Kind>> + ^ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/ranges_algo.h:1499:7: note: in instantiation of template class 'std::ranges::subrange<SplashFont **, SplashFont **, std::ranges::subrange_kind::sized>' requested here + operator()(_Range&& __r, iterator_t<_Range> __middle) const + ^ +/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/workdir/UnpackedTarball/poppler/splash/SplashFontEngine.cc:246:24: note: in instantiation of function template specialization 'std::ranges::__rotate_fn::operator()<std::array<SplashFont *, 16> &>' requested here + std::ranges::rotate(fontCache, fontCache.end() - 1); + ^ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/iterator_concepts.h:966:7: note: candidate template ignored: constraints not satisfied [with _Tp = std::ranges::subrange<SplashFont **, SplashFont **, std::ranges::subrange_kind::sized>] + __begin(_Tp& __t) + ^ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/iterator_concepts.h:964:16: note: because 'is_array_v<std::ranges::subrange<SplashFont **, SplashFont **, std::ranges::subrange_kind::sized> >' evaluated to false + requires is_array_v<_Tp> || __member_begin<_Tp&> || __adl_begin<_Tp&> + ^ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/iterator_concepts.h:964:35: note: and 'std::ranges::subrange<SplashFont **, SplashFont **, std::ranges::subrange_kind::sized> &' does not satisfy '__member_begin' + requires is_array_v<_Tp> || __member_begin<_Tp&> || __adl_begin<_Tp&> + ^ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/iterator_concepts.h:947:23: note: because '__decay_copy(__t.begin())' would be invalid: no member named 'begin' in 'std::ranges::subrange<SplashFont **, SplashFont **, std::ranges::subrange_kind::sized>' + { __decay_copy(__t.begin()) } -> input_or_output_iterator; + ^ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/iterator_concepts.h:964:59: note: and 'std::ranges::subrange<SplashFont **, SplashFont **, std::ranges::subrange_kind::sized> &' does not satisfy '__adl_begin' + requires is_array_v<_Tp> || __member_begin<_Tp&> || __adl_begin<_Tp&> + ^ +/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/iterator_concepts.h:958:19: note: because '__decay_copy(begin(__t))' would be invalid: call to deleted function 'begin' + { __decay_copy(begin(__t)) } -> input_or_output_iterator; + ^ + +--- poppler/splash/SplashFontEngine.cc.orig2 2025-01-08 10:58:44.891336796 +0100 ++++ poppler/splash/SplashFontEngine.cc 2025-01-08 11:02:24.548166442 +0100 +@@ -243,7 +243,11 @@ + if (fontCache.back()) { + delete fontCache.back(); + } ++#if 0//ndef __clang__ + std::ranges::rotate(fontCache, fontCache.end() - 1); ++#else ++ std::rotate(fontCache.begin(), fontCache.end() - 1, fontCache.end()); ++#endif + + fontCache[0] = newFont; + return fontCache[0]; +--- poppler/fofi/FoFiTrueType.cc.orig 2025-01-08 12:26:45.256494256 +0100 ++++ poppler/fofi/FoFiTrueType.cc 2025-01-08 12:22:26.462723118 +0100 +@@ -1160,12 +1160,20 @@ + locaTable[i].origOffset = glyfTableLen; + } + } ++#if 0//ndef __clang__ + std::ranges::sort(locaTable, cmpTrueTypeLocaOffsetFunctor()); ++#else ++ std::sort(locaTable.begin(), locaTable.end(), cmpTrueTypeLocaOffsetFunctor()); ++#endif + for (i = 0; i < nGlyphs; ++i) { + locaTable[i].len = locaTable[i + 1].origOffset - locaTable[i].origOffset; + } + locaTable[nGlyphs].len = 0; ++#if 0//ndef __clang__ + std::ranges::sort(locaTable, cmpTrueTypeLocaIdxFunctor()); ++#else ++ std::sort(locaTable.begin(), locaTable.end(), cmpTrueTypeLocaIdxFunctor()); ++#endif + pos = 0; + for (i = 0; i <= nGlyphs; ++i) { + locaTable[i].newOffset = pos; +--- poppler/poppler/CIDFontsWidthsBuilder.h.orig 2025-01-08 12:34:25.458714665 +0100 ++++ poppler/poppler/CIDFontsWidthsBuilder.h 2025-01-08 12:35:05.809036940 +0100 +@@ -89,7 +89,11 @@ + // How many elements at the end has this + int uniqueElementsFromEnd(int value) + { ++#if 0//ndef __clang__ + auto lastDifferent = std::ranges::find_if(std::ranges::reverse_view(m_values), [value](auto &&element) { return element != value; }); ++#else ++ auto lastDifferent = std::find_if(m_values.rbegin(), m_values.rend(), [value](auto &&element) { return element != value; }); ++#endif + return std::distance(m_values.rbegin(), lastDifferent); + } + +--- poppler/poppler/Dict.cc.orig 2025-01-08 12:17:07.701541557 +0100 ++++ poppler/poppler/Dict.cc 2025-01-08 12:29:29.609619053 +0100 +@@ -125,7 +125,11 @@ + return &*pos; + } + } else { ++#if 0//ndef __clang__ + const auto pos = std::ranges::find_if(std::ranges::reverse_view(entries), [key](const DictEntry &entry) { return entry.first == key; }); ++#else ++ const auto pos = std::find_if(entries.rbegin(), entries.rend(), [key](const DictEntry &entry) { return entry.first == key; }); ++#endif + if (pos != entries.rend()) { + return &*pos; + } +--- poppler/poppler/CIDFontsWidthsBuilder.h.orig2 2025-01-08 13:26:29.167797754 +0100 ++++ poppler/poppler/CIDFontsWidthsBuilder.h 2025-01-08 13:27:03.165988989 +0100 +@@ -152,7 +152,11 @@ + if (differentValues || m_values.size() < 4) { + std::vector<int> savedValues; + if (m_values.size() >= 4) { ++#if 0//ndef __clang__ + auto lastDifferent = std::ranges::find_if(std::ranges::reverse_view(m_values), [value = m_values.back()](auto &&element) { return element != value; }); ++#else ++ auto lastDifferent = std::find_if(m_values.rbegin(), m_values.rend(), [value = m_values.back()](auto &&element) { return element != value; }); ++#endif + if (std::distance(m_values.rbegin(), lastDifferent) >= 3) { + savedValues.push_back(m_values.back()); + m_values.pop_back(); +--- poppler/poppler/Dict.cc.orig 2025-01-09 17:07:59.770799229 +0100 ++++ poppler/poppler/Dict.cc 2025-01-09 17:04:28.369931616 +0100 +@@ -113,14 +113,22 @@ + if (!sorted) { + Dict *that = const_cast<Dict *>(this); + ++#if 0//ndef __clang__ + std::ranges::sort(that->entries, CmpDictEntry {}); ++#else ++ std::sort(that->entries.begin(), that->entries.end(), CmpDictEntry {}); ++#endif + that->sorted = true; + } + } + } + + if (sorted) { ++#if 0//ndef __clang__ + const auto pos = std::ranges::lower_bound(entries, key, std::less<> {}, &DictEntry::first); ++#else ++ const auto pos = std::lower_bound(entries.begin(), entries.end(), key, CmpDictEntry {}); ++#endif + if (pos != entries.end() && pos->first == key) { + return &*pos; + } +--- poppler/poppler/GlobalParams.cc.orig 2025-01-02 01:28:08.000000000 +0100 ++++ poppler/poppler/GlobalParams.cc 2025-01-09 17:13:51.367905376 +0100 +@@ -366,7 +366,11 @@ + for (const SysFontInfo *f : fonts) { + fi = f; + if (fi->match(name2, bold, italic, oblique, fixedWidth)) { ++#if 0//ndef __clang__ + if (std::ranges::find(filesToIgnore, fi->path->toStr()) == filesToIgnore.end()) { ++#else ++ if (std::find(filesToIgnore.begin(), filesToIgnore.end(), fi->path->toStr()) == filesToIgnore.end()) { ++#endif + break; + } + } +@@ -377,7 +381,11 @@ + for (const SysFontInfo *f : fonts) { + fi = f; + if (fi->match(name2, false, italic)) { ++#if 0//ndef __clang__ + if (std::ranges::find(filesToIgnore, fi->path->toStr()) == filesToIgnore.end()) { ++#else ++ if (std::find(filesToIgnore.begin(), filesToIgnore.end(), fi->path->toStr()) == filesToIgnore.end()) { ++#endif + break; + } + } +@@ -389,7 +397,11 @@ + for (const SysFontInfo *f : fonts) { + fi = f; + if (fi->match(name2, false, false)) { ++#if 0//ndef __clang__ + if (std::ranges::find(filesToIgnore, fi->path->toStr()) == filesToIgnore.end()) { ++#else ++ if (std::find(filesToIgnore.begin(), filesToIgnore.end(), fi->path->toStr()) == filesToIgnore.end()) { ++#endif + break; + } + } +@@ -737,7 +749,11 @@ + + // remove the - from the names, for some reason, Fontconfig does not + // understand "MS-Mincho" but does with "MS Mincho" ++#if 0//ndef __clang__ + std::ranges::replace(fontName, '-', ' '); ++#else ++ std::replace(fontName.begin(), fontName.end(), '-', ' '); ++#endif + + size_t start = std::string::npos; + findModifier(fontName, modStart, "Regular", start); +@@ -1120,7 +1136,11 @@ + FcPatternGetInteger(fontSet->fonts[i], FC_INDEX, 0, &faceIndex); + + const std::string sFilePath = reinterpret_cast<char *>(fcFilePath); ++#if 0//ndef __clang__ + if (std::ranges::find(filesToIgnore, sFilePath) == filesToIgnore.end()) { ++#else ++ if (std::find(filesToIgnore.begin(), filesToIgnore.end(), sFilePath) == filesToIgnore.end()) { ++#endif + return FamilyStyleFontSearchResult(sFilePath, faceIndex); + } + } +--- poppler/poppler/Catalog.cc.orig 2025-01-09 17:19:48.592089218 +0100 ++++ poppler/poppler/Catalog.cc 2025-01-09 17:19:36.361030948 +0100 +@@ -705,7 +705,11 @@ + RefRecursionChecker seen; + parse(tree, seen); + if (!entries.empty()) { ++#if 0//ndef __clang__ + std::ranges::sort(entries, [](const auto &first, const auto &second) { return first->name.cmp(&second->name) < 0; }); ++#else ++ std::sort(entries.begin(), entries.end(), [](const auto &first, const auto &second) { return first->name.cmp(&second->name) < 0; }); ++#endif + } + } + +@@ -754,7 +758,11 @@ + + Object NameTree::lookup(const GooString *name) + { ++#if 0//ndef __clang__ + auto entry = std::ranges::lower_bound(entries, name, EntryGooStringComparer {}); ++#else ++ auto entry = std::lower_bound(entries.begin(), entries.end(), name, [](const auto &element, const GooString *n) { return element->name.cmp(n) < 0; }); ++#endif + + if (entry != entries.end() && (*entry)->name.cmp(name) == 0) { + return (*entry)->value.fetch(xref); +--- poppler/poppler/GfxFont.cc.orig2 2025-01-09 17:26:15.227421640 +0100 ++++ poppler/poppler/GfxFont.cc 2025-01-09 17:27:06.930929833 +0100 +@@ -1868,7 +1868,11 @@ + ++i; + } + } ++#if 0//ndef __clang__ + std::ranges::sort(widths.exceps, cmpWidthExcepFunctor()); ++#else ++ std::sort(widths.exceps.begin(), widths.exceps.end(), cmpWidthExcepFunctor()); ++#endif + } + + // default metrics for vertical font +@@ -1916,7 +1920,11 @@ + ++i; + } + } ++#if 0//ndef __clang__ + std::ranges::sort(widths.excepsV, cmpWidthExcepVFunctor()); ++#else ++ std::sort(widths.excepsV.begin(), widths.excepsV.end(), cmpWidthExcepVFunctor()); ++#endif + } + + ok = true; +--- poppler/poppler/Gfx.cc.orig 2025-01-09 17:31:05.423273919 +0100 ++++ poppler/poppler/Gfx.cc 2025-01-09 17:31:07.340292763 +0100 +@@ -2545,7 +2545,11 @@ + bboxIntersections[1] = ((xMin - x0) * dx + (yMax - y0) * dy) * mul; + bboxIntersections[2] = ((xMax - x0) * dx + (yMin - y0) * dy) * mul; + bboxIntersections[3] = ((xMax - x0) * dx + (yMax - y0) * dy) * mul; ++#if 0//ndef __clang__ + std::ranges::sort(bboxIntersections); ++#else ++ std::sort(std::begin(bboxIntersections), std::end(bboxIntersections)); ++#endif + tMin = bboxIntersections[0]; + tMax = bboxIntersections[3]; + if (tMin < 0 && !shading->getExtend0()) { +@@ -2646,7 +2650,11 @@ + s[1] = (yMax - ty) / dx; + s[2] = (xMin - tx) / -dy; + s[3] = (xMax - tx) / -dy; ++#if 0//ndef __clang__ + std::ranges::sort(s); ++#else ++ std::sort(std::begin(s), std::end(s)); ++#endif + sMin = s[1]; + sMax = s[2]; + } +@@ -2787,7 +2795,11 @@ + s[1] = (yMax - ty) / dx; + s[2] = (xMin - tx) / -dy; + s[3] = (xMax - tx) / -dy; ++#if 0//ndef __clang__ + std::ranges::sort(s); ++#else ++ std::sort(std::begin(s), std::end(s)); ++#endif + sMin = s[1]; + sMax = s[2]; + } +--- poppler/poppler/TextOutputDev.cc.orig 2025-01-09 17:37:28.163110149 +0100 ++++ poppler/poppler/TextOutputDev.cc 2025-01-09 17:36:48.827864411 +0100 +@@ -4574,7 +4574,11 @@ + if (!words.empty()) { + // Reverse word order for RTL text. Fixes #53 for glib backend (Evince) + if (!page->primaryLR) { ++#if 0//ndef __clang__ + std::ranges::reverse(words); ++#else ++ std::reverse(words.begin(), words.end()); ++#endif + } + + lines.push_back(std::move(words)); +@@ -5456,7 +5460,11 @@ + for (word = rawWords; word; word = word->next) { + s.clear(); + uText.resize(word->len()); ++#if 0//ndef __clang__ + std::ranges::transform(word->chars, uText.begin(), [](auto &c) { return c.text; }); ++#else ++ std::transform(word->chars.begin(), word->chars.end(), uText.begin(), [](auto &c) { return c.text; }); ++#endif + dumpFragment(uText.data(), uText.size(), uMap, &s); + (*outputFunc)(outputStream, s.c_str(), s.getLength()); + +--- poppler/poppler/PDFDoc.cc.orig 2025-01-09 17:38:49.498598893 +0100 ++++ poppler/poppler/PDFDoc.cc 2025-01-09 17:38:22.459449316 +0100 +@@ -596,7 +596,11 @@ + if (fw->getType() == formSignature) { + assert(fw->getField()->getType() == formSignature); + FormFieldSignature *ffs = static_cast<FormFieldSignature *>(fw->getField()); ++#if 0//ndef __clang__ + if (std::ranges::find(res, ffs) == res.end()) { ++#else ++ if (std::find(res.begin(), res.end(), ffs) == res.end()) { ++#endif + res.push_back(ffs); + } + } +--- poppler/poppler/Annot.cc.orig 2025-01-09 17:40:31.125125064 +0100 ++++ poppler/poppler/Annot.cc 2025-01-09 17:40:14.021036519 +0100 +@@ -7499,7 +7499,11 @@ + + bool Annots::removeAnnot(Annot *annot) + { ++#if 0//ndef __clang__ + auto idx = std::ranges::find(annots, annot); ++#else ++ auto idx = std::find(annots.begin(), annots.end(), annot); ++#endif + + if (idx == annots.end()) { + return false; +--- poppler/poppler/Dict.cc.orig 2025-01-09 18:35:56.796874707 +0100 ++++ poppler/poppler/Dict.cc 2025-01-09 18:36:22.159050403 +0100 +@@ -32,7 +32,9 @@ + #include <config.h> + + #include <algorithm> ++#if 0//ndef __clang__ + #include <ranges> ++#endif + + #include "XRef.h" + #include "Dict.h" +--- poppler/poppler/CIDFontsWidthsBuilder.h.orig 2025-01-09 18:37:58.541718087 +0100 ++++ poppler/poppler/CIDFontsWidthsBuilder.h 2025-01-09 18:38:02.766747356 +0100 +@@ -15,7 +15,9 @@ + #include <vector> + #include <variant> + #include <algorithm> ++#if 0//ndef __clang__ + #include <ranges> ++#endif + #include <cassert> + + /** Class to help build the widths array as defined in +--- poppler/poppler/Catalog.cc.orig 2025-01-10 09:09:33.713016092 +0100 ++++ poppler/poppler/Catalog.cc 2025-01-10 09:10:36.719237223 +0100 +@@ -749,12 +749,14 @@ + } + } + ++#if 0//ndef __clang__ + struct EntryGooStringComparer + { + static constexpr const GooString *get(const GooString *string) { return string; }; + static constexpr const GooString *get(const auto &entry) { return &entry->name; } + auto operator()(const auto &lhs, const auto &rhs) { return get(lhs)->cmp(get(rhs)) < 0; } + }; ++#endif + + Object NameTree::lookup(const GooString *name) + { diff --git a/external/poppler/disable-freetype.patch.1 b/external/poppler/disable-freetype.patch.1 index 5d7426242c35..211214eebb3e 100644 --- a/external/poppler/disable-freetype.patch.1 +++ b/external/poppler/disable-freetype.patch.1 @@ -8,16 +8,17 @@ disable freetype dependent code #include <cctype> -#include "goo/ft_utils.h" +//#include "goo/ft_utils.h" - #include "goo/gmem.h" #include "goo/gfile.h" #include "goo/GooString.h" -@@ -78,8 +78,8 @@ + #include "Error.h" +@@ -78,9 +78,9 @@ #include "fofi/FoFiTrueType.h" #include "fofi/FoFiIdentifier.h" -#include <ft2build.h> --#include FT_FREETYPE_H +//#include <ft2build.h> + #include <variant> +-#include FT_FREETYPE_H +//#include FT_FREETYPE_H #include <unordered_set> diff --git a/external/poppler/disable-nss-and-gpgmepp.patch.1 b/external/poppler/disable-nss-and-gpgmepp.patch.1 deleted file mode 100644 index 1fc9ede6035c..000000000000 --- a/external/poppler/disable-nss-and-gpgmepp.patch.1 +++ /dev/null @@ -1,103 +0,0 @@ -disable NSS/GPGMEPP dependent code. - ---- poppler/poppler/Form.cc.orig 2023-06-05 19:29:14.000000000 +0900 -+++ poppler/poppler/Form.cc 2023-06-17 16:51:27.873431500 +0900 -@@ -64,7 +64,7 @@ - #include "Form.h" - #include "PDFDoc.h" - #include "DateInfo.h" --#include "CryptoSignBackend.h" -+/*#include "CryptoSignBackend.h"*/ - #include "SignatureInfo.h" - #include "CertificateInfo.h" - #include "XRef.h" -@@ -584,7 +584,7 @@ - { - return static_cast<FormFieldSignature *>(field)->validateSignatureResult(); - } -- -+#if 0 - // update hash with the specified range of data from the file - static bool hashFileRange(FILE *f, CryptoSign::SigningInterface *handler, Goffset start, Goffset end) - { -@@ -608,10 +608,12 @@ - delete[] buf; - return true; - } -+#endif - - bool FormWidgetSignature::signDocument(const std::string &saveFilename, const std::string &certNickname, const std::string &password, const GooString *reason, const GooString *location, const std::optional<GooString> &ownerPassword, - const std::optional<GooString> &userPassword) - { -+#if 0 - auto backend = CryptoSign::Factory::createActive(); - if (!backend) { - return false; -@@ -697,8 +699,8 @@ - signatureField->setSignature(*signature); - - fclose(file); -- -- return true; -+#endif -+ return false; - } - - static std::tuple<double, double> calculateDxDy(int rot, const PDFRectangle *rect) -@@ -2355,6 +2357,7 @@ - - void FormFieldSignature::hashSignedDataBlock(CryptoSign::VerificationInterface *handler, Goffset block_len) - { -+#if 0 - if (!handler) { - return; - } -@@ -2374,6 +2377,7 @@ - i += BLOCK_SIZE; - } - } -+#endif - } - - FormSignatureType FormWidgetSignature::signatureType() const -@@ -2395,6 +2399,7 @@ - - SignatureInfo *FormFieldSignature::validateSignatureAsync(bool doVerifyCert, bool forceRevalidation, time_t validationTime, bool ocspRevocationCheck, bool enableAIA, const std::function<void()> &doneCallback) - { -+#if 0 - auto backend = CryptoSign::Factory::createActive(); - if (!backend) { - if (doneCallback) { -@@ -2497,6 +2502,7 @@ - - signature_handler->validateCertificateAsync(std::chrono::system_clock::from_time_t(validationTime), ocspRevocationCheck, enableAIA, doneCallback); - -+#endif - return signature_info; - } - -@@ -2508,10 +2508,13 @@ - - CertificateValidationStatus FormFieldSignature::validateSignatureResult() - { -+#if 0 - if (!signature_handler) { - return CERTIFICATE_GENERIC_ERROR; - } - return signature_handler->validateCertificateResult(); -+#endif -+ return CERTIFICATE_GENERIC_ERROR; - } - - std::vector<Goffset> FormFieldSignature::getSignedRangeBounds() const - ---- poppler/poppler/Form.h 2024-05-13 10:18:04.303912457 +0200 -+++ poppler/poppler/Form.h 2024-05-13 11:41:51.547002511 +0200 -@@ -669,7 +669,6 @@ - double customAppearanceLeftFontSize = 20; - Ref imageResource = Ref::INVALID(); - std::unique_ptr<X509CertificateInfo> certificate_info; -- std::unique_ptr<CryptoSign::VerificationInterface> signature_handler; - - void print(int indent) override; - }; diff --git a/external/poppler/gcc7-EntityInfo.patch.1 b/external/poppler/gcc7-EntityInfo.patch.1 index 1dd7c83ad475..3bf3894937a6 100644 --- a/external/poppler/gcc7-EntityInfo.patch.1 +++ b/external/poppler/gcc7-EntityInfo.patch.1 @@ -40,8 +40,8 @@ workdir/UnpackedTarball/poppler/poppler/CertificateInfo.h:58:24: note: ‘X509Ce -GfxFontLoc &GfxFontLoc::operator=(GfxFontLoc &&other) noexcept = default; +GfxFontLoc &GfxFontLoc::operator=(GfxFontLoc &&other) /*noexcept*/ = default; - void GfxFontLoc::setPath(GooString *pathA) - { + //------------------------------------------------------------------------ + // GfxFont --- poppler/poppler/GfxFont.h.orig 2022-09-14 20:24:30.784608340 +0200 +++ poppler/poppler/GfxFont.h 2022-09-14 20:25:08.850586861 +0200 @@ -124,7 +124,7 @@ @@ -51,5 +51,5 @@ workdir/UnpackedTarball/poppler/poppler/CertificateInfo.h:58:24: note: ‘X509Ce - GfxFontLoc &operator=(GfxFontLoc &&other) noexcept; + GfxFontLoc &operator=(GfxFontLoc &&other) /*noexcept*/; - // Set the 'path' string from a GooString on the heap. - // Ownership of the object is taken. + GfxFontLocType locType; + GfxFontType fontType; diff --git a/external/poppler/gcc7-GfxFont.patch.1 b/external/poppler/gcc7-GfxFont.patch.1 index e73dbeb201c1..0d0d3e0ae3c1 100644 --- a/external/poppler/gcc7-GfxFont.patch.1 +++ b/external/poppler/gcc7-GfxFont.patch.1 @@ -58,7 +58,7 @@ index cc2ce038..b0d0d610 100644 //----- external font file (fontFile, fontDir) @@ -708,7 +708,7 @@ std::optional<GfxFontLoc> GfxFont::locateFont(XRef *xref, PSOutputDev *ps) fontLoc.fontType = fontCIDType2; - fontLoc.setPath(path); + fontLoc.path = *path; fontLoc.fontNum = fontNum; - return fontLoc; + return std::move(fontLoc); // std::move only required to please g++-7 @@ -72,8 +72,8 @@ index cc2ce038..b0d0d610 100644 - return fontLoc; + return std::move(fontLoc); // std::move only required to please g++-7 } - delete path; } + @@ -749,7 +749,7 @@ std::optional<GfxFontLoc> GfxFont::locateFont(XRef *xref, PSOutputDev *ps) fontLoc.fontType = fontType1; fontLoc.path = substName; @@ -86,7 +86,7 @@ index cc2ce038..b0d0d610 100644 @@ -811,7 +811,7 @@ std::optional<GfxFontLoc> GfxFont::getExternalFont(GooString *path, bool cid) fontLoc.locType = gfxFontLocExternal; fontLoc.fontType = fontType; - fontLoc.setPath(path); + fontLoc.path = path; - return fontLoc; + return std::move(fontLoc); // std::move only required to please g++-7 } diff --git a/external/poppler/poppler-config.patch.1 b/external/poppler/poppler-config.patch.1 index e2163319fd43..a12fb0107098 100644 --- a/external/poppler/poppler-config.patch.1 +++ b/external/poppler/poppler-config.patch.1 @@ -29,7 +29,7 @@ index 0fbd336a..451213f8 100644 +/* #undef ENABLE_LIBOPENJPEG */ + +/* Build against libtiff. */ -+/* #define ENABLE_LIBTIFF 1 */ ++/* #undef ENABLE_LIBTIFF */ + +/* Build against libpng. */ +/* #define ENABLE_LIBPNG 1 */ @@ -41,16 +41,16 @@ index 0fbd336a..451213f8 100644 +/* #undef ENABLE_ZLIB_UNCOMPRESS */ + +/* Build against libnss3 for digital signature validation */ -+/* #define ENABLE_NSS3 1 */ ++/* #undef ENABLE_NSS3 */ + +/* Build against libgpgme for digital signature validation */ +/* #undef ENABLE_GPGME */ + +/* Signatures enabled */ -+/* #define ENABLE_SIGNATURES 1 */ ++/* #undef ENABLE_SIGNATURES */ + +/* Default signature backend */ -+/* #define DEFAULT_SIGNATURE_BACKEND "NSS" */ ++#define DEFAULT_SIGNATURE_BACKEND "None" + +/* Use cairo for rendering. */ +/* #define HAVE_CAIRO 1 */ @@ -179,7 +179,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_NAME "poppler" + +/* Define to the full name and version of this package. */ -+#define PACKAGE_STRING "poppler 24.06.0" ++#define PACKAGE_STRING "poppler 25.01.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "poppler" @@ -188,7 +188,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_URL "" + +/* Define to the version of this package. */ -+#define PACKAGE_VERSION "24.06.0" ++#define PACKAGE_VERSION "25.01.0" + +/* Poppler data dir */ +#define POPPLER_DATADIR "/usr/local/share/poppler" @@ -206,7 +206,7 @@ index 0fbd336a..451213f8 100644 +/* #undef USE_FLOAT */ + +/* Version number of package */ -+#define VERSION "24.06.0" ++#define VERSION "25.01.0" + +#if defined(__APPLE__) +#elif defined (_WIN32) @@ -290,7 +290,7 @@ index 0fbd336a..451213f8 100644 + +/* Defines the poppler version. */ +#ifndef POPPLER_VERSION -+#define POPPLER_VERSION "24.06.0" ++#define POPPLER_VERSION "25.01.0" +#endif + +/* Use single precision arithmetic in the Splash backend */ @@ -320,7 +320,7 @@ index 0fbd336a..451213f8 100644 + +/* Build against libtiff. */ +#ifndef ENABLE_LIBTIFF -+/* #define ENABLE_LIBTIFF 1 */ ++/* #undef ENABLE_LIBTIFF */ +#endif + +/* Build against libpng. */ @@ -377,7 +377,7 @@ index 0fbd336a..451213f8 100644 +//------------------------------------------------------------------------ + +// copyright notice -+#define popplerCopyright "Copyright 2005-2023 The Poppler Developers - http://poppler.freedesktop.org" ++#define popplerCopyright "Copyright 2005-2025 The Poppler Developers - http://poppler.freedesktop.org" +#define xpdfCopyright "Copyright 1996-2011, 2022 Glyph & Cog, LLC" + +//------------------------------------------------------------------------ @@ -437,9 +437,9 @@ index 0fbd336a..451213f8 100644 + +#include "poppler-global.h" + -+#define POPPLER_VERSION "24.06.0" -+#define POPPLER_VERSION_MAJOR 24 -+#define POPPLER_VERSION_MINOR 6 ++#define POPPLER_VERSION "25.01.0" ++#define POPPLER_VERSION_MAJOR 25 ++#define POPPLER_VERSION_MINOR 1 +#define POPPLER_VERSION_MICRO 0 + +namespace poppler diff --git a/external/poppler/std_numbers.patch.1 b/external/poppler/std_numbers.patch.1 new file mode 100644 index 000000000000..38a23b7a6dc0 --- /dev/null +++ b/external/poppler/std_numbers.patch.1 @@ -0,0 +1,30 @@ +remove C++20 std::numbers + +--- poppler/poppler/Annot.cc.orig 2025-01-09 17:42:27.108725610 +0100 ++++ poppler/poppler/Annot.cc 2025-01-09 17:44:32.213373330 +0100 +@@ -70,7 +70,6 @@ + #include <cstdlib> + #include <cmath> + #include <cassert> +-#include <numbers> + #include "goo/gmem.h" + #include "goo/gstrtod.h" + #include "Error.h" +@@ -1762,7 +1762,7 @@ + { + double r2; + +- r2 = r / std::numbers::sqrt2; ++ r2 = r / sqrt(2.0); + appearBuf->appendf("{0:.2f} {1:.2f} m ", cx + r2, cy + r2); + appearBuf->appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c ", cx + (1 - bezierCircle) * r2, cy + (1 + bezierCircle) * r2, cx - (1 - bezierCircle) * r2, cy + (1 + bezierCircle) * r2, cx - r2, cy + r2); + appearBuf->appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c ", cx - (1 + bezierCircle) * r2, cy + (1 - bezierCircle) * r2, cx - (1 + bezierCircle) * r2, cy - (1 - bezierCircle) * r2, cx - r2, cy - r2); +@@ -1775,7 +1775,7 @@ + { + double r2; + +- r2 = r / std::numbers::sqrt2; ++ r2 = r / sqrt(2.0); + appearBuf->appendf("{0:.2f} {1:.2f} m ", cx - r2, cy - r2); + appearBuf->appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c ", cx - (1 - bezierCircle) * r2, cy - (1 + bezierCircle) * r2, cx + (1 - bezierCircle) * r2, cy - (1 + bezierCircle) * r2, cx + r2, cy - r2); + appearBuf->appendf("{0:.2f} {1:.2f} {2:.2f} {3:.2f} {4:.2f} {5:.2f} c ", cx + (1 + bezierCircle) * r2, cy - (1 - bezierCircle) * r2, cx + (1 + bezierCircle) * r2, cy + (1 - bezierCircle) * r2, cx + r2, cy + r2); diff --git a/external/poppler/std_span.patch.1 b/external/poppler/std_span.patch.1 index 37516afd5f03..c61f1269a876 100644 --- a/external/poppler/std_span.patch.1 +++ b/external/poppler/std_span.patch.1 @@ -36,3 +36,15 @@ replace C++20 std::span with o3tl::span #include "FoFiBase.h" #include "poppler_private_export.h" +--- poppler/poppler/UnicodeMap.h.orig 2025-01-09 15:49:23.405887878 +0100 ++++ poppler/poppler/UnicodeMap.h 2025-01-09 15:49:15.094853934 +0100 +@@ -38,7 +38,8 @@ + #include <string> + #include <vector> + #include <variant> +-#include <span> ++#include <o3tl/span.hxx> ++namespace std { using o3tl::span; } + + //------------------------------------------------------------------------ + diff --git a/external/poppler/std_string.patch.1 b/external/poppler/std_string.patch.1 index 02a7940b8e40..3c3ef6dcf564 100644 --- a/external/poppler/std_string.patch.1 +++ b/external/poppler/std_string.patch.1 @@ -53,17 +53,6 @@ remove C++20 starts_with // for now we only support ttf, ttc, otf fonts return false; } ---- poppler/poppler/GfxFont.cc.orig 2025-01-09 11:26:07.863484064 +0100 -+++ poppler/poppler/GfxFont.cc 2025-01-09 11:31:47.164550059 +0100 -@@ -1252,7 +1252,7 @@ - - // pass 1: use the name-to-Unicode mapping table - missing = hex = false; -- bool isZapfDingbats = name && name->ends_with("ZapfDingbats"); -+ bool isZapfDingbats = name && GooString::endsWith(*name, "ZapfDingbats"); - for (int code = 0; code < 256; ++code) { - if ((charName = enc[code])) { - if (isZapfDingbats) { --- poppler/poppler/Form.cc.orig2 2025-01-09 11:33:42.284911742 +0100 +++ poppler/poppler/Form.cc 2025-01-09 11:34:46.013111945 +0100 @@ -2818,7 +2818,7 @@ @@ -86,3 +75,36 @@ remove C++20 starts_with i = 3; step = 2; } else { +--- poppler/poppler/GfxFont.cc.orig2 2025-01-09 15:28:44.912394819 +0100 ++++ poppler/poppler/GfxFont.cc 2025-01-09 15:29:01.903477753 +0100 +@@ -1085,7 +1085,7 @@ + baseEnc = nullptr; + baseEncFromFontFile = false; + obj1 = fontDict->lookup("Encoding"); +- bool isZapfDingbats = name && name->ends_with("ZapfDingbats"); ++ bool isZapfDingbats = name && GooString::endsWith(*name, "ZapfDingbats"); + if (isZapfDingbats) { + baseEnc = zapfDingbatsEncoding; + hasEncoding = true; +--- poppler/poppler/UTF.h.orig2 2025-01-09 15:46:59.275299177 +0100 ++++ poppler/poppler/UTF.h 2025-01-09 15:47:32.502434901 +0100 +@@ -74,7 +74,7 @@ + // check whether string starts with Big-Endian byte order mark and string length is even + inline bool hasUnicodeByteOrderMarkAndLengthIsEven(const std::string &s) + { +- return s.starts_with(unicodeByteOrderMark) && s.length() % 2 == 0; ++ return hasUnicodeByteOrderMark(s) && s.length() % 2 == 0; + } + + // is a unicode whitespace character +--- poppler/poppler/GlobalParamsWin.cc.orig 2025-01-10 09:54:56.256775789 +0100 ++++ poppler/poppler/GlobalParamsWin.cc 2025-01-10 09:55:02.001792823 +0100 +@@ -488,7 +488,7 @@ + path = fontFile->second; + if (substituteFontName) + substituteFontName->Set(path.c_str()); +- if (path.ends_with(".ttc")) { ++ if (GooString::endsWith(path, ".ttc")) { + *type = sysFontTTC; + } else { + *type = sysFontTTF; commit 1cb5da832b36b3b54214667df8d47201ce593b6f Author: Michael Stahl <[email protected]> AuthorDate: Tue Jan 7 18:42:29 2025 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:48 2026 +0100 sdext: adapt xpdfwrapper to poppler 24.12 Change-Id: Ia47edf2ac821e3ef5c40f7582253f894eac74060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179902 Tested-by: Jenkins Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit aa94faf493945e854a888e809a9c5cc8d6d0b978) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179957 Tested-by: Michael Stahl <[email protected]> (cherry picked from commit f85468ee653cf8d0fee6e6afe6c320631cce436f) diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx index 3ad139b65fa3..b0bc1c493a9d 100644 --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx @@ -1037,7 +1037,12 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str, int bitsPerComponent = 1; StreamColorSpaceMode csMode = streamCSNone; +#if POPPLER_CHECK_VERSION(24, 12, 0) + bool hasAlpha; + str->getImageParams( &bitsPerComponent, &csMode, &hasAlpha ); +#else str->getImageParams( &bitsPerComponent, &csMode ); +#endif if( bitsPerComponent == 1 && (csMode == streamCSNone || csMode == streamCSDeviceGray) ) { GfxRGB oneColor = { dblToCol( 1.0 ), dblToCol( 1.0 ), dblToCol( 1.0 ) }; commit 9875af14ef5826b32ce4e09bf88c80571651d5d7 Author: Taichi Haradaguchi <[email protected]> AuthorDate: Fri Aug 9 05:50:39 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:48 2026 +0100 poppler: upgrade to release 24.08.0 Fixes CVE-2024-6239 Downloaded from https://poppler.freedesktop.org/poppler-24.08.0.tar.xz Change-Id: I70373c367cc3da87d9847c00b02a17f514b52ae8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171667 Tested-by: Jenkins Reviewed-by: Taichi Haradaguchi <[email protected]> (cherry picked from commit e266da95e0522fd9896f92f1c2ca3235e0e6fd66) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172951 Reviewed-by: Xisco Fauli <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173040 (cherry picked from commit e79a53b37d7157b7991eb27b3f440028ca06feea) (cherry picked from commit 8b4687eb81e8413469f4a968be2d4b2a279d5195) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180030 Tested-by: allotropia jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 58d93d6e4334b750723767b751705e00b9dd510c) diff --git a/download.lst b/download.lst index f968e1e5233d..236a137eb8ae 100644 --- a/download.lst +++ b/download.lst @@ -522,8 +522,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := 0cdabd495cada11f6ee9e75c793f80daf46367b66c25a63ee8c26d0f9ec40c76 -POPPLER_TARBALL := poppler-24.06.0.tar.xz +POPPLER_SHA256SUM := 97453fbddf0c9a9eafa0ea45ac710d3d49bcf23a62e864585385d3c0b4403174 +POPPLER_TARBALL := poppler-24.08.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines diff --git a/external/poppler/gcc7-GfxFont.patch.1 b/external/poppler/gcc7-GfxFont.patch.1 index a240b1b8bad2..e73dbeb201c1 100644 --- a/external/poppler/gcc7-GfxFont.patch.1 +++ b/external/poppler/gcc7-GfxFont.patch.1 @@ -41,7 +41,7 @@ index cc2ce038..b0d0d610 100644 @@ -668,7 +668,7 @@ std::optional<GfxFontLoc> GfxFont::locateFont(XRef *xref, PSOutputDev *ps) fontLoc.locType = gfxFontLocResident; fontLoc.fontType = fontType1; - fontLoc.path = *name; + fontLoc.path = name.value_or(std::string()); - return fontLoc; + return std::move(fontLoc); // std::move only required to please g++-7 } diff --git a/external/poppler/std_span.patch.1 b/external/poppler/std_span.patch.1 index 1ed550daa3a4..37516afd5f03 100644 --- a/external/poppler/std_span.patch.1 +++ b/external/poppler/std_span.patch.1 @@ -24,3 +24,15 @@ replace C++20 std::span with o3tl::span #include "CharTypes.h" #include "poppler_private_export.h" +--- poppler/fofi/FoFiTrueType.h.orig 2025-01-09 14:58:33.689388042 +0100 ++++ poppler/fofi/FoFiTrueType.h 2025-01-09 14:58:35.674394746 +0100 +@@ -35,7 +35,8 @@ + #include <vector> + #include <unordered_map> + #include <string> +-#include <span> ++#include <o3tl/span.hxx> ++namespace std { using o3tl::span; } + #include "FoFiBase.h" + #include "poppler_private_export.h" + diff --git a/include/o3tl/span.hxx b/include/o3tl/span.hxx index 6cf718a1a120..b7c9fc58389c 100644 --- a/include/o3tl/span.hxx +++ b/include/o3tl/span.hxx @@ -24,6 +24,7 @@ namespace o3tl { using std::span; } #include <cassert> #include <cstddef> +#include <array> #include <iterator> #include <type_traits> #include <vector> @@ -60,6 +61,10 @@ public: assert(a != nullptr || len == 0); } + template<typename T2, std::size_t Size> + constexpr span(const std::array<T2, Size>& arr) + : data_(const_cast<T*>(arr.data())), size_(arr.size()) {} + template<typename T2> constexpr span(const std::vector<T2>& vec) : data_(const_cast<T*>(vec.data())), size_(vec.size()) {} commit e496fac1e8cf8f00489a89a1be75d87009b5a7b9 Author: Xisco Fauli <[email protected]> AuthorDate: Mon Jun 10 16:49:29 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Jan 28 12:57:48 2026 +0100 poppler: Upgrade to 24.06.0 Downloaded from https://poppler.freedesktop.org/poppler-24.06.0.tar.xz Change-Id: I6b679ae014edd7a9897eed39a6e91c63251cc016 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168642 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173039 Reviewed-by: Taichi Haradaguchi <[email protected]> (cherry picked from commit cec9dd0f6f961f39072795c27ec90994587c5369) (cherry picked from commit 2728df128681088e579f38792248eb932b74f8b8) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180011 Tested-by: Michael Stahl <[email protected]> Reviewed-by: Michael Stahl <[email protected]> (cherry picked from commit 2452c7182a839e793b6a6d99b2a0ae4b73429dde) diff --git a/download.lst b/download.lst index 3300d9a1ac5d..f968e1e5233d 100644 --- a/download.lst +++ b/download.lst @@ -522,8 +522,8 @@ LIBTIFF_TARBALL := tiff-4.7.1.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -POPPLER_SHA256SUM := d8c5eb30b50285ad9f0af8c6335cc2d3b9597fca475cbc2598a5479fa379f779 -POPPLER_TARBALL := poppler-24.05.0.tar.xz +POPPLER_SHA256SUM := 0cdabd495cada11f6ee9e75c793f80daf46367b66c25a63ee8c26d0f9ec40c76 +POPPLER_TARBALL := poppler-24.06.0.tar.xz POPPLER_DATA_SHA256SUM := c835b640a40ce357e1b83666aabd95edffa24ddddd49b8daff63adb851cdab74 POPPLER_DATA_TARBALL := poppler-data-0.4.12.tar.gz # three static lines diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk index a60e7521ac87..3edb6e068f79 100644 --- a/external/poppler/UnpackedTarball_poppler.mk +++ b/external/poppler/UnpackedTarball_poppler.mk @@ -20,6 +20,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,poppler,\ external/poppler/gcc7-GfxFont.patch.1 \ external/poppler/std_charconv.patch.1 \ external/poppler/std_string.patch.1 \ + external/poppler/std_span.patch.1 \ external/poppler/poppler-config.patch.1 \ external/poppler/pch.patch.0 \ )) diff --git a/external/poppler/poppler-config.patch.1 b/external/poppler/poppler-config.patch.1 index 8f71e987b2b9..e2163319fd43 100644 --- a/external/poppler/poppler-config.patch.1 +++ b/external/poppler/poppler-config.patch.1 @@ -179,7 +179,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_NAME "poppler" + +/* Define to the full name and version of this package. */ -+#define PACKAGE_STRING "poppler 23.09.0" ++#define PACKAGE_STRING "poppler 24.06.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "poppler" @@ -188,7 +188,7 @@ index 0fbd336a..451213f8 100644 +#define PACKAGE_URL "" + +/* Define to the version of this package. */ -+#define PACKAGE_VERSION "23.09.0" ++#define PACKAGE_VERSION "24.06.0" + +/* Poppler data dir */ +#define POPPLER_DATADIR "/usr/local/share/poppler" @@ -206,7 +206,7 @@ index 0fbd336a..451213f8 100644 +/* #undef USE_FLOAT */ + +/* Version number of package */ -+#define VERSION "23.09.0" ++#define VERSION "24.06.0" + +#if defined(__APPLE__) +#elif defined (_WIN32) @@ -290,7 +290,7 @@ index 0fbd336a..451213f8 100644 + +/* Defines the poppler version. */ +#ifndef POPPLER_VERSION -+#define POPPLER_VERSION "23.09.0" ++#define POPPLER_VERSION "24.06.0" +#endif + +/* Use single precision arithmetic in the Splash backend */ @@ -437,9 +437,9 @@ index 0fbd336a..451213f8 100644 + +#include "poppler-global.h" + -+#define POPPLER_VERSION "23.09.0" -+#define POPPLER_VERSION_MAJOR 23 -+#define POPPLER_VERSION_MINOR 9 ++#define POPPLER_VERSION "24.06.0" ++#define POPPLER_VERSION_MAJOR 24 ++#define POPPLER_VERSION_MINOR 6 +#define POPPLER_VERSION_MICRO 0 + +namespace poppler diff --git a/external/poppler/std_span.patch.1 b/external/poppler/std_span.patch.1 new file mode 100644 index 000000000000..1ed550daa3a4 --- /dev/null +++ b/external/poppler/std_span.patch.1 @@ -0,0 +1,26 @@ +replace C++20 std::span with o3tl::span + +--- poppler/poppler/Stream.h.orig 2025-01-09 11:50:21.095027459 +0100 ++++ poppler/poppler/Stream.h 2025-01-09 11:53:05.933540760 +0100 +@@ -47,7 +47,8 @@ + #include <atomic> + #include <cstdio> + #include <vector> +-#include <span> ++#include <o3tl/span.hxx> ++namespace std { using o3tl::span; } + + #include "poppler-config.h" + #include "poppler_private_export.h" +--- poppler/poppler/UTF.h.orig2 2025-01-09 11:48:18.197644776 +0100 ++++ poppler/poppler/UTF.h 2025-01-09 11:53:11.688558686 +0100 +@@ -23,7 +23,8 @@ + #include <climits> + #include <string> + #include <vector> +-#include <span> ++#include <o3tl/span.hxx> ++namespace std { using o3tl::span; } + + #include "CharTypes.h" + #include "poppler_private_export.h" diff --git a/external/poppler/std_string.patch.1 b/external/poppler/std_string.patch.1 index 6c5ce136ca47..02a7940b8e40 100644 --- a/external/poppler/std_string.patch.1 +++ b/external/poppler/std_string.patch.1 @@ -75,3 +75,14 @@ remove C++20 starts_with const Object fontObj = fontDict->getVal(i); if (fontObj.isDict() && fontObj.dictIs("Font")) { const Object fontBaseFontObj = fontObj.dictLookup("BaseFont"); +--- poppler/poppler/PSOutputDev.cc.orig 2025-01-09 12:21:50.100540341 +0100 ++++ poppler/poppler/PSOutputDev.cc 2025-01-09 12:21:52.004545519 +0100 +@@ -7482,7 +7482,7 @@ + // for the keyword, which was emitted by the caller) + // - lines that start with a left paren are treated as <text> + // instead of <textline>, so we escape a leading paren +- if (s.starts_with(unicodeByteOrderMark)) { ++ if (GooString::startsWith(s, unicodeByteOrderMark)) { + i = 3; + step = 2; + } else { diff --git a/include/o3tl/span.hxx b/include/o3tl/span.hxx index cfe4c1ffa3a3..6cf718a1a120 100644 --- a/include/o3tl/span.hxx +++ b/include/o3tl/span.hxx @@ -35,6 +35,7 @@ namespace o3tl { template<typename T> class span { public: + using element_type = T; using value_type = T; using pointer = value_type *; using const_pointer = value_type const *; @@ -61,7 +62,7 @@ public: template<typename T2> constexpr span(const std::vector<T2>& vec) -e ... etc. - the rest is truncated
