summaryrefslogtreecommitdiff
blob: 6238002c2e59cfd95de5b510fe9ec46959eb3fff (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
From 2f77decfd2340c9a241dc508ae984a93dfef2643 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <andreas.sturmlechner@gmail.com>
Date: Sat, 12 Jan 2019 21:43:29 +0100
Subject: [PATCH 2/2] Fix build with poppler-0.71.0

Thanks-to: maurerpe <junk4me46806@yahoo.com>
---
 texk/web2c/luatexdir/image/pdftoepdf.w | 10 +++++-----
 texk/web2c/luatexdir/lua/lepdflib.cc   | 18 +++++++++---------
 texk/web2c/pdftexdir/pdftex-common.h   |  2 +-
 texk/web2c/pdftexdir/pdftoepdf.cc      | 20 ++++++++++----------
 texk/web2c/pdftexdir/writeenc.c        |  2 +-
 texk/web2c/xetexdir/pdfimage.cpp       |  2 +-
 6 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w
index 0a23b201..aa1d7f25 100644
--- a/texk/web2c/luatexdir/image/pdftoepdf.w
+++ b/texk/web2c/luatexdir/image/pdftoepdf.w
@@ -363,7 +363,7 @@ void copyReal(PDF pdf, double d)
 
 static void copyString(PDF pdf, GooString * string)
 {
-    char *p;
+    const char *p;
     unsigned char c;
     size_t i, l;
     p = string->getCString();
@@ -393,7 +393,7 @@ static void copyString(PDF pdf, GooString * string)
     pdf->cave = true;
 }
 
-static void copyName(PDF pdf, char *s)
+static void copyName(PDF pdf, const char *s)
 {
     pdf_out(pdf, '/');
     for (; *s != 0; s++) {
@@ -527,7 +527,7 @@ static void writeRefs(PDF pdf, PdfDocument * pdf_doc)
 
 /* get the pagebox coordinates according to the pagebox_spec */
 
-static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
+static const PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
 {
     switch (pagebox_spec) {
         case PDF_BOX_SPEC_MEDIA:
@@ -584,7 +584,7 @@ void read_pdf_info(image_dict * idict)
     Catalog *catalog;
     Page *page;
     int rotate;
-    PDFRectangle *pagebox;
+    const PDFRectangle *pagebox;
     int pdf_major_version_found, pdf_minor_version_found;
     float xsize, ysize, xorig, yorig;
     if (isInit == false) {
@@ -721,7 +721,7 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
     Ref *pageref;
     Dict *pageDict;
     Object obj1, contents, pageobj, pagesobj1, pagesobj2, *op1, *op2, *optmp;
-    PDFRectangle *pagebox;
+    const PDFRectangle *pagebox;
     int i, l;
     double bbox[4];
     /* char s[256]; */
diff --git a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
index d47ec941..01f9415c 100644
--- a/texk/web2c/luatexdir/lua/lepdflib.cc
+++ b/texk/web2c/luatexdir/lua/lepdflib.cc
@@ -238,7 +238,7 @@ static int l_new_Attribute(lua_State * L)
        if (uobj->pd != NULL && uobj->pd->pc != uobj->pc)
           pdfdoc_changed_error(L);
        uout = new_Attribute_userdata(L);
-       uout->d = new Attribute(n, nlen, (Object *)uobj->d);
+       uout->d = new Attribute(GooString(n, nlen), (Object *)uobj->d);
        uout->atype = ALLOC_LEPDF;
        uout->pc = uobj->pc;
        uout->pd = uobj->pd;
@@ -443,7 +443,7 @@ static int m_##in##_##function(lua_State * L)                  \
     uin = (udstruct *) luaL_checkudata(L, 1, M_##in);          \
     if (uin->pd != NULL && uin->pd->pc != uin->pc)             \
         pdfdoc_changed_error(L);                               \
-    o = ((in *) uin->d)->function();                           \
+    o = (out *) ((in *) uin->d)->function();		       \
     if (o != NULL) {                                           \
         uout = new_##out##_userdata(L);                        \
         uout->d = o;                                           \
@@ -972,12 +972,12 @@ m_poppler_get_INT(Dict, getLength);
 
 static int m_Dict_add(lua_State * L)
 {
-    char *s;
+    const char *s;
     udstruct *uin, *uobj;
     uin = (udstruct *) luaL_checkudata(L, 1, M_Dict);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
-    s = copyString(luaL_checkstring(L, 2));
+    s = luaL_checkstring(L, 2);
     uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
     ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d)));
     return 0;
@@ -1894,7 +1894,7 @@ static int m_Object_dictAdd(lua_State * L)
         pdfdoc_changed_error(L);
     if (!((Object *) uin->d)->isDict())
         luaL_error(L, "Object is not a Dict");
-    ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d)));
+    ((Object *) uin->d)->dictAdd(s, std::move(*((Object *) uobj->d)));
     return 0;
 }
 
@@ -2308,7 +2308,7 @@ m_PDFDoc_INT(getErrorCode);
 
 static int m_PDFDoc_getFileName(lua_State * L)
 {
-    GooString *gs;
+    const GooString *gs;
     udstruct *uin;
     uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
@@ -2396,7 +2396,7 @@ m_PDFDoc_INT(getNumPages);
 
 static int m_PDFDoc_readMetadata(lua_State * L)
 {
-    GooString *gs;
+    const GooString *gs;
     udstruct *uin;
     uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
@@ -2414,7 +2414,7 @@ static int m_PDFDoc_readMetadata(lua_State * L)
 
 static int m_PDFDoc_getStructTreeRoot(lua_State * L)
 {
-    StructTreeRoot *obj;
+    const StructTreeRoot *obj;
     udstruct *uin, *uout;
     uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
@@ -2422,7 +2422,7 @@ static int m_PDFDoc_getStructTreeRoot(lua_State * L)
     if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
         obj = ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
         uout = new_StructTreeRoot_userdata(L);
-        uout->d = obj;
+        uout->d = (StructTreeRoot *) obj;
         uout->pc = uin->pc;
         uout->pd = uin->pd;
     } else
diff --git a/texk/web2c/pdftexdir/pdftex-common.h b/texk/web2c/pdftexdir/pdftex-common.h
index 307ba64a..09741707 100644
--- a/texk/web2c/pdftexdir/pdftex-common.h
+++ b/texk/web2c/pdftexdir/pdftex-common.h
@@ -101,7 +101,7 @@ extern void tex_printf(const char *, ...);
 extern void write_epdf(void);
 
 /* writeenc.c */
-extern void epdf_write_enc(char **, int);
+extern void epdf_write_enc(const char **, int);
 
 /* writeimg.c */
 extern float epdf_width;
diff --git a/texk/web2c/pdftexdir/pdftoepdf.cc b/texk/web2c/pdftexdir/pdftoepdf.cc
index af12c74e..e353b652 100644
--- a/texk/web2c/pdftexdir/pdftoepdf.cc
+++ b/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -270,7 +270,7 @@ static int getNewObjectNumber(Ref ref)
 
 static void copyObject(Object *);
 
-static void copyName(char *s)
+static void copyName(const char *s)
 {
     pdf_puts("/");
     for (; *s != 0; s++) {
@@ -305,7 +305,7 @@ static void copyDict(Object * obj)
 static void copyFontDict(Object * obj, InObj * r)
 {
     int i, l;
-    char *key;
+    const char *key;
     if (!obj->isDict())
         pdftex_fail("PDF inclusion: invalid dict type <%s>",
                     obj->getTypeName());
@@ -377,7 +377,7 @@ static bool embeddableFont(Object * fontdesc)
     return false;
 }
 
-static void copyFont(char *tag, Object * fontRef)
+static void copyFont(const char *tag, Object * fontRef)
 {
     Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
         stemV;
@@ -462,7 +462,7 @@ static void copyFontResources(Object * obj)
     pdf_puts(">>\n");
 }
 
-static void copyOtherResources(Object * obj, char *key)
+static void copyOtherResources(Object * obj, const char *key)
 {
     // copies all other resources (write_epdf handles Fonts and ProcSets),
 
@@ -549,7 +549,7 @@ static void copyObject(Object * obj)
     Object obj1;
     int i, l, c;
     Ref ref;
-    char *p;
+    const char *p;
     GString *s;
     if (obj->isBool()) {
         pdf_printf("%s", obj->getBool()? "true" : "false");
@@ -650,7 +650,7 @@ static void writeRefs()
 static void writeEncodings()
 {
     UsedEncoding *r, *n;
-    char *glyphNames[256], *s;
+    const char *glyphNames[256], *s;
     int i;
     for (r = encodingList; r != 0; r = r->next) {
         for (i = 0; i < 256; i++) {
@@ -678,7 +678,7 @@ static void writeEncodings()
 }
 
 // get the pagebox according to the pagebox_spec
-static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
+static const PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
 {
     if (pagebox_spec == pdfboxspecmedia)
         return page->getMediaBox();
@@ -710,7 +710,7 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
 {
     PdfDocument *pdf_doc;
     Page *page;
-    PDFRectangle *pagebox;
+    const PDFRectangle *pagebox;
 #ifdef POPPLER_VERSION
     int pdf_major_version_found, pdf_minor_version_found;
 #else
@@ -829,7 +829,7 @@ void write_epdf(void)
     Object groupDict;
     bool writeSepGroup = false;
     Object info;
-    char *key;
+    const char *key;
     char s[256];
     int i, l;
     int rotate;
@@ -856,7 +856,7 @@ void write_epdf(void)
     pageObj = xref->fetch(pageRef->num, pageRef->gen);
     pageDict = pageObj.getDict();
     rotate = page->getRotate();
-    PDFRectangle *pagebox;
+    const PDFRectangle *pagebox;
     // write the Page header
     pdf_puts("/Type /XObject\n");
     pdf_puts("/Subtype /Form\n");
diff --git a/texk/web2c/pdftexdir/writeenc.c b/texk/web2c/pdftexdir/writeenc.c
index bd55103f..08f44633 100644
--- a/texk/web2c/pdftexdir/writeenc.c
+++ b/texk/web2c/pdftexdir/writeenc.c
@@ -83,7 +83,7 @@ fe_entry *get_fe_entry(char *s)
 
 /**********************************************************************/
 
-void epdf_write_enc(char **glyph_names, int fe_objnum)
+void epdf_write_enc(const char **glyph_names, int fe_objnum)
 {
     int i, i_old;
     assert(glyph_names != NULL);
diff --git a/texk/web2c/xetexdir/pdfimage.cpp b/texk/web2c/xetexdir/pdfimage.cpp
index 85389136..ce46cae1 100644
--- a/texk/web2c/xetexdir/pdfimage.cpp
+++ b/texk/web2c/xetexdir/pdfimage.cpp
@@ -78,7 +78,7 @@ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
 
 	Page*		page = doc->getCatalog()->getPage(page_num);
 
-	PDFRectangle*	r;
+	const PDFRectangle*	r;
 	switch (pdf_box) {
 		default:
 		case pdfbox_crop:
-- 
2.20.1