9870aa
From a600c6438fef2f4c06f9a4a7d933d99fb054a973 Mon Sep 17 00:00:00 2001
9870aa
From: Eduard Braun <eduard.braun2@gmx.de>
9870aa
Date: Tue, 24 Apr 2018 19:18:26 +0200
9870aa
Subject: [PATCH] Fix compilation with poppler 0.64
9870aa
9870aa
---
9870aa
 src/extension/internal/pdfinput/pdf-parser.cpp  | 10 +++++-----
9870aa
 src/extension/internal/pdfinput/pdf-parser.h    |  2 +-
9870aa
 src/extension/internal/pdfinput/svg-builder.cpp |  4 ++--
9870aa
 src/extension/internal/pdfinput/svg-builder.h   |  3 +--
9870aa
 4 files changed, 9 insertions(+), 10 deletions(-)
9870aa
9870aa
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
9870aa
index 15bc2d746d..6c498f9812 100644
9870aa
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
9870aa
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
9870aa
@@ -2582,7 +2582,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/)
9870aa
   }
9870aa
 }
9870aa
 
9870aa
-void PdfParser::doShowText(GooString *s) {
9870aa
+void PdfParser::doShowText(const GooString *s) {
9870aa
   GfxFont *font;
9870aa
   int wMode;
9870aa
   double riseX, riseY;
9870aa
@@ -2601,7 +2601,7 @@ void PdfParser::doShowText(GooString *s) {
9870aa
   font = state->getFont();
9870aa
   wMode = font->getWMode();
9870aa
 
9870aa
-  builder->beginString(state, s);
9870aa
+  builder->beginString(state);
9870aa
 
9870aa
   // handle a Type 3 char
9870aa
   if (font->getType() == fontType3 && 0) {//out->interpretType3Chars()) {
9870aa
@@ -2631,7 +2631,7 @@ void PdfParser::doShowText(GooString *s) {
9870aa
     double lineX = state->getLineX();
9870aa
     double lineY = state->getLineY();
9870aa
     oldParser = parser;
9870aa
-    p = s->getCString();
9870aa
+    p = g_strdup(s->getCString());
9870aa
     len = s->getLength();
9870aa
     while (len > 0) {
9870aa
       n = font->getNextChar(p, len, &code,
9870aa
@@ -2686,7 +2686,7 @@ void PdfParser::doShowText(GooString *s) {
9870aa
 
9870aa
   } else {
9870aa
     state->textTransformDelta(0, state->getRise(), &riseX, &riseY);
9870aa
-    p = s->getCString();
9870aa
+    p = g_strdup(s->getCString());
9870aa
     len = s->getLength();
9870aa
     while (len > 0) {
9870aa
       n = font->getNextChar(p, len, &code,
9870aa
@@ -2732,7 +2732,7 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/)
9870aa
 {
9870aa
   Object obj1, obj2, obj3, refObj;
9870aa
 
9870aa
-  char *name = args[0].getName();
9870aa
+  char *name = g_strdup(args[0].getName());
9870aa
 #if defined(POPPLER_NEW_OBJECT_API)
9870aa
   if ((obj1 = res->lookupXObject(name)).isNull()) {
9870aa
 #else
9870aa
diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h
9870aa
index e28fecc2e1..f985b15cad 100644
9870aa
--- a/src/extension/internal/pdfinput/pdf-parser.h
9870aa
+++ b/src/extension/internal/pdfinput/pdf-parser.h
9870aa
@@ -287,7 +287,7 @@ private:
9870aa
   void opMoveShowText(Object args[], int numArgs);
9870aa
   void opMoveSetShowText(Object args[], int numArgs);
9870aa
   void opShowSpaceText(Object args[], int numArgs);
9870aa
-  void doShowText(GooString *s);
9870aa
+  void doShowText(const GooString *s);
9870aa
 
9870aa
   // XObject operators
9870aa
   void opXObject(Object args[], int numArgs);
9870aa
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
9870aa
index 158c5ae068..8e5a5f6396 100644
9870aa
--- a/src/extension/internal/pdfinput/svg-builder.cpp
9870aa
+++ b/src/extension/internal/pdfinput/svg-builder.cpp
9870aa
@@ -1021,7 +1021,7 @@ void SvgBuilder::updateFont(GfxState *state) {
9870aa
     GfxFont *font = state->getFont();
9870aa
     // Store original name
9870aa
     if (font->getName()) {
9870aa
-        _font_specification = font->getName()->getCString();
9870aa
+        _font_specification = g_strdup(font->getName()->getCString());
9870aa
     } else {
9870aa
         _font_specification = (char*) "Arial";
9870aa
     }
9870aa
@@ -1362,7 +1362,7 @@ void SvgBuilder::_flushText() {
9870aa
     _glyphs.clear();
9870aa
 }
9870aa
 
9870aa
-void SvgBuilder::beginString(GfxState *state, GooString * /*s*/) {
9870aa
+void SvgBuilder::beginString(GfxState *state) {
9870aa
     if (_need_font_update) {
9870aa
         updateFont(state);
9870aa
     }
9870aa
diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h
9870aa
index ad15c9c06f..ed2a4d48e0 100644
9870aa
--- a/src/extension/internal/pdfinput/svg-builder.h
9870aa
+++ b/src/extension/internal/pdfinput/svg-builder.h
9870aa
@@ -29,7 +29,6 @@ namespace Inkscape {
9870aa
 #include <glibmm/ustring.h>
9870aa
 
9870aa
 #include "CharTypes.h"
9870aa
-class GooString;
9870aa
 class Function;
9870aa
 class GfxState;
9870aa
 struct GfxColor;
9870aa
@@ -136,7 +135,7 @@ public:
9870aa
     void clearSoftMask(GfxState *state);
9870aa
 
9870aa
     // Text handling
9870aa
-    void beginString(GfxState *state, GooString *s);
9870aa
+    void beginString(GfxState *state);
9870aa
     void endString(GfxState *state);
9870aa
     void addChar(GfxState *state, double x, double y,
9870aa
                  double dx, double dy,
9870aa
-- 
9870aa
2.17.1
9870aa