use backports

f41
Caolán McNamara 6 years ago
parent 96152ccc5d
commit 3304f50ebe

@ -1,18 +1,67 @@
From 00208d1da5dbd33d20414cfd138e24a45551687e Mon Sep 17 00:00:00 2001 From 81ef46fd80c5b5f0bd0278378a0c110198c9f623 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org> From: Aleksei Nikiforov <darktemplar@basealt.ru>
Date: Fri, 25 Jan 2019 21:56:28 +0100 Date: Thu, 22 Nov 2018 17:54:00 +0300
Subject: [PATCH] Fix build with poppler-0.73.0 Subject: [PATCH] Fix build with poppler 0.71
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Code by Marek Kasik. Change-Id: I470ece9dc4766e10e1ccb5e99b25a8d8cc4cbf38
Reviewed-on: https://gerrit.libreoffice.org/63860
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 8ff41a26caf51544699863c89598d37d93dc1b21)
Reviewed-on: https://gerrit.libreoffice.org/66375
Reviewed-by: Aleksei Nikiforov <darktemplar@basealt.ru>
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Fix build with poppler-0.72
Change-Id: I0664d1b39e97b7555c0a3cba442db52b84f37134
Reviewed-on: https://gerrit.libreoffice.org/65960
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit 65a6c9ae4791188ffcecf489073cf38873ce5e17)
Reviewed-on: https://gerrit.libreoffice.org/66376
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
poppler dropped GBool since 0.71
See https://lists.freedesktop.org/archives/libreoffice/2018-November/081410.html
Change-Id: I258e08894486a925bed50a3a4232b6e805af6784
Reviewed-on: https://gerrit.libreoffice.org/63625
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 5e8bdd9203dd642111c62a6668ee665a20d4ba19)
Reviewed-on: https://gerrit.libreoffice.org/66374
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
sdext: fix build with poppler 0.73
... which has removed Guchar, Gushort, Guint, Gulong...
Change-Id: Ia54ad378031f167f6779f6ffe574b85c1e72f26d
Reviewed-on: https://gerrit.libreoffice.org/66305
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl@cib.de>
(cherry picked from commit 50d371ae08c66648d9f32f633b2245e1746e2bb6)
Reviewed-on: https://gerrit.libreoffice.org/66363
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
--- ---
.../pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 30 +++++++++---------- .../pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 38 ++++++++++------
.../pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx | 30 +++++++++---------- .../pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx | 45 ++++++++++++-------
.../pdfimport/xpdfwrapper/pnghelper.cxx | 6 ++-- .../pdfimport/xpdfwrapper/pnghelper.cxx | 6 +--
.../pdfimport/xpdfwrapper/wrapper_gpl.cxx | 4 +-- .../pdfimport/xpdfwrapper/wrapper_gpl.cxx | 4 +-
4 files changed, 35 insertions(+), 35 deletions(-) 4 files changed, 60 insertions(+), 33 deletions(-)
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index 06e4faead..6d196d7d1 100644 index 06e4fae..9432755 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -298,7 +298,7 @@ void writePpm_( OutputBuffer& o_rOutputBuf, @@ -298,7 +298,7 @@ void writePpm_( OutputBuffer& o_rOutputBuf,
@ -42,158 +91,184 @@ index 06e4faead..6d196d7d1 100644
m_bSkipImages(false) m_bSkipImages(false)
{ {
} }
@@ -555,7 +555,7 @@ void PDFOutDev::processLink(Link* link, Catalog*) @@ -555,7 +555,11 @@ void PDFOutDev::processLink(Link* link, Catalog*)
LinkAction* pAction = link->getAction(); LinkAction* pAction = link->getAction();
if (pAction && pAction->getKind() == actionURI) if (pAction && pAction->getKind() == actionURI)
{ {
- const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->getCString(); +#if POPPLER_CHECK_VERSION(0, 72, 0)
+ const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->c_str(); + const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->c_str();
+#else
const char* pURI = static_cast<LinkURI*>(pAction)->getURI()->getCString();
+#endif
std::vector<char> aEsc( lcl_escapeLineFeeds(pURI) ); std::vector<char> aEsc( lcl_escapeLineFeeds(pURI) );
@@ -578,7 +578,7 @@ void PDFOutDev::restoreState(GfxState*) @@ -578,7 +582,11 @@ void PDFOutDev::restoreState(GfxState*)
printf( "restoreState\n" ); printf( "restoreState\n" );
} }
-void PDFOutDev::setDefaultCTM(double *pMat) +#if POPPLER_CHECK_VERSION(0, 71, 0)
+void PDFOutDev::setDefaultCTM(const double *pMat) +void PDFOutDev::setDefaultCTM(const double *pMat)
+#else
void PDFOutDev::setDefaultCTM(double *pMat)
+#endif
{ {
assert(pMat); assert(pMat);
@@ -753,7 +753,7 @@ void PDFOutDev::updateFont(GfxState *state) @@ -753,7 +761,11 @@ void PDFOutDev::updateFont(GfxState *state)
aFont = it->second; aFont = it->second;
- std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.getCString()) ); +#if POPPLER_CHECK_VERSION(0, 72, 0)
+ std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.c_str()) ); + std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.c_str()) );
+#else
std::vector<char> aEsc( lcl_escapeLineFeeds(aFont.familyName.getCString()) );
+#endif
printf( " %d %d %d %d %f %d %s", printf( " %d %d %d %d %f %d %s",
aFont.isEmbedded, aFont.isEmbedded,
aFont.isBold, aFont.isBold,
@@ -939,11 +939,11 @@ void PDFOutDev::endTextObject(GfxState*) @@ -939,11 +951,11 @@ void PDFOutDev::endTextObject(GfxState*)
} }
void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str, void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str,
- int width, int height, GBool invert, - int width, int height, GBool invert,
+ int width, int height, bool invert, + int width, int height, poppler_bool invert,
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- GBool /*interpolate*/, - GBool /*interpolate*/,
+ bool /*interpolate*/, + poppler_bool /*interpolate*/,
#endif #endif
- GBool /*inlineImg*/ ) - GBool /*inlineImg*/ )
+ bool /*inlineImg*/ ) + poppler_bool /*inlineImg*/ )
{ {
if (m_bSkipImages) if (m_bSkipImages)
return; return;
@@ -972,9 +972,9 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str, @@ -972,9 +984,9 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str,
void PDFOutDev::drawImage(GfxState*, Object*, Stream* str, void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
int width, int height, GfxImageColorMap* colorMap, int width, int height, GfxImageColorMap* colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- GBool /*interpolate*/, - GBool /*interpolate*/,
+ bool /*interpolate*/, + poppler_bool /*interpolate*/,
#endif #endif
- int* maskColors, GBool /*inlineImg*/ ) - int* maskColors, GBool /*inlineImg*/ )
+ int* maskColors, bool /*inlineImg*/ ) + int* maskColors, poppler_bool /*inlineImg*/ )
{ {
if (m_bSkipImages) if (m_bSkipImages)
return; return;
@@ -1023,13 +1023,13 @@ void PDFOutDev::drawMaskedImage(GfxState*, Object*, Stream* str, @@ -1023,13 +1035,13 @@ void PDFOutDev::drawMaskedImage(GfxState*, Object*, Stream* str,
int width, int height, int width, int height,
GfxImageColorMap* colorMap, GfxImageColorMap* colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- GBool /*interpolate*/, - GBool /*interpolate*/,
+ bool /*interpolate*/, + poppler_bool /*interpolate*/,
#endif #endif
Stream* maskStr, Stream* maskStr,
int maskWidth, int maskHeight, int maskWidth, int maskHeight,
- GBool maskInvert - GBool maskInvert
+ bool maskInvert + poppler_bool maskInvert
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- , GBool /*maskInterpolate*/ - , GBool /*maskInterpolate*/
+ , bool /*maskInterpolate*/ + , poppler_bool /*maskInterpolate*/
#endif #endif
) )
{ {
@@ -1045,13 +1045,13 @@ void PDFOutDev::drawSoftMaskedImage(GfxState*, Object*, Stream* str, @@ -1045,13 +1057,13 @@ void PDFOutDev::drawSoftMaskedImage(GfxState*, Object*, Stream* str,
int width, int height, int width, int height,
GfxImageColorMap* colorMap, GfxImageColorMap* colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- GBool /*interpolate*/, - GBool /*interpolate*/,
+ bool /*interpolate*/, + poppler_bool /*interpolate*/,
#endif #endif
Stream* maskStr, Stream* maskStr,
int maskWidth, int maskHeight, int maskWidth, int maskHeight,
GfxImageColorMap* maskColorMap GfxImageColorMap* maskColorMap
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- , GBool /*maskInterpolate*/ - , GBool /*maskInterpolate*/
+ , bool /*maskInterpolate*/ + , poppler_bool /*maskInterpolate*/
#endif #endif
) )
{ {
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
index 7e65f085d..2dd2fff96 100644 index 7e65f08..533eb93 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx --- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx +++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
@@ -151,22 +151,22 @@ namespace pdfi @@ -130,6 +130,13 @@ namespace pdfi
{ return const_cast<GooString &>(familyName); }
};
+ // Versions before 0.15 defined GBool as int; 0.15 redefined it as bool; 0.71 dropped GBool
+#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR < 71
+ typedef GBool poppler_bool;
+#else
+ typedef bool poppler_bool;
+#endif
+
class PDFOutDev : public OutputDev
{
// not owned by this class
@@ -151,22 +158,26 @@ namespace pdfi
// Does this device use upside-down coordinates? // Does this device use upside-down coordinates?
// (Upside-down means (0,0) is the top left corner of the page.) // (Upside-down means (0,0) is the top left corner of the page.)
- virtual GBool upsideDown() override { return gTrue; } - virtual GBool upsideDown() override { return gTrue; }
+ virtual bool upsideDown() override { return true; } + virtual poppler_bool upsideDown() override { return true; }
// Does this device use drawChar() or drawString()? // Does this device use drawChar() or drawString()?
- virtual GBool useDrawChar() override { return gTrue; } - virtual GBool useDrawChar() override { return gTrue; }
+ virtual bool useDrawChar() override { return true; } + virtual poppler_bool useDrawChar() override { return true; }
// Does this device use beginType3Char/endType3Char? Otherwise, // Does this device use beginType3Char/endType3Char? Otherwise,
// text in Type 3 fonts will be drawn with drawChar/drawString. // text in Type 3 fonts will be drawn with drawChar/drawString.
- virtual GBool interpretType3Chars() override { return gFalse; } - virtual GBool interpretType3Chars() override { return gFalse; }
+ virtual bool interpretType3Chars() override { return false; } + virtual poppler_bool interpretType3Chars() override { return false; }
// Does this device need non-text content? // Does this device need non-text content?
- virtual GBool needNonText() override { return gTrue; } - virtual GBool needNonText() override { return gTrue; }
+ virtual bool needNonText() override { return true; } + virtual poppler_bool needNonText() override { return true; }
//----- initialization and control //----- initialization and control
// Set default transform matrix. // Set default transform matrix.
- virtual void setDefaultCTM(double *ctm) override; +#if POPPLER_CHECK_VERSION(0, 71, 0)
+ virtual void setDefaultCTM(const double *ctm) override; + virtual void setDefaultCTM(const double *ctm) override;
+#else
virtual void setDefaultCTM(double *ctm) override;
+#endif
// Start a page. // Start a page.
virtual void startPage(int pageNum, GfxState *state virtual void startPage(int pageNum, GfxState *state
@@ -233,40 +233,40 @@ namespace pdfi @@ -233,40 +244,40 @@ namespace pdfi
//----- image drawing //----- image drawing
virtual void drawImageMask(GfxState *state, Object *ref, Stream *str, virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
- int width, int height, GBool invert, - int width, int height, GBool invert,
+ int width, int height, bool invert, + int width, int height, poppler_bool invert,
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- GBool interpolate, - GBool interpolate,
+ bool interpolate, + poppler_bool interpolate,
#endif #endif
- GBool inlineImg) override; - GBool inlineImg) override;
+ bool inlineImg) override; + poppler_bool inlineImg) override;
virtual void drawImage(GfxState *state, Object *ref, Stream *str, virtual void drawImage(GfxState *state, Object *ref, Stream *str,
int width, int height, GfxImageColorMap *colorMap, int width, int height, GfxImageColorMap *colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- GBool interpolate, - GBool interpolate,
+ bool interpolate, + poppler_bool interpolate,
#endif #endif
- int *maskColors, GBool inlineImg) override; - int *maskColors, GBool inlineImg) override;
+ int *maskColors, bool inlineImg) override; + int *maskColors, poppler_bool inlineImg) override;
virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str, virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
int width, int height, int width, int height,
GfxImageColorMap *colorMap, GfxImageColorMap *colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- GBool interpolate, - GBool interpolate,
+ bool interpolate, + poppler_bool interpolate,
#endif #endif
Stream *maskStr, int maskWidth, int maskHeight, Stream *maskStr, int maskWidth, int maskHeight,
- GBool maskInvert - GBool maskInvert
+ bool maskInvert + poppler_bool maskInvert
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- , GBool maskInterpolate - , GBool maskInterpolate
+ , bool maskInterpolate + , poppler_bool maskInterpolate
#endif #endif
) override; ) override;
virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str, virtual void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
@ -201,18 +276,18 @@ index 7e65f085d..2dd2fff96 100644
GfxImageColorMap *colorMap, GfxImageColorMap *colorMap,
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- GBool interpolate, - GBool interpolate,
+ bool interpolate, + poppler_bool interpolate,
#endif #endif
Stream *maskStr, Stream *maskStr,
int maskWidth, int maskHeight, int maskWidth, int maskHeight,
GfxImageColorMap *maskColorMap GfxImageColorMap *maskColorMap
#if POPPLER_CHECK_VERSION(0, 12, 0) #if POPPLER_CHECK_VERSION(0, 12, 0)
- , GBool maskInterpolate - , GBool maskInterpolate
+ , bool maskInterpolate + , poppler_bool maskInterpolate
#endif #endif
) override; ) override;
@@ -279,7 +279,7 @@ extern FILE* g_binary_out; @@ -279,9 +290,13 @@ extern FILE* g_binary_out;
// note: if you ever change Output_t, please keep in mind that the current code // note: if you ever change Output_t, please keep in mind that the current code
// relies on it being of 8 bit size // relies on it being of 8 bit size
@ -220,9 +295,15 @@ index 7e65f085d..2dd2fff96 100644
+typedef unsigned char Output_t; +typedef unsigned char Output_t;
typedef std::vector< Output_t > OutputBuffer; typedef std::vector< Output_t > OutputBuffer;
+#if !POPPLER_CHECK_VERSION(0, 73, 0)
+static_assert(std::is_same<Guchar, unsigned char>::value, "unexpected typedef");
+#endif
+
#endif // INCLUDED_SDEXT_SOURCE_PDFIMPORT_XPDFWRAPPER_PDFIOUTDEV_GPL_HXX #endif // INCLUDED_SDEXT_SOURCE_PDFIMPORT_XPDFWRAPPER_PDFIOUTDEV_GPL_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
index 44f30c0ba..66c175165 100644 index 44f30c0..66c1751 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx --- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
@@ -242,7 +242,7 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf, @@ -242,7 +242,7 @@ void PngHelper::createPng( OutputBuffer& o_rOutputBuf,
@ -253,7 +334,7 @@ index 44f30c0ba..66c175165 100644
int nIndex = (y*height/maskHeight) * (width*4+1) + // mapped line int nIndex = (y*height/maskHeight) * (width*4+1) + // mapped line
(x*width/maskWidth)*4 + 1 + 3 // mapped column (x*width/maskWidth)*4 + 1 + 3 // mapped column
diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx diff --git a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
index 16db05afe..cd559cab0 100644 index 16db05a..cd559ca 100644
--- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx --- a/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx +++ b/sdext/source/pdfimport/xpdfwrapper/wrapper_gpl.cxx
@@ -69,7 +69,7 @@ int main(int argc, char **argv) @@ -69,7 +69,7 @@ int main(int argc, char **argv)

Loading…
Cancel
Save