Skip to content

Commit f357d91

Browse files
authored
Merge pull request #11936 from OSGeo/backport-11935-to-release/3.10
[Backport release/3.10] Fix warnings when building against Poppler 25.03.00
2 parents 1b71303 + 480af71 commit f357d91

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

frmts/pdf/pdfdataset.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ class GDALPDFOutputDev : public SplashOutputDev
171171
invert, interpolate, inlineImg);
172172
else
173173
{
174-
str->reset();
174+
VSIPDFFileStream::resetNoCheckReturnValue(str);
175175
if (inlineImg)
176176
{
177177
skipBytes(str, width, height, 1, 1);
@@ -209,7 +209,7 @@ class GDALPDFOutputDev : public SplashOutputDev
209209
interpolate, maskColors, inlineImg);
210210
else
211211
{
212-
str->reset();
212+
VSIPDFFileStream::resetNoCheckReturnValue(str);
213213
if (inlineImg)
214214
{
215215
skipBytes(str, width, height, colorMap->getNumPixelComps(),

frmts/pdf/pdfio.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void VSIPDFFileStream::reset()
260260
/************************************************************************/
261261

262262
#if POPPLER_MAJOR_VERSION > 25 || \
263-
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION > 2)
263+
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3)
264264
bool VSIPDFFileStream::unfilteredReset()
265265
{
266266
return reset();

frmts/pdf/pdfio.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,18 @@ class VSIPDFFileStream final : public BaseStream
5555
virtual void reset() override;
5656
#endif
5757

58+
static void resetNoCheckReturnValue(Stream *str)
59+
{
60+
#if POPPLER_MAJOR_VERSION > 25 || \
61+
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
62+
CPL_IGNORE_RET_VAL(str->reset());
63+
#else
64+
str->reset();
65+
#endif
66+
}
67+
5868
#if POPPLER_MAJOR_VERSION > 25 || \
59-
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION > 2)
69+
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3)
6070
virtual bool unfilteredReset() override;
6171
#else
6272
virtual void unfilteredReset() override;

frmts/pdf/pdfobject.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -1409,7 +1409,13 @@ int64_t GDALPDFStreamPoppler::GetLength(int64_t nMaxSize)
14091409
if (m_nLength >= 0)
14101410
return m_nLength;
14111411

1412+
#if POPPLER_MAJOR_VERSION > 25 || \
1413+
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
1414+
if (!m_poStream->reset())
1415+
return 0;
1416+
#else
14121417
m_poStream->reset();
1418+
#endif
14131419
m_nLength = 0;
14141420
unsigned char readBuf[4096];
14151421
int readChars;
@@ -1477,7 +1483,13 @@ int64_t GDALPDFStreamPoppler::GetRawLength()
14771483
return m_nRawLength;
14781484

14791485
auto undecodeStream = m_poStream->getUndecodedStream();
1486+
#if POPPLER_MAJOR_VERSION > 25 || \
1487+
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
1488+
if (!undecodeStream->reset())
1489+
return 0;
1490+
#else
14801491
undecodeStream->reset();
1492+
#endif
14811493
m_nRawLength = 0;
14821494
while (undecodeStream->getChar() != EOF)
14831495
m_nRawLength++;

0 commit comments

Comments
 (0)