From b471814ef406582f2b1bc0aabbe430c0026608c7 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
Date: Sat, 12 Jan 2019 17:21:54 +0100
Subject: [PATCH] Fix build with poppler-0.72.0

Non-upstreamable patch that breaks backward compatibility.
---
 frmts/pdf/pdfdataset.cpp | 4 ++--
 frmts/pdf/pdfobject.cpp  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/frmts/pdf/pdfdataset.cpp b/frmts/pdf/pdfdataset.cpp
index 84fe1fe..38b8c30 100644
--- a/frmts/pdf/pdfdataset.cpp
+++ b/frmts/pdf/pdfdataset.cpp
@@ -3459,7 +3459,7 @@ void PDFDataset::FindLayersPoppler()
 #endif
             if( ocg != nullptr && ocg->getName() != nullptr )
             {
-                const char* pszLayerName = (const char*)ocg->getName()->getCString();
+                const char* pszLayerName = (const char*)ocg->getName()->c_str();
                 AddLayer(pszLayerName);
                 oLayerOCGMapPoppler[pszLayerName] = ocg;
             }
@@ -4787,7 +4787,7 @@ GDALDataset *PDFDataset::Open( GDALOpenInfo * poOpenInfo )
     GooString* poMetadata = poCatalogPoppler->readMetadata();
     if (poMetadata)
     {
-        const char* pszContent = poMetadata->getCString();
+        const char* pszContent = poMetadata->c_str();
         if (pszContent != nullptr &&
             STARTS_WITH(pszContent, "<?xpacket begin="))
         {
diff --git a/frmts/pdf/pdfobject.cpp b/frmts/pdf/pdfobject.cpp
index 0a5f907..9bed6c1 100644
--- a/frmts/pdf/pdfobject.cpp
+++ b/frmts/pdf/pdfobject.cpp
@@ -1061,7 +1061,7 @@ const CPLString& GDALPDFObjectPoppler::GetString()
 #else
         GooString* gooString = m_po->getString();
 #endif
-        return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->getCString()),
+        return (osStr = GDALPDFGetUTF8StringFromBytes(reinterpret_cast<const GByte*>(gooString->c_str()),
                                                       static_cast<int>(gooString->getLength())));
     }
     else
@@ -1422,7 +1422,7 @@ char* GDALPDFStreamPoppler::GetBytes()
         char* pszContent = (char*) VSIMalloc(m_nLength + 1);
         if (pszContent)
         {
-            memcpy(pszContent, gstr->getCString(), m_nLength);
+            memcpy(pszContent, gstr->c_str(), m_nLength);
             pszContent[m_nLength] = '\0';
         }
         delete gstr;
-- 
2.20.1

