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