summary refs log tree commit diff
path: root/gnu/packages/patches/texlive-bin-pdftex-poppler-compat.patch
blob: eba4733f32d99aace1a0f15777e2903105e07396 (plain) (blame)
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
Fix compatibility with Poppler 0.72.

These files are taken from the upstream "poppler0.72.0.cc" variants and
diffed against the "newpoppler" files from the 20180414 distribution.

See revision 49336:
https://tug.org/svn/texlive/trunk/Build/source/texk/web2c/pdftexdir/

--- a/texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc	1970-01-01 01:00:00.000000000 +0100
+++ b/texk/web2c/pdftexdir/pdftoepdf-newpoppler.cc	2018-12-09 21:14:58.479732695 +0100
@@ -22,7 +22,7 @@
 https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
 by Arch Linux. A little modifications are made to avoid a crash for
 some kind of pdf images, such as figure_missing.pdf in gnuplot.
-The poppler should be 0.59.0 or newer versions.
+The poppler should be 0.72.0 or newer versions.
 POPPLER_VERSION should be defined.
 */
 
@@ -120,7 +120,7 @@
 
 static InObj *inObjList;
 static UsedEncoding *encodingList;
-static GBool isInit = gFalse;
+static bool isInit = false;
 
 // --------------------------------------------------------------------
 // Maintain list of open embedded PDF files
@@ -317,7 +317,7 @@
     pdf_puts("<<\n");
     assert(r->type == objFont); // FontDescriptor is in fd_tree
     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
-        key = obj->dictGetKey(i);
+        key = (char *)obj->dictGetKey(i);
         if (strncmp("FontDescriptor", key, strlen("FontDescriptor")) == 0
             || strncmp("BaseFont", key, strlen("BaseFont")) == 0
             || strncmp("Encoding", key, strlen("Encoding")) == 0)
@@ -427,7 +427,7 @@
         charset = fontdesc.dictLookup("CharSet");
         if (!charset.isNull() &&
             charset.isString() && is_subsetable(fontmap))
-            epdf_mark_glyphs(fd, (char *)charset.getString()->getCString());
+            epdf_mark_glyphs(fd, (char *)charset.getString()->c_str());
         else
             embed_whole_font(fd);
         addFontDesc(fontdescRef.getRef(), fd);
@@ -454,7 +454,7 @@
     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
         fontRef = obj->dictGetValNF(i);
         if (fontRef.isRef())
-            copyFont(obj->dictGetKey(i), &fontRef);
+            copyFont((char *)obj->dictGetKey(i), &fontRef);
         else if (fontRef.isDict()) {   // some programs generate pdf with embedded font object
             copyName((char *)obj->dictGetKey(i));
             pdf_puts(" ");
@@ -566,7 +566,7 @@
         pdf_printf("%s", convertNumToPDF(obj->getNum()));
     } else if (obj->isString()) {
         s = (GooString *)obj->getString();
-        p = s->getCString();
+        p = (char *)s->c_str();
         l = s->getLength();
         if (strlen(p) == (unsigned int) l) {
             pdf_puts("(");
@@ -664,7 +664,7 @@
                     ("PDF inclusion: CID fonts are not supported"
                      " (try to disable font replacement to fix this)");
             }
-            if ((s = ((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
+            if ((s = (char *)((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
                 glyphNames[i] = s;
             else
                 glyphNames[i] = notdef;
@@ -683,7 +683,7 @@
 }
 
 // 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();
@@ -715,7 +715,7 @@
 {
     PdfDocument *pdf_doc;
     Page *page;
-    PDFRectangle *pagebox;
+    const PDFRectangle *pagebox;
 #ifdef POPPLER_VERSION
     int pdf_major_version_found, pdf_minor_version_found;
 #else
@@ -724,8 +724,8 @@
     // initialize
     if (!isInit) {
         globalParams = new GlobalParams();
-        globalParams->setErrQuiet(gFalse);
-        isInit = gTrue;
+        globalParams->setErrQuiet(false);
+        isInit = true;
     }
     // open PDF file
     pdf_doc = find_add_document(image_name);
@@ -849,7 +849,7 @@
     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");
@@ -977,7 +977,7 @@
             }
             l = dic1.getLength();
             for (i = 0; i < l; i++) {
-                groupDict.dictAdd(copyString(dic1.getKey(i)),
+                groupDict.dictAdd((const char *)copyString(dic1.getKey(i)),
                                   dic1.getValNF(i));
             }
 // end modification
@@ -1001,14 +1001,14 @@
         pdf_puts("/Resources <<\n");
         for (i = 0, l = obj1->dictGetLength(); i < l; ++i) {
             obj2 = obj1->dictGetVal(i);
-            key = obj1->dictGetKey(i);
+            key = (char *)obj1->dictGetKey(i);
             if (strcmp("Font", key) == 0)
                 copyFontResources(&obj2);
             else if (strcmp("ProcSet", key) == 0)
                 copyProcSet(&obj2);
             else
-                copyOtherResources(&obj2, key);
+                copyOtherResources(&obj2, (char *)key);
         }
         pdf_puts(">>\n");
     }

--- a/texk/web2c/pdftexdir/pdftosrc-newpoppler.cc	1970-01-01 01:00:00.000000000 +0100
+++ b/texk/web2c/pdftexdir/pdftosrc-newpoppler.cc	2018-12-09 21:14:58.479732695 +0100
@@ -20,7 +20,7 @@
 /*
 This is based on the patch texlive-poppler-0.59.patch <2017-09-19> at
 https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
-by Arch Linux. The poppler should be 0.59.0 or newer versions.
+by Arch Linux. The poppler should be 0.72.0 or newer versions.
 POPPLER_VERSION should be defined.
 */
 
@@ -109,7 +109,7 @@
             fprintf(stderr, "No SourceName found\n");
             exit(1);
         }
-        outname = (char *)srcName.getString()->getCString();
+        outname = (char *)srcName.getString()->c_str();
         // We cannot free srcName, as objname shares its string.
         // srcName.free();
     } else if (objnum > 0) {
@@ -118,7 +118,7 @@
             fprintf(stderr, "Not a Stream object\n");
             exit(1);
         }
-        sprintf(buf, "%s", fileName->getCString());
+        sprintf(buf, "%s", fileName->c_str());
         if ((p = strrchr(buf, '.')) == 0)
             p = strchr(buf, 0);
         if (objgen == 0)
@@ -128,7 +128,7 @@
         outname = buf;
     } else {                    // objnum < 0 means we are extracting the XRef table
         extract_xref_table = true;
-        sprintf(buf, "%s", fileName->getCString());
+        sprintf(buf, "%s", fileName->c_str());
         if ((p = strrchr(buf, '.')) == 0)
             p = strchr(buf, 0);
         sprintf(p, ".xref");
@@ -173,9 +173,9 @@
 
                 // parse the header: object numbers and offsets
                 objStr.streamReset();
-                str = new EmbedStream(objStr.getStream(), Object(objNull), gTrue, first);
+                str = new EmbedStream(objStr.getStream(), Object(objNull), true, first);
                 lexer = new Lexer(xref, str);
-                parser = new Parser(xref, lexer, gFalse);
+                parser = new Parser(xref, lexer, false);
                 for (n = 0; n < nObjects; ++n) {
                     obj1 = parser->getObj();
                     obj2 = parser->getObj();