diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2019-03-07 18:03:00 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2019-05-29 09:39:36 +0100 |
commit | 9de16a6637b73e35f79d2d622de403b24e6502f2 (patch) | |
tree | bc6fba44e03e9caab75968fda94a0cea73caf5e3 /devices/gdevepsc.c | |
parent | 808021913baf763e07cc9eabc3716bfa507380ff (diff) | |
download | ghostpdl-9de16a6637b73e35f79d2d622de403b24e6502f2.tar.gz |
Move FILE * operations behind new gp_file * API.
(squash of commits from filesec branch)
Most of this commit is donkeywork conversions of calls from
FILE * -> gp_file *, fwrite -> gp_fwrite etc. Pretty much every
device is touched, along with the clist and parsing code.
The more interesting changes are within gp.h (where the actual
new API is defined), gpmisc.c (where the basic implementations
live), and the platform specific levels (gp_mswin.c, gp_unifs.c
etc where the platform specific implementations have been
tweaked/renamed).
File opening path validation
All file opening routines now call a central routine for
path validation.
This then consults new entries in gs_lib_ctx to see if validation
is enabled or not. If so, it validates the paths by seeing if
they match.
Simple C level functions for adding/removing/clearing paths, exposed
through the gsapi level.
Add 2 postscript operators for path control.
<name> <string> .addcontrolpath -
Add the given <string> (path) to the list of paths for
controlset <name>, where <name> can be:
/PermitFileReading
/PermitFileWriting
/PermitFileControl
(Anything else -> rangecheck)
- .activatepathcontrol -
Enable path control. At this point PS cannot make any
more changes, and all file access is checked.
Diffstat (limited to 'devices/gdevepsc.c')
-rw-r--r-- | devices/gdevepsc.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/devices/gdevepsc.c b/devices/gdevepsc.c index a102e12cd..192128a43 100644 --- a/devices/gdevepsc.c +++ b/devices/gdevepsc.c @@ -157,12 +157,12 @@ prn_device(epson_procs, "epsonc", /* ------ Internal routines ------ */ /* Forward references */ -static void epsc_output_run(byte *, int, int, char, FILE *, int); +static void epsc_output_run(byte *, int, int, char, gp_file *, int); /* Send the page to the printer. */ #define DD 0x80 /* double density flag */ static int -epsc_print_page(gx_device_printer * pdev, FILE * prn_stream) +epsc_print_page(gx_device_printer * pdev, gp_file * prn_stream) { static int graphics_modes_9[5] = { -1, 0 /*60 */ , 1 /*120 */ , -1, DD + 3 /*240 */ }; @@ -208,7 +208,7 @@ epsc_print_page(gx_device_printer * pdev, FILE * prn_stream) } /* Initialize the printer and reset the margins. */ - fwrite("\033@\033P\033l\000\033Q\377\033U\001\r", 1, 14, prn_stream); + gp_fwrite("\033@\033P\033l\000\033Q\377\033U\001\r", 1, 14, prn_stream); /* Create color buffer */ if (gx_device_has_color(pdev)) { @@ -248,11 +248,11 @@ epsc_print_page(gx_device_printer * pdev, FILE * prn_stream) /* Vertical tab to the appropriate position. */ while (skip > 255) { - fputs("\033J\377", prn_stream); + gp_fputs("\033J\377", prn_stream); skip -= 255; } if (skip) - fprintf(prn_stream, "\033J%c", skip); + gp_fprintf(prn_stream, "\033J%c", skip); /* Copy the rest of the scan lines. */ lcnt = 1 + gdev_prn_copy_scan_lines(pdev, lnum + 1, @@ -347,7 +347,7 @@ epsc_print_page(gx_device_printer * pdev, FILE * prn_stream) ** but lets check anyway */ if (current_color) - fprintf(prn_stream, "\033r%c", current_color ^ 7); + gp_fprintf(prn_stream, "\033r%c", current_color ^ 7); } /* We have to 'transpose' blocks of 8 pixels x 8 lines, */ @@ -405,7 +405,7 @@ epsc_print_page(gx_device_printer * pdev, FILE * prn_stream) y_mult, start_graphics, prn_stream, pass); /* Tab over to the appropriate position. */ - fprintf(prn_stream, "\033D%c%c\t", tpos, 0); + gp_fprintf(prn_stream, "\033D%c%c\t", tpos, 0); out_blk = outp = newp; } } else @@ -415,7 +415,7 @@ epsc_print_page(gx_device_printer * pdev, FILE * prn_stream) epsc_output_run(out_blk, (int)(outp - out_blk), y_mult, start_graphics, prn_stream, pass); - fputc('\r', prn_stream); + gp_fputc('\r', prn_stream); } } while (nextcolor); skip = 24; @@ -423,7 +423,7 @@ epsc_print_page(gx_device_printer * pdev, FILE * prn_stream) } /* Eject the page and reinitialize the printer */ - fputs("\f\033@", prn_stream); + gp_fputs("\f\033@", prn_stream); gs_free(pdev->memory, (char *)out, out_size + 1, 1, "epsc_print_page(out)"); @@ -438,21 +438,21 @@ epsc_print_page(gx_device_printer * pdev, FILE * prn_stream) /* pass=0 for all columns, 1 for even columns, 2 for odd columns. */ static void epsc_output_run(byte * data, int count, int y_mult, - char start_graphics, FILE * prn_stream, int pass) + char start_graphics, gp_file * prn_stream, int pass) { int xcount = count / y_mult; - fputc(033, prn_stream); + gp_fputc(033, prn_stream); if (!(start_graphics & ~3)) { - fputc("KLYZ"[(int)start_graphics], prn_stream); + gp_fputc("KLYZ"[(int)start_graphics], prn_stream); } else { - fputc('*', prn_stream); - fputc(start_graphics & ~DD, prn_stream); + gp_fputc('*', prn_stream); + gp_fputc(start_graphics & ~DD, prn_stream); } - fputc(xcount & 0xff, prn_stream); - fputc(xcount >> 8, prn_stream); + gp_fputc(xcount & 0xff, prn_stream); + gp_fputc(xcount >> 8, prn_stream); if (!pass) - fwrite((char *)data, 1, count, prn_stream); + gp_fwrite((char *)data, 1, count, prn_stream); else { /* Only write every other column of y_mult bytes. */ int which = pass; byte *dp = data; @@ -460,7 +460,7 @@ epsc_output_run(byte * data, int count, int y_mult, for (i = 0; i < xcount; i++, which++) for (j = 0; j < y_mult; j++, dp++) { - putc(((which & 1) ? *dp : 0), prn_stream); + gp_fputc(((which & 1) ? *dp : 0), prn_stream); } } } |