Description: Track changes to libpoppler25 API
 Track changes to libpoppler 25 ABI.
 .
 startDoc now takes a PDFDoc rather than its Xref.
 setErrorFunction -> setErrorCallback.
Author: Andy Whitcroft <apw@ubuntu.com>
Last-Update: 2012-06-13
Index: gdal-1.9.0/frmts/pdf/pdfdataset.cpp
===================================================================
--- gdal-1.9.0.orig/frmts/pdf/pdfdataset.cpp	2012-02-20 10:48:39.000000000 +0100
+++ gdal-1.9.0/frmts/pdf/pdfdataset.cpp	2013-07-31 11:26:00.243406983 +0200
@@ -330,7 +330,7 @@
         SplashOutputDev *poSplashOut;
         poSplashOut = new SplashOutputDev(splashModeRGB8, 4, gFalse, sColor);
         PDFDoc* poDoc = poGDS->poDoc;
-        poSplashOut->startDoc(poDoc->getXRef());
+        poSplashOut->startDoc(poDoc);
         double dfDPI = poGDS->dfDPI;
 
         /* EVIL: we modify a private member... */
@@ -521,13 +521,14 @@
 /************************************************************************/
 
 #ifdef USE_POPPLER
-static void PDFDatasetErrorFunction(int nPos, char *pszMsg, va_list args)
+static void PDFDatasetErrorCallback( void *data, ErrorCategory category,
+				     Goffset nPos, char *msg )
 {
     CPLString osError;
 
     if (nPos >= 0)
-        osError.Printf("Pos = %d, ", nPos);
-    osError += CPLString().vPrintf(pszMsg, args);
+        osError.Printf("Pos = %d, ", (int)nPos);
+    osError += CPLString().Printf("%s", msg);
 
     if (strcmp(osError.c_str(), "Incorrect password") == 0)
         return;
@@ -570,7 +571,7 @@
     GooString* poUserPwd = NULL;
 
     /* Set custom error handler for poppler errors */
-    setErrorFunction(PDFDatasetErrorFunction);
+    setErrorCallback(PDFDatasetErrorCallback, NULL);
 
     PDFDoc* poDoc = NULL;
     ObjectAutoFree oObj;
Index: gdal-1.9.0/frmts/pdf/pdfio.cpp
===================================================================
--- gdal-1.9.0.orig/frmts/pdf/pdfio.cpp	2012-02-20 10:48:39.000000000 +0100
+++ gdal-1.9.0/frmts/pdf/pdfio.cpp	2013-07-31 11:33:26.363421840 +0200
@@ -46,11 +46,7 @@
 VSIPDFFileStream::VSIPDFFileStream(VSILFILE* f, const char* pszFilename,
                                    Guint startA, GBool limitedA,
                                    Guint lengthA, Object *dictA):
-#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
                                                         BaseStream(dictA, lengthA)
-#else
-                                                        BaseStream(dictA)
-#endif
 {
     poParent = NULL;
     poFilename = new GooString(pszFilename);
@@ -70,11 +66,7 @@
 VSIPDFFileStream::VSIPDFFileStream(VSIPDFFileStream* poParent,
                                    Guint startA, GBool limitedA,
                                    Guint lengthA, Object *dictA):
-#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
                                                         BaseStream(dictA, lengthA)
-#else
-                                                        BaseStream(dictA)
-#endif
 {
     this->poParent = poParent;
     poFilename = poParent->poFilename;
@@ -103,11 +95,21 @@
 }
 
 /************************************************************************/
+/*                                  copy()                              */
+/************************************************************************/
+
+BaseStream* VSIPDFFileStream::copy()
+{
+    return new VSIPDFFileStream(poParent, nStart, bLimited,
+                                nLength, &dict);
+}
+
+/************************************************************************/
 /*                             makeSubStream()                          */
 /************************************************************************/
 
-Stream *VSIPDFFileStream::makeSubStream(Guint startA, GBool limitedA,
-                                        Guint lengthA, Object *dictA)
+Stream *VSIPDFFileStream::makeSubStream(Goffset startA, GBool limitedA,
+                                        Goffset lengthA, Object *dictA)
 {
     return new VSIPDFFileStream(this,
                                 startA, limitedA,
@@ -118,7 +120,7 @@
 /*                                 getPos()                             */
 /************************************************************************/
 
-int VSIPDFFileStream::getPos()
+Goffset VSIPDFFileStream::getPos()
 {
     return nCurrentPos;
 }
@@ -127,7 +129,7 @@
 /*                                getStart()                            */
 /************************************************************************/
 
-Guint VSIPDFFileStream::getStart()
+Goffset VSIPDFFileStream::getStart()
 {
     return nStart;
 }
@@ -273,7 +275,7 @@
 /*                               setPos()                               */
 /************************************************************************/
 
-void VSIPDFFileStream::setPos(Guint pos, int dir)
+void VSIPDFFileStream::setPos(Goffset pos, int dir)
 {
     if (dir >= 0)
     {
@@ -301,7 +303,7 @@
 /*                            moveStart()                               */
 /************************************************************************/
 
-void VSIPDFFileStream::moveStart(int delta)
+void VSIPDFFileStream::moveStart(Goffset delta)
 {
     nStart += delta;
     VSIFSeekL(f, nCurrentPos = nStart, SEEK_SET);
Index: gdal-1.9.0/frmts/pdf/pdfio.h
===================================================================
--- gdal-1.9.0.orig/frmts/pdf/pdfio.h	2012-02-20 10:48:39.000000000 +0100
+++ gdal-1.9.0/frmts/pdf/pdfio.h	2013-07-31 11:28:07.731411229 +0200
@@ -54,11 +54,13 @@
                          Guint startA, GBool limitedA,
                          Guint lengthA, Object *dictA);
         virtual ~VSIPDFFileStream();
+        
+        virtual BaseStream* copy();
 
-        virtual Stream *   makeSubStream(Guint startA, GBool limitedA,
-                                         Guint lengthA, Object *dictA);
-        virtual int        getPos();
-        virtual Guint      getStart();
+        virtual Stream *   makeSubStream(Goffset startA, GBool limitedA,
+                                         Goffset lengthA, Object *dictA);
+        virtual Goffset        getPos();
+        virtual Goffset      getStart();
         virtual StreamKind getKind();
         virtual GooString *getFileName();
 
@@ -69,8 +71,8 @@
         virtual void       reset();
         virtual void       unfilteredReset ();
         virtual void       close();
-        virtual void       setPos(Guint pos, int dir = 0);
-        virtual void       moveStart(int delta);
+        virtual void       setPos(Goffset pos, int dir = 0);
+        virtual void       moveStart(Goffset delta);
 
     private:
         VSIPDFFileStream  *poParent;
