| 1 |
diff -ur xpdf-4.06/goo/gfile.cc xpdf-src/goo/gfile.cc |
| 2 |
--- xpdf-4.06/goo/gfile.cc Fri Nov 14 07:08:30 2025 |
| 3 |
+++ xpdf-src/goo/gfile.cc Thu Jan 29 15:00:37 2026 |
| 4 |
@@ -441,6 +441,7 @@ |
| 5 |
#endif |
| 6 |
} |
| 7 |
|
| 8 |
+#ifndef PDF_PARSER_ONLY |
| 9 |
GBool openTempFile(GString **name, FILE **f, |
| 10 |
const char *mode, const char *ext) { |
| 11 |
#if defined(_WIN32) |
| 12 |
@@ -555,6 +556,7 @@ |
| 13 |
return gTrue; |
| 14 |
#endif |
| 15 |
} |
| 16 |
+#endif /* !PDF_PARSER_ONLY */ |
| 17 |
|
| 18 |
GBool createDir(char *path, int mode) { |
| 19 |
#ifdef _WIN32 |
| 20 |
@@ -648,7 +650,7 @@ |
| 21 |
#endif |
| 22 |
|
| 23 |
FILE *openFile(const char *path, const char *mode) { |
| 24 |
-#if defined(_WIN32) |
| 25 |
+#if 0 /* we use fsyscp_fopen for fopen on win32 */ |
| 26 |
wchar_t wPath[winMaxLongPath + 1]; |
| 27 |
wchar_t wMode[8]; |
| 28 |
int i; |
| 29 |
@@ -667,7 +669,7 @@ |
| 30 |
#endif |
| 31 |
} |
| 32 |
|
| 33 |
-#ifdef _WIN32 |
| 34 |
+#if 0 |
| 35 |
void readWindowsShortcut(wchar_t *wPath, size_t wPathSize) { |
| 36 |
size_t n = wcslen(wPath); |
| 37 |
if (n < 4 || wcscmp(wPath + n - 4, L".lnk")) { |
| 38 |
@@ -715,8 +717,11 @@ |
| 39 |
|
| 40 |
int makeDir(const char *path, int mode) { |
| 41 |
#ifdef _WIN32 |
| 42 |
+/* |
| 43 |
wchar_t wPath[winMaxLongPath + 1]; |
| 44 |
return _wmkdir(fileNameToUCS2(path, wPath, winMaxLongPath + 1)); |
| 45 |
+*/ |
| 46 |
+ return _mkdir(path); |
| 47 |
#else |
| 48 |
return mkdir(path, (mode_t)mode); |
| 49 |
#endif |
| 50 |
@@ -775,6 +780,7 @@ |
| 51 |
#endif |
| 52 |
} |
| 53 |
|
| 54 |
+#ifndef PDF_PARSER_ONLY |
| 55 |
void fixCommandLine(int *argc, char **argv[]) { |
| 56 |
#ifdef _WIN32 |
| 57 |
int argcw; |
| 58 |
@@ -800,3 +806,4 @@ |
| 59 |
LocalFree(argvw); |
| 60 |
#endif |
| 61 |
} |
| 62 |
+#endif /* !PDF_PARSER_ONLY */ |
| 63 |
diff -ur xpdf-4.06/goo/gfile.h xpdf-src/goo/gfile.h |
| 64 |
--- xpdf-4.06/goo/gfile.h Fri Nov 14 07:08:30 2025 |
| 65 |
+++ xpdf-src/goo/gfile.h Thu Jan 29 14:59:47 2026 |
| 66 |
@@ -77,8 +77,11 @@ |
| 67 |
// should be done to the returned file pointer; the file may be |
| 68 |
// reopened later for reading, but not for writing. The <mode> string |
| 69 |
// should be "w" or "wb". Returns true on success. |
| 70 |
+ |
| 71 |
+#ifndef PDF_PARSER_ONLY |
| 72 |
extern GBool openTempFile(GString **name, FILE **f, |
| 73 |
const char *mode, const char *ext); |
| 74 |
+#endif /* !PDF_PARSER_ONLY */ |
| 75 |
|
| 76 |
// Create a directory. Returns true on success. |
| 77 |
extern GBool createDir(char *path, int mode); |
| 78 |
@@ -106,7 +109,7 @@ |
| 79 |
// UCS-2 and calls _wfopen(). On other OSes, this simply calls fopen(). |
| 80 |
extern FILE *openFile(const char *path, const char *mode); |
| 81 |
|
| 82 |
-#ifdef _WIN32 |
| 83 |
+#if 0 |
| 84 |
// If [wPath] is a Windows shortcut (.lnk file), read the target path |
| 85 |
// and store it back into [wPath]. |
| 86 |
extern void readWindowsShortcut(wchar_t *wPath, size_t wPathSize); |
| 87 |
@@ -145,6 +148,8 @@ |
| 88 |
|
| 89 |
// On Windows, this gets the Unicode command line and converts it to |
| 90 |
// UTF-8. On other systems, this is a nop. |
| 91 |
+#ifndef PDF_PARSER_ONLY |
| 92 |
extern void fixCommandLine(int *argc, char **argv[]); |
| 93 |
+#endif /* !PDF_PARSER_ONLY */ |
| 94 |
|
| 95 |
#endif |
| 96 |
diff -ur xpdf-4.06/xpdf/Error.cc xpdf-src/xpdf/Error.cc |
| 97 |
--- xpdf-4.06/xpdf/Error.cc Fri Nov 14 07:08:30 2025 |
| 98 |
+++ xpdf-src/xpdf/Error.cc Thu Jan 29 14:39:22 2026 |
| 99 |
@@ -73,11 +73,14 @@ |
| 100 |
(*errorCbk)(errorCbkData, category, (int)pos, sanitized->getCString()); |
| 101 |
} else { |
| 102 |
fflush(stdout); |
| 103 |
+ /* Label the error messages for pdftex's use as libxpdf. |
| 104 |
+ It would be cleaner to use the callback feature, but seems |
| 105 |
+ like too much trouble at this late date. */ |
| 106 |
if (pos >= 0) { |
| 107 |
- fprintf(stderr, "%s (%d): %s\n", |
| 108 |
+ fprintf(stderr, "\nlibxpdf: %s (%d): %s\n", |
| 109 |
errorCategoryNames[category], (int)pos, sanitized->getCString()); |
| 110 |
} else { |
| 111 |
- fprintf(stderr, "%s: %s\n", |
| 112 |
+ fprintf(stderr, "\nlibxpdf: %s: %s\n", |
| 113 |
errorCategoryNames[category], sanitized->getCString()); |
| 114 |
} |
| 115 |
fflush(stderr); |
| 116 |
diff -ur xpdf-4.06/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc |
| 117 |
--- xpdf-4.06/xpdf/GlobalParams.cc Fri Nov 14 07:08:30 2025 |
| 118 |
+++ xpdf-src/xpdf/GlobalParams.cc Thu Jan 29 14:08:16 2026 |
| 119 |
@@ -39,7 +39,8 @@ |
| 120 |
#include "FontEncodingTables.h" |
| 121 |
#include "GlobalParams.h" |
| 122 |
|
| 123 |
-#ifdef _WIN32 |
| 124 |
+/* defined in kpathsea/win32lib.h for Visual Studio */ |
| 125 |
+#if defined(_WIN32) && !defined(_MSC_VER) |
| 126 |
#ifndef __GNUC__ |
| 127 |
# define strcasecmp stricmp |
| 128 |
# define strncasecmp strnicmp |
| 129 |
diff -ur xpdf-4.06/xpdf/GlobalParams.h xpdf-src/xpdf/GlobalParams.h |
| 130 |
--- xpdf-4.06/xpdf/GlobalParams.h Fri Nov 14 07:08:30 2025 |
| 131 |
+++ xpdf-src/xpdf/GlobalParams.h Thu Jan 29 14:40:36 2026 |
| 132 |
@@ -5,6 +5,9 @@ |
| 133 |
// Copyright 2001-2003 Glyph & Cog, LLC |
| 134 |
// |
| 135 |
//======================================================================== |
| 136 |
+// Modified for TeX Live by Peter Breitenlohner |
| 137 |
+// See top-level ChangeLog for a list of all modifications |
| 138 |
+//======================================================================== |
| 139 |
|
| 140 |
#ifndef GLOBALPARAMS_H |
| 141 |
#define GLOBALPARAMS_H |
| 142 |
@@ -233,7 +236,7 @@ |
| 143 |
|
| 144 |
// Initialize the global parameters by attempting to read a config |
| 145 |
// file. |
| 146 |
- GlobalParams(const char *cfgFileName); |
| 147 |
+ GlobalParams(const char *cfgFileName = NULL); |
| 148 |
|
| 149 |
~GlobalParams(); |
| 150 |
|
| 151 |
diff -ur xpdf-4.06/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc |
| 152 |
--- xpdf-4.06/xpdf/PDFDoc.cc Fri Nov 14 07:08:30 2025 |
| 153 |
+++ xpdf-src/xpdf/PDFDoc.cc Thu Jan 29 15:22:44 2026 |
| 154 |
@@ -61,14 +61,14 @@ |
| 155 |
GString *userPassword, PDFCore *coreA) { |
| 156 |
Object obj; |
| 157 |
GString *fileName1, *fileName2; |
| 158 |
-#ifdef _WIN32 |
| 159 |
+#if 0 |
| 160 |
int n, i; |
| 161 |
#endif |
| 162 |
|
| 163 |
init(coreA); |
| 164 |
|
| 165 |
fileName = fileNameA; |
| 166 |
-#ifdef _WIN32 |
| 167 |
+#if 0 |
| 168 |
n = fileName->getLength(); |
| 169 |
fileNameU = (wchar_t *)gmallocn(n + 1, sizeof(wchar_t)); |
| 170 |
for (i = 0; i < n; ++i) { |
| 171 |
@@ -111,7 +111,7 @@ |
| 172 |
ok = setup(ownerPassword, userPassword); |
| 173 |
} |
| 174 |
|
| 175 |
-#ifdef _WIN32 |
| 176 |
+#if 0 |
| 177 |
PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword, |
| 178 |
GString *userPassword, PDFCore *coreA) { |
| 179 |
OSVERSIONINFO version; |
| 180 |
@@ -161,11 +161,11 @@ |
| 181 |
|
| 182 |
PDFDoc::PDFDoc(char *fileNameA, GString *ownerPassword, |
| 183 |
GString *userPassword, PDFCore *coreA) { |
| 184 |
-#ifdef _WIN32 |
| 185 |
+#if 0 |
| 186 |
OSVERSIONINFO version; |
| 187 |
#endif |
| 188 |
Object obj; |
| 189 |
-#ifdef _WIN32 |
| 190 |
+#if 0 |
| 191 |
Unicode u; |
| 192 |
int i, j; |
| 193 |
#endif |
| 194 |
@@ -174,7 +174,7 @@ |
| 195 |
|
| 196 |
fileName = new GString(fileNameA); |
| 197 |
|
| 198 |
-#if defined(_WIN32) |
| 199 |
+#if 0 |
| 200 |
wchar_t wPath[winMaxLongPath + 1]; |
| 201 |
i = 0; |
| 202 |
j = 0; |
| 203 |
@@ -217,7 +217,7 @@ |
| 204 |
|
| 205 |
PDFDoc::PDFDoc(BaseStream *strA, GString *ownerPassword, |
| 206 |
GString *userPassword, PDFCore *coreA) { |
| 207 |
-#ifdef _WIN32 |
| 208 |
+#if 0 |
| 209 |
int n, i; |
| 210 |
#endif |
| 211 |
|
| 212 |
@@ -225,7 +225,7 @@ |
| 213 |
|
| 214 |
if (strA->getFileName()) { |
| 215 |
fileName = strA->getFileName()->copy(); |
| 216 |
-#ifdef _WIN32 |
| 217 |
+#if 0 |
| 218 |
n = fileName->getLength(); |
| 219 |
fileNameU = (wchar_t *)gmallocn(n + 1, sizeof(wchar_t)); |
| 220 |
for (i = 0; i < n; ++i) { |
| 221 |
@@ -235,7 +235,7 @@ |
| 222 |
#endif |
| 223 |
} else { |
| 224 |
fileName = NULL; |
| 225 |
-#ifdef _WIN32 |
| 226 |
+#if 0 |
| 227 |
fileNameU = NULL; |
| 228 |
#endif |
| 229 |
} |
| 230 |
@@ -357,7 +357,7 @@ |
| 231 |
if (fileName) { |
| 232 |
delete fileName; |
| 233 |
} |
| 234 |
-#ifdef _WIN32 |
| 235 |
+#if 0 |
| 236 |
if (fileNameU) { |
| 237 |
gfree(fileNameU); |
| 238 |
} |
| 239 |
@@ -605,7 +605,7 @@ |
| 240 |
return ret; |
| 241 |
} |
| 242 |
|
| 243 |
-#ifdef _WIN32 |
| 244 |
+#if 0 |
| 245 |
GBool PDFDoc::saveEmbeddedFile(int idx, const wchar_t *path, int pathLen) { |
| 246 |
FILE *f; |
| 247 |
OSVERSIONINFO version; |
| 248 |
diff -ur xpdf-4.06/xpdf/Page.cc xpdf-src/xpdf/Page.cc |
| 249 |
--- xpdf-4.06/xpdf/Page.cc Fri Nov 14 07:08:30 2025 |
| 250 |
+++ xpdf-src/xpdf/Page.cc Thu Jan 29 14:54:59 2026 |
| 251 |
@@ -548,9 +548,9 @@ |
| 252 |
delete links; |
| 253 |
} |
| 254 |
|
| 255 |
-#ifndef PDF_PARSER_ONLY |
| 256 |
void Page::getDefaultCTM(double *ctm, double hDPI, double vDPI, |
| 257 |
int rotate, GBool useMediaBox, GBool upsideDown) { |
| 258 |
+#ifndef PDF_PARSER_ONLY |
| 259 |
GfxState *state; |
| 260 |
int i; |
| 261 |
|
| 262 |
@@ -567,6 +567,5 @@ |
| 263 |
ctm[i] = state->getCTM()[i]; |
| 264 |
} |
| 265 |
delete state; |
| 266 |
-} |
| 267 |
#endif |
| 268 |
- |
| 269 |
+} |
| 270 |
diff -ur xpdf-4.06/xpdf/config.h xpdf-src/xpdf/config.h |
| 271 |
--- xpdf-4.06/xpdf/config.h Fri Nov 14 07:08:30 2025 |
| 272 |
+++ xpdf-src/xpdf/config.h Sun Jan 25 12:18:00 2026 |
| 273 |
@@ -69,10 +69,12 @@ |
| 274 |
// popen |
| 275 |
//------------------------------------------------------------------------ |
| 276 |
|
| 277 |
+/* not necessary: defined in kpathsea/win32lib.h. |
| 278 |
#if defined(_MSC_VER) || defined(__BORLANDC__) |
| 279 |
#define popen _popen |
| 280 |
#define pclose _pclose |
| 281 |
#endif |
| 282 |
+*/ |
| 283 |
|
| 284 |
#if defined(VMS) || defined(VMCMS) || defined(DOS) || defined(OS2) || defined(__EMX__) || defined(_WIN32) || defined(__DJGPP__) |
| 285 |
#define POPEN_READ_MODE "rb" |