summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gs/base/fapi_ft.c2
-rw-r--r--gs/base/gp_dvx.c2
-rw-r--r--gs/base/gp_macio.c4
-rw-r--r--gs/base/gp_mswin.c4
-rw-r--r--gs/base/gp_os2.c8
-rw-r--r--gs/base/gp_unifs.c4
-rw-r--r--gs/base/gp_unix.c2
-rw-r--r--gs/base/gp_unix_cache.c12
-rw-r--r--gs/base/gp_vms.c6
-rw-r--r--gs/base/gsdevice.c2
-rw-r--r--gs/base/gsicc_create.c4
-rw-r--r--gs/base/gsicc_lcms.c10
-rw-r--r--gs/base/gsicc_lcms2.c7
-rw-r--r--gs/base/gsicc_manage.c3
-rw-r--r--gs/base/gsiodev.c4
-rw-r--r--gs/base/gsiodisk.c8
-rw-r--r--gs/base/gsiomacres.c2
-rw-r--r--gs/base/gsroprun.c5
-rw-r--r--gs/base/gxblend.c13
-rw-r--r--gs/base/gxblend1.c3
-rw-r--r--gs/base/gxiodev.h4
-rw-r--r--gs/base/gxpcmap.c3
-rw-r--r--gs/base/lib.mak14
-rw-r--r--gs/base/mkromfs.c3
-rw-r--r--gs/base/stdio_.h4
-rw-r--r--gs/base/strmio.c2
-rw-r--r--gs/contrib/japanese/dviprlib.c4
-rw-r--r--gs/contrib/japanese/gdevdmpr.c2
-rw-r--r--gs/contrib/pcl3/eprn/eprnparm.c3
-rw-r--r--gs/contrib/pscolor/test.c19
-rw-r--r--gs/devices/vector/gdevtxtw.c2
-rw-r--r--gs/psi/apitest.c5
-rw-r--r--gs/psi/gserver.c3
-rw-r--r--gs/psi/int.mak2
-rw-r--r--gs/psi/zfile.c2
-rw-r--r--gs/psi/ziodev2.c4
-rw-r--r--pl/pjparse.c6
-rw-r--r--pl/plmain.c4
-rw-r--r--svg/svg.mak2
-rw-r--r--svg/svgtop.c4
-rw-r--r--xps/xpszip.c12
41 files changed, 125 insertions, 84 deletions
diff --git a/gs/base/fapi_ft.c b/gs/base/fapi_ft.c
index 3103657a7..eb8bac036 100644
--- a/gs/base/fapi_ft.c
+++ b/gs/base/fapi_ft.c
@@ -215,7 +215,7 @@ FF_open_read_stream(gs_memory_t * mem, char *fname, FT_Stream * fts)
215 code = 215 code =
216 file_open_stream(pfn.fname, pfn.len, "r", 216 file_open_stream(pfn.fname, pfn.len, "r",
217 file_default_buffer_size, &ps, pfn.iodev, 217 file_default_buffer_size, &ps, pfn.iodev,
218 pfn.iodev->procs.fopen, mem); 218 pfn.iodev->procs.gp_fopen, mem);
219 if (code < 0) { 219 if (code < 0) {
220 goto error_out; 220 goto error_out;
221 } 221 }
diff --git a/gs/base/gp_dvx.c b/gs/base/gp_dvx.c
index cdbb655fc..15b4b5e56 100644
--- a/gs/base/gp_dvx.c
+++ b/gs/base/gp_dvx.c
@@ -124,7 +124,7 @@ gp_open_printer(const gs_memory_t *mem,
124 stdprn->_flag = _IOWRT; /* Make stdprn buffered to improve performance */ 124 stdprn->_flag = _IOWRT; /* Make stdprn buffered to improve performance */
125 return stdprn; 125 return stdprn;
126 } else 126 } else
127 return fopen(fname, (binary_mode ? "wb" : "w")); 127 return gp_fopen(fname, (binary_mode ? "wb" : "w"));
128} 128}
129 129
130/* Close the connection to the printer. */ 130/* Close the connection to the printer. */
diff --git a/gs/base/gp_macio.c b/gs/base/gp_macio.c
index 00be43830..ef6f3ae0c 100644
--- a/gs/base/gp_macio.c
+++ b/gs/base/gp_macio.c
@@ -14,6 +14,9 @@
14*/ 14*/
15 15
16 16
17/* prevent gp.h from defining fopen */
18#define fopen fopen
19
17 20
18#ifndef __CARBON__ 21#ifndef __CARBON__
19//#include "MacHeaders" 22//#include "MacHeaders"
@@ -54,6 +57,7 @@
54#include <console.h> 57#include <console.h>
55 58
56#include "gx.h" 59#include "gx.h"
60
57#include "gp.h" 61#include "gp.h"
58#include "gpmisc.h" 62#include "gpmisc.h"
59#include "gxdevice.h" 63#include "gxdevice.h"
diff --git a/gs/base/gp_mswin.c b/gs/base/gp_mswin.c
index cb8e1a201..00d97c882 100644
--- a/gs/base/gp_mswin.c
+++ b/gs/base/gp_mswin.c
@@ -29,6 +29,9 @@
29/* DLL version must now be used under MS-Windows */ 29/* DLL version must now be used under MS-Windows */
30/* Russell Lang 16 March 1996 */ 30/* Russell Lang 16 March 1996 */
31 31
32/* prevent gp.h from defining fopen */
33#define fopen fopen
34
32#include "stdio_.h" 35#include "stdio_.h"
33#include "string_.h" 36#include "string_.h"
34#include "memory_.h" 37#include "memory_.h"
@@ -41,6 +44,7 @@
41#include <fcntl.h> 44#include <fcntl.h>
42#include <signal.h> 45#include <signal.h>
43#include "gx.h" 46#include "gx.h"
47
44#include "gp.h" 48#include "gp.h"
45#include "gpcheck.h" 49#include "gpcheck.h"
46#include "gpmisc.h" 50#include "gpmisc.h"
diff --git a/gs/base/gp_os2.c b/gs/base/gp_os2.c
index 56eb67933..eabbdb9d0 100644
--- a/gs/base/gp_os2.c
+++ b/gs/base/gp_os2.c
@@ -17,6 +17,9 @@
17/* Common platform-specific routines for OS/2 and MS-DOS */ 17/* Common platform-specific routines for OS/2 and MS-DOS */
18/* compiled with GCC/EMX */ 18/* compiled with GCC/EMX */
19 19
20/* prevent gp.h from defining fopen */
21#define fopen fopen
22
20#define INCL_DOS 23#define INCL_DOS
21#define INCL_SPL 24#define INCL_SPL
22#define INCL_SPLDOSPRINT 25#define INCL_SPLDOSPRINT
@@ -47,6 +50,7 @@
47#include "gsexit.h" 50#include "gsexit.h"
48#include "gsmemory.h" 51#include "gsmemory.h"
49#include "gsstruct.h" 52#include "gsstruct.h"
53
50#include "gp.h" 54#include "gp.h"
51#include "gpmisc.h" 55#include "gpmisc.h"
52#include "gsutil.h" 56#include "gsutil.h"
@@ -318,7 +322,7 @@ gp_open_printer(const gs_memory_t *mem,
318 pfile = popen(fname + 1, (binary_mode ? "wb" : "w")); 322 pfile = popen(fname + 1, (binary_mode ? "wb" : "w"));
319 else 323 else
320 /* normal file or port */ 324 /* normal file or port */
321 pfile = fopen(fname, (binary_mode ? "wb" : "w")); 325 pfile = gp_fopen(fname, (binary_mode ? "wb" : "w"));
322 326
323 if (pfile == (FILE *) NULL) 327 if (pfile == (FILE *) NULL)
324 return (FILE *) NULL; 328 return (FILE *) NULL;
@@ -496,7 +500,7 @@ pm_spool(const gs_memory_t *mem, char *filename, const char *queue)
496 emprintf(mem, "Out of memory in pm_spool\n"); 500 emprintf(mem, "Out of memory in pm_spool\n");
497 return 1; 501 return 1;
498 } 502 }
499 if ((f = fopen(filename, "rb")) == (FILE *) NULL) { 503 if ((f = gp_fopen(filename, "rb")) == (FILE *) NULL) {
500 free(buffer); 504 free(buffer);
501 emprintf1(mem, "Can't open temporary file %s\n", filename); 505 emprintf1(mem, "Can't open temporary file %s\n", filename);
502 return 1; 506 return 1;
diff --git a/gs/base/gp_unifs.c b/gs/base/gp_unifs.c
index 0e8535b78..23d421e5d 100644
--- a/gs/base/gp_unifs.c
+++ b/gs/base/gp_unifs.c
@@ -16,10 +16,14 @@
16 16
17/* "Unix-like" file system platform routines for Ghostscript */ 17/* "Unix-like" file system platform routines for Ghostscript */
18 18
19/* prevent gp.h from defining fopen */
20#define fopen fopen
21
19#include "stdio_.h" /* for FILENAME_MAX */ 22#include "stdio_.h" /* for FILENAME_MAX */
20#include "memory_.h" 23#include "memory_.h"
21#include "string_.h" 24#include "string_.h"
22#include "gx.h" 25#include "gx.h"
26
23#include "gp.h" 27#include "gp.h"
24#include "gpmisc.h" 28#include "gpmisc.h"
25#include "gsstruct.h" 29#include "gsstruct.h"
diff --git a/gs/base/gp_unix.c b/gs/base/gp_unix.c
index bc8b7f619..fedd8a9bb 100644
--- a/gs/base/gp_unix.c
+++ b/gs/base/gp_unix.c
@@ -215,7 +215,7 @@ gp_open_printer(const gs_memory_t *mem,
215{ 215{
216 const char *fmode = (binary_mode ? "wb" : "w"); 216 const char *fmode = (binary_mode ? "wb" : "w");
217 217
218 return (strlen(fname) == 0 ? 0 : fopen(fname, fmode)); 218 return (strlen(fname) == 0 ? 0 : gp_fopen(fname, fmode));
219} 219}
220FILE * 220FILE *
221gp_open_printer_64(const gs_memory_t *mem, 221gp_open_printer_64(const gs_memory_t *mem,
diff --git a/gs/base/gp_unix_cache.c b/gs/base/gp_unix_cache.c
index c5a30cbd5..ada78aca1 100644
--- a/gs/base/gp_unix_cache.c
+++ b/gs/base/gp_unix_cache.c
@@ -345,7 +345,7 @@ int gp_cache_insert(int type, byte *key, int keylen, void *buffer, int buflen)
345 outfn[len-1] = '\0'; 345 outfn[len-1] = '\0';
346 } 346 }
347 347
348 in = fopen(infn, "r"); 348 in = gp_fopen(infn, "r");
349 if (in == NULL) { 349 if (in == NULL) {
350 dlprintf1("pcache: unable to open '%s'\n", infn); 350 dlprintf1("pcache: unable to open '%s'\n", infn);
351 free(prefix); 351 free(prefix);
@@ -353,7 +353,7 @@ int gp_cache_insert(int type, byte *key, int keylen, void *buffer, int buflen)
353 free(outfn); 353 free(outfn);
354 return -1; 354 return -1;
355 } 355 }
356 out = fopen(outfn, "w"); 356 out = gp_fopen(outfn, "w");
357 if (out == NULL) { 357 if (out == NULL) {
358 dlprintf1("pcache: unable to open '%s'\n", outfn); 358 dlprintf1("pcache: unable to open '%s'\n", outfn);
359 fclose(in); 359 fclose(in);
@@ -379,7 +379,7 @@ int gp_cache_insert(int type, byte *key, int keylen, void *buffer, int buflen)
379 379
380 /* save it to disk */ 380 /* save it to disk */
381 path = gp_cache_itempath(prefix, &item); 381 path = gp_cache_itempath(prefix, &item);
382 file = fopen(path, "wb"); 382 file = gp_fopen(path, "wb");
383 free(path); 383 free(path);
384 if (file != NULL) { 384 if (file != NULL) {
385 gp_cache_saveitem(file, &item); 385 gp_cache_saveitem(file, &item);
@@ -438,7 +438,7 @@ int gp_cache_query(int type, byte* key, int keylen, void **buffer,
438 outfn[len-1] = '\0'; 438 outfn[len-1] = '\0';
439 } 439 }
440 440
441 in = fopen(infn, "r"); 441 in = gp_fopen(infn, "r");
442 if (in == NULL) { 442 if (in == NULL) {
443 dlprintf1("pcache: unable to open '%s'\n", infn); 443 dlprintf1("pcache: unable to open '%s'\n", infn);
444 free(prefix); 444 free(prefix);
@@ -446,7 +446,7 @@ int gp_cache_query(int type, byte* key, int keylen, void **buffer,
446 free(outfn); 446 free(outfn);
447 return -1; 447 return -1;
448 } 448 }
449 out = fopen(outfn, "w"); 449 out = gp_fopen(outfn, "w");
450 if (out == NULL) { 450 if (out == NULL) {
451 dlprintf1("pcache: unable to open '%s'\n", outfn); 451 dlprintf1("pcache: unable to open '%s'\n", outfn);
452 fclose(in); 452 fclose(in);
@@ -469,7 +469,7 @@ int gp_cache_query(int type, byte* key, int keylen, void **buffer,
469 469
470 /* look for it on the disk */ 470 /* look for it on the disk */
471 path = gp_cache_itempath(prefix, &item); 471 path = gp_cache_itempath(prefix, &item);
472 file = fopen(path, "rb"); 472 file = gp_fopen(path, "rb");
473 free(path); 473 free(path);
474 if (file != NULL) { 474 if (file != NULL) {
475 hit = gp_cache_loaditem(file, &item, alloc, userdata); 475 hit = gp_cache_loaditem(file, &item, alloc, userdata);
diff --git a/gs/base/gp_vms.c b/gs/base/gp_vms.c
index f7a114257..918880f2f 100644
--- a/gs/base/gp_vms.c
+++ b/gs/base/gp_vms.c
@@ -16,9 +16,13 @@
16 16
17/* VAX/VMS specific routines for Ghostscript */ 17/* VAX/VMS specific routines for Ghostscript */
18 18
19/* prevent gp.h from defining fopen */
20#define fopen fopen
21
19#include "string_.h" 22#include "string_.h"
20#include "memory_.h" 23#include "memory_.h"
21#include "gx.h" 24#include "gx.h"
25
22#include "gp.h" 26#include "gp.h"
23#include "gpmisc.h" 27#include "gpmisc.h"
24#include "gsstruct.h" 28#include "gsstruct.h"
@@ -259,7 +263,7 @@ gp_open_scratch_file(const gs_memory_t *mem,
259 return 0; /* file name too long */ 263 return 0; /* file name too long */
260 strcat(fname, "XXXXXX"); 264 strcat(fname, "XXXXXX");
261 mktemp(fname); 265 mktemp(fname);
262 f = fopen(fname, mode); 266 f = gp_fopen(fname, mode);
263 267
264 if (f == NULL) 268 if (f == NULL)
265 emprintf1(mem, "**** Could not open temporary file %s\n", fname); 269 emprintf1(mem, "**** Could not open temporary file %s\n", fname);
diff --git a/gs/base/gsdevice.c b/gs/base/gsdevice.c
index 0240f2862..10a0f5ca2 100644
--- a/gs/base/gsdevice.c
+++ b/gs/base/gsdevice.c
@@ -1030,7 +1030,7 @@ gx_device_open_output_file(const gx_device * dev, char *fname,
1030 strcpy(fmode, gp_fmode_wb); 1030 strcpy(fmode, gp_fmode_wb);
1031 if (positionable) 1031 if (positionable)
1032 strcat(fmode, "+"); 1032 strcat(fmode, "+");
1033 code = parsed.iodev->procs.fopen(parsed.iodev, parsed.fname, fmode, 1033 code = parsed.iodev->procs.gp_fopen(parsed.iodev, parsed.fname, fmode,
1034 pfile, NULL, 0); 1034 pfile, NULL, 0);
1035 if (code) 1035 if (code)
1036 emprintf1(dev->memory, 1036 emprintf1(dev->memory,
diff --git a/gs/base/gsicc_create.c b/gs/base/gsicc_create.c
index 78f379b67..67d75d233 100644
--- a/gs/base/gsicc_create.c
+++ b/gs/base/gsicc_create.c
@@ -121,6 +121,8 @@ Note: All profile data must be encoded as big-endian
121#include "string_.h" 121#include "string_.h"
122#include "gsmemory.h" 122#include "gsmemory.h"
123#include "gx.h" 123#include "gx.h"
124#include <gp.h>
125
124#include "gxistate.h" 126#include "gxistate.h"
125#include "gstypes.h" 127#include "gstypes.h"
126#include "gscspace.h" 128#include "gscspace.h"
@@ -452,7 +454,7 @@ save_profile(unsigned char *buffer, char filename[], int buffer_size)
452 FILE *fid; 454 FILE *fid;
453 455
454 sprintf(full_file_name,"%d)Profile_%s.icc",icc_debug_index,filename); 456 sprintf(full_file_name,"%d)Profile_%s.icc",icc_debug_index,filename);
455 fid = fopen(full_file_name,"wb"); 457 fid = gp_fopen(full_file_name,"wb");
456 fwrite(buffer,sizeof(unsigned char),buffer_size,fid); 458 fwrite(buffer,sizeof(unsigned char),buffer_size,fid);
457 fclose(fid); 459 fclose(fid);
458 icc_debug_index++; 460 icc_debug_index++;
diff --git a/gs/base/gsicc_lcms.c b/gs/base/gsicc_lcms.c
index 7a55c7537..e3add4a73 100644
--- a/gs/base/gsicc_lcms.c
+++ b/gs/base/gsicc_lcms.c
@@ -24,6 +24,8 @@
24#include "lcms.h" 24#include "lcms.h"
25#include "gslibctx.h" 25#include "gslibctx.h"
26#include "gserrors.h" 26#include "gserrors.h"
27#include "gp.h"
28
27 29
28#define DUMP_CMS_BUFFER 0 30#define DUMP_CMS_BUFFER 0
29#define DEBUG_LCMS_MEM 0 31#define DEBUG_LCMS_MEM 0
@@ -210,8 +212,8 @@ gscms_transform_color_buffer(gx_device *dev, gsicc_link_t *icclink,
210 cmsDoTransform(hTransform,inputpos,outputpos, 212 cmsDoTransform(hTransform,inputpos,outputpos,
211 input_buff_desc->plane_stride); 213 input_buff_desc->plane_stride);
212#if DUMP_CMS_BUFFER 214#if DUMP_CMS_BUFFER
213 fid_in = fopen("CM_Input.raw","ab"); 215 fid_in = gp_fopen("CM_Input.raw","ab");
214 fid_out = fopen("CM_Output.raw","ab"); 216 fid_out = fp_fopen("CM_Output.raw","ab");
215 fwrite((unsigned char*) inputbuffer,sizeof(unsigned char), 217 fwrite((unsigned char*) inputbuffer,sizeof(unsigned char),
216 input_buff_desc->plane_stride * 218 input_buff_desc->plane_stride *
217 input_buff_desc->num_chan, fid_in); 219 input_buff_desc->num_chan, fid_in);
@@ -230,8 +232,8 @@ gscms_transform_color_buffer(gx_device *dev, gsicc_link_t *icclink,
230 outputpos += output_buff_desc->row_stride; 232 outputpos += output_buff_desc->row_stride;
231 } 233 }
232#if DUMP_CMS_BUFFER 234#if DUMP_CMS_BUFFER
233 fid_in = fopen("CM_Input.raw","ab"); 235 fid_in = gp_fopen("CM_Input.raw","ab");
234 fid_out = fopen("CM_Output.raw","ab"); 236 fid_out = gp_fopen("CM_Output.raw","ab");
235 fwrite((unsigned char*) inputbuffer,sizeof(unsigned char), 237 fwrite((unsigned char*) inputbuffer,sizeof(unsigned char),
236 input_buff_desc->row_stride,fid_in); 238 input_buff_desc->row_stride,fid_in);
237 fwrite((unsigned char*) outputbuffer,sizeof(unsigned char), 239 fwrite((unsigned char*) outputbuffer,sizeof(unsigned char),
diff --git a/gs/base/gsicc_lcms2.c b/gs/base/gsicc_lcms2.c
index 9a013bef2..b9dbcf9d0 100644
--- a/gs/base/gsicc_lcms2.c
+++ b/gs/base/gsicc_lcms2.c
@@ -21,6 +21,7 @@
21#include "lcms2_plugin.h" 21#include "lcms2_plugin.h"
22#include "gslibctx.h" 22#include "gslibctx.h"
23#include "gserrors.h" 23#include "gserrors.h"
24#include "gp.h"
24 25
25#define DUMP_CMS_BUFFER 0 26#define DUMP_CMS_BUFFER 0
26#define DEBUG_LCMS_MEM 0 27#define DEBUG_LCMS_MEM 0
@@ -298,8 +299,8 @@ gscms_transform_color_buffer(gx_device *dev, gsicc_link_t *icclink,
298 } 299 }
299 } 300 }
300#if DUMP_CMS_BUFFER 301#if DUMP_CMS_BUFFER
301 fid_in = fopen("CM_Input.raw","ab"); 302 fid_in = gp_fopen("CM_Input.raw","ab");
302 fid_out = fopen("CM_Output.raw","ab"); 303 fid_out = gp_fopen("CM_Output.raw","ab");
303 fwrite((unsigned char*) inputbuffer,sizeof(unsigned char), 304 fwrite((unsigned char*) inputbuffer,sizeof(unsigned char),
304 input_buff_desc->row_stride,fid_in); 305 input_buff_desc->row_stride,fid_in);
305 fwrite((unsigned char*) outputbuffer,sizeof(unsigned char), 306 fwrite((unsigned char*) outputbuffer,sizeof(unsigned char),
@@ -692,4 +693,4 @@ gscms_get_name2device_link(gsicc_link_t *icclink,
692 if(lcms_deshandle) cmsCloseProfile(lcms_deshandle); 693 if(lcms_deshandle) cmsCloseProfile(lcms_deshandle);
693 if(lcms_proofhandle) cmsCloseProfile(lcms_proofhandle); 694 if(lcms_proofhandle) cmsCloseProfile(lcms_proofhandle);
694 return; 695 return;
695} \ No newline at end of file 696}
diff --git a/gs/base/gsicc_manage.c b/gs/base/gsicc_manage.c
index e3c7af701..456b593f2 100644
--- a/gs/base/gsicc_manage.c
+++ b/gs/base/gsicc_manage.c
@@ -23,6 +23,7 @@
23#include "scommon.h" 23#include "scommon.h"
24#include "strmio.h" 24#include "strmio.h"
25#include "gx.h" 25#include "gx.h"
26#include "gp.h"
26#include "gxistate.h" 27#include "gxistate.h"
27#include "gxcspace.h" 28#include "gxcspace.h"
28#include "gscms.h" 29#include "gscms.h"
@@ -2338,7 +2339,7 @@ dump_icc_buffer(int buffersize, char filename[],byte *Buffer)
2338 FILE *fid; 2339 FILE *fid;
2339 2340
2340 sprintf(full_file_name,"%d)%s_debug.icc",global_icc_index,filename); 2341 sprintf(full_file_name,"%d)%s_debug.icc",global_icc_index,filename);
2341 fid = fopen(full_file_name,"wb"); 2342 fid = gp_fopen(full_file_name,"wb");
2342 fwrite(Buffer,sizeof(unsigned char),buffersize,fid); 2343 fwrite(Buffer,sizeof(unsigned char),buffersize,fid);
2343 fclose(fid); 2344 fclose(fid);
2344} 2345}
diff --git a/gs/base/gsiodev.c b/gs/base/gsiodev.c
index feb8a07fa..aea5cdc12 100644
--- a/gs/base/gsiodev.c
+++ b/gs/base/gsiodev.c
@@ -49,7 +49,7 @@ const gx_io_device gs_iodev_os =
49{ 49{
50 "%os%", "FileSystem", 50 "%os%", "FileSystem",
51 {iodev_no_init, iodev_no_open_device, 51 {iodev_no_init, iodev_no_open_device,
52 NULL /*iodev_os_open_file */ , iodev_os_fopen, iodev_os_fclose, 52 NULL /*iodev_os_open_file */ , iodev_os_gp_fopen, iodev_os_fclose,
53 os_delete, os_rename, os_status, 53 os_delete, os_rename, os_status,
54 os_enumerate, gp_enumerate_files_next, gp_enumerate_files_close, 54 os_enumerate, gp_enumerate_files_next, gp_enumerate_files_close,
55 os_get_params, iodev_no_put_params 55 os_get_params, iodev_no_put_params
@@ -190,7 +190,7 @@ iodev_no_put_params(gx_io_device * iodev, gs_param_list * plist)
190 190
191/* The fopen routine is exported for %null. */ 191/* The fopen routine is exported for %null. */
192int 192int
193iodev_os_fopen(gx_io_device * iodev, const char *fname, const char *access, 193iodev_os_gp_fopen(gx_io_device * iodev, const char *fname, const char *access,
194 FILE ** pfile, char *rfname, uint rnamelen) 194 FILE ** pfile, char *rfname, uint rnamelen)
195{ 195{
196 errno = 0; 196 errno = 0;
diff --git a/gs/base/gsiodisk.c b/gs/base/gsiodisk.c
index 1d40498ee..45162ad3b 100644
--- a/gs/base/gsiodisk.c
+++ b/gs/base/gsiodisk.c
@@ -110,7 +110,7 @@
110 110
111/* Function prototypes */ 111/* Function prototypes */
112static iodev_proc_init(iodev_diskn_init); 112static iodev_proc_init(iodev_diskn_init);
113static iodev_proc_fopen(iodev_diskn_fopen); 113static iodev_proc_gp_fopen(iodev_diskn_gp_fopen);
114static iodev_proc_delete_file(diskn_delete); 114static iodev_proc_delete_file(diskn_delete);
115static iodev_proc_rename_file(diskn_rename); 115static iodev_proc_rename_file(diskn_rename);
116static iodev_proc_file_status(diskn_status); 116static iodev_proc_file_status(diskn_status);
@@ -127,7 +127,7 @@ const gx_io_device varname = \
127{ \ 127{ \
128 diskname, "FileSystem", \ 128 diskname, "FileSystem", \
129 {iodev_diskn_init, iodev_no_open_device, \ 129 {iodev_diskn_init, iodev_no_open_device, \
130 NULL /* no longer used */ , iodev_diskn_fopen, iodev_os_fclose, \ 130 NULL /* no longer used */ , iodev_diskn_gp_fopen, iodev_os_fclose, \
131 diskn_delete, diskn_rename, diskn_status, \ 131 diskn_delete, diskn_rename, diskn_status, \
132 iodev_no_enumerate_files, /* Only until we have a root location */ \ 132 iodev_no_enumerate_files, /* Only until we have a root location */ \
133 diskn_enumerate_next, diskn_enumerate_close, \ 133 diskn_enumerate_next, diskn_enumerate_close, \
@@ -198,7 +198,7 @@ iodev_diskn_init(gx_io_device * iodev, gs_memory_t * mem)
198} 198}
199 199
200static int 200static int
201iodev_diskn_fopen(gx_io_device * iodev, const char *fname, const char *access, 201iodev_diskn_gp_fopen(gx_io_device * iodev, const char *fname, const char *access,
202 FILE ** pfile, char *rfname, uint rnamelen) 202 FILE ** pfile, char *rfname, uint rnamelen)
203{ 203{
204 char realname[gp_file_name_sizeof]; 204 char realname[gp_file_name_sizeof];
@@ -218,7 +218,7 @@ iodev_diskn_fopen(gx_io_device * iodev, const char *fname, const char *access,
218 return_error(gs_error_undefinedfilename); 218 return_error(gs_error_undefinedfilename);
219 } 219 }
220 220
221 return iodev_os_fopen(iodev_default(pstate->memory), realname, access, pfile, rfname, rnamelen); 221 return iodev_os_gp_fopen(iodev_default(pstate->memory), realname, access, pfile, rfname, rnamelen);
222} 222}
223 223
224static int 224static int
diff --git a/gs/base/gsiomacres.c b/gs/base/gsiomacres.c
index 6da920bbe..3b59231f0 100644
--- a/gs/base/gsiomacres.c
+++ b/gs/base/gsiomacres.c
@@ -293,7 +293,7 @@ int read_datafork_resource(byte *buf, const char *fname, const uint type, const
293 FILE *in; 293 FILE *in;
294 int i; 294 int i;
295 295
296 in = fopen(fname, "rb"); 296 in = gp_fopen(fname, "rb");
297 if (in == NULL) { 297 if (in == NULL) {
298 if_debug1('s', "[s] couldn't open '%s'\n", fname); 298 if_debug1('s', "[s] couldn't open '%s'\n", fname);
299 return 0; 299 return 0;
diff --git a/gs/base/gsroprun.c b/gs/base/gsroprun.c
index dc12a1268..25a210b5b 100644
--- a/gs/base/gsroprun.c
+++ b/gs/base/gsroprun.c
@@ -19,6 +19,7 @@
19#include "stdpre.h" 19#include "stdpre.h"
20#include "gsropt.h" 20#include "gsropt.h"
21#include "arch.h" 21#include "arch.h"
22#include "gp.h"
22 23
23/* Enable the following define to use 'template'd code (code formed by 24/* Enable the following define to use 'template'd code (code formed by
24 * repeated #inclusion of a header file to generate differen versions). 25 * repeated #inclusion of a header file to generate differen versions).
@@ -59,7 +60,7 @@ static void write_usage(void)
59 depth, i&15, usage[3*i], usage[3*i+1], usage[3*i+2]); 60 depth, i&15, usage[3*i], usage[3*i+1], usage[3*i+2]);
60 } 61 }
61#ifdef RECORD_BINARY 62#ifdef RECORD_BINARY
62 FILE *out = fopen("ropusage2.tmp", "wb"); 63 FILE *out = gp_fopen("ropusage2.tmp", "wb");
63 if (!out) 64 if (!out)
64 return; 65 return;
65 fwrite(usage, sizeof(int), (1024<<7), out); 66 fwrite(usage, sizeof(int), (1024<<7), out);
@@ -71,7 +72,7 @@ static void record(int rop)
71{ 72{
72 if (inited == 0) { 73 if (inited == 0) {
73#ifdef RECORD_BINARY 74#ifdef RECORD_BINARY
74 FILE *in = fopen("ropusage2.tmp", "r"); 75 FILE *in = gp_fopen("ropusage2.tmp", "r");
75 if (!in) 76 if (!in)
76 memset(usage, 0, MAX*sizeof(int)); 77 memset(usage, 0, MAX*sizeof(int));
77 else { 78 else {
diff --git a/gs/base/gxblend.c b/gs/base/gxblend.c
index f1cc643d3..c87f6c996 100644
--- a/gs/base/gxblend.c
+++ b/gs/base/gxblend.c
@@ -17,6 +17,7 @@
17 17
18#include "memory_.h" 18#include "memory_.h"
19#include "gx.h" 19#include "gx.h"
20#include "gp.h"
20#include "gstparam.h" 21#include "gstparam.h"
21#include "gxblend.h" 22#include "gxblend.h"
22#include "gxcolor2.h" 23#include "gxcolor2.h"
@@ -1574,7 +1575,7 @@ dump_raw_buffer(int num_rows, int width, int n_chan,
1574 if ((n_chan == 2) || (n_chan == 3)) { 1575 if ((n_chan == 2) || (n_chan == 3)) {
1575 int x; 1576 int x;
1576 sprintf(full_file_name,"%02d)%s.pam",global_index,filename); 1577 sprintf(full_file_name,"%02d)%s.pam",global_index,filename);
1577 fid = fopen(full_file_name,"wb"); 1578 fid = gp_fopen(full_file_name,"wb");
1578 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 4\nMAXVAL 255\nTUPLTYPE GRAYSCALE_ALPHA\nENDHDR\n", 1579 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 4\nMAXVAL 255\nTUPLTYPE GRAYSCALE_ALPHA\nENDHDR\n",
1579 width, num_rows); 1580 width, num_rows);
1580 for(y=0; y<num_rows; y++) 1581 for(y=0; y<num_rows; y++)
@@ -1584,7 +1585,7 @@ dump_raw_buffer(int num_rows, int width, int n_chan,
1584 fclose(fid); 1585 fclose(fid);
1585 if (n_chan == 3) { 1586 if (n_chan == 3) {
1586 sprintf(full_file_name,"%02d)%s_shape.pam",global_index,filename); 1587 sprintf(full_file_name,"%02d)%s_shape.pam",global_index,filename);
1587 fid = fopen(full_file_name,"wb"); 1588 fid = gp_fopen(full_file_name,"wb");
1588 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 1\nMAXVAL 255\nTUPLTYPE GRAYSCALE\nENDHDR\n", 1589 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 1\nMAXVAL 255\nTUPLTYPE GRAYSCALE\nENDHDR\n",
1589 width, num_rows); 1590 width, num_rows);
1590 for(y=0; y<num_rows; y++) 1591 for(y=0; y<num_rows; y++)
@@ -1596,7 +1597,7 @@ dump_raw_buffer(int num_rows, int width, int n_chan,
1596 if ((n_chan == 4) || (n_chan == 5) || (n_chan == 6)) { 1597 if ((n_chan == 4) || (n_chan == 5) || (n_chan == 6)) {
1597 int x; 1598 int x;
1598 sprintf(full_file_name,"%02d)%s.pam",global_index,filename); 1599 sprintf(full_file_name,"%02d)%s.pam",global_index,filename);
1599 fid = fopen(full_file_name,"wb"); 1600 fid = gp_fopen(full_file_name,"wb");
1600 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 4\nMAXVAL 255\nTUPLTYPE RGB_ALPHA\nENDHDR\n", 1601 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 4\nMAXVAL 255\nTUPLTYPE RGB_ALPHA\nENDHDR\n",
1601 width, num_rows); 1602 width, num_rows);
1602 for(y=0; y<num_rows; y++) 1603 for(y=0; y<num_rows; y++)
@@ -1606,7 +1607,7 @@ dump_raw_buffer(int num_rows, int width, int n_chan,
1606 fclose(fid); 1607 fclose(fid);
1607 if (n_chan > 4) { 1608 if (n_chan > 4) {
1608 sprintf(full_file_name,"%02d)%s_shape.pam",global_index,filename); 1609 sprintf(full_file_name,"%02d)%s_shape.pam",global_index,filename);
1609 fid = fopen(full_file_name,"wb"); 1610 fid = gp_fopen(full_file_name,"wb");
1610 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 1\nMAXVAL 255\nTUPLTYPE GRAYSCALE\nENDHDR\n", 1611 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 1\nMAXVAL 255\nTUPLTYPE GRAYSCALE\nENDHDR\n",
1611 width, num_rows); 1612 width, num_rows);
1612 for(y=0; y<num_rows; y++) 1613 for(y=0; y<num_rows; y++)
@@ -1616,7 +1617,7 @@ dump_raw_buffer(int num_rows, int width, int n_chan,
1616 } 1617 }
1617 if (n_chan == 6) { 1618 if (n_chan == 6) {
1618 sprintf(full_file_name,"%02d)%s_tags.pam",global_index,filename); 1619 sprintf(full_file_name,"%02d)%s_tags.pam",global_index,filename);
1619 fid = fopen(full_file_name,"wb"); 1620 fid = gp_fopen(full_file_name,"wb");
1620 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 1\nMAXVAL 255\nTUPLTYPE GRAYSCALE\nENDHDR\n", 1621 fprintf(fid, "P7\nWIDTH %d\nHEIGHT %d\nDEPTH 1\nMAXVAL 255\nTUPLTYPE GRAYSCALE\nENDHDR\n",
1621 width, num_rows); 1622 width, num_rows);
1622 for(y=0; y<num_rows; y++) 1623 for(y=0; y<num_rows; y++)
@@ -1629,7 +1630,7 @@ dump_raw_buffer(int num_rows, int width, int n_chan,
1629#endif 1630#endif
1630 max_bands = ( n_chan < 57 ? n_chan : 56); /* Photoshop handles at most 56 bands */ 1631 max_bands = ( n_chan < 57 ? n_chan : 56); /* Photoshop handles at most 56 bands */
1631 sprintf(full_file_name,"%02d)%s_%dx%dx%d.raw",global_index,filename,width,num_rows,max_bands); 1632 sprintf(full_file_name,"%02d)%s_%dx%dx%d.raw",global_index,filename,width,num_rows,max_bands);
1632 fid = fopen(full_file_name,"wb"); 1633 fid = gp_fopen(full_file_name,"wb");
1633 1634
1634 for (z = 0; z < max_bands; ++z) { 1635 for (z = 0; z < max_bands; ++z) {
1635 /* grab pointer to the next plane */ 1636 /* grab pointer to the next plane */
diff --git a/gs/base/gxblend1.c b/gs/base/gxblend1.c
index 6f68e5ee1..16e2b2d33 100644
--- a/gs/base/gxblend1.c
+++ b/gs/base/gxblend1.c
@@ -17,6 +17,7 @@
17 17
18#include "memory_.h" 18#include "memory_.h"
19#include "gx.h" 19#include "gx.h"
20#include "gp.h"
20#include "gstparam.h" 21#include "gstparam.h"
21#include "gsrect.h" 22#include "gsrect.h"
22#include "gxblend.h" 23#include "gxblend.h"
@@ -612,7 +613,7 @@ dump_planar_rgba(gs_memory_t *mem, const pdf14_buf *pbuf)
612 if (buf->data == NULL) 613 if (buf->data == NULL)
613 return 0; 614 return 0;
614 615
615 file = fopen ("c:\\temp\\tmp.png", "wb"); 616 file = gp_fopen ("c:\\temp\\tmp.png", "wb");
616 617
617 if_debug0m('v', mem, "[v]pnga_output_page\n"); 618 if_debug0m('v', mem, "[v]pnga_output_page\n");
618 619
diff --git a/gs/base/gxiodev.h b/gs/base/gxiodev.h
index 1e3ffd96f..f0633bf57 100644
--- a/gs/base/gxiodev.h
+++ b/gs/base/gxiodev.h
@@ -97,7 +97,7 @@ struct gx_io_device_procs_s {
97#define iodev_proc_fopen(proc)\ 97#define iodev_proc_fopen(proc)\
98 int proc(gx_io_device *iodev, const char *fname, const char *access,\ 98 int proc(gx_io_device *iodev, const char *fname, const char *access,\
99 FILE **pfile, char *rfname, uint rnamelen) 99 FILE **pfile, char *rfname, uint rnamelen)
100 iodev_proc_fopen((*fopen)); 100 iodev_proc_fopen((*gp_fopen));
101 101
102#define iodev_proc_fclose(proc)\ 102#define iodev_proc_fclose(proc)\
103 int proc(gx_io_device *iodev, FILE *file) 103 int proc(gx_io_device *iodev, FILE *file)
@@ -158,7 +158,7 @@ iodev_proc_get_params(iodev_no_get_params);
158iodev_proc_put_params(iodev_no_put_params); 158iodev_proc_put_params(iodev_no_put_params);
159/* The %os% implemention of fopen and fclose. */ 159/* The %os% implemention of fopen and fclose. */
160/* These are exported for pipes and for %null. */ 160/* These are exported for pipes and for %null. */
161iodev_proc_fopen(iodev_os_fopen); 161iodev_proc_fopen(iodev_os_gp_fopen);
162iodev_proc_fclose(iodev_os_fclose); 162iodev_proc_fclose(iodev_os_fclose);
163 163
164/* Get the N'th IODevice. */ 164/* Get the N'th IODevice. */
diff --git a/gs/base/gxpcmap.c b/gs/base/gxpcmap.c
index 064af6c07..42adc4af5 100644
--- a/gs/base/gxpcmap.c
+++ b/gs/base/gxpcmap.c
@@ -18,6 +18,7 @@
18#include "math_.h" 18#include "math_.h"
19#include "memory_.h" 19#include "memory_.h"
20#include "gx.h" 20#include "gx.h"
21#include "gp.h"
21#include "gserrors.h" 22#include "gserrors.h"
22#include "gsstruct.h" 23#include "gsstruct.h"
23#include "gsutil.h" /* for gs_next_ids */ 24#include "gsutil.h" /* for gs_next_ids */
@@ -1153,7 +1154,7 @@ dump_raw_pattern(int height, int width, int n_chan, int depth,
1153 sprintf(full_file_name,"%d)PATTERN_CHUNK_%dx%dx%d.raw",global_pat_index, 1154 sprintf(full_file_name,"%d)PATTERN_CHUNK_%dx%dx%d.raw",global_pat_index,
1154 width,height,max_bands); 1155 width,height,max_bands);
1155 } 1156 }
1156 fid = fopen(full_file_name,"wb"); 1157 fid = gp_fopen(full_file_name,"wb");
1157 if (depth >= 8) { 1158 if (depth >= 8) {
1158 /* Contone data. */ 1159 /* Contone data. */
1159 if (is_planar) { 1160 if (is_planar) {
diff --git a/gs/base/lib.mak b/gs/base/lib.mak
index 98003062f..642678c5e 100644
--- a/gs/base/lib.mak
+++ b/gs/base/lib.mak
@@ -2232,7 +2232,7 @@ gsroprun1_h=$(GLSRC)gsroprun1.h
2232gsroprun8_h=$(GLSRC)gsroprun8.h 2232gsroprun8_h=$(GLSRC)gsroprun8.h
2233gsroprun24_h=$(GLSRC)gsroprun24.h 2233gsroprun24_h=$(GLSRC)gsroprun24.h
2234$(GLOBJ)gsroprun.$(OBJ) : $(GLSRC)gsroprun.c $(std_h) $(stdpre_h) $(gsropt_h)\ 2234$(GLOBJ)gsroprun.$(OBJ) : $(GLSRC)gsroprun.c $(std_h) $(stdpre_h) $(gsropt_h)\
2235 $(gsroprun1_h) $(gsroprun8_h) $(gsroprun24_h) $(arch_h) 2235 $(gsroprun1_h) $(gsroprun8_h) $(gsroprun24_h) $(gp_h) $(arch_h)
2236 $(GLCC) $(GLO_)gsroprun.$(OBJ) $(C_) $(GLSRC)gsroprun.c 2236 $(GLCC) $(GLO_)gsroprun.$(OBJ) $(C_) $(GLSRC)gsroprun.c
2237 2237
2238# ---------------- Async rendering ---------------- # 2238# ---------------- Async rendering ---------------- #
@@ -2443,7 +2443,7 @@ $(GLOBJ)gxp1fill.$(OBJ) : $(GLSRC)gxp1fill.c $(AK) $(gx_h)\
2443 2443
2444$(GLOBJ)gxpcmap.$(OBJ) : $(GLSRC)gxpcmap.c $(AK) $(gx_h) $(gserrors_h)\ 2444$(GLOBJ)gxpcmap.$(OBJ) : $(GLSRC)gxpcmap.c $(AK) $(gx_h) $(gserrors_h)\
2445 $(math__h) $(memory__h) $(gspath2_h) $(gxdevsop_h) $(gxp1impl_h)\ 2445 $(math__h) $(memory__h) $(gspath2_h) $(gxdevsop_h) $(gxp1impl_h)\
2446 $(gsstruct_h) $(gsutil_h)\ 2446 $(gsstruct_h) $(gsutil_h) $(gp_h) \
2447 $(gxcolor2_h) $(gxcspace_h) $(gxdcolor_h) $(gxdevice_h) $(gxdevmem_h)\ 2447 $(gxcolor2_h) $(gxcspace_h) $(gxdcolor_h) $(gxdevice_h) $(gxdevmem_h)\
2448 $(gxfixed_h) $(gxmatrix_h) $(gxpcolor_h) $(gxclist_h) $(gxcldev_h)\ 2448 $(gxfixed_h) $(gxmatrix_h) $(gxpcolor_h) $(gxclist_h) $(gxcldev_h)\
2449 $(gzstate_h) $(gdevp14_h) $(gdevmpla_h) $(MAKEDIRS) 2449 $(gzstate_h) $(gdevp14_h) $(gdevmpla_h) $(MAKEDIRS)
@@ -2754,7 +2754,7 @@ $(GLOBJ)gsicc_manage.$(OBJ) : $(GLSRC)gsicc_manage.c $(AK) $(gx_h)\
2754 $(gxistate_h) $(gxcspace_h) $(gscms_h) $(gsicc_manage_h) $(gsicc_cache_h)\ 2754 $(gxistate_h) $(gxcspace_h) $(gscms_h) $(gsicc_manage_h) $(gsicc_cache_h)\
2755 $(gsicc_profilecache_h) $(gserrors_h) $(string__h) $(gxclist_h) $(gxcldev_h)\ 2755 $(gsicc_profilecache_h) $(gserrors_h) $(string__h) $(gxclist_h) $(gxcldev_h)\
2756 $(gzstate_h) $(gsicc_create_h) $(gpmisc_h) $(gxdevice_h) $(std_h)\ 2756 $(gzstate_h) $(gsicc_create_h) $(gpmisc_h) $(gxdevice_h) $(std_h)\
2757 $(gsicc_cms_h) $(MAKEDIRS) 2757 $(gsicc_cms_h) $(gp_h) $(MAKEDIRS)
2758 $(GLCC) $(GLO_)gsicc_manage.$(OBJ) $(C_) $(GLSRC)gsicc_manage.c 2758 $(GLCC) $(GLO_)gsicc_manage.$(OBJ) $(C_) $(GLSRC)gsicc_manage.c
2759 2759
2760$(GLOBJ)gsicc_cache.$(OBJ) : $(GLSRC)gsicc_cache.c $(AK) $(gx_h)\ 2760$(GLOBJ)gsicc_cache.$(OBJ) : $(GLSRC)gsicc_cache.c $(AK) $(gx_h)\
@@ -2778,7 +2778,7 @@ $(GLOBJ)gsicc_lcms_0.$(OBJ) : $(GLSRC)gsicc_lcms.c\
2778 $(gsicc_cms_h) $(lcms_h) $(gslibctx_h) $(gserrors_h) 2778 $(gsicc_cms_h) $(lcms_h) $(gslibctx_h) $(gserrors_h)
2779 $(GLLCMSCC) $(GLO_)gsicc_lcms_0.$(OBJ) $(C_) $(GLSRC)gsicc_lcms.c 2779 $(GLLCMSCC) $(GLO_)gsicc_lcms_0.$(OBJ) $(C_) $(GLSRC)gsicc_lcms.c
2780 2780
2781$(GLOBJ)gsicc_lcms.$(OBJ) : $(GLOBJ)gsicc_lcms_$(SHARE_LCMS).$(OBJ) 2781$(GLOBJ)gsicc_lcms.$(OBJ) : $(GLOBJ)gsicc_lcms_$(SHARE_LCMS).$(OBJ) $(gp_h)
2782 $(CP_) $(GLOBJ)gsicc_lcms_$(SHARE_LCMS).$(OBJ) $(GLOBJ)gsicc_lcms.$(OBJ) 2782 $(CP_) $(GLOBJ)gsicc_lcms_$(SHARE_LCMS).$(OBJ) $(GLOBJ)gsicc_lcms.$(OBJ)
2783 2783
2784 2784
@@ -2790,7 +2790,7 @@ $(GLOBJ)gsicc_lcms2_0.$(OBJ) : $(GLSRC)gsicc_lcms2.c\
2790 $(gsicc_cms_h) $(lcms2_h) $(gslibctx_h) $(lcms2_plugin_h) $(gserrors_h) 2790 $(gsicc_cms_h) $(lcms2_h) $(gslibctx_h) $(lcms2_plugin_h) $(gserrors_h)
2791 $(GLLCMS2CC) $(GLO_)gsicc_lcms2_0.$(OBJ) $(C_) $(GLSRC)gsicc_lcms2.c 2791 $(GLLCMS2CC) $(GLO_)gsicc_lcms2_0.$(OBJ) $(C_) $(GLSRC)gsicc_lcms2.c
2792 2792
2793$(GLOBJ)gsicc_lcms2.$(OBJ) : $(GLOBJ)gsicc_lcms2_$(SHARE_LCMS).$(OBJ) 2793$(GLOBJ)gsicc_lcms2.$(OBJ) : $(GLOBJ)gsicc_lcms2_$(SHARE_LCMS).$(OBJ) $(gp_h)
2794 $(CP_) $(GLOBJ)gsicc_lcms2_$(SHARE_LCMS).$(OBJ) $(GLOBJ)gsicc_lcms2.$(OBJ) 2794 $(CP_) $(GLOBJ)gsicc_lcms2_$(SHARE_LCMS).$(OBJ) $(GLOBJ)gsicc_lcms2.$(OBJ)
2795 2795
2796# Note that gsicc_create requires compile with lcms to obtain icc34.h 2796# Note that gsicc_create requires compile with lcms to obtain icc34.h
@@ -2988,12 +2988,12 @@ $(GLOBJ)gximag3x.$(OBJ) : $(GLSRC)gximag3x.c $(AK) $(gx_h)\
2988 2988
2989$(GLOBJ)gxblend.$(OBJ) : $(GLSRC)gxblend.c $(AK) $(gx_h) $(memory__h)\ 2989$(GLOBJ)gxblend.$(OBJ) : $(GLSRC)gxblend.c $(AK) $(gx_h) $(memory__h)\
2990 $(gstparam_h) $(gxblend_h) $(gxcolor2_h) $(gsicc_cache_h)\ 2990 $(gstparam_h) $(gxblend_h) $(gxcolor2_h) $(gsicc_cache_h)\
2991 $(gsicc_manage_h) $(MAKEDIRS) 2991 $(gsicc_manage_h) $(gp_h) $(MAKEDIRS)
2992 $(GLCC) $(GLO_)gxblend.$(OBJ) $(C_) $(GLSRC)gxblend.c 2992 $(GLCC) $(GLO_)gxblend.$(OBJ) $(C_) $(GLSRC)gxblend.c
2993 2993
2994$(GLOBJ)gxblend1.$(OBJ) : $(GLSRC)gxblend1.c $(AK) $(gx_h) $(memory__h)\ 2994$(GLOBJ)gxblend1.$(OBJ) : $(GLSRC)gxblend1.c $(AK) $(gx_h) $(memory__h)\
2995 $(gstparam_h) $(gsrect_h) $(gxdcconv_h) $(gxblend_h) $(gxdevcli_h)\ 2995 $(gstparam_h) $(gsrect_h) $(gxdcconv_h) $(gxblend_h) $(gxdevcli_h)\
2996 $(gxistate_h) $(gdevdevn_h) $(gdevp14_h) $(vdtrace_h) $(png__h)\ 2996 $(gxistate_h) $(gdevdevn_h) $(gdevp14_h) $(vdtrace_h) $(png__h) $(gp_h)\
2997 $(MAKEDIRS) 2997 $(MAKEDIRS)
2998 $(GLCC) $(GLO_)gxblend1.$(OBJ) $(C_) $(GLSRC)gxblend1.c 2998 $(GLCC) $(GLO_)gxblend1.$(OBJ) $(C_) $(GLSRC)gxblend1.c
2999 2999
diff --git a/gs/base/mkromfs.c b/gs/base/mkromfs.c
index 624803fb9..937081790 100644
--- a/gs/base/mkromfs.c
+++ b/gs/base/mkromfs.c
@@ -64,6 +64,9 @@
64 * 64 *
65 */ 65 */
66 66
67/* prevent gp.h redefining fopen */
68#define fopen fopen
69
67#include "stdpre.h" 70#include "stdpre.h"
68#include "stdint_.h" 71#include "stdint_.h"
69#include "time_.h" 72#include "time_.h"
diff --git a/gs/base/stdio_.h b/gs/base/stdio_.h
index 4f4e5fb9d..b372feb37 100644
--- a/gs/base/stdio_.h
+++ b/gs/base/stdio_.h
@@ -77,4 +77,8 @@ int unlink(const char *);
77int snprintf(char *buffer, size_t count, const char *format , ...); 77int snprintf(char *buffer, size_t count, const char *format , ...);
78#endif 78#endif
79 79
80#ifndef fopen
81#define fopen DO_NOT_USE_FOPEN
82#endif
83
80#endif /* stdio__INCLUDED */ 84#endif /* stdio__INCLUDED */
diff --git a/gs/base/strmio.c b/gs/base/strmio.c
index 7f36a2ac1..ead91c5bc 100644
--- a/gs/base/strmio.c
+++ b/gs/base/strmio.c
@@ -59,7 +59,7 @@ sfopen(const char *path, const char *mode, gs_memory_t *mem)
59 open_file = pfn.iodev->procs.open_file; 59 open_file = pfn.iodev->procs.open_file;
60 if (open_file == 0) 60 if (open_file == 0)
61 code = file_open_stream(pfn.fname, pfn.len, mode, 2048, &s, 61 code = file_open_stream(pfn.fname, pfn.len, mode, 2048, &s,
62 pfn.iodev, pfn.iodev->procs.fopen, mem); 62 pfn.iodev, pfn.iodev->procs.gp_fopen, mem);
63 else 63 else
64 code = open_file(pfn.iodev, pfn.fname, pfn.len, mode, &s, mem); 64 code = open_file(pfn.iodev, pfn.fname, pfn.len, mode, &s, mem);
65 if (code < 0) 65 if (code < 0)
diff --git a/gs/contrib/japanese/dviprlib.c b/gs/contrib/japanese/dviprlib.c
index d7ccd93db..6b5963936 100644
--- a/gs/contrib/japanese/dviprlib.c
+++ b/gs/contrib/japanese/dviprlib.c
@@ -52,7 +52,7 @@ dviprt_readcfg(char *ifname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
52 info.fname = ifname; 52 info.fname = ifname;
53 info.line_no = -1; 53 info.line_no = -1;
54 if (ifname) { 54 if (ifname) {
55 info.file = fopen(ifname,gp_fmode_rb); 55 info.file = gp_fopen(ifname,gp_fmode_rb);
56 if (info.file == NULL) { 56 if (info.file == NULL) {
57 dviprt_printcfgerror(&info,"Cannot open.\n",-1); 57 dviprt_printcfgerror(&info,"Cannot open.\n",-1);
58 return CFG_ERROR_FILE_OPEN; 58 return CFG_ERROR_FILE_OPEN;
@@ -496,7 +496,7 @@ dviprt_readsrc(char *fname,dviprt_cfg_t *pcfg,uchar *pcodebuf,int codebuf_s,
496 info.line_no = -1; 496 info.line_no = -1;
497 info.fname = fname; 497 info.fname = fname;
498 if (fname) { 498 if (fname) {
499 info.file = fopen(fname,"r"); 499 info.file = gp_fopen(fname,"r");
500 if (info.file == NULL) { 500 if (info.file == NULL) {
501 dviprt_printcfgerror(&info,"Cannot open.\n",-1); 501 dviprt_printcfgerror(&info,"Cannot open.\n",-1);
502 return CFG_ERROR_FILE_OPEN; 502 return CFG_ERROR_FILE_OPEN;
diff --git a/gs/contrib/japanese/gdevdmpr.c b/gs/contrib/japanese/gdevdmpr.c
index 71c5c0f4c..6e86afa5c 100644
--- a/gs/contrib/japanese/gdevdmpr.c
+++ b/gs/contrib/japanese/gdevdmpr.c
@@ -853,7 +853,7 @@ gdev_dmprt_dviprt_lib_fopen(const char *fnamebase,char *fname)
853 strcpy(fname,env); 853 strcpy(fname,env);
854 strcat(fname, gp_file_name_concat_string(env,strlen(env))); 854 strcat(fname, gp_file_name_concat_string(env,strlen(env)));
855 strcat(fname,fnamebase); 855 strcat(fname,fnamebase);
856 fp = fopen(fname,gp_fmode_rb); 856 fp = gp_fopen(fname,gp_fmode_rb);
857 } 857 }
858 } 858 }
859 return fp; 859 return fp;
diff --git a/gs/contrib/pcl3/eprn/eprnparm.c b/gs/contrib/pcl3/eprn/eprnparm.c
index ac249ebbc..0412900fc 100644
--- a/gs/contrib/pcl3/eprn/eprnparm.c
+++ b/gs/contrib/pcl3/eprn/eprnparm.c
@@ -63,6 +63,7 @@ static const char
63 63
64/* Special headers */ 64/* Special headers */
65#include "gdeveprn.h" 65#include "gdeveprn.h"
66#include "gp.h"
66 67
67/*****************************************************************************/ 68/*****************************************************************************/
68 69
@@ -377,7 +378,7 @@ static int eprn_read_media_data(eprn_Eprn *eprn, gs_memory_t *memory)
377 eprn_PageDescription *list = NULL; 378 eprn_PageDescription *list = NULL;
378 379
379 /* Open the file */ 380 /* Open the file */
380 if ((f = fopen(eprn->media_file, "r")) == NULL) { 381 if ((f = gp_fopen(eprn->media_file, "r")) == NULL) {
381 eprintf5("%s" ERRPREF "Error opening the media configuration file\n" 382 eprintf5("%s" ERRPREF "Error opening the media configuration file\n"
382 "%s `%s'\n%s for reading: %s.\n", 383 "%s `%s'\n%s for reading: %s.\n",
383 epref, epref, eprn->media_file, epref, strerror(errno)); 384 epref, epref, eprn->media_file, epref, strerror(errno));
diff --git a/gs/contrib/pscolor/test.c b/gs/contrib/pscolor/test.c
index 182d08ce9..26a1369cb 100644
--- a/gs/contrib/pscolor/test.c
+++ b/gs/contrib/pscolor/test.c
@@ -23,6 +23,7 @@
23#include "iref.h" 23#include "iref.h"
24#include "iminst.h" 24#include "iminst.h"
25#include "imain.h" 25#include "imain.h"
26#include "gp.h"
26 27
27#include "gsdll.h" /* old DLL public interface */ 28#include "gsdll.h" /* old DLL public interface */
28 29
@@ -56,7 +57,7 @@ gsdll_stdin(void *instance, char *buf, int len)
56 fprintf(temp_fd,"%s",buf); 57 fprintf(temp_fd,"%s",buf);
57 fflush(temp_fd); 58 fflush(temp_fd);
58 fclose(temp_fd); 59 fclose(temp_fd);
59 read_fd=fopen("temp.ps","rb"); 60 read_fd=gp_fopen("temp.ps","rb");
60// fprintf(stderr, "Seitenende %d %d %s\n",hlen,strlen(buf),buf); 61// fprintf(stderr, "Seitenende %d %d %s\n",hlen,strlen(buf),buf);
61 while( (c=fgetc(read_fd)) != EOF) 62 while( (c=fgetc(read_fd)) != EOF)
62 { 63 {
@@ -65,7 +66,7 @@ gsdll_stdin(void *instance, char *buf, int len)
65 // fprintf(stderr, "Seitenende ende %d %d %s\n",hlen,strlen(buf),buf); 66 // fprintf(stderr, "Seitenende ende %d %d %s\n",hlen,strlen(buf),buf);
66 fflush(choose); 67 fflush(choose);
67 fclose(read_fd); 68 fclose(read_fd);
68 temp_fd=fopen("temp.ps","wb"); 69 temp_fd=gp_fopen("temp.ps","wb");
69 return (strlen(buf)); 70 return (strlen(buf));
70 } else if(eof!=0){ 71 } else if(eof!=0){
71// fprintf(stderr, "Mittendrin %s\n",buf); 72// fprintf(stderr, "Mittendrin %s\n",buf);
@@ -74,7 +75,7 @@ gsdll_stdin(void *instance, char *buf, int len)
74 return (strlen(buf)); 75 return (strlen(buf));
75 } else { 76 } else {
76 fprintf(stderr, "Dateiende\n"); 77 fprintf(stderr, "Dateiende\n");
77 read_fd=fopen("temp.ps","rb"); 78 read_fd=gp_fopen("temp.ps","rb");
78 while( (c=fgetc(read_fd)) != EOF) 79 while( (c=fgetc(read_fd)) != EOF)
79 { 80 {
80 fputc(c,choose); 81 fputc(c,choose);
@@ -82,7 +83,7 @@ gsdll_stdin(void *instance, char *buf, int len)
82 fflush(choose); 83 fflush(choose);
83 fclose(read_fd); 84 fclose(read_fd);
84 fclose(temp_fd); 85 fclose(temp_fd);
85 temp_fd=fopen("temp.ps","wb"); 86 temp_fd=gp_fopen("temp.ps","wb");
86 return 0; 87 return 0;
87 } 88 }
88} 89}
@@ -249,7 +250,7 @@ out:
249 choose=black_fd; 250 choose=black_fd;
250 } 251 }
251/* 252/*
252 read_fd=fopen("temp.ps","rb"); 253 read_fd=gp_fopen("temp.ps","rb");
253 while( (c=fgetc(read_fd)) != EOF) 254 while( (c=fgetc(read_fd)) != EOF)
254 { 255 {
255 fputc(c,choose); 256 fputc(c,choose);
@@ -257,7 +258,7 @@ out:
257 fflush(choose); 258 fflush(choose);
258 fclose(read_fd); 259 fclose(read_fd);
259 fclose(temp_fd); 260 fclose(temp_fd);
260 temp_fd=fopen("temp.ps","wb"); 261 temp_fd=gp_fopen("temp.ps","wb");
261*/ 262*/
262 return 0; 263 return 0;
263} 264}
@@ -318,9 +319,9 @@ int main(int argc, char *argv[])
318 gsapi_set_stdio(minst, gsdll_stdin, gsdll_stdout, gsdll_stderr); 319 gsapi_set_stdio(minst, gsdll_stdin, gsdll_stdout, gsdll_stderr);
319 gsapi_set_display_callback(minst, &display); 320 gsapi_set_display_callback(minst, &display);
320 321
321 color_fd=fopen("color.ps","wb"); 322 color_fd=gp_fopen("color.ps","wb");
322 black_fd=fopen("black.ps","wb"); 323 black_fd=gp_fopen("black.ps","wb");
323 temp_fd=fopen("temp.ps","wb"); 324 temp_fd=gp_fopen("temp.ps","wb");
324 choose=black_fd; 325 choose=black_fd;
325 326
326 code = gsapi_init_with_args(minst, gsargc, gsargv); 327 code = gsapi_init_with_args(minst, gsargc, gsargv);
diff --git a/gs/devices/vector/gdevtxtw.c b/gs/devices/vector/gdevtxtw.c
index b20b8d18e..ac53c7ca6 100644
--- a/gs/devices/vector/gdevtxtw.c
+++ b/gs/devices/vector/gdevtxtw.c
@@ -270,7 +270,7 @@ txtwrite_open_device(gx_device * dev)
270 tdev->PageData.y_ordered_list = NULL; 270 tdev->PageData.y_ordered_list = NULL;
271 tdev->file = NULL; 271 tdev->file = NULL;
272#ifdef TRACE_TXTWRITE 272#ifdef TRACE_TXTWRITE
273 tdev->DebugFile = fopen("/temp/txtw_dbg.txt", "wb+"); 273 tdev->DebugFile = gp_fopen("/temp/txtw_dbg.txt", "wb+");
274#endif 274#endif
275 return 0; 275 return 0;
276} 276}
diff --git a/gs/psi/apitest.c b/gs/psi/apitest.c
index e60df8c53..c63147ac4 100644
--- a/gs/psi/apitest.c
+++ b/gs/psi/apitest.c
@@ -1,6 +1,7 @@
1#include <pthread.h> 1#include <pthread.h>
2#include "ierrors.h" 2#include "ierrors.h"
3#include "iapi.h" 3#include "iapi.h"
4#include <gp.h>
4#include <stdio.h> 5#include <stdio.h>
5#include <stdlib.h> 6#include <stdlib.h>
6#include <string.h> 7#include <string.h>
@@ -56,9 +57,9 @@ static void *gs_main(void *arg)
56 my_stdio stdio; 57 my_stdio stdio;
57 58
58 snprintf(text, sizeof(text), "stdout.%d", threadnum); 59 snprintf(text, sizeof(text), "stdout.%d", threadnum);
59 stdio.stdout = fopen(text, "w"); 60 stdio.stdout = gp_fopen(text, "w");
60 snprintf(text, sizeof(text), "stderr.%d", threadnum); 61 snprintf(text, sizeof(text), "stderr.%d", threadnum);
61 stdio.stderr = fopen(text, "w"); 62 stdio.stderr = gp_fopen(text, "w");
62 63
63 gsargv = malloc(sizeof(*gsargv)*my_argc); 64 gsargv = malloc(sizeof(*gsargv)*my_argc);
64 if (!gsargv) 65 if (!gsargv)
diff --git a/gs/psi/gserver.c b/gs/psi/gserver.c
index 87e2c02ff..5652c3217 100644
--- a/gs/psi/gserver.c
+++ b/gs/psi/gserver.c
@@ -25,6 +25,7 @@
25#include "ostack.h" 25#include "ostack.h"
26#include "store.h" 26#include "store.h"
27#include "gspaint.h" /* for gs_erasepage */ 27#include "gspaint.h" /* for gs_erasepage */
28#include "gp.h"
28 29
29/* 30/*
30 * This file provides a very simple procedural interface to the Ghostscript 31 * This file provides a very simple procedural interface to the Ghostscript
@@ -125,7 +126,7 @@ main(int argc, char *argv[])
125 int errlen; 126 int errlen;
126 static const char *fnames[] = 127 static const char *fnames[] =
127 {"golfer.eps", 0}; 128 {"golfer.eps", 0};
128 FILE *cin = fopen("stdin.tmp", "w+"); 129 FILE *cin = gp_fopen("stdin.tmp", "w+");
129 int sout = open("stdout.tmp", O_WRONLY | O_CREAT | O_TRUNC, 130 int sout = open("stdout.tmp", O_WRONLY | O_CREAT | O_TRUNC,
130 S_IREAD | S_IWRITE); 131 S_IREAD | S_IWRITE);
131 int serr = open("stderr.tmp", O_WRONLY | O_CREAT | O_TRUNC, 132 int serr = open("stderr.tmp", O_WRONLY | O_CREAT | O_TRUNC,
diff --git a/gs/psi/int.mak b/gs/psi/int.mak
index 1a601b77a..ef378bc70 100644
--- a/gs/psi/int.mak
+++ b/gs/psi/int.mak
@@ -1827,7 +1827,7 @@ $(PSOBJ)gs.$(OBJ) : $(PSSRC)gs.c $(GH)\
1827 1827
1828$(PSOBJ)apitest.$(OBJ) : $(PSSRC)apitest.c $(GH)\ 1828$(PSOBJ)apitest.$(OBJ) : $(PSSRC)apitest.c $(GH)\
1829 $(ierrors_h) $(iapi_h) $(imain_h) $(imainarg_h) $(iminst_h) $(gsmalloc_h)\ 1829 $(ierrors_h) $(iapi_h) $(imain_h) $(imainarg_h) $(iminst_h) $(gsmalloc_h)\
1830 $(locale__h) 1830 $(locale__h) $(gp_h)
1831 $(PSCC) $(PSO_)apitest.$(OBJ) $(C_) $(PSSRC)apitest.c 1831 $(PSCC) $(PSO_)apitest.$(OBJ) $(C_) $(PSSRC)apitest.c
1832 1832
1833$(PSOBJ)iapi.$(OBJ) : $(PSSRC)iapi.c $(AK)\ 1833$(PSOBJ)iapi.$(OBJ) : $(PSSRC)iapi.c $(AK)\
diff --git a/gs/psi/zfile.c b/gs/psi/zfile.c
index bdf99eafa..a27a4be16 100644
--- a/gs/psi/zfile.c
+++ b/gs/psi/zfile.c
@@ -864,7 +864,7 @@ iodev_os_open_file(gx_io_device * iodev, const char *fname, uint len,
864{ 864{
865 return file_open_stream(fname, len, file_access, 865 return file_open_stream(fname, len, file_access,
866 file_default_buffer_size, ps, 866 file_default_buffer_size, ps,
867 iodev, iodev->procs.fopen, mem); 867 iodev, iodev->procs.gp_fopen, mem);
868} 868}
869 869
870/* Make a t_file reference to a stream. */ 870/* Make a t_file reference to a stream. */
diff --git a/gs/psi/ziodev2.c b/gs/psi/ziodev2.c
index 3d9f2fb70..8ed18fca1 100644
--- a/gs/psi/ziodev2.c
+++ b/gs/psi/ziodev2.c
@@ -35,7 +35,7 @@ const gx_io_device gs_iodev_null = {
35 "%null%", "Special", 35 "%null%", "Special",
36 { 36 {
37 iodev_no_init, null_open, iodev_no_open_file, 37 iodev_no_init, null_open, iodev_no_open_file,
38 iodev_os_fopen, iodev_os_fclose, 38 iodev_os_gp_fopen, iodev_os_fclose,
39 iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status, 39 iodev_no_delete_file, iodev_no_rename_file, iodev_no_file_status,
40 iodev_no_enumerate_files, NULL, NULL, 40 iodev_no_enumerate_files, NULL, NULL,
41 iodev_no_get_params, iodev_no_put_params 41 iodev_no_get_params, iodev_no_put_params
@@ -51,7 +51,7 @@ null_open(gx_io_device * iodev, const char *access, stream ** ps,
51 return file_open_stream(gp_null_file_name, 51 return file_open_stream(gp_null_file_name,
52 strlen(gp_null_file_name), 52 strlen(gp_null_file_name),
53 access, 256 /* arbitrary */ , ps, 53 access, 256 /* arbitrary */ , ps,
54 iodev, iodev->procs.fopen, mem); 54 iodev, iodev->procs.gp_fopen, mem);
55} 55}
56 56
57/* ------ Operators ------ */ 57/* ------ Operators ------ */
diff --git a/pl/pjparse.c b/pl/pjparse.c
index 4a5e76bfa..e0da1d3ab 100644
--- a/pl/pjparse.c
+++ b/pl/pjparse.c
@@ -519,7 +519,7 @@ pjl_warn_exists(const gs_memory_t *mem, char *fname)
519{ 519{
520 FILE *fpdownload; 520 FILE *fpdownload;
521 /* issue a warning if the file exists */ 521 /* issue a warning if the file exists */
522 if ( (fpdownload = fopen(fname, gp_fmode_rb) ) != NULL ) { 522 if ( (fpdownload = gp_fopen(fname, gp_fmode_rb) ) != NULL ) {
523 fclose(fpdownload); 523 fclose(fpdownload);
524 dmprintf1(mem, "warning file exists overwriting %s\n", fname); 524 dmprintf1(mem, "warning file exists overwriting %s\n", fname);
525 } 525 }
@@ -541,7 +541,7 @@ pjl_setup_file_for_writing(pjl_parser_state_t *pst, char *pathname, int size, bo
541 strcpy(fmode, gp_fmode_wb); 541 strcpy(fmode, gp_fmode_wb);
542 if (append) 542 if (append)
543 strcat(fmode, "+"); 543 strcat(fmode, "+");
544 if ( (fp = fopen(fname, gp_fmode_wb)) == NULL) { 544 if ( (fp = gp_fopen(fname, gp_fmode_wb)) == NULL) {
545 dmprintf(pst->mem, "warning file open for writing failed\n" ); 545 dmprintf(pst->mem, "warning file open for writing failed\n" );
546 return NULL; 546 return NULL;
547 } 547 }
@@ -883,7 +883,7 @@ get_fp(pjl_parser_state_t *pst, char *name)
883 if ( result[0] == '\0' ) 883 if ( result[0] == '\0' )
884 return 0; 884 return 0;
885 } 885 }
886 return fopen(result, gp_fmode_rb); 886 return gp_fopen(result, gp_fmode_rb);
887} 887}
888 888
889/* scan for a named resoource in the pcl sandbox 0: or 1: and return 889/* scan for a named resoource in the pcl sandbox 0: or 1: and return
diff --git a/pl/plmain.c b/pl/plmain.c
index 0ba3c5b7a..98eb0b4ad 100644
--- a/pl/plmain.c
+++ b/pl/plmain.c
@@ -878,7 +878,7 @@ pl_top_create_device(pl_main_instance_t *pti, int index, bool is_default)
878/* Process the options on the command line. */ 878/* Process the options on the command line. */
879static FILE * 879static FILE *
880pl_main_arg_fopen(const char *fname, void *ignore_data) 880pl_main_arg_fopen(const char *fname, void *ignore_data)
881{ return fopen(fname, "r"); 881{ return gp_fopen(fname, "r");
882} 882}
883 883
884static void 884static void
@@ -1432,7 +1432,7 @@ pl_main_cursor_open(const gs_memory_t *mem,
1432 if (fname[0] == '-' && fname[1] == 0) 1432 if (fname[0] == '-' && fname[1] == 0)
1433 cursor->strm = mem->gs_lib_ctx->fstdin; 1433 cursor->strm = mem->gs_lib_ctx->fstdin;
1434 else 1434 else
1435 cursor->strm = fopen(fname, "rb"); 1435 cursor->strm = gp_fopen(fname, "rb");
1436 if (!cursor->strm) 1436 if (!cursor->strm)
1437 return gs_error_ioerror; 1437 return gs_error_ioerror;
1438 1438
diff --git a/svg/svg.mak b/svg/svg.mak
index 2461d8d1b..77e61965e 100644
--- a/svg/svg.mak
+++ b/svg/svg.mak
@@ -67,7 +67,7 @@ $(SVGOBJ)svgxml.$(OBJ): $(SVGSRC)svgxml.c $(SVGINCLUDES)
67 $(SVGCCC) $(SVGSRC)svgxml.c $(SVGO_)svgxml.$(OBJ) 67 $(SVGCCC) $(SVGSRC)svgxml.c $(SVGO_)svgxml.$(OBJ)
68 68
69 69
70$(SVG_TOP_OBJ): $(SVGSRC)svgtop.c $(pltop_h) $(SVGGEN)pconf.h $(SVGINCLUDES) 70$(SVG_TOP_OBJ): $(SVGSRC)svgtop.c $(pltop_h) $(SVGGEN)pconf.h $(gp_h) $(SVGINCLUDES)
71 $(CP_) $(SVGGEN)pconf.h $(SVGGEN)pconfig.h 71 $(CP_) $(SVGGEN)pconf.h $(SVGGEN)pconfig.h
72 $(SVGCCC) $(SVGSRC)svgtop.c $(SVGO_)svgtop.$(OBJ) 72 $(SVGCCC) $(SVGSRC)svgtop.c $(SVGO_)svgtop.$(OBJ)
73 73
diff --git a/svg/svgtop.c b/svg/svgtop.c
index 8b42cd781..9796f892f 100644
--- a/svg/svgtop.c
+++ b/svg/svgtop.c
@@ -25,7 +25,7 @@
25#include "gxdevice.h" /* so we can include gxht.h below */ 25#include "gxdevice.h" /* so we can include gxht.h below */
26#include "gxht.h" /* gsht1.h is incomplete, we need storage size of gs_halftone */ 26#include "gxht.h" /* gsht1.h is incomplete, we need storage size of gs_halftone */
27#include "gsht1.h" 27#include "gsht1.h"
28 28#include "gp.h"
29static int svg_install_halftone(svg_context_t *ctx, gx_device *pdevice); 29static int svg_install_halftone(svg_context_t *ctx, gx_device *pdevice);
30 30
31#define SVG_PARSER_MIN_INPUT_SIZE 8192 31#define SVG_PARSER_MIN_INPUT_SIZE 8192
@@ -248,7 +248,7 @@ svg_imp_process_file(pl_interp_instance_t *pinstance, char *filename)
248 248
249 dmprintf1(ctx->memory, "svg_imp_process_file %s\n", filename); 249 dmprintf1(ctx->memory, "svg_imp_process_file %s\n", filename);
250 250
251 file = fopen(filename, "rb"); 251 file = gp_fopen(filename, "rb");
252 if (!file) 252 if (!file)
253 return gs_error_ioerror; 253 return gs_error_ioerror;
254 254
diff --git a/xps/xpszip.c b/xps/xpszip.c
index b67046d92..aeaaa9daf 100644
--- a/xps/xpszip.c
+++ b/xps/xpszip.c
@@ -20,7 +20,7 @@
20 20
21static int isfile(char *path) 21static int isfile(char *path)
22{ 22{
23 FILE *file = fopen(path, "rb"); 23 FILE *file = gp_fopen(path, "rb");
24 if (file) 24 if (file)
25 { 25 {
26 fclose(file); 26 fclose(file);
@@ -354,7 +354,7 @@ xps_read_dir_part(xps_context_t *ctx, char *name)
354 xps_strlcat(buf, name, sizeof buf); 354 xps_strlcat(buf, name, sizeof buf);
355 355
356 /* All in one piece */ 356 /* All in one piece */
357 file = fopen(buf, "rb"); 357 file = gp_fopen(buf, "rb");
358 if (file) 358 if (file)
359 { 359 {
360 fseek(file, 0, SEEK_END); 360 fseek(file, 0, SEEK_END);
@@ -372,11 +372,11 @@ xps_read_dir_part(xps_context_t *ctx, char *name)
372 while (1) 372 while (1)
373 { 373 {
374 sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, count); 374 sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, count);
375 file = fopen(buf, "rb"); 375 file = gp_fopen(buf, "rb");
376 if (!file) 376 if (!file)
377 { 377 {
378 sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, count); 378 sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, count);
379 file = fopen(buf, "rb"); 379 file = gp_fopen(buf, "rb");
380 } 380 }
381 if (!file) 381 if (!file)
382 break; 382 break;
@@ -397,7 +397,7 @@ xps_read_dir_part(xps_context_t *ctx, char *name)
397 sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, i); 397 sprintf(buf, "%s%s/[%d].piece", ctx->directory, name, i);
398 else 398 else
399 sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, i); 399 sprintf(buf, "%s%s/[%d].last.piece", ctx->directory, name, i);
400 file = fopen(buf, "rb"); 400 file = gp_fopen(buf, "rb");
401 n = fread(part->data + offset, 1, size - offset, file); 401 n = fread(part->data + offset, 1, size - offset, file);
402 offset += n; 402 offset += n;
403 fclose(file); 403 fclose(file);
@@ -471,7 +471,7 @@ xps_process_file(xps_context_t *ctx, char *filename)
471 int code; 471 int code;
472 char *p; 472 char *p;
473 473
474 ctx->file = fopen(filename, "rb"); 474 ctx->file = gp_fopen(filename, "rb");
475 if (!ctx->file) 475 if (!ctx->file)
476 return gs_throw1(-1, "cannot open file: '%s'", filename); 476 return gs_throw1(-1, "cannot open file: '%s'", filename);
477 477