summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/TLpatches/patch-bunched
blob: f86680d4bd7d30632bdfa20abc30c59d5ee2cf53 (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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
diff -ur xpdf-4.05/goo/gfile.cc xpdf-src/goo/gfile.cc
--- xpdf-4.05/goo/gfile.cc	Thu Feb 08 05:32:41 2024
+++ xpdf-src/goo/gfile.cc	Sat Feb 10 11:31:53 2024
@@ -7,6 +7,9 @@
 // Copyright 1996-2003 Glyph & Cog, LLC
 //
 //========================================================================
+//  Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+//  See top-level ChangeLog for a list of all modifications
+//========================================================================
 
 #include <aconf.h>
 
@@ -441,6 +444,7 @@
 #endif
 }
 
+#ifndef PDF_PARSER_ONLY
 GBool openTempFile(GString **name, FILE **f,
 		   const char *mode, const char *ext) {
 #if defined(_WIN32)
@@ -555,6 +559,7 @@
   return gTrue;
 #endif
 }
+#endif /* !PDF_PARSER_ONLY */
 
 GBool createDir(char *path, int mode) {
 #ifdef _WIN32
@@ -649,6 +654,8 @@
 
 FILE *openFile(const char *path, const char *mode) {
 #if defined(_WIN32)
+  return fopen(path, mode);
+#if 0
   wchar_t wPath[winMaxLongPath + 1];
   wchar_t wMode[8];
   int i;
@@ -660,6 +667,7 @@
   wMode[i] = (wchar_t)0;
   readWindowsShortcut(wPath, winMaxLongPath + 1);
   return _wfopen(wPath, wMode);
+#endif /* 0 */
 #elif defined(VMS)
   return fopen(path, mode, "ctx=stm");
 #else
@@ -667,6 +675,7 @@
 #endif
 }
 
+#if 0
 #ifdef _WIN32
 void readWindowsShortcut(wchar_t *wPath, size_t wPathSize) {
   size_t n = wcslen(wPath);
@@ -712,11 +721,15 @@
   wcscpy(wPath, target);
 }
 #endif
+#endif /* 0 */
 
 int makeDir(const char *path, int mode) {
 #ifdef _WIN32
+  /*
   wchar_t wPath[winMaxLongPath + 1];
   return _wmkdir(fileNameToUCS2(path, wPath, winMaxLongPath + 1));
+  */
+  return _mkdir(path);
 #else
   return mkdir(path, (mode_t)mode);
 #endif
@@ -775,6 +788,7 @@
 #endif
 }
 
+#ifndef PDF_PARSER_ONLY
 void fixCommandLine(int *argc, char **argv[]) {
 #ifdef _WIN32
   int argcw;
@@ -800,3 +814,4 @@
   LocalFree(argvw);
 #endif
 }
+#endif /* !PDF_PARSER_ONLY */
diff -ur xpdf-4.05/goo/gfile.h xpdf-src/goo/gfile.h
--- xpdf-4.05/goo/gfile.h	Thu Feb 08 05:32:41 2024
+++ xpdf-src/goo/gfile.h	Sat Feb 10 11:38:12 2024
@@ -106,11 +106,13 @@
 // UCS-2 and calls _wfopen().  On other OSes, this simply calls fopen().
 extern FILE *openFile(const char *path, const char *mode);
 
+#if 0
 #ifdef _WIN32
 // If [wPath] is a Windows shortcut (.lnk file), read the target path
 // and store it back into [wPath].
 extern void readWindowsShortcut(wchar_t *wPath, size_t wPathSize);
 #endif
+#endif /* 0 */
 
 // Create a directory.  On Windows, this converts the path from UTF-8
 // to UCS-2 and calls _wmkdir(), ignoring the mode argument.  On other
@@ -145,6 +147,8 @@
 
 // On Windows, this gets the Unicode command line and converts it to
 // UTF-8.  On other systems, this is a nop.
+#ifndef PDF_PARSER_ONLY
 extern void fixCommandLine(int *argc, char **argv[]);
+#endif /* !PDF_PARSER_ONLY */
 
 #endif
diff -ur xpdf-4.05/xpdf/Error.cc xpdf-src/xpdf/Error.cc
--- xpdf-4.05/xpdf/Error.cc	Thu Feb 08 05:32:41 2024
+++ xpdf-src/xpdf/Error.cc	Sat Feb 10 11:42:28 2024
@@ -73,11 +73,14 @@
     (*errorCbk)(errorCbkData, category, (int)pos, sanitized->getCString());
   } else {
     fflush(stdout);
+    /* Label the error messages for pdftex's use as libxpdf.
+       It would be cleaner to use the callback feature, but seems
+       like too much trouble at this late date. */
     if (pos >= 0) {
-      fprintf(stderr, "%s (%d): %s\n",
+      fprintf(stderr, "\nlibxpdf: %s (%d): %s\n",
 	      errorCategoryNames[category], (int)pos, sanitized->getCString());
     } else {
-      fprintf(stderr, "%s: %s\n",
+      fprintf(stderr, "\nlibxpdf: %s: %s\n",
 	      errorCategoryNames[category], sanitized->getCString());
     }
     fflush(stderr);
diff -ur xpdf-4.05/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc
--- xpdf-4.05/xpdf/GlobalParams.cc	Thu Feb 08 05:32:41 2024
+++ xpdf-src/xpdf/GlobalParams.cc	Sat Feb 10 14:04:34 2024
@@ -41,9 +41,13 @@
 
 #ifdef _WIN32
 #ifndef __GNUC__
-#  define strcasecmp stricmp
-#  define strncasecmp strnicmp
+#  undef strcasecmp
+#  undef strncasecmp
+#  define strcasecmp _stricmp
+#  define strncasecmp _strnicmp
 #endif
+#else
+#  include <strings.h>
 #endif
 
 #if MULTITHREADED
@@ -770,7 +774,9 @@
   separateRotatedText = gFalse;
   createDefaultKeyBindings();
   popupMenuCmds = new GList();
+#ifndef PDF_PARSER_ONLY
   initStateFilePaths();
+#endif
   saveSessionOnQuit = gTrue;
   savePageNumbers = gTrue;
   printCommands = gFalse;
@@ -811,6 +817,7 @@
   f = NULL;
   fileName = NULL;
   if (cfgFileName && cfgFileName[0]) {
+#ifndef PDF_PARSER_ONLY
     fileName = new GString(cfgFileName);
     if (!(f = fopen(fileName->getCString(), "r"))) {
       delete fileName;
@@ -843,6 +850,7 @@
     parseFile(fileName, f);
     delete fileName;
     fclose(f);
+#endif /* !PDF_PARSER_ONLY */
   }
 }
 
@@ -1028,6 +1036,7 @@
 				     xpdfKeyContextAny, "zoomFitWidth"));
 }
 
