Submitted By: Bruce Dubbs <bdubbs at linusfromscratch.org>
Date: 2019-01-13
Initial Package Version: 6.1.4.2
Upstream Status: Unknown
Origin: Arch Linux and self
Description: Fix for poppler 0.70 thru 0.73 and boost 1.69.0
Most of the changes are due to libreoffice using private poppler headers.
Using native constructs for gTrue, gFalse, GBool, and Guchar. 
One minor cast is needed for boost.


diff -Naur libreoffice-6.1.2.1-orig/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx libreoffice-6.1.2.1/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
--- libreoffice-6.1.2.1-orig/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx	2018-09-20 04:44:38.000000000 -0500
+++ libreoffice-6.1.2.1/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx	2019-01-13 12:50:32.494248312 -0600
@@ -298,7 +298,7 @@
     o_rOutputBuf.resize(header_size);
 
     // initialize stream
-    Guchar *p;
+    unsigned char *p;
     GfxRGB rgb;
     std::unique_ptr<ImageStream> imgStr(
         new ImageStream(str,
@@ -401,7 +401,7 @@
                 oneColor = { byteToCol( 0xff ), byteToCol( 0xff ), byteToCol( 0xff ) };
         if( colorMap->getColorSpace()->getMode() == csIndexed || colorMap->getColorSpace()->getMode() == csDeviceGray )
         {
-            Guchar nIndex = 0;
+            unsigned char nIndex = 0;
             colorMap->getRGB( &nIndex, &zeroColor );
             nIndex = 1;
             colorMap->getRGB( &nIndex, &oneColor );
@@ -514,7 +514,7 @@
 PDFOutDev::PDFOutDev( PDFDoc* pDoc ) :
     m_pDoc( pDoc ),
     m_aFontMap(),
-    m_pUtf8Map( new UnicodeMap("UTF-8", gTrue, &mapUTF8) ),
+    m_pUtf8Map( new UnicodeMap("UTF-8", true, &mapUTF8) ),
     m_bSkipImages(false)
 {
 }
@@ -555,7 +555,7 @@
     LinkAction* pAction = link->getAction();
     if (pAction && pAction->getKind() == actionURI)
     {
-        const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->getCString();
+        const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->c_str();
 
         std::vector<char> aEsc( lcl_escapeLineFeeds(pURI) );
 
@@ -578,7 +578,11 @@
     printf( "restoreState\n" );
 }
 
+#if POPPLER_CHECK_VERSION(0, 70, 0)
+void PDFOutDev::setDefaultCTM(const double *pMat)
+#else
 void PDFOutDev::setDefaultCTM(double *pMat)
+#endif
 {
     assert(pMat);
 
@@ -753,7 +757,7 @@
 
             aFont = it->second;
 
-            std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.getCString()) );
+            std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.c_str()) );
             printf( " %d %d %d %d %f %d %s",
                     aFont.isEmbedded,
                     aFont.isBold,
@@ -939,11 +943,11 @@
 }
 
 void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str,
-                              int width, int height, GBool invert,
+                              int width, int height, bool invert,
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                              GBool /*interpolate*/,
+                              bool /*interpolate*/,
 #endif
-                              GBool /*inlineImg*/ )
+                              bool /*inlineImg*/ )
 {
     if (m_bSkipImages)
         return;
@@ -972,9 +976,9 @@
 void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
                           int width, int height, GfxImageColorMap* colorMap,
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                          GBool /*interpolate*/,
+                          bool /*interpolate*/,
 #endif
-                          int* maskColors, GBool /*inlineImg*/ )
+                          int* maskColors, bool /*inlineImg*/ )
 {
     if (m_bSkipImages)
         return;
@@ -1023,13 +1027,13 @@
                                 int width, int height,
                                 GfxImageColorMap* colorMap,
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                                GBool /*interpolate*/,
+                                bool /*interpolate*/,
 #endif
                                 Stream* maskStr,
                                 int maskWidth, int maskHeight,
-                                GBool maskInvert
+                                bool maskInvert
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                                , GBool /*maskInterpolate*/
+                                , bool /*maskInterpolate*/
 #endif
                                )
 {
@@ -1045,13 +1049,13 @@
                                     int width, int height,
                                     GfxImageColorMap* colorMap,
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                                    GBool /*interpolate*/,
+                                    bool /*interpolate*/,
 #endif
                                     Stream* maskStr,
                                     int maskWidth, int maskHeight,
                                     GfxImageColorMap* maskColorMap
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                                    , GBool /*maskInterpolate*/
+                                    , bool /*maskInterpolate*/
 #endif
                                    )
 {
diff -Naur libreoffice-6.1.2.1-orig/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx libreoffice-6.1.2.1/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
--- libreoffice-6.1.2.1-orig/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx	2018-09-20 04:44:38.000000000 -0500
+++ libreoffice-6.1.2.1/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx	2019-01-13 12:50:57.585469473 -0600
@@ -151,22 +151,26 @@
 
         // Does this device use upside-down coordinates?
         // (Upside-down means (0,0) is the top left corner of the page.)
-        virtual GBool upsideDown() override { return gTrue; }
+        virtual bool upsideDown() override { return true; }
 
         // Does this device use drawChar() or drawString()?
-        virtual GBool useDrawChar() override { return gTrue; }
+        virtual bool useDrawChar() override { return true; }
 
         // Does this device use beginType3Char/endType3Char?  Otherwise,
         // text in Type 3 fonts will be drawn with drawChar/drawString.
-        virtual GBool interpretType3Chars() override { return gFalse; }
+        virtual bool interpretType3Chars() override { return false; }
 
         // Does this device need non-text content?
-        virtual GBool needNonText() override { return gTrue; }
+        virtual bool needNonText() override { return true; }
 
         //----- initialization and control
 
         // Set default transform matrix.
+#if POPPLER_CHECK_VERSION(0, 70, 0)
+        virtual void setDefaultCTM(const double *ctm) override;
+#else
         virtual void setDefaultCTM(double *ctm) override;
+#endif
 
         // Start a page.
         virtual void startPage(int pageNum, GfxState *state
@@ -233,40 +237,40 @@
 
         //----- image drawing
         virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
-                                   int width, int height, GBool invert,
+                                   int width, int height, bool invert,
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                                   GBool interpolate,
+                                   bool interpolate,
 #endif
-                                   GBool inlineImg) override;
+                                   bool inlineImg) override;
         virtual void drawImage(GfxState *state, Object *ref, Stream *str,
                                int width, int height, GfxImageColorMap *colorMap,
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                               GBool interpolate,
+                               bool interpolate,
 #endif
-                               int *maskColors, GBool inlineImg) override;
+                               int *maskColors, bool inlineImg) override;
         virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
                                      int width, int height,
                                      GfxImageColorMap *colorMap,
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                                     GBool interpolate,
+                                     bool interpolate,
 #endif
                                      Stream *maskStr, int maskWidth, int maskHeight,
