git: a6b2bfcb415d - main - graphics/gdal: prepare for poppler 21.10

From: Tobias C. Berner <tcberner_at_FreeBSD.org>
Date: Wed, 06 Oct 2021 10:35:42 UTC
The branch main has been updated by tcberner:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a6b2bfcb415d315f37e6c1ea4512e9c608212403

commit a6b2bfcb415d315f37e6c1ea4512e9c608212403
Author:     Tobias C. Berner <tcberner@FreeBSD.org>
AuthorDate: 2021-10-06 10:30:28 +0000
Commit:     Tobias C. Berner <tcberner@FreeBSD.org>
CommitDate: 2021-10-06 10:35:19 +0000

    graphics/gdal: prepare for poppler 21.10
    
    Obtained from:  https://github.com/OSGeo/gdal/commit/9c09870e374ca21d558101af3f4c09a6164fdfc3
    PR:             258836
---
 graphics/gdal/files/patch-frmts-pdf-pdfdataset.cpp | 23 +++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/graphics/gdal/files/patch-frmts-pdf-pdfdataset.cpp b/graphics/gdal/files/patch-frmts-pdf-pdfdataset.cpp
index 247bc4a4fdb0..486541d94a06 100644
--- a/graphics/gdal/files/patch-frmts-pdf-pdfdataset.cpp
+++ b/graphics/gdal/files/patch-frmts-pdf-pdfdataset.cpp
@@ -1,6 +1,6 @@
---- frmts/pdf/pdfdataset.cpp.orig	2021-04-27 09:12:27 UTC
+--- frmts/pdf/pdfdataset.cpp.orig	2021-09-01 09:50:03 UTC
 +++ frmts/pdf/pdfdataset.cpp
-@@ -3584,7 +3584,7 @@ void PDFDataset::FindLayersPoppler()
+@@ -3593,7 +3593,7 @@ void PDFDataset::FindLayersPoppler()
  #if (POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 72)
                  const char* pszLayerName = (const char*)ocg->getName()->c_str();
  #else
@@ -9,7 +9,14 @@
  #endif
                  AddLayer(pszLayerName);
                  oLayerOCGListPoppler.push_back(std::make_pair(CPLString(pszLayerName), ocg));
-@@ -4969,7 +4969,7 @@ PDFDataset *PDFDataset::Open( GDALOpenInfo * poOpenInf
+@@ -4982,13 +4982,13 @@ PDFDataset *PDFDataset::Open( GDALOpenInfo * poOpenInf
+ #ifdef HAVE_POPPLER
+   if (bUseLib.test(PDFLIB_POPPLER))
+   {
+-    GooString* poMetadata = poCatalogPoppler->readMetadata();
++    auto poMetadata = poCatalogPoppler->readMetadata();
+     if (poMetadata)
+     {
  #if (POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 72)
          const char* pszContent = poMetadata->c_str();
  #else
@@ -18,3 +25,13 @@
  #endif
          if (pszContent != nullptr &&
              STARTS_WITH(pszContent, "<?xpacket begin="))
+@@ -4996,7 +4996,9 @@ PDFDataset *PDFDataset::Open( GDALOpenInfo * poOpenInf
+             const char * const apszMDList[2] = { pszContent, nullptr };
+             poDS->SetMetadata(const_cast<char**>(apszMDList), "xml:XMP");
+         }
++#if (POPPLER_MAJOR_VERSION < 21 || (POPPLER_MAJOR_VERSION == 21 && POPPLER_MINOR_VERSION <= 9))
+         delete poMetadata;
++#endif
+     }
+ 
+     /* Read Info object */