Description: Add support for Poppler 0.71.0. Author: Even Rouault Origin: https://github.com/OSGeo/gdal/commit/4cc0215b8f2cef3582265cdfaf16589390697706 Bug: https://github.com/OSGeo/gdal/issues/1121 Bug-Debian: https://bugs.debian.org/915722 --- a/frmts/pdf/pdfdataset.cpp +++ b/frmts/pdf/pdfdataset.cpp @@ -2593,18 +2593,25 @@ static void PDFDatasetErrorFunctionCommo } #ifdef POPPLER_0_20_OR_LATER -static void PDFDatasetErrorFunction(CPL_UNUSED void* userData, CPL_UNUSED ErrorCategory eErrCategory, + +static void PDFDatasetErrorFunction(void* /* userData*/, + ErrorCategory /* eErrCategory */, #ifdef POPPLER_0_23_OR_LATER Goffset nPos, #else int nPos, #endif - char *pszMsg) +#ifdef POPPLER_0_71_OR_LATER + const char *pszMsg +#else + char *pszMsg +#endif + ) { CPLString osError; if (nPos >= 0) - osError.Printf("Pos = %d, ", (int)nPos); + osError.Printf("Pos = " CPL_FRMT_GUIB ", ", static_cast(nPos)); osError += pszMsg; PDFDatasetErrorFunctionCommon(osError); } @@ -4442,7 +4449,7 @@ GDALDataset *PDFDataset::Open( GDALOpenI #ifdef HAVE_POPPLER if (bUseLib.test(PDFLIB_POPPLER)) { - PDFRectangle* psMediaBox = poPagePoppler->getMediaBox(); + const auto* psMediaBox = poPagePoppler->getMediaBox(); dfX1 = psMediaBox->x1; dfY1 = psMediaBox->y1; dfX2 = psMediaBox->x2; @@ -4780,14 +4787,12 @@ GDALDataset *PDFDataset::Open( GDALOpenI GooString* poMetadata = poCatalogPoppler->readMetadata(); if (poMetadata) { - char* pszContent = poMetadata->getCString(); + const char* pszContent = poMetadata->getCString(); if (pszContent != nullptr && STARTS_WITH(pszContent, "SetMetadata(apszMDList, "xml:XMP"); + const char * const apszMDList[2] = { pszContent, nullptr }; + poDS->SetMetadata(const_cast(apszMDList), "xml:XMP"); } delete poMetadata; } --- a/frmts/pdf/pdfio.h +++ b/frmts/pdf/pdfio.h @@ -58,6 +58,15 @@ #define makeSubStream_object_type Object* #endif +// Detect Poppler 0.71 that no longer defines GBool +#ifdef POPPLER_0_69_OR_LATER +#ifndef initObj +#define POPPLER_0_71_OR_LATER +#define GBool bool +#define gFalse false +#endif +#endif + class VSIPDFFileStream: public BaseStream { public: