download.lst                                                            |    4 
 external/poppler/0001-Revert-Remove-gdir-we-have-std-filesystem.patch.1 |  503 
++++++++++
 external/poppler/UnpackedTarball_poppler.mk                             |    2 
 external/poppler/clang-std-ranges.patch.1                               |   49 
 external/poppler/std_optional.patch.1                                   |   13 
 external/poppler/std_span.patch.1                                       |    2 
 external/poppler/std_string.patch.1                                     |    6 
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx                   |    9 
 sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx                        |   17 
 9 files changed, 589 insertions(+), 16 deletions(-)

New commits:
commit a899becaac0c03a2f3586d7c0245a544e6f307de
Author:     Christian Lohmaier <lohmaier+libreoff...@googlemail.com>
AuthorDate: Tue Apr 22 15:59:23 2025 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Apr 29 15:25:27 2025 +0200

    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 <lohmaier+libreoff...@googlemail.com>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 8cdbe3666440f81aa71539e8d38d5a93eec17b26)

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 77809703689b3407b26c0d39078f03e543b73e8e
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Apr 25 20:37:57 2025 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Tue Apr 29 15:25:18 2025 +0200

    poppler: remove <filesystem> and tweak some optional code
    
    Not supported by baseline GCC
    
    Change-Id: I466814903b2946ce82dcfede1643adad7a714b2f

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 <michael.st...@allotropia.de>
+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 <k...@redhat.com>
++// Copyright (C) 2009, 2011, 2012, 2017, 2018, 2021, 2022 Albert Astals Cid 
<aa...@kde.org>
++// Copyright (C) 2009 Kovid Goyal <ko...@kovidgoyal.net>
++// Copyright (C) 2013 Adam Reichold <adamreich...@myopera.com>
++// Copyright (C) 2013, 2017 Adrian Johnson <ajohn...@redneon.com>
++// Copyright (C) 2014 Bogdan Cristea <crist...@gmail.com>
++// Copyright (C) 2014 Peter Breitenlohner <p...@mppmu.mpg.de>
++// Copyright (C) 2017 Christoph Cullmann <cullm...@kde.org>
++// Copyright (C) 2017 Thomas Freitag <thomas.frei...@alfa.de>
++// Copyright (C) 2018 Mojca Miklavec <mo...@macports.org>
++// Copyright (C) 2019 Christian Persch <c...@src.gnome.org>
++//
++// 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 ff25307363469dcdca8b4ceba6446b5af2d2216c
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Apr 2 16:27:00 2025 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Apr 25 20:05:36 2025 +0200

    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 <xiscofa...@libreoffice.org>
    (cherry picked from commit 4f13305178c1bf88dffceb42ec15d0944b808a5c)

diff --git a/download.lst b/download.lst
index 77489db6a0e6..faf88c42e35f 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 := 
21234cb2a9647d73c752ce4031e65a79d11a511a835f2798284c2497b8701dee
-POPPLER_TARBALL := poppler-25.02.0.tar.xz
+POPPLER_SHA256SUM := 
b010c596dce127fba88532fd2f1043e55ea30601767952d0f2c0a80e7dc0da3d
+POPPLER_TARBALL := poppler-25.04.0.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
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 b5e2873b3858..d9a79e99e3dd 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 5131838a996b..31469688d95f 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
@@ -212,7 +212,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
@@ -250,7 +251,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;
@@ -287,7 +289,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();
@@ -335,7 +339,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;
@@ -369,7 +374,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 43f9fdfb2ef863fa978aa4063c008897c577c28c
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Feb 25 14:09:16 2025 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Apr 25 19:41:30 2025 +0200

    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 <xiscofa...@libreoffice.org>
    Tested-by: Jenkins
    (cherry picked from commit 12c1596b0fd152399bed90f3d26014a32efc24e3)

diff --git a/download.lst b/download.lst
index 4a7181e22d85..77489db6a0e6 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 := 
7eefc122207bbbd72a303c5e0743f4941e8ae861e24dcf0501e18ce1d1414112
-POPPLER_TARBALL := poppler-25.01.0.tar.xz
+POPPLER_SHA256SUM := 
21234cb2a9647d73c752ce4031e65a79d11a511a835f2798284c2497b8701dee
+POPPLER_TARBALL := poppler-25.02.0.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts

Reply via email to