download.lst                                     |    4 
 external/poppler/StaticLibrary_poppler.mk        |    2 
 external/poppler/UnpackedTarball_poppler.mk      |    3 
 external/poppler/clang-std-ranges.patch.1        |  394 +++++++++++++++++++++++
 external/poppler/disable-freetype.patch.1        |    7 
 external/poppler/disable-nss-and-gpgmepp.patch.1 |  103 ------
 external/poppler/gcc7-EntityInfo.patch.1         |    8 
 external/poppler/gcc7-GfxFont.patch.1            |    6 
 external/poppler/poppler-config.patch.1          |   26 -
 external/poppler/std_numbers.patch.1             |   30 +
 external/poppler/std_span.patch.1                |   12 
 external/poppler/std_string.patch.1              |   44 +-
 12 files changed, 499 insertions(+), 140 deletions(-)

New commits:
commit be6774fd28da7aab58647c9f0f869c92ce4425ef
Author:     Michael Stahl <[email protected]>
AuthorDate: Tue Jan 7 18:45:34 2025 +0100
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Jan 10 10:46:51 2025 +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]>

diff --git a/download.lst b/download.lst
index 07f70423dd15..4c390281ef25 100644
--- a/download.lst
+++ b/download.lst
@@ -470,8 +470,8 @@ LIBPNG_TARBALL := libpng-1.6.44.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
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/poppler/StaticLibrary_poppler.mk 
b/external/poppler/StaticLibrary_poppler.mk
index 20cb4001d196..d8e722fb9c3d 100644
--- a/external/poppler/StaticLibrary_poppler.mk
+++ b/external/poppler/StaticLibrary_poppler.mk
@@ -19,6 +19,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 \
@@ -86,6 +87,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 382e2e0f1d5f..4b92ef93be26 100644
--- a/external/poppler/UnpackedTarball_poppler.mk
+++ b/external/poppler/UnpackedTarball_poppler.mk
@@ -13,12 +13,13 @@ $(eval $(call 
gb_UnpackedTarball_set_tarball,poppler,$(POPPLER_TARBALL),,poppler
 
 $(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 \
 ))
 
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;

Reply via email to