gambas3/gambas3-3.14.3-poppler-0.85.patch

55 lines
1.8 KiB
Diff
Raw Normal View History

From 6a16e02ee3a0f05cd70876d76f807ab5076440b1 Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
Date: Thu, 30 Jan 2020 21:08:47 +0200
Subject: [PATCH] Use GlobalParams::getUtf8Map() found in poppler 0.85
[GB.PDF]
* BUG: Make 'gb.pdf' compile with poppler >= 0.85.
---
gb.pdf/configure.ac | 2 ++
gb.pdf/src/CPdfDocument.cpp | 7 +++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gb.pdf/configure.ac b/gb.pdf/configure.ac
index 691e3088a..1dd10b455 100644
--- a/gb.pdf/configure.ac
+++ b/gb.pdf/configure.ac
@@ -29,6 +29,8 @@ if test "$have_poppler" = "yes"; then
AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_76, $((1-$?)), Poppler version >= 0.76)
pkg-config --atleast-version=0.83.0 poppler
AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_83, $((1-$?)), Poppler version >= 0.83)
+ pkg-config --atleast-version=0.85.0 poppler
+ AC_DEFINE_UNQUOTED(POPPLER_VERSION_0_85, $((1-$?)), Poppler version >= 0.85)
fi
AC_OUTPUT( \
diff --git a/gb.pdf/src/CPdfDocument.cpp b/gb.pdf/src/CPdfDocument.cpp
index 9522d15db..4b53fd50d 100644
--- a/gb.pdf/src/CPdfDocument.cpp
+++ b/gb.pdf/src/CPdfDocument.cpp
@@ -104,12 +104,14 @@ END_PROPERTY
static void return_unicode_string(const Unicode *unicode, int len)
{
- static UnicodeMap *uMap = NULL;
-
GooString gstr;
char buf[8]; /* 8 is enough for mapping an unicode char to a string */
int i, n;
+#if POPPLER_VERSION_0_85
+ const UnicodeMap *uMap = globalParams->getUtf8Map();
+#else
+ static UnicodeMap *uMap = NULL;
if (uMap == NULL)
{
GooString *enc = new GooString("UTF-8");
@@ -117,6 +119,7 @@ static void return_unicode_string(const Unicode *unicode, int len)
uMap->incRefCnt();
delete enc;
}
+#endif
for (i = 0; i < len; ++i) {
n = uMap->mapUnicode(unicode[i], buf, sizeof(buf));