summaryrefslogtreecommitdiff
path: root/debian/patches/0004-Revert-change-regarding-const-ness-and-use-casts-ins.patch
blob: 2d79be062be968904a67eab0b5d6673b83d7fdd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 50a5297b82e26cfd52f6c00645ddc1057099d6a7 Mon Sep 17 00:00:00 2001
From: Andreas Politz <politza@hochschule-trier.de>
Date: Fri, 27 Apr 2018 17:43:14 +0200
Subject: [PATCH] Revert change regarding const'ness and use casts instead

Implement the originally proposed fix.
---
 server/poppler-hack.cc | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/server/poppler-hack.cc b/server/poppler-hack.cc
index c727425..427f9df 100644
--- a/server/poppler-hack.cc
+++ b/server/poppler-hack.cc
@@ -51,7 +51,10 @@ GType poppler_annot_markup_get_type (void) G_GNUC_CONST;
     double y2;
   };
 
-  char *_xpoppler_goo_string_to_utf8(const GooString *s)
+  // This function does not modify its argument s, but for
+  // compatibility reasons (e.g. getLength in GooString.h before 2015)
+  // with older poppler code, it can't be declared as such.
+  char *_xpoppler_goo_string_to_utf8(/* const */ GooString *s)
   {
     char *result;
 
@@ -85,7 +88,7 @@ GType poppler_annot_markup_get_type (void) G_GNUC_CONST;
   // Set the rectangle of an annotation.  It was first added in v0.26.
   void xpoppler_annot_set_rectangle (PopplerAnnot *a, PopplerRectangle *rectangle)
   {
-    const GooString *state = a->annot->getAppearState ();
+    GooString *state = (GooString*) a->annot->getAppearState ();
     char *ustate = _xpoppler_goo_string_to_utf8 (state);
 
     a->annot->setRect (rectangle->x1, rectangle->y1,
@@ -100,12 +103,12 @@ GType poppler_annot_markup_get_type (void) G_GNUC_CONST;
   gchar *xpoppler_annot_markup_get_created (PopplerAnnotMarkup *poppler_annot)
   {
     AnnotMarkup *annot;
-    const GooString *text;
+    GooString *text;
 
     g_return_val_if_fail (POPPLER_IS_ANNOT_MARKUP (poppler_annot), NULL);
 
     annot = static_cast<AnnotMarkup *>(POPPLER_ANNOT (poppler_annot)->annot);
-    text = annot->getDate ();
+    text = (GooString*) annot->getDate ();
 
     return text ? _xpoppler_goo_string_to_utf8 (text) : NULL;
   }
-- 
2.19.1