Hi,
fix build with poppler-26.02.0. Should also work with poppler-26.01.0.
While here, remove old chunks for poppler-26.01.0 that break make
patch after the update to gdal-3.12.2.
Ok?
Ciao,
Kili
Index: patches/patch-frmts_pdf_pdfdataset_cpp
===================================================================
RCS file: patches/patch-frmts_pdf_pdfdataset_cpp
diff -N patches/patch-frmts_pdf_pdfdataset_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-frmts_pdf_pdfdataset_cpp 10 Feb 2026 20:49:53 -0000
@@ -0,0 +1,135 @@
+Fix build with poppler-26.02.0.
+
+Upstream commit 831295894d225b7d6098a5b8ccb51d33da52ef0c.
+
+Index: frmts/pdf/pdfdataset.cpp
+--- frmts/pdf/pdfdataset.cpp.orig
++++ frmts/pdf/pdfdataset.cpp
+@@ -38,6 +38,7 @@
+ #include "pdfdrivercore.h"
+
+ #include <algorithm>
++#include <array>
+ #include <cassert>
+ #include <limits>
+ #include <set>
+@@ -93,8 +94,13 @@ class GDALPDFOutputDev final : public SplashOutputDev
+
+ public:
+ GDALPDFOutputDev(SplashColorMode colorModeA, int bitmapRowPadA,
+- bool reverseVideoA, SplashColorPtr paperColorA)
+- : SplashOutputDev(colorModeA, bitmapRowPadA, reverseVideoA,
++ [[maybe_unused]] bool reverseVideoA,
++ SplashColorPtr paperColorA)
++ : SplashOutputDev(colorModeA, bitmapRowPadA,
++#if POPPLER_MAJOR_VERSION < 26 ||
\
++ (POPPLER_MAJOR_VERSION == 26 && POPPLER_MINOR_VERSION < 2)
++ reverseVideoA,
++#endif
+ paperColorA),
+ bEnableVector(TRUE), bEnableText(TRUE), bEnableBitmap(TRUE)
+ {
+@@ -175,10 +181,17 @@ class GDALPDFOutputDev final : public SplashOutputDev
+ }
+ }
+
+- virtual void setSoftMaskFromImageMask(GfxState *state, Object *ref,
+- Stream *str, int width, int height,
+- bool invert, bool inlineImg,
+- double *baseMatrix) override
++#if POPPLER_MAJOR_VERSION > 26 ||
\
++ (POPPLER_MAJOR_VERSION == 26 && POPPLER_MINOR_VERSION >= 2)
++ void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str,
++ int width, int height, bool invert,
++ bool inlineImg,
++ std::array<double, 6> &baseMatrix) override
++#else
++ void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str,
++ int width, int height, bool invert,
++ bool inlineImg, double *baseMatrix) override
++#endif
+ {
+ if (bEnableBitmap)
+ SplashOutputDev::setSoftMaskFromImageMask(
+@@ -187,8 +200,14 @@ class GDALPDFOutputDev final : public SplashOutputDev
+ str->close();
+ }
+
+- virtual void unsetSoftMaskFromImageMask(GfxState *state,
+- double *baseMatrix) override
++#if POPPLER_MAJOR_VERSION > 26 ||
\
++ (POPPLER_MAJOR_VERSION == 26 && POPPLER_MINOR_VERSION >= 2)
++ void unsetSoftMaskFromImageMask(GfxState *state,
++ std::array<double, 6> &baseMatrix)
override
++#else
++ void unsetSoftMaskFromImageMask(GfxState *state,
++ double *baseMatrix) override
++#endif
+ {
+ if (bEnableBitmap)
+ SplashOutputDev::unsetSoftMaskFromImageMask(state, baseMatrix);
+@@ -2458,6 +2477,8 @@ static void PDFFreeDoc(PDFDoc *poDoc)
+ {
+ if (poDoc)
+ {
++#if POPPLER_MAJOR_VERSION < 26 ||
\
++ (POPPLER_MAJOR_VERSION == 26 && POPPLER_MINOR_VERSION < 2)
+ /* hack to avoid potential cross heap issues on Win32 */
+ /* str is the VSIPDFFileStream object passed in the constructor of
+ * PDFDoc */
+@@ -2465,6 +2486,7 @@ static void PDFFreeDoc(PDFDoc *poDoc)
+ // VSIPDFFileStream::FillBuffer() */
+ delete poDoc->str;
+ poDoc->str = nullptr;
++#endif
+
+ delete poDoc;
+ }
+@@ -4635,8 +4657,9 @@ PDFDataset *PDFDataset::Open(GDALOpenInfo *poOpenInfo)
+ if (globalParamsCreatedByGDAL)
+ registerErrorCallback();
+ Object oObj;
+- auto poStream =
+- new VSIPDFFileStream(fp.get(), pszFilename, std::move(oObj));
++ auto poStream = std::make_unique<VSIPDFFileStream>(
++ fp.get(), pszFilename, std::move(oObj));
++ const bool bFoundLinearizedHint = poStream->FoundLinearizedHint();
+ #if POPPLER_MAJOR_VERSION > 22 ||
\
+ (POPPLER_MAJOR_VERSION == 22 && POPPLER_MINOR_VERSION > 2)
+ std::optional<GooString> osUserPwd;
+@@ -4644,8 +4667,14 @@ PDFDataset *PDFDataset::Open(GDALOpenInfo *poOpenInfo)
+ osUserPwd = std::optional<GooString>(pszUserPwd);
+ try
+ {
+- poDocPoppler =
+- new PDFDoc(poStream, std::optional<GooString>(),
osUserPwd);
++#if POPPLER_MAJOR_VERSION > 26 ||
\
++ (POPPLER_MAJOR_VERSION == 26 && POPPLER_MINOR_VERSION >= 2)
++ poDocPoppler = new PDFDoc(
++ std::move(poStream), std::optional<GooString>(),
osUserPwd);
++#else
++ poDocPoppler = new PDFDoc(
++ poStream.release(), std::optional<GooString>(),
osUserPwd);
++#endif
+ }
+ catch (const std::exception &e)
+ {
+@@ -4657,7 +4686,7 @@ PDFDataset *PDFDataset::Open(GDALOpenInfo *poOpenInfo)
+ GooString *poUserPwd = nullptr;
+ if (pszUserPwd)
+ poUserPwd = new GooString(pszUserPwd);
+- poDocPoppler = new PDFDoc(poStream, nullptr, poUserPwd);
++ poDocPoppler = new PDFDoc(poStream.release(), nullptr, poUserPwd);
+ delete poUserPwd;
+ #endif
+ if (globalParamsCreatedByGDAL)
+@@ -4707,8 +4736,7 @@ PDFDataset *PDFDataset::Open(GDALOpenInfo *poOpenInfo)
+ PDFFreeDoc(poDocPoppler);
+ return nullptr;
+ }
+- else if (poDocPoppler->isLinearized() &&
+- !poStream->FoundLinearizedHint())
++ else if (poDocPoppler->isLinearized() && !bFoundLinearizedHint)
+ {
+ // This is a likely defect of poppler Linearization.cc file
that
+ // recognizes a file as linearized if the /Linearized hint is
Index: patches/patch-frmts_pdf_pdfio_cpp
===================================================================
RCS file: /cvs/ports/geo/gdal/patches/patch-frmts_pdf_pdfio_cpp,v
diff -u -p -r1.1 patch-frmts_pdf_pdfio_cpp
--- patches/patch-frmts_pdf_pdfio_cpp 9 Jan 2026 19:53:14 -0000 1.1
+++ patches/patch-frmts_pdf_pdfio_cpp 10 Feb 2026 20:49:53 -0000
@@ -1,28 +1,28 @@
-Fix build with poppler-26.01.0.
+Fix build with poppler-26.02.0.
-See also upstream PR https://github.com/OSGeo/gdal/pull/13664
+Upstream commit 831295894d225b7d6098a5b8ccb51d33da52ef0c.
Index: frmts/pdf/pdfio.cpp
--- frmts/pdf/pdfio.cpp.orig
+++ frmts/pdf/pdfio.cpp
-@@ -252,7 +252,7 @@ int VSIPDFFileStream::lookChar()
+@@ -68,11 +68,20 @@ VSIPDFFileStream::~VSIPDFFileStream()
+ /* copy() */
+ /************************************************************************/
- #if POPPLER_MAJOR_VERSION > 25 ||
\
- (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
--bool VSIPDFFileStream::reset()
-+bool VSIPDFFileStream::rewind()
- #else
- void VSIPDFFileStream::reset()
- #endif
-@@ -274,9 +274,9 @@ void VSIPDFFileStream::reset()
-
- #if POPPLER_MAJOR_VERSION > 25 ||
\
- (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3)
--bool VSIPDFFileStream::unfilteredReset()
-+bool VSIPDFFileStream::unfilteredRewind()
++#if POPPLER_MAJOR_VERSION > 26 ||
\
++ (POPPLER_MAJOR_VERSION == 26 && POPPLER_MINOR_VERSION >= 2)
++std::unique_ptr<BaseStream> VSIPDFFileStream::copy()
++{
++ return std::make_unique<VSIPDFFileStream>(poParent, nStart, bLimited,
++ nLength, dict.copy());
++}
++#else
+ BaseStream *VSIPDFFileStream::copy()
{
-- return reset();
-+ return rewind();
+ return new VSIPDFFileStream(poParent, nStart, bLimited, nLength,
+ dict.copy());
}
- #else
- void VSIPDFFileStream::unfilteredReset()
++#endif
+
+ /************************************************************************/
+ /* makeSubStream() */
Index: patches/patch-frmts_pdf_pdfio_h
===================================================================
RCS file: /cvs/ports/geo/gdal/patches/patch-frmts_pdf_pdfio_h,v
diff -u -p -r1.1 patch-frmts_pdf_pdfio_h
--- patches/patch-frmts_pdf_pdfio_h 9 Jan 2026 19:53:14 -0000 1.1
+++ patches/patch-frmts_pdf_pdfio_h 10 Feb 2026 20:49:53 -0000
@@ -1,34 +1,20 @@
-Fix build with poppler-26.01.0.
+Fix build with poppler-26.02.0.
-See also upstream PR https://github.com/OSGeo/gdal/pull/13664
+Upstream commit 831295894d225b7d6098a5b8ccb51d33da52ef0c.
Index: frmts/pdf/pdfio.h
--- frmts/pdf/pdfio.h.orig
+++ frmts/pdf/pdfio.h
-@@ -57,7 +57,7 @@ class VSIPDFFileStream final : public BaseStream
+@@ -29,7 +29,12 @@ class VSIPDFFileStream final : public BaseStream
+ bool limitedA, vsi_l_offset lengthA, Object &&dictA);
+ ~VSIPDFFileStream() override;
- #if POPPLER_MAJOR_VERSION > 25 ||
\
- (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
-- bool reset() override;
-+ bool rewind() override;
- #else
- void reset() override;
- #endif
-@@ -66,7 +66,7 @@ class VSIPDFFileStream final : public BaseStream
- {
- #if POPPLER_MAJOR_VERSION > 25 ||
\
- (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
-- CPL_IGNORE_RET_VAL(str->reset());
-+ CPL_IGNORE_RET_VAL(str->rewind());
- #else
- str->reset();
- #endif
-@@ -74,7 +74,7 @@ class VSIPDFFileStream final : public BaseStream
++#if POPPLER_MAJOR_VERSION > 26 ||
\
++ (POPPLER_MAJOR_VERSION == 26 && POPPLER_MINOR_VERSION >= 2)
++ std::unique_ptr<BaseStream> copy() override;
++#else
+ BaseStream *copy() override;
++#endif
#if POPPLER_MAJOR_VERSION > 25 ||
\
- (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3)
-- bool unfilteredReset() override;
-+ bool unfilteredRewind() override;
- #else
- void unfilteredReset() override;
- #endif
+ (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 5)
Index: patches/patch-frmts_pdf_pdfobject_cpp
===================================================================
RCS file: patches/patch-frmts_pdf_pdfobject_cpp
diff -N patches/patch-frmts_pdf_pdfobject_cpp
--- patches/patch-frmts_pdf_pdfobject_cpp 9 Jan 2026 19:53:14 -0000
1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,25 +0,0 @@
-Fix build with poppler-26.01.0.
-
-See also upstream PR https://github.com/OSGeo/gdal/pull/13664
-
-Index: frmts/pdf/pdfobject.cpp
---- frmts/pdf/pdfobject.cpp.orig
-+++ frmts/pdf/pdfobject.cpp
-@@ -1411,7 +1411,7 @@ int64_t GDALPDFStreamPoppler::GetLength(int64_t nMaxSi
-
- #if POPPLER_MAJOR_VERSION > 25 ||
\
- (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
-- if (!m_poStream->reset())
-+ if (!m_poStream->rewind())
- return 0;
- #else
- m_poStream->reset();
-@@ -1490,7 +1490,7 @@ int64_t GDALPDFStreamPoppler::GetRawLength()
- auto undecodeStream = m_poStream->getUndecodedStream();
- #if POPPLER_MAJOR_VERSION > 25 ||
\
- (POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
-- if (!undecodeStream->reset())
-+ if (!undecodeStream->rewind())
- return 0;
- #else
- undecodeStream->reset();