From: mike Date: Fri, 16 Mar 2001 20:42:06 +0000 (+0000) Subject: Possible fixes for pstoraster... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ceb0d2de57f6c7467ffb501effbb946c055986ff;p=thirdparty%2Fcups.git Possible fixes for pstoraster... git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@1637 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/pstoraster/gdevprn.c b/pstoraster/gdevprn.c index 57ddf56d4d..ff47bcd87f 100644 --- a/pstoraster/gdevprn.c +++ b/pstoraster/gdevprn.c @@ -24,7 +24,7 @@ GNU software to build or run it. */ -/*$Id: gdevprn.c,v 1.11 2001/03/08 15:13:14 mike Exp $ */ +/*$Id: gdevprn.c,v 1.12 2001/03/16 20:42:06 mike Exp $ */ /* Generic printer driver support */ #include "ctype_.h" #include "gdevprn.h" @@ -815,10 +815,8 @@ gdev_prn_maybe_reallocate_memory(gx_device_printer *prdev, { int code = 0; gx_device *const pdev = (gx_device *)prdev; - gx_device_memory * const mdev = (gx_device_memory *)prdev; - /* The first test here used to be prdev->open. See News for 5.50. */ - if (mdev->base != 0 && + if (prdev->is_open && (memcmp(&prdev->space_params, old_sp, sizeof(*old_sp)) != 0 || prdev->width != old_width || prdev->height != old_height ) ) { diff --git a/pstoraster/gdevprn.h b/pstoraster/gdevprn.h index b5754bd75a..18b7e5ed20 100644 --- a/pstoraster/gdevprn.h +++ b/pstoraster/gdevprn.h @@ -22,7 +22,7 @@ GNU software to build or run it. */ -/*$Id: gdevprn.h,v 1.4 2000/03/08 23:14:25 mike Exp $ */ +/*$Id: gdevprn.h,v 1.5 2001/03/16 20:42:06 mike Exp $ */ /* Common header file for memory-buffered printers */ #ifndef gdevprn_INCLUDED @@ -37,7 +37,7 @@ #include "gsutil.h" /* for memflip8x8 */ #include "gxdevice.h" #include "gxdevmem.h" -#include "gxclist.h" +#include "gxcldev.h" #include "gsparam.h" /* diff --git a/pstoraster/gxcldev.h b/pstoraster/gxcldev.h index ef572e568c..dd94ea2e9e 100644 --- a/pstoraster/gxcldev.h +++ b/pstoraster/gxcldev.h @@ -22,13 +22,12 @@ GNU software to build or run it. */ -/*$Id: gxcldev.h,v 1.2 2000/03/08 23:14:51 mike Exp $ */ +/*$Id: gxcldev.h,v 1.3 2001/03/16 20:42:06 mike Exp $ */ /* Internal definitions for Ghostscript command lists. */ #ifndef gxcldev_INCLUDED # define gxcldev_INCLUDED -#include "gxclist.h" #include "gsropt.h" #include "gxht.h" /* for gxdht.h */ #include "gxtmap.h" /* ditto */ @@ -247,6 +246,19 @@ typedef struct cmd_block_s { /* ---------------- Band state ---------------- */ +/* Define the prefix on each command run in the writing buffer. */ +typedef struct cmd_prefix_s cmd_prefix; +struct cmd_prefix_s { + cmd_prefix *next; + uint size; +}; + +/* Define the pointers for managing a list of command runs in the buffer. */ +/* There is one of these for each band, plus one for band-range commands. */ +typedef struct cmd_list_s { + cmd_prefix *head, *tail; /* list of commands for band */ +} cmd_list; + /* Remember the current state of one band when writing or reading. */ struct gx_clist_state_s { gx_color_index colors[2]; /* most recent colors */ @@ -281,6 +293,12 @@ struct gx_clist_state_s { ulong cost; /* cost of rendering the band */ }; +/**** MRS: We need to include this here instead of the top to avoid lots of + **** pointer errors. Why the f**k does GS have to define so many + **** interdependent structures?!? + ****/ +#include "gxclist.h" + /* The initial values for a band state */ /*static const gx_clist_state cls_initial */ #define cls_initial_values\ @@ -555,6 +573,7 @@ int cmd_update_lop(P3(gx_device_clist_writer *, gx_clist_state *, * permanent_error, which prevents writing to the command list. */ +/**** MRS: Added cast to cdev->states since size of gx_clist_state is unknown ****/ #define FOR_RECTS\ BEGIN\ int yend = y + height;\ @@ -565,7 +584,7 @@ int cmd_update_lop(P3(gx_device_clist_writer *, gx_clist_state *, return (cdev->permanent_error);\ do {\ int band = y / band_height;\ - gx_clist_state *pcls = cdev->states + band;\ + gx_clist_state *pcls = ((struct gx_clist_state_s *)cdev->states) + band;\ int band_end = (band + 1) * band_height;\ \ height = min(band_end, yend) - y;\ diff --git a/pstoraster/gxclist.h b/pstoraster/gxclist.h index bb324feba3..cdcccbe386 100644 --- a/pstoraster/gxclist.h +++ b/pstoraster/gxclist.h @@ -22,7 +22,7 @@ GNU software to build or run it. */ -/*$Id: gxclist.h,v 1.2 2000/03/08 23:14:53 mike Exp $ */ +/*$Id: gxclist.h,v 1.3 2001/03/16 20:42:06 mike Exp $ */ /* Command list definitions for Ghostscript. */ /* Requires gxdevice.h and gxdevmem.h */ @@ -132,18 +132,6 @@ typedef struct { #define ts_bits(cldev,pts) (ts_mask(pts) + (cldev)->tile_band_mask_size) } tile_slot; -/* Define the prefix on each command run in the writing buffer. */ -typedef struct cmd_prefix_s cmd_prefix; -struct cmd_prefix_s { - cmd_prefix *next; - uint size; -}; - -/* Define the pointers for managing a list of command runs in the buffer. */ -/* There is one of these for each band, plus one for band-range commands. */ -typedef struct cmd_list_s { - cmd_prefix *head, *tail; /* list of commands for band */ -} cmd_list; /* * In order to keep the per-band state down to a reasonable size, @@ -208,9 +196,9 @@ typedef struct gx_device_clist_writer_s { byte *cbuf; /* start of command buffer */ byte *cnext; /* next slot in command buffer */ byte *cend; /* end of command buffer */ - cmd_list *ccl; /* &clist_state.list of last command */ + cmd_list *ccl; /* &clist_state.list of last command */ cmd_list band_range_list; /* list of band-range commands */ - int band_range_min, band_range_max; /* range for list */ + int band_range_min, band_range_max; /* range for list */ uint tile_max_size; /* max size of a single tile (bytes) */ uint tile_max_count; /* max # of hash table entries */ gx_strip_bitmap tile_params; /* current tile parameters */ diff --git a/pstoraster/gxclmem.c b/pstoraster/gxclmem.c index 6cbcf3bbcb..ebba3ed633 100644 --- a/pstoraster/gxclmem.c +++ b/pstoraster/gxclmem.c @@ -22,7 +22,7 @@ GNU software to build or run it. */ -/*$Id: gxclmem.c,v 1.5 2001/02/07 01:25:40 mike Exp $ */ +/*$Id: gxclmem.c,v 1.6 2001/03/16 20:42:06 mike Exp $ */ /* RAM-based command list implementation */ #include "memory_.h" #include "gx.h" @@ -629,7 +629,7 @@ memfile_next_blk(MEMFILE * f) } /* end else (when we are compressing) */ #endif /* HAVE_LIBZ */ - return (0); + return (ecode); } int /* returns # of chars actually written */ diff --git a/pstoraster/gxclpath.c b/pstoraster/gxclpath.c index 7f577e9057..4096ad9c7c 100644 --- a/pstoraster/gxclpath.c +++ b/pstoraster/gxclpath.c @@ -22,7 +22,7 @@ GNU software to build or run it. */ -/*$Id: gxclpath.c,v 1.2 2000/03/08 23:14:53 mike Exp $ */ +/*$Id: gxclpath.c,v 1.3 2001/03/16 20:42:06 mike Exp $ */ /* Higher-level path operations for band lists */ #include "math_.h" #include "memory_.h" @@ -163,7 +163,7 @@ cmd_clear_known(gx_device_clist_writer * cldev, uint known) gx_clist_state *pcls = cldev->states; int i; - for (i = cldev->nbands; --i >= 0; ++pcls) + for (i = cldev->nbands - 1; i >= 0; i --, pcls ++) pcls->known &= unknown; } diff --git a/pstoraster/gxclpath.h b/pstoraster/gxclpath.h index cebaf8d2a3..5bca392df0 100644 --- a/pstoraster/gxclpath.h +++ b/pstoraster/gxclpath.h @@ -22,7 +22,7 @@ GNU software to build or run it. */ -/*$Id: gxclpath.h,v 1.2 2000/03/08 23:14:53 mike Exp $ */ +/*$Id: gxclpath.h,v 1.3 2001/03/16 20:42:06 mike Exp $ */ /* Extends (requires) gxcldev.h */ #ifndef gxclpath_INCLUDED @@ -191,7 +191,7 @@ void cmd_clear_known(P2(gx_device_clist_writer * cldev, uint known)); /* Write out values of any unknown parameters. */ #define cmd_do_write_unknown(cldev, pcls, must_know)\ - ( ~(pcls)->known & (must_know) ?\ + ( ~((pcls)->known) & (must_know) ?\ cmd_write_unknown(cldev, pcls, must_know) : 0 ) int cmd_write_unknown(P3(gx_device_clist_writer * cldev, gx_clist_state * pcls, uint must_know)); diff --git a/pstoraster/gxclutil.c b/pstoraster/gxclutil.c index aec8ca01aa..4b0e46acfe 100644 --- a/pstoraster/gxclutil.c +++ b/pstoraster/gxclutil.c @@ -22,7 +22,7 @@ GNU software to build or run it. */ -/*$Id: gxclutil.c,v 1.1 2000/03/08 23:14:54 mike Exp $ */ +/*$Id: gxclutil.c,v 1.2 2001/03/16 20:42:06 mike Exp $ */ /* Command list writing utilities. */ #include "memory_.h" @@ -495,9 +495,9 @@ cmd_set_tile_phase(gx_device_clist_writer * cldev, gx_clist_state * pcls, if (code < 0) return code; ++dp; - cmd_putxy(pcls->tile_phase, dp); pcls->tile_phase.x = px; pcls->tile_phase.y = py; + cmd_putxy(pcls->tile_phase, dp); return 0; }