On Sun, 16 Apr 2017, Even Rouault wrote:

On dimanche 16 avril 2017 20:31:09 CEST Andrew C Aitchison wrote:
GDAL 2.2.0 beta1
Scientific Linux 6 (= CentOS6 =  Red Hat EL 6).
g++ 4.9.2 and g++ 5.3.1

gdal-2.2.0/frmts/pdf/pdfdataset.cpp does not compile on my
Scientific Linux 6 (= CentOS6 =  Red Hat EL 6) machine.

pdfio.h lines 87-90:
    private:
         /* Added in poppler 0.15.0 */
         virtual GBool hasGetChars() override;
         virtual int getChars(int nChars, Guchar *buffer) override;

You can just remove the override qualifier in the above methods. Supporting 
properly this old
version could be done but would be quite tedious.

I found an existing define which is true for poppler >= 0.16.
And have written a patch which leaves the override qualifier for
newer poppler libraries but disables it for very old ones.
Somewhere around 0.15 or 0.16 it will incorrectly remove the override qualifier, but the code will still compile correctly.

--
Andrew C Aitchison
--- frmts/pdf/pdfio.h   2017/04/16 19:18:35
+++ frmts/pdf/pdfio.h   2017/04/19 14:32:02
@@ -85,9 +85,18 @@
         virtual void       close() override;
 
     private:
-        /* Added in poppler 0.15.0 */
+#ifdef POPPLER_BASE_STREAM_HAS_TWO_ARGS
+        /* getChars/hasGetChars added in poppler 0.15.0
+         * POPPLER_BASE_STREAM_HAS_TWO_ARGS true from poppler 0.16,
+         * This test will be wrong for poppler 0.15 or 0.16,
+         * but will still compile correctly.
+         */
         virtual GBool hasGetChars() override;
         virtual int getChars(int nChars, Guchar *buffer) override;
+#else
+        virtual GBool hasGetChars() ;
+        virtual int getChars(int nChars, Guchar *buffer) ;
+#endif
 
         VSIPDFFileStream  *poParent;
         GooString         *poFilename;
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to