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