-                                     GBool maskInvert
+                                     bool maskInvert
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                                     , GBool maskInterpolate
+                                     , bool maskInterpolate
 #endif
                                     ) override;
         virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
                                          int width, int height,
                                          GfxImageColorMap *colorMap,
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                                         GBool interpolate,
+                                         bool interpolate,
 #endif
                                          Stream *maskStr,
                                          int maskWidth, int maskHeight,
                                          GfxImageColorMap *maskColorMap
 #if POPPLER_CHECK_VERSION(0, 12, 0)
-                                         , GBool maskInterpolate
+                                         , bool maskInterpolate
 #endif
                                         ) override;
 
@@ -279,7 +283,7 @@
 
 // note: if you ever change Output_t, please keep in mind that the current code
 // relies on it being of 8 bit size
-typedef Guchar Output_t;
+typedef unsigned char Output_t;
 typedef std::vector< Output_t > OutputBuffer;
 
 #endif // INCLUDED_SDEXT_SOURCE_PDFIMPORT_XPDFWRAPPER_PDFIOUTDEV_GPL_HXX
diff -Naur libreoffice-6.1.2.1-orig/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx libreoffice-6.1.2.1/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
--- libreoffice-6.1.2.1-orig/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx	2018-09-20 04:44:38.000000000 -0500
+++ libreoffice-6.1.2.1/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx	2019-01-13 12:49:57.497939858 -0600
@@ -242,7 +242,7 @@
     appendIHDR( o_rOutputBuf, width, height, 8, 6 ); // RGBA image
 
     // initialize stream
-    Guchar *p, *pm;
+    unsigned char *p, *pm;
     GfxRGB rgb;
     GfxGray alpha;
     ImageStream* imgStr =
@@ -328,7 +328,7 @@
     appendIHDR( o_rOutputBuf, width, height, 8, 6 ); // RGBA image
 
     // initialize stream
-    Guchar *p;
+    unsigned char *p;
     GfxRGB rgb;
     ImageStream* imgStr =
         new ImageStream(str,
@@ -374,7 +374,7 @@
     {
         for( int x = 0; x < maskWidth; ++x )
         {
-            Guchar aPixel = 0;
+            unsigned char aPixel = 0;
             imgStrMask->getPixel( &aPixel );
             int nIndex = (y*height/maskHeight) * (width*4+1) + // mapped line
                          (x*width/maskWidth)*4 + 1  + 3        // mapped column
diff -Naur libreoffice-6.1.2.1-orig/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx libreoffice-6.1.2.1/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
--- libreoffice-6.1.2.1-orig/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx	2018-09-20 04:44:38.000000000 -0500
+++ libreoffice-6.1.2.1/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx	2019-01-13 12:46:47.552265969 -0600
@@ -69,7 +69,7 @@
 
     // read config file
     globalParams = new GlobalParams();
-    globalParams->setErrQuiet(gTrue);
+    globalParams->setErrQuiet(true);
 #if defined(_MSC_VER)
     globalParams->setupBaseFonts(nullptr);
 #endif
@@ -143,7 +143,7 @@
                 i,
                 PDFI_OUTDEV_RESOLUTION,
                 PDFI_OUTDEV_RESOLUTION,
-                0, gTrue, gTrue, gTrue);
+                0, true, true, true);
         rDoc.processLinks(&aOutDev, i);
     }
 
diff -Naur libreoffice-6.1.2.1-orig/sfx2/source/appl/shutdownicon.cxx libreoffice-6.1.2.1/sfx2/source/appl/shutdownicon.cxx
--- libreoffice-6.1.2.1-orig/sfx2/source/appl/shutdownicon.cxx	2018-09-20 04:44:38.000000000 -0500
+++ libreoffice-6.1.2.1/sfx2/source/appl/shutdownicon.cxx	2019-01-13 12:46:12.926960885 -0600
@@ -141,7 +141,7 @@
 #endif // ENABLE_QUICKSTART_APPLET
     }
     assert(!boost::logic::indeterminate(loaded));
-    return loaded;
+    return (bool)loaded;
 }
 
 }
