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/gdevlbp8.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/gdevlbp8.c')
-rw-r--r-- | devices/gdevlbp8.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/devices/gdevlbp8.c b/devices/gdevlbp8.c index 342c37298..b99e219bd 100644 --- a/devices/gdevlbp8.c +++ b/devices/gdevlbp8.c @@ -102,14 +102,14 @@ static const char lips3_end[] = { /* Send the page to the printer. */ static int -can_print_page(gx_device_printer *pdev, FILE *prn_stream, +can_print_page(gx_device_printer *pdev, gp_file *prn_stream, const char *init, int init_size, const char *end, int end_size) { char data[LINE_SIZE*2]; char *out_data; int last_line_nro = 0; - fwrite(init, init_size, 1, prn_stream); /* initialize */ + gp_fwrite(init, init_size, 1, prn_stream); /* initialize */ /* Send each scan line in turn */ { @@ -133,8 +133,8 @@ can_print_page(gx_device_printer *pdev, FILE *prn_stream, out_data = data; /* move down */ - fprintf(prn_stream, "%c[%de", - ESC, lnum-last_line_nro ); + gp_fprintf(prn_stream, "%c[%de", + ESC, lnum-last_line_nro ); last_line_nro = lnum; while (out_data < end_data) { @@ -170,15 +170,15 @@ can_print_page(gx_device_printer *pdev, FILE *prn_stream, break; /* move down and across*/ - fprintf(prn_stream, "%c[%d`", - ESC, num_cols ); + gp_fprintf(prn_stream, "%c[%d`", + ESC, num_cols ); /* transfer raster graphic command */ - fprintf(prn_stream, "%c[%d;%d;300;.r", - ESC, out_count, out_count); + gp_fprintf(prn_stream, "%c[%d;%d;300;.r", + ESC, out_count, out_count); /* send the row */ - fwrite(out_data, sizeof(char), - out_count, prn_stream); + gp_fwrite(out_data, sizeof(char), + out_count, prn_stream); out_data += out_count+zero_count; num_cols += 8*(out_count+zero_count); @@ -188,18 +188,18 @@ can_print_page(gx_device_printer *pdev, FILE *prn_stream, } /* eject page */ - fprintf(prn_stream, "%c=", ESC); + gp_fprintf(prn_stream, "%c=", ESC); /* terminate */ if (end != NULL) - (void)fwrite(end, end_size, 1, prn_stream); + (void)gp_fwrite(end, end_size, 1, prn_stream); return 0; } /* Print an LBP-8 page. */ static int -lbp8_print_page(gx_device_printer *pdev, FILE *prn_stream) +lbp8_print_page(gx_device_printer *pdev, gp_file *prn_stream) { return can_print_page(pdev, prn_stream, lbp8_init, sizeof(lbp8_init), NULL, 0); @@ -208,7 +208,7 @@ lbp8_print_page(gx_device_printer *pdev, FILE *prn_stream) #ifdef NOCONTRIB /* Print a LIPS III page. */ static int -lips3_print_page(gx_device_printer *pdev, FILE *prn_stream) +lips3_print_page(gx_device_printer *pdev, gp_file *prn_stream) { return can_print_page(pdev, prn_stream, lips3_init, sizeof(lips3_init), lips3_end, sizeof(lips3_end)); } |