1 From 51351358a62acb6887eab49bc0dc4a7a3d18c17a Mon Sep 17 00:00:00 2001
2 From: Jan Tojnar <jtojnar@gmail.com>
3 Date: Tue, 3 Dec 2019 00:17:05 +0100
4 Subject: [PATCH] Fix build with Poppler 0.83.0
7 src/extension/internal/pdfinput/pdf-input.cpp | 6 +++---
8 src/extension/internal/pdfinput/pdf-parser.cpp | 4 ++--
9 .../internal/pdfinput/poppler-transition-api.h | 12 ++++++++++++
10 src/extension/internal/pdfinput/svg-builder.cpp | 4 ++--
11 4 files changed, 19 insertions(+), 7 deletions(-)
13 diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp
14 index e46ab9778b..472dc732de 100644
15 --- a/src/extension/internal/pdfinput/pdf-input.cpp
16 +++ b/src/extension/internal/pdfinput/pdf-input.cpp
17 @@ -689,12 +689,12 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) {
19 gchar const *poppler_datadir = g_getenv("POPPLER_DATADIR");
20 if (poppler_datadir != NULL) {
21 - globalParams = new GlobalParams(poppler_datadir);
22 + globalParams = _POPPLER_NEW_GLOBAL_PARAMS(poppler_datadir);
24 - globalParams = new GlobalParams();
25 + globalParams = _POPPLER_NEW_GLOBAL_PARAMS();
28 - globalParams = new GlobalParams();
29 + globalParams = _POPPLER_NEW_GLOBAL_PARAMS();
30 #endif // ENABLE_OSX_APP_LOCATIONS
33 diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
34 index 4eae275757..4513ad94c5 100644
35 --- a/src/extension/internal/pdfinput/pdf-parser.cpp
36 +++ b/src/extension/internal/pdfinput/pdf-parser.cpp
37 @@ -267,7 +267,7 @@ public:
38 ClipHistoryEntry *save();
39 ClipHistoryEntry *restore();
40 GBool hasSaves() { return saved != nullptr; }
41 - void setClip(GfxPath *newClipPath, GfxClipType newClipType = clipNormal);
42 + void setClip(_POPPLER_CONST_83 GfxPath *newClipPath, GfxClipType newClipType = clipNormal);
43 GfxPath *getClipPath() { return clipPath; }
44 GfxClipType getClipType() { return clipType; }
46 @@ -3377,7 +3377,7 @@ ClipHistoryEntry::~ClipHistoryEntry()
50 -void ClipHistoryEntry::setClip(GfxPath *clipPathA, GfxClipType clipTypeA) {
51 +void ClipHistoryEntry::setClip(_POPPLER_CONST_83 GfxPath *clipPathA, GfxClipType clipTypeA) {
52 // Free previous clip path
55 diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
56 index 01834007e8..96718118db 100644
57 --- a/src/extension/internal/pdfinput/poppler-transition-api.h
58 +++ b/src/extension/internal/pdfinput/poppler-transition-api.h
61 #include <glib/poppler-features.h>
63 +#if POPPLER_CHECK_VERSION(0, 83, 0)
64 +#define _POPPLER_CONST_83 const
66 +#define _POPPLER_CONST_83
69 #if POPPLER_CHECK_VERSION(0, 82, 0)
70 #define _POPPLER_CONST_82 const
73 #define _POPPLER_NEW_PARSER(xref, obj) Parser(xref, new Lexer(xref, obj), gFalse)
76 +#if POPPLER_CHECK_VERSION(0, 83, 0)
77 +#define _POPPLER_NEW_GLOBAL_PARAMS(args...) std::unique_ptr<GlobalParams>(new GlobalParams(args))
79 +#define _POPPLER_NEW_GLOBAL_PARAMS(args...) new GlobalParams(args)
83 #if POPPLER_CHECK_VERSION(0, 72, 0)
84 #define getCString c_str
85 diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp
86 index a7134684a0..d04173b289 100644
87 --- a/src/extension/internal/pdfinput/svg-builder.cpp
88 +++ b/src/extension/internal/pdfinput/svg-builder.cpp
89 @@ -262,10 +262,10 @@ static void svgSetTransform(Inkscape::XML::Node *node, double c0, double c1,
91 * \brief Generates a SVG path string from poppler's data structure
93 -static gchar *svgInterpretPath(GfxPath *path) {
94 +static gchar *svgInterpretPath(_POPPLER_CONST_83 GfxPath *path) {
95 Inkscape::SVG::PathString pathString;
96 for (int i = 0 ; i < path->getNumSubpaths() ; ++i ) {
97 - GfxSubpath *subpath = path->getSubpath(i);
98 + _POPPLER_CONST_83 GfxSubpath *subpath = path->getSubpath(i);
99 if (subpath->getNumPoints() > 0) {
100 pathString.moveTo(subpath->getX(0), subpath->getY(0));