summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/pdfinput/pdf-parser.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2018-09-04 22:31:06 +0000
committerEduard Braun <eduard.braun2@gmx.de>2018-09-04 22:31:06 +0000
commit722e121361d0f784083d10e897155b7d4e44e515 (patch)
tree52339871445e11a58d8942f77cb634bb739aaa5c /src/extension/internal/pdfinput/pdf-parser.cpp
parentfix for comment https://gitlab.com/inkscape/inkscape/commit/a12d0aecffa31fa7b... (diff)
downloadinkscape-722e121361d0f784083d10e897155b7d4e44e515.tar.gz
inkscape-722e121361d0f784083d10e897155b7d4e44e515.zip
Modified fix for compatibility with poppler 0.64
This is slightly uglier than a600c6438fef2f4c06f9a4a7d933d99fb054a973 but avoids duplicating strings (which is unnecessary and leaked memory). It's also closer to what upstream intended with the changes in 0.64.
Diffstat (limited to 'src/extension/internal/pdfinput/pdf-parser.cpp')
-rw-r--r--src/extension/internal/pdfinput/pdf-parser.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index 5fa21263a..a3a8ff25a 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -32,6 +32,7 @@
#include "pdf-parser.h"
#include "util/units.h"
+#include "glib/poppler-features.h"
#include "goo/gmem.h"
#include "goo/GooString.h"
#include "GlobalParams.h"
@@ -2577,7 +2578,11 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/)
}
}
+#if POPPLER_CHECK_VERSION(0,64,0)
void PdfParser::doShowText(const GooString *s) {
+#else
+void PdfParser::doShowText(GooString *s) {
+#endif
GfxFont *font;
int wMode;
double riseX, riseY;
@@ -2590,7 +2595,11 @@ void PdfParser::doShowText(const GooString *s) {
Object charProc;
Dict *resDict;
Parser *oldParser;
+#if POPPLER_CHECK_VERSION(0,64,0)
+ const char *p;
+#else
char *p;
+#endif
int len, n, uLen;
font = state->getFont();
@@ -2626,7 +2635,7 @@ void PdfParser::doShowText(const GooString *s) {
double lineX = state->getLineX();
double lineY = state->getLineY();
oldParser = parser;
- p = g_strdup(s->getCString());
+ p = s->getCString();
len = s->getLength();
while (len > 0) {
n = font->getNextChar(p, len, &code,
@@ -2681,7 +2690,7 @@ void PdfParser::doShowText(const GooString *s) {
} else {
state->textTransformDelta(0, state->getRise(), &riseX, &riseY);
- p = g_strdup(s->getCString());
+ p = s->getCString();
len = s->getLength();
while (len > 0) {
n = font->getNextChar(p, len, &code,
@@ -2727,7 +2736,11 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/)
{
Object obj1, obj2, obj3, refObj;
- char *name = g_strdup(args[0].getName());
+#if POPPLER_CHECK_VERSION(0,64,0)
+ const char *name = args[0].getName();
+#else
+ char *name = args[0].getName();
+#endif
#if defined(POPPLER_NEW_OBJECT_API)
if ((obj1 = res->lookupXObject(name)).isNull()) {
#else