Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cogitri/812aaec7efae1919ed5d9a81a9cad9d5 to your computer and use it in GitHub Desktop.
Save Cogitri/812aaec7efae1919ed5d9a81a9cad9d5 to your computer and use it in GitHub Desktop.
0001-community-libreoffice-fix-build-against-libreoffice-.patch
From a4e9b0a80ca077713d510a0d091c6f397afc67d0 Mon Sep 17 00:00:00 2001
From: Rasmus Thomsen <oss@cogitri.dev>
Date: Sat, 26 Oct 2019 20:17:51 +0200
Subject: [PATCH] community/libreoffice: fix build against libreoffice 0.82
---
community/libreoffice/APKBUILD | 1 +
community/libreoffice/fix-poppler-082.patch | 109 ++++++++++++++++++++
2 files changed, 110 insertions(+)
create mode 100644 community/libreoffice/fix-poppler-082.patch
diff --git a/community/libreoffice/APKBUILD b/community/libreoffice/APKBUILD
index 5a26529de6..03dfed7ee7 100644
--- a/community/libreoffice/APKBUILD
+++ b/community/libreoffice/APKBUILD
@@ -135,6 +135,7 @@ source="https://download.documentfoundation.org/libreoffice/src/$_v/libreoffice-
disable-liborcus-unittest.patch
musl-stacksize.patch
musl-libintl.patch
+ fix-poppler-082.patch
"
# secfixes:
diff --git a/community/libreoffice/fix-poppler-082.patch b/community/libreoffice/fix-poppler-082.patch
new file mode 100644
index 0000000000..506bc83faf
--- /dev/null
+++ b/community/libreoffice/fix-poppler-082.patch
@@ -0,0 +1,109 @@
+From 142e03e329bbd6cd2d37cb24ed18c2538eb20daa Mon Sep 17 00:00:00 2001
+From: Rasmus Thomsen <oss@cogitri.dev>
+Date: Sat, 26 Oct 2019 14:11:35 +0200
+Subject: [PATCH] Fix build with poppler-0.82
+
+Change-Id: I3b6b3faea7986f3e5a6ae4790580d03bc9c955fc
+---
+ .../pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx | 25 +++++++++++++++++++
+ .../pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx | 16 +++++++++++-
+ 2 files changed, 40 insertions(+), 1 deletion(-)
+
+--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx 2019-10-26 12:40:49.670720552 +0200
++++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx 2019-10-26 12:40:52.894158294 +0200
+@@ -232,10 +232,17 @@ namespace pdfi
+ virtual void eoClip(GfxState *state) override;
+
+ //----- text drawing
++#if POPPLER_CHECK_VERSION(0, 82, 0)
++ virtual void drawChar(GfxState *state, double x, double y,
++ double dx, double dy,
++ double originX, double originY,
++ CharCode code, int nBytes, const Unicode *u, int uLen) override;
++#else
+ virtual void drawChar(GfxState *state, double x, double y,
+ double dx, double dy,
+ double originX, double originY,
+ CharCode code, int nBytes, Unicode *u, int uLen) override;
++#endif
+ #if POPPLER_CHECK_VERSION(0, 64, 0)
+ virtual void drawString(GfxState *state, const GooString *s) override;
+ #else
+@@ -248,10 +255,17 @@ namespace pdfi
+ int width, int height, poppler_bool invert,
+ poppler_bool interpolate,
+ poppler_bool inlineImg) override;
++#if POPPLER_CHECK_VERSION(0, 82, 0)
+ virtual void drawImage(GfxState *state, Object *ref, Stream *str,
+ int width, int height, GfxImageColorMap *colorMap,
+ poppler_bool interpolate,
+- int* maskColors, poppler_bool inlineImg) override;
++ const int* maskColors, poppler_bool inlineImg) override;
++#else
++ virtual void drawImage(GfxState *state, Object *ref, Stream *str,
++ int width, int height, GfxImageColorMap *colorMap,
++ poppler_bool interpolate,
++ int* maskColors, poppler_bool inlineImg) override;
++#endif
+ virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
+ int width, int height,
+ GfxImageColorMap *colorMap,
+
+--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 2019-10-26 12:54:06.718793588 +0200
++++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx 2019-10-26 12:55:54.338415432 +0200
+@@ -863,11 +863,20 @@ void PDFOutDev::eoClip(GfxState *state)
+ local offset of character (zero for horizontal writing mode). not
+ taken into account for output pos updates. Used for vertical writing.
+ */
++
++#if POPPLER_CHECK_VERSION(0, 82, 0)
++void PDFOutDev::drawChar(GfxState *state, double x, double y,
++ double dx, double dy,
++ double originX, double originY,
++ CharCode, int /*nBytes*/, const Unicode *u, int uLen)
++{
++#else
+ void PDFOutDev::drawChar(GfxState *state, double x, double y,
+ double dx, double dy,
+ double originX, double originY,
+ CharCode, int /*nBytes*/, Unicode *u, int uLen)
+ {
++#endif
+ assert(state);
+
+ if( u == nullptr )
+@@ -979,11 +988,19 @@ void PDFOutDev::drawImageMask(GfxState* pState, Object*, Stream* str,
+ writeBinaryBuffer(aBuf);
+ }
+
++#if POPPLER_CHECK_VERSION(0, 82, 0)
++void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
++ int width, int height, GfxImageColorMap* colorMap,
++ poppler_bool /*interpolate*/,
++ const int* maskColors, poppler_bool /*inlineImg*/ )
++{
++#else
+ void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
+ int width, int height, GfxImageColorMap* colorMap,
+ poppler_bool /*interpolate*/,
+ int* maskColors, poppler_bool /*inlineImg*/ )
+ {
++#endif
+ if (m_bSkipImages)
+ return;
+ OutputBuffer aBuf; initBuf(aBuf);
+@@ -1004,12 +1021,12 @@ void PDFOutDev::drawImage(GfxState*, Object*, Stream* str,
+ {
+ GfxRGB aMinRGB;
+ colorMap->getColorSpace()->getRGB(
+- reinterpret_cast<GfxColor*>(maskColors),
++ const_cast<GfxColor*>(reinterpret_cast<const GfxColor*>(maskColors)),
+ &aMinRGB );
+
+ GfxRGB aMaxRGB;
+ colorMap->getColorSpace()->getRGB(
+- reinterpret_cast<GfxColor*>(maskColors)+gfxColorMaxComps,
++ const_cast<GfxColor*>(reinterpret_cast<const GfxColor*>(maskColors))+gfxColorMaxComps,
+ &aMaxRGB );
+
+ aMaskBuf.push_back( colToByte(aMinRGB.r) );
--
2.23.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment