Skip to content

Commit

Permalink
Fix warnings when building against Poppler 25.03.00
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault authored and github-actions[bot] committed Mar 9, 2025
1 parent 1b71303 commit 480af71
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
4 changes: 2 additions & 2 deletions frmts/pdf/pdfdataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class GDALPDFOutputDev : public SplashOutputDev
invert, interpolate, inlineImg);
else
{
str->reset();
VSIPDFFileStream::resetNoCheckReturnValue(str);
if (inlineImg)
{
skipBytes(str, width, height, 1, 1);
Expand Down Expand Up @@ -209,7 +209,7 @@ class GDALPDFOutputDev : public SplashOutputDev
interpolate, maskColors, inlineImg);
else
{
str->reset();
VSIPDFFileStream::resetNoCheckReturnValue(str);
if (inlineImg)
{
skipBytes(str, width, height, colorMap->getNumPixelComps(),
Expand Down
2 changes: 1 addition & 1 deletion frmts/pdf/pdfio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ void VSIPDFFileStream::reset()
/************************************************************************/

#if POPPLER_MAJOR_VERSION > 25 || \
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION > 2)
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3)
bool VSIPDFFileStream::unfilteredReset()
{
return reset();
Expand Down
12 changes: 11 additions & 1 deletion frmts/pdf/pdfio.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,18 @@ class VSIPDFFileStream final : public BaseStream
virtual void reset() override;
#endif

static void resetNoCheckReturnValue(Stream *str)
{
#if POPPLER_MAJOR_VERSION > 25 || \
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
CPL_IGNORE_RET_VAL(str->reset());
#else
str->reset();
#endif
}

#if POPPLER_MAJOR_VERSION > 25 || \
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION > 2)
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 3)
virtual bool unfilteredReset() override;
#else
virtual void unfilteredReset() override;
Expand Down
12 changes: 12 additions & 0 deletions frmts/pdf/pdfobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,7 +1409,13 @@ int64_t GDALPDFStreamPoppler::GetLength(int64_t nMaxSize)
if (m_nLength >= 0)
return m_nLength;

#if POPPLER_MAJOR_VERSION > 25 || \
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
if (!m_poStream->reset())
return 0;
#else
m_poStream->reset();
#endif
m_nLength = 0;
unsigned char readBuf[4096];
int readChars;
Expand Down Expand Up @@ -1477,7 +1483,13 @@ int64_t GDALPDFStreamPoppler::GetRawLength()
return m_nRawLength;

auto undecodeStream = m_poStream->getUndecodedStream();
#if POPPLER_MAJOR_VERSION > 25 || \
(POPPLER_MAJOR_VERSION == 25 && POPPLER_MINOR_VERSION >= 2)
if (!undecodeStream->reset())
return 0;
#else
undecodeStream->reset();
#endif
m_nRawLength = 0;
while (undecodeStream->getChar() != EOF)
m_nRawLength++;
Expand Down

0 comments on commit 480af71

Please sign in to comment.