+#ifndef PDF_PARSER_ONLY
 void GlobalParams::initStateFilePaths() {
 #ifdef _WIN32
   char path[MAX_PATH];
@@ -1046,6 +1055,7 @@
   sessionFile = appendToPath(getHomeDir(), ".xpdf.session");
 #endif
 }
+#endif
 
 void GlobalParams::parseFile(GString *fileName, FILE *f) {
   int line;
@@ -2487,8 +2497,11 @@
 				   base14->fontNum,
 				   displayFontTab[i].obliqueFactor));
       } else {
+// Do not display unnecessary looking message on W32
+#ifndef _WIN32
 	error(errConfig, -1, "No display font for '{0:s}'",
 	      displayFontTab[i].name);
+#endif
       }
     }
   }
diff -ur xpdf-4.05/xpdf/GlobalParams.h xpdf-src/xpdf/GlobalParams.h
--- xpdf-4.05/xpdf/GlobalParams.h	Thu Feb 08 05:32:41 2024
+++ xpdf-src/xpdf/GlobalParams.h	Sat Feb 10 14:04:34 2024
@@ -5,6 +5,9 @@
 // Copyright 2001-2003 Glyph & Cog, LLC
 //
 //========================================================================
+//  Modified for TeX Live by Peter Breitenlohner <tex-live@tug.org>
+//  See top-level ChangeLog for a list of all modifications
+//========================================================================
 
 #ifndef GLOBALPARAMS_H
 #define GLOBALPARAMS_H
@@ -233,7 +236,7 @@
 
   // Initialize the global parameters by attempting to read a config
   // file.
-  GlobalParams(const char *cfgFileName);
+  GlobalParams(const char *cfgFileName = NULL);
 
   ~GlobalParams();
 
@@ -423,7 +426,9 @@
 
   void setDataDirVar();
   void createDefaultKeyBindings();
+#ifndef PDF_PARSER_ONLY
   void initStateFilePaths();
+#endif
   void parseFile(GString *fileName, FILE *f);
   GList *parseLineTokens(char *buf, GString *fileName, int line);
   void parseNameToUnicode(GList *tokens, GString *fileName, int line);
diff -ur xpdf-4.05/xpdf/PDFCore.h xpdf-src/xpdf/PDFCore.h
--- xpdf-4.05/xpdf/PDFCore.h	Thu Feb 08 05:32:41 2024
+++ xpdf-src/xpdf/PDFCore.h	Sat Feb 10 13:12:11 2024
@@ -12,7 +12,9 @@
 #include <aconf.h>
 
 #include <stdlib.h>
+#ifndef PDF_PARSER_ONLY
 #include <atomic>
+#endif
 #include "SplashTypes.h"
 #include "CharTypes.h"
 #include "DisplayState.h"
@@ -75,7 +77,7 @@
 //------------------------------------------------------------------------
 // AsyncFindAll
 //------------------------------------------------------------------------
-
+#ifndef PDF_PARSER_ONLY
 class AsyncFindAll {
 public:
 
@@ -98,6 +100,7 @@
   PDFCore *core;
   std::atomic<bool> canceled;
 };
+#endif
 
 //------------------------------------------------------------------------
 // PDFCore
diff -ur xpdf-4.05/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc
--- xpdf-4.05/xpdf/PDFDoc.cc	Thu Feb 08 05:32:41 2024
+++ xpdf-src/xpdf/PDFDoc.cc	Sat Feb 10 12:22:46 2024
@@ -111,6 +111,7 @@
   ok = setup(ownerPassword, userPassword);
 }
 
+#if 0
 #ifdef _WIN32
 PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword,
 	       GString *userPassword, PDFCore *coreA) {
@@ -158,23 +159,29 @@
   ok = setup(ownerPassword, userPassword);
 }
 #endif
+#endif /* 0 */
 
 PDFDoc::PDFDoc(char *fileNameA, GString *ownerPassword,
 	       GString *userPassword, PDFCore *coreA) {
+#if 0
 #ifdef _WIN32
   OSVERSIONINFO version;
 #endif
+#endif /* 0 */
   Object obj;
+#if 0
 #ifdef _WIN32
   Unicode u;
   int i, j;
 #endif
+#endif /* 0 */
 
   init(coreA);
 
   fileName = new GString(fileNameA);
 
 #if defined(_WIN32)
+#if 0
   wchar_t wPath[winMaxLongPath + 1];
   i = 0;
   j = 0;
@@ -194,8 +201,11 @@
   if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
     file = _wfopen(fileNameU, wfopenReadMode);
   } else {
-    file = fopen(fileName->getCString(), fopenReadMode);
+#endif /* 0 */
+  file = fopen(fileName->getCString(), fopenReadMode);
+#if 0
   }
+#endif /* 0 */
 #elif defined(VMS)
   file = fopen(fileName->getCString(), fopenReadMode, "ctx=stm");
 #else
@@ -613,6 +623,7 @@
   GBool ret;
 
   // NB: _wfopen is only available in NT
+#if 0
   version.dwOSVersionInfoSize = sizeof(version);
   GetVersionEx(&version);
   if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
@@ -622,12 +633,15 @@
     path2w[i] = 0;
     f = _wfopen(path2w, L"wb");
   } else {
+#endif /* 0 */
     for (i = 0; i < pathLen && i < MAX_PATH; ++i) {
       path2c[i] = (char)path[i];
     }
     path2c[i] = 0;
     f = fopen(path2c, "wb");
+#if 0
   }
+#endif /* 0 */
   if (!f) {
     return gFalse;
   }
diff -ur xpdf-4.05/xpdf/Page.cc xpdf-src/xpdf/Page.cc
--- xpdf-4.05/xpdf/Page.cc	Thu Feb 08 05:32:41 2024
+++ xpdf-src/xpdf/Page.cc	Sat Feb 10 12:25:57 2024
@@ -525,9 +525,9 @@
   delete links;
 }
 
-#ifndef PDF_PARSER_ONLY
 void Page::getDefaultCTM(double *ctm, double hDPI, double vDPI,
 			 int rotate, GBool useMediaBox, GBool upsideDown) {
+#ifndef PDF_PARSER_ONLY
   GfxState *state;
   int i;
 
@@ -544,6 +544,6 @@
     ctm[i] = state->getCTM()[i];
   }
   delete state;
-}
 #endif
+}
 
diff -ur xpdf-4.05/xpdf/config.h xpdf-src/xpdf/config.h
--- xpdf-4.05/xpdf/config.h	Thu Feb 08 05:32:41 2024
+++ xpdf-src/xpdf/config.h	Sat Feb 10 12:28:00 2024
@@ -80,11 +80,6 @@
 // popen
 //------------------------------------------------------------------------
 
-#if defined(_MSC_VER) || defined(__BORLANDC__)
-#define popen _popen
-#define pclose _pclose
-#endif
-
 #if defined(VMS) || defined(VMCMS) || defined(DOS) || defined(OS2) || defined(__EMX__) || defined(_WIN32) || defined(__DJGPP__)
 #define POPEN_READ_MODE "rb"
 #else