diff --git a/ghostscript-gdevcups-segfaults.patch b/ghostscript-gdevcups-segfaults.patch deleted file mode 100644 index 53602d8..0000000 --- a/ghostscript-gdevcups-segfaults.patch +++ /dev/null @@ -1,1812 +0,0 @@ -diff -up ghostscript-8.71/cups/gdevcups.c.gdevcups-segfaults ghostscript-8.71/cups/gdevcups.c ---- ghostscript-8.71/cups/gdevcups.c.gdevcups-segfaults 2010-10-14 17:05:32.266994174 +0100 -+++ ghostscript-8.71/cups/gdevcups.c 2010-10-14 17:05:32.281994345 +0100 -@@ -1,5 +1,5 @@ - /* -- * "$Id: gdevcups.c 10631 2010-01-22 17:46:02Z till $" -+ * "$Id$" - * - * GNU Ghostscript raster output driver for the Common UNIX Printing - * System (CUPS). -@@ -34,6 +34,8 @@ - * cups_close() - Close the output file. - * cups_decode_color() - Decode a color value. - * cups_encode_color() - Encode a color value. -+ * cups_get_color_comp_index() -+ * - Color component to index - * cups_get_color_mapping_procs() - * - Get the list of color mapping procedures. - * cups_get_matrix() - Generate the default page matrix. -@@ -66,7 +68,6 @@ - #include "std.h" /* to stop stdlib.h redefining types */ - #include "gdevprn.h" - #include "gsparam.h" --#include "gsexit.h" - #include "arch.h" - - #include -@@ -78,6 +79,12 @@ - #undef private - #define private - -+/* This should go into gdevprn.h, or, better yet, gdevprn should -+ acquire an API for changing resolution. */ -+int gdev_prn_maybe_realloc_memory(gx_device_printer *pdev, -+ gdev_prn_space_params *old_space, -+ int old_width, int old_height, -+ bool old_page_uses_transparency); - - /* - * Check if we are compiling against CUPS 1.2. If so, enable -@@ -95,16 +102,6 @@ - - - /* -- * Newer versions of Ghostscript don't provide gs_exit() function anymore. -- * It has been renamed to gs_to_exit()... -- */ -- --#ifdef dev_t_proc_encode_color --# define gs_exit gs_to_exit --#endif /* dev_t_proc_encode_color */ -- -- --/* - * CIE XYZ color constants... - */ - -@@ -177,6 +174,7 @@ private cm_map_proc_rgb(cups_map_rgb); - private cm_map_proc_cmyk(cups_map_cmyk); - private dev_proc_decode_color(cups_decode_color); - private dev_proc_encode_color(cups_encode_color); -+private dev_proc_get_color_comp_index(cups_get_color_comp_index); - private dev_proc_get_color_mapping_procs(cups_get_color_mapping_procs); - - static const gx_cm_color_map_procs cups_color_mapping_procs = -@@ -204,6 +202,24 @@ typedef struct gx_device_cups_s - cups_raster_t *stream; /* Raster stream */ - cups_page_header_t header; /* PostScript page device info */ - int landscape; /* Non-zero if this is landscape */ -+ int lastpage; -+ int HaveProfile; /* Has a color profile been defined? */ -+ char *Profile; /* Current simple color profile string */ -+ ppd_file_t *PPD; /* PPD file for this device */ -+ unsigned char RevLower1[16]; /* Lower 1-bit reversal table */ -+ unsigned char RevUpper1[16]; /* Upper 1-bit reversal table */ -+ unsigned char RevLower2[16]; /* Lower 2-bit reversal table */ -+ unsigned char RevUpper2[16]; /* Upper 2-bit reversal table */ -+#ifdef GX_COLOR_INDEX_TYPE -+ gx_color_value DecodeLUT[65536];/* Output color to RGB value LUT */ -+#else -+ gx_color_value DecodeLUT[256]; /* Output color to RGB value LUT */ -+#endif /* GX_COLOR_INDEX_TYPE */ -+ unsigned short EncodeLUT[gx_max_color_value + 1];/* RGB value to output color LUT */ -+ int Density[CUPS_MAX_VALUE + 1];/* Density LUT */ -+ int Matrix[3][3][CUPS_MAX_VALUE + 1];/* Color transform matrix LUT */ -+ -+ /* Used by cups_put_params(): */ - } gx_device_cups; - - private gx_device_procs cups_procs = -@@ -268,7 +284,7 @@ private gx_device_procs cups_procs = - NULL, /* discard_transparency_layer */ - #ifdef dev_t_proc_encode_color - cups_get_color_mapping_procs, -- gx_error_get_color_comp_index, /* Dummy to avoid segfault */ -+ cups_get_color_comp_index, - cups_encode_color, - cups_decode_color, - #else -@@ -285,7 +301,9 @@ private gx_device_procs cups_procs = - NULL, /* fill_linear_color_triangle */ - NULL, /* update_spot_equivalent_colors */ - NULL, /* ret_devn_params */ -- NULL /* fillpage */ -+ NULL, /* fillpage */ -+ NULL, /* push_transparency_state */ -+ NULL /* pop_transparency_state */ - }; - - #define prn_device_body_copies(dtype, procs, dname, w10, h10, xdpi, ydpi, lo, to, lm, bm, rm, tm, ncomp, depth, mg, mc, dg, dc, print_pages)\ -@@ -381,63 +399,35 @@ gx_device_cups gs_cups_device = - "" /* cupsPageSizeName */ - #endif /* CUPS_RASTER_SYNCv1 */ - }, -- 0 /* landscape */ -+ 0, /* landscape */ -+ 0, /* lastpage */ -+ 0, /* HaveProfile */ -+ NULL, /* Profile */ -+ NULL, /* PPD */ -+ { 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, -+ 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f },/* RevLower1 */ -+ { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, -+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 },/* RevUpper1 */ -+ { 0x00, 0x04, 0x08, 0x0c, 0x01, 0x05, 0x09, 0x0d, -+ 0x02, 0x06, 0x0a, 0x0e, 0x03, 0x07, 0x0b, 0x0f },/* RevLower2 */ -+ { 0x00, 0x40, 0x80, 0xc0, 0x10, 0x50, 0x90, 0xd0, -+ 0x20, 0x60, 0xa0, 0xe0, 0x30, 0x70, 0xb0, 0xf0 },/* RevUpper2 */ -+ { }, /* DecodeLUT */ -+ { }, /* EncodeLUT */ -+ { }, /* Density */ -+ { } /* Matrix */ - }; - - /* -- * Globals... -- */ -- --#ifdef GX_COLOR_INDEX_TYPE --static gx_color_value cupsDecodeLUT[65536]; -- /* Output color to RGB value LUT */ --#else --static gx_color_value cupsDecodeLUT[256]; -- /* Output color to RGB value LUT */ --#endif /* GX_COLOR_INDEX_TYPE */ --static unsigned short cupsEncodeLUT[gx_max_color_value + 1]; -- /* RGB value to output color LUT */ -- --static ppd_file_t *cupsPPD = 0; /* PPD file for this device */ --static char *cupsProfile = NULL; -- /* Current simple color profile string */ --static int cupsHaveProfile = 0; -- /* Has a color profile been defined? */ --static int cupsMatrix[3][3][CUPS_MAX_VALUE + 1]; -- /* Color transform matrix LUT */ --static int cupsDensity[CUPS_MAX_VALUE + 1]; -- /* Density LUT */ --static unsigned char cupsRevLower1[16] = -- { /* Lower 1-bit reversal table */ -- 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, -- 0x01, 0x09, 0x05, 0x0d, 0x03, 0x0b, 0x07, 0x0f -- }, -- cupsRevUpper1[16] = -- { /* Upper 1-bit reversal table */ -- 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, -- 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0 -- }, -- cupsRevLower2[16] = -- { /* Lower 2-bit reversal table */ -- 0x00, 0x04, 0x08, 0x0c, 0x01, 0x05, 0x09, 0x0d, -- 0x02, 0x06, 0x0a, 0x0e, 0x03, 0x07, 0x0b, 0x0f -- }, -- cupsRevUpper2[16] = -- { /* Upper 2-bit reversal table */ -- 0x00, 0x40, 0x80, 0xc0, 0x10, 0x50, 0x90, 0xd0, -- 0x20, 0x60, 0xa0, 0xe0, 0x30, 0x70, 0xb0, 0xf0 -- }; -- --/* - * Local functions... - */ - - static double cups_map_cielab(double, double); --static void cups_print_chunked(gx_device_printer *, unsigned char *, -+static int cups_print_chunked(gx_device_printer *, unsigned char *, - unsigned char *, int); --static void cups_print_banded(gx_device_printer *, unsigned char *, -+static int cups_print_banded(gx_device_printer *, unsigned char *, - unsigned char *, int); --static void cups_print_planar(gx_device_printer *, unsigned char *, -+static int cups_print_planar(gx_device_printer *, unsigned char *, - unsigned char *, int); - - /*static void cups_set_margins(gx_device *);*/ -@@ -459,16 +449,16 @@ cups_close(gx_device *pdev) /* I - Devi - } - - #if 0 /* Can't do this here because put_params() might close the device */ -- if (cupsPPD != NULL) -+ if (cups->PPD != NULL) - { -- ppdClose(cupsPPD); -- cupsPPD = NULL; -+ ppdClose(cups->PPD); -+ cups->PPD = NULL; - } - -- if (cupsProfile != NULL) -+ if (cups->Profile != NULL) - { -- free(cupsProfile); -- cupsProfile = NULL; -+ free(cups->Profile); -+ cups->Profile = NULL; - } - #endif /* 0 */ - -@@ -509,9 +499,9 @@ cups_decode_color(gx_device *pdev, - mask = (1 << shift) - 1; - - for (i = cups->color_info.num_components - 1; i > 0; i --, ci >>= shift) -- cv[i] = cupsDecodeLUT[ci & mask]; -+ cv[i] = cups->DecodeLUT[ci & mask]; - -- cv[0] = cupsDecodeLUT[ci & mask]; -+ cv[0] = cups->DecodeLUT[ci & mask]; - } - - return (0); -@@ -539,10 +529,10 @@ cups_encode_color(gx_device * - - shift = cups->header.cupsBitsPerColor; - -- for (ci = cupsEncodeLUT[cv[0]], i = 1; -+ for (ci = cups->EncodeLUT[cv[0]], i = 1; - i < cups->color_info.num_components; - i ++) -- ci = (ci << shift) | cupsEncodeLUT[cv[i]]; -+ ci = (ci << shift) | cups->EncodeLUT[cv[i]]; - - #ifdef DEBUG - dprintf2("DEBUG2: cv[0]=%d -> %llx\n", cv[0], ci); -@@ -583,6 +573,145 @@ cups_encode_color(gx_device * - return (ci); - } - -+/* -+ * 'cups_get_color_comp_index()' - Color component to index -+ */ -+ -+#define compare_color_names(pname, name_size, name_str) \ -+ (name_size == (int)strlen(name_str) && strncasecmp(pname, name_str, name_size) == 0) -+ -+int /* O - Index of the named color in -+ the color space */ -+cups_get_color_comp_index(gx_device * pdev, const char * pname, -+ int name_size, int component_type) -+{ -+ switch (cups->header.cupsColorSpace) -+ { -+ case CUPS_CSPACE_K : -+ if (compare_color_names(pname, name_size, "Black") || -+ compare_color_names(pname, name_size, "Gray") || -+ compare_color_names(pname, name_size, "Grey")) -+ return 0; -+ else -+ return -1; /* Indicate that the component name is "unknown" */ -+ break; -+ case CUPS_CSPACE_W : -+ case CUPS_CSPACE_WHITE : -+ if (compare_color_names(pname, name_size, "White") || -+ compare_color_names(pname, name_size, "Luminance") || -+ compare_color_names(pname, name_size, "Gray") || -+ compare_color_names(pname, name_size, "Grey")) -+ return 0; -+ else -+ return -1; -+ break; -+ case CUPS_CSPACE_RGBA : -+ if (compare_color_names(pname, name_size, "Alpha") || -+ compare_color_names(pname, name_size, "Transparent") || -+ compare_color_names(pname, name_size, "Transparency")) -+ return 3; -+ case CUPS_CSPACE_RGBW : -+ if (compare_color_names(pname, name_size, "White")) -+ return 3; -+ case CUPS_CSPACE_RGB : -+ if (compare_color_names(pname, name_size, "Red")) -+ return 0; -+ if (compare_color_names(pname, name_size, "Green")) -+ return 1; -+ if (compare_color_names(pname, name_size, "Blue")) -+ return 2; -+ else -+ return -1; -+ break; -+ case CUPS_CSPACE_CMYK : -+# ifdef CUPS_RASTER_HAVE_COLORIMETRIC -+ case CUPS_CSPACE_CIEXYZ : -+ case CUPS_CSPACE_CIELab : -+ case CUPS_CSPACE_ICC1 : -+ case CUPS_CSPACE_ICC2 : -+ case CUPS_CSPACE_ICC3 : -+ case CUPS_CSPACE_ICC4 : -+ case CUPS_CSPACE_ICC5 : -+ case CUPS_CSPACE_ICC6 : -+ case CUPS_CSPACE_ICC7 : -+ case CUPS_CSPACE_ICC8 : -+ case CUPS_CSPACE_ICC9 : -+ case CUPS_CSPACE_ICCA : -+ case CUPS_CSPACE_ICCB : -+ case CUPS_CSPACE_ICCC : -+ case CUPS_CSPACE_ICCD : -+ case CUPS_CSPACE_ICCE : -+ case CUPS_CSPACE_ICCF : -+# endif /* CUPS_RASTER_HAVE_COLORIMETRIC */ -+ if (compare_color_names(pname, name_size, "Black")) -+ return 3; -+ case CUPS_CSPACE_CMY : -+ if (compare_color_names(pname, name_size, "Cyan")) -+ return 0; -+ if (compare_color_names(pname, name_size, "Magenta")) -+ return 1; -+ if (compare_color_names(pname, name_size, "Yellow")) -+ return 2; -+ else -+ return -1; -+ break; -+ case CUPS_CSPACE_GMCS : -+ if (compare_color_names(pname, name_size, "Silver") || -+ compare_color_names(pname, name_size, "Silver Foil")) -+ return 3; -+ case CUPS_CSPACE_GMCK : -+ if (compare_color_names(pname, name_size, "Gold") || -+ compare_color_names(pname, name_size, "Gold Foil")) -+ return 0; -+ case CUPS_CSPACE_YMCK : -+ if (compare_color_names(pname, name_size, "Black")) -+ return 3; -+ case CUPS_CSPACE_YMC : -+ if (compare_color_names(pname, name_size, "Yellow")) -+ return 0; -+ if (compare_color_names(pname, name_size, "Magenta")) -+ return 1; -+ if (compare_color_names(pname, name_size, "Cyan")) -+ return 2; -+ else -+ return -1; -+ break; -+ case CUPS_CSPACE_KCMYcm : -+ if (compare_color_names(pname, name_size, "Light Cyan") || -+ compare_color_names(pname, name_size, "Photo Cyan")) -+ return 4; -+ if (compare_color_names(pname, name_size, "Light Magenta") || -+ compare_color_names(pname, name_size, "Photo Magenta")) -+ return 5; -+ case CUPS_CSPACE_KCMY : -+ if (compare_color_names(pname, name_size, "Black")) -+ return 0; -+ if (compare_color_names(pname, name_size, "Cyan")) -+ return 1; -+ if (compare_color_names(pname, name_size, "Magenta")) -+ return 2; -+ if (compare_color_names(pname, name_size, "Yellow")) -+ return 3; -+ else -+ return -1; -+ break; -+ case CUPS_CSPACE_GOLD : -+ if (compare_color_names(pname, name_size, "Gold") || -+ compare_color_names(pname, name_size, "Gold Foil")) -+ return 0; -+ else -+ return -1; -+ break; -+ case CUPS_CSPACE_SILVER : -+ if (compare_color_names(pname, name_size, "Silver") || -+ compare_color_names(pname, name_size, "Silver Foil")) -+ return 0; -+ else -+ return -1; -+ break; -+ } -+ return -1; -+} - - /* - * 'cups_get_color_mapping_procs()' - Get the list of color mapping procedures. -@@ -658,8 +787,8 @@ cups_get_matrix(gx_device *pdev, /* I - - } - #endif /* CUPS_RASTER_SYNCv1 */ - -- dprintf2("DEBUG2: width = %d, height = %d\n", cups->width, -- cups->height); -+ dprintf2("DEBUG2: width = %d, height = %d\n", cups->header.cupsWidth, -+ cups->header.cupsHeight); - dprintf4("DEBUG2: PageSize = [ %d %d ], HWResolution = [ %d %d ]\n", - cups->header.PageSize[0], cups->header.PageSize[1], - cups->header.HWResolution[0], cups->header.HWResolution[1]); -@@ -915,7 +1044,8 @@ cups_get_space_params(const gx_device_pr - switch (sscanf(cache_env, "%f%254s", &cache_size, cache_units)) - { - case 0 : -- return; -+ cache_size = 8 * 1024 * 1024; -+ break; - case 1 : - cache_size *= 4 * CUPS_TILE_SIZE * CUPS_TILE_SIZE; - break; -@@ -932,15 +1062,12 @@ cups_get_space_params(const gx_device_pr - } - } - else -- return; -- -- if (cache_size == 0) -- return; -+ cache_size = 8 * 1024 * 1024; - - dprintf1("DEBUG2: cache_size = %.0f\n", cache_size); - -- space_params->MaxBitmap = (int)cache_size; -- space_params->BufferSpace = (int)cache_size; -+ space_params->MaxBitmap = (long)cache_size; -+ space_params->BufferSpace = (long)cache_size / 10; - } - - -@@ -1003,7 +1130,7 @@ cups_map_cmyk(gx_device *pdev, /* I - D - c0 = 0; - else if (c0 > frac_1) - c0 = frac_1; -- out[0] = frac_1 - (frac)cupsDensity[c0]; -+ out[0] = frac_1 - (frac)cups->Density[c0]; - break; - - case CUPS_CSPACE_RGBA : -@@ -1026,26 +1153,26 @@ cups_map_cmyk(gx_device *pdev, /* I - D - c0 = 0; - else if (c0 > frac_1) - c0 = frac_1; -- out[0] = frac_1 - (frac)cupsDensity[c0]; -+ out[0] = frac_1 - (frac)cups->Density[c0]; - - if (c1 < 0) - c1 = 0; - else if (c1 > frac_1) - c1 = frac_1; -- out[1] = frac_1 - (frac)cupsDensity[c1]; -+ out[1] = frac_1 - (frac)cups->Density[c1]; - - if (c2 < 0) - c2 = 0; - else if (c2 > frac_1) - c2 = frac_1; -- out[2] = frac_1 - (frac)cupsDensity[c2]; -+ out[2] = frac_1 - (frac)cups->Density[c2]; - - if (cups->header.cupsColorSpace == CUPS_CSPACE_RGBW) { - if (c3 < 0) - c3 = 0; - else if (c3 > frac_1) - c3 = frac_1; -- out[3] = frac_1 - (frac)cupsDensity[c3]; -+ out[3] = frac_1 - (frac)cups->Density[c3]; - } - break; - -@@ -1056,9 +1183,9 @@ cups_map_cmyk(gx_device *pdev, /* I - D - if (c0 < 0) - out[0] = 0; - else if (c0 > frac_1) -- out[0] = (frac)cupsDensity[frac_1]; -+ out[0] = (frac)cups->Density[frac_1]; - else -- out[0] = (frac)cupsDensity[c0]; -+ out[0] = (frac)cups->Density[c0]; - break; - - case CUPS_CSPACE_CMY : -@@ -1069,23 +1196,23 @@ cups_map_cmyk(gx_device *pdev, /* I - D - if (c0 < 0) - out[0] = 0; - else if (c0 > frac_1) -- out[0] = (frac)cupsDensity[frac_1]; -+ out[0] = (frac)cups->Density[frac_1]; - else -- out[0] = (frac)cupsDensity[c0]; -+ out[0] = (frac)cups->Density[c0]; - - if (c1 < 0) - out[1] = 0; - else if (c1 > frac_1) -- out[1] = (frac)cupsDensity[frac_1]; -+ out[1] = (frac)cups->Density[frac_1]; - else -- out[1] = (frac)cupsDensity[c1]; -+ out[1] = (frac)cups->Density[c1]; - - if (c2 < 0) - out[2] = 0; - else if (c2 > frac_1) -- out[2] = (frac)cupsDensity[frac_1]; -+ out[2] = (frac)cups->Density[frac_1]; - else -- out[2] = (frac)cupsDensity[c2]; -+ out[2] = (frac)cups->Density[c2]; - break; - - case CUPS_CSPACE_YMC : -@@ -1096,53 +1223,53 @@ cups_map_cmyk(gx_device *pdev, /* I - D - if (c0 < 0) - out[0] = 0; - else if (c0 > frac_1) -- out[0] = (frac)cupsDensity[frac_1]; -+ out[0] = (frac)cups->Density[frac_1]; - else -- out[0] = (frac)cupsDensity[c0]; -+ out[0] = (frac)cups->Density[c0]; - - if (c1 < 0) - out[1] = 0; - else if (c1 > frac_1) -- out[1] = (frac)cupsDensity[frac_1]; -+ out[1] = (frac)cups->Density[frac_1]; - else -- out[1] = (frac)cupsDensity[c1]; -+ out[1] = (frac)cups->Density[c1]; - - if (c2 < 0) - out[2] = 0; - else if (c2 > frac_1) -- out[2] = (frac)cupsDensity[frac_1]; -+ out[2] = (frac)cups->Density[frac_1]; - else -- out[2] = (frac)cupsDensity[c2]; -+ out[2] = (frac)cups->Density[c2]; - break; - - case CUPS_CSPACE_CMYK : - if (c < 0) - out[0] = 0; - else if (c > frac_1) -- out[0] = (frac)cupsDensity[frac_1]; -+ out[0] = (frac)cups->Density[frac_1]; - else -- out[0] = (frac)cupsDensity[c]; -+ out[0] = (frac)cups->Density[c]; - - if (m < 0) - out[1] = 0; - else if (m > frac_1) -- out[1] = (frac)cupsDensity[frac_1]; -+ out[1] = (frac)cups->Density[frac_1]; - else -- out[1] = (frac)cupsDensity[m]; -+ out[1] = (frac)cups->Density[m]; - - if (y < 0) - out[2] = 0; - else if (y > frac_1) -- out[2] = (frac)cupsDensity[frac_1]; -+ out[2] = (frac)cups->Density[frac_1]; - else -- out[2] = (frac)cupsDensity[y]; -+ out[2] = (frac)cups->Density[y]; - - if (k < 0) - out[3] = 0; - else if (k > frac_1) -- out[3] = (frac)cupsDensity[frac_1]; -+ out[3] = (frac)cups->Density[frac_1]; - else -- out[3] = (frac)cupsDensity[k]; -+ out[3] = (frac)cups->Density[k]; - break; - - case CUPS_CSPACE_YMCK : -@@ -1151,30 +1278,30 @@ cups_map_cmyk(gx_device *pdev, /* I - D - if (y < 0) - out[0] = 0; - else if (y > frac_1) -- out[0] = (frac)cupsDensity[frac_1]; -+ out[0] = (frac)cups->Density[frac_1]; - else -- out[0] = (frac)cupsDensity[y]; -+ out[0] = (frac)cups->Density[y]; - - if (m < 0) - out[1] = 0; - else if (m > frac_1) -- out[1] = (frac)cupsDensity[frac_1]; -+ out[1] = (frac)cups->Density[frac_1]; - else -- out[1] = (frac)cupsDensity[m]; -+ out[1] = (frac)cups->Density[m]; - - if (c < 0) - out[2] = 0; - else if (c > frac_1) -- out[2] = (frac)cupsDensity[frac_1]; -+ out[2] = (frac)cups->Density[frac_1]; - else -- out[2] = (frac)cupsDensity[c]; -+ out[2] = (frac)cups->Density[c]; - - if (k < 0) - out[3] = 0; - else if (k > frac_1) -- out[3] = (frac)cupsDensity[frac_1]; -+ out[3] = (frac)cups->Density[frac_1]; - else -- out[3] = (frac)cupsDensity[k]; -+ out[3] = (frac)cups->Density[k]; - break; - - case CUPS_CSPACE_KCMYcm : -@@ -1182,30 +1309,30 @@ cups_map_cmyk(gx_device *pdev, /* I - D - if (k < 0) - out[0] = 0; - else if (k > frac_1) -- out[0] = (frac)cupsDensity[frac_1]; -+ out[0] = (frac)cups->Density[frac_1]; - else -- out[0] = (frac)cupsDensity[k]; -+ out[0] = (frac)cups->Density[k]; - - if (c < 0) - out[1] = 0; - else if (c > frac_1) -- out[1] = (frac)cupsDensity[frac_1]; -+ out[1] = (frac)cups->Density[frac_1]; - else -- out[1] = (frac)cupsDensity[c]; -+ out[1] = (frac)cups->Density[c]; - - if (m < 0) - out[2] = 0; - else if (m > frac_1) -- out[2] = (frac)cupsDensity[frac_1]; -+ out[2] = (frac)cups->Density[frac_1]; - else -- out[2] = (frac)cupsDensity[m]; -+ out[2] = (frac)cups->Density[m]; - - if (y < 0) - out[3] = 0; - else if (y > frac_1) -- out[3] = (frac)cupsDensity[frac_1]; -+ out[3] = (frac)cups->Density[frac_1]; - else -- out[3] = (frac)cupsDensity[y]; -+ out[3] = (frac)cups->Density[y]; - break; - - # ifdef CUPS_RASTER_HAVE_COLORIMETRIC -@@ -1400,9 +1527,9 @@ cups_map_cmyk(gx_device *pdev, /* I - D - } - } - -- out[0] = cupsDecodeLUT[c0]; -- out[1] = cupsDecodeLUT[c1]; -- out[2] = cupsDecodeLUT[c2]; -+ out[0] = cups->DecodeLUT[c0]; -+ out[1] = cups->DecodeLUT[c1]; -+ out[2] = cups->DecodeLUT[c2]; - break; - # endif /* CUPS_RASTER_HAVE_COLORIMETRIC */ - } -@@ -1494,21 +1621,21 @@ cups_map_rgb(gx_device *pdev - * Do color correction as needed... - */ - -- if (cupsHaveProfile) -+ if (cups->HaveProfile) - { - /* - * Color correct CMY... - */ - -- tc = cupsMatrix[0][0][c] + -- cupsMatrix[0][1][m] + -- cupsMatrix[0][2][y]; -- tm = cupsMatrix[1][0][c] + -- cupsMatrix[1][1][m] + -- cupsMatrix[1][2][y]; -- ty = cupsMatrix[2][0][c] + -- cupsMatrix[2][1][m] + -- cupsMatrix[2][2][y]; -+ tc = cups->Matrix[0][0][c] + -+ cups->Matrix[0][1][m] + -+ cups->Matrix[0][2][y]; -+ tm = cups->Matrix[1][0][c] + -+ cups->Matrix[1][1][m] + -+ cups->Matrix[1][2][y]; -+ ty = cups->Matrix[2][0][c] + -+ cups->Matrix[2][1][m] + -+ cups->Matrix[2][2][y]; - - if (tc < 0) - c = 0; -@@ -1577,18 +1704,18 @@ cups_map_cmyk_color(gx_device *pdev - * Density correct... - */ - -- if (cupsHaveProfile) -+ if (cups->HaveProfile) - { -- c = cupsDensity[c]; -- m = cupsDensity[m]; -- y = cupsDensity[y]; -- k = cupsDensity[k]; -+ c = cups->Density[c]; -+ m = cups->Density[m]; -+ y = cups->Density[y]; -+ k = cups->Density[k]; - } - -- ic = cupsEncodeLUT[c]; -- im = cupsEncodeLUT[m]; -- iy = cupsEncodeLUT[y]; -- ik = cupsEncodeLUT[k]; -+ ic = cups->EncodeLUT[c]; -+ im = cups->EncodeLUT[m]; -+ iy = cups->EncodeLUT[y]; -+ ik = cups->EncodeLUT[k]; - - /* - * Convert the CMYK color to a color index... -@@ -1804,42 +1931,42 @@ cups_map_color_rgb(gx_device *pdev, - case CUPS_CSPACE_SILVER : - prgb[0] = - prgb[1] = -- prgb[2] = cupsDecodeLUT[c3]; -+ prgb[2] = cups->DecodeLUT[c3]; - break; - - case CUPS_CSPACE_W : - prgb[0] = - prgb[1] = -- prgb[2] = cupsDecodeLUT[c3]; -+ prgb[2] = cups->DecodeLUT[c3]; - break; - - case CUPS_CSPACE_RGB : -- prgb[0] = cupsDecodeLUT[c1]; -- prgb[1] = cupsDecodeLUT[c2]; -- prgb[2] = cupsDecodeLUT[c3]; -+ prgb[0] = cups->DecodeLUT[c1]; -+ prgb[1] = cups->DecodeLUT[c2]; -+ prgb[2] = cups->DecodeLUT[c3]; - break; - - case CUPS_CSPACE_RGBA : -- prgb[0] = cupsDecodeLUT[c0]; -- prgb[1] = cupsDecodeLUT[c1]; -- prgb[2] = cupsDecodeLUT[c2]; -+ prgb[0] = cups->DecodeLUT[c0]; -+ prgb[1] = cups->DecodeLUT[c1]; -+ prgb[2] = cups->DecodeLUT[c2]; - break; - - case CUPS_CSPACE_CMY : -- prgb[0] = cupsDecodeLUT[c1]; -- prgb[1] = cupsDecodeLUT[c2]; -- prgb[2] = cupsDecodeLUT[c3]; -+ prgb[0] = cups->DecodeLUT[c1]; -+ prgb[1] = cups->DecodeLUT[c2]; -+ prgb[2] = cups->DecodeLUT[c3]; - break; - - case CUPS_CSPACE_YMC : -- prgb[0] = cupsDecodeLUT[c3]; -- prgb[1] = cupsDecodeLUT[c2]; -- prgb[2] = cupsDecodeLUT[c1]; -+ prgb[0] = cups->DecodeLUT[c3]; -+ prgb[1] = cups->DecodeLUT[c2]; -+ prgb[2] = cups->DecodeLUT[c1]; - break; - - case CUPS_CSPACE_KCMY : - case CUPS_CSPACE_KCMYcm : -- k = cupsDecodeLUT[c0]; -+ k = cups->DecodeLUT[c0]; - divk = gx_max_color_value - k; - if (divk == 0) - { -@@ -1860,13 +1987,13 @@ cups_map_color_rgb(gx_device *pdev, - - case CUPS_CSPACE_RGBW : - /* -- * cupsDecodeLUT actually maps to RGBW, not CMYK... -+ * cups->DecodeLUT actually maps to RGBW, not CMYK... - */ - -- k = cupsDecodeLUT[c3]; -- c = cupsDecodeLUT[c0] + k; -- m = cupsDecodeLUT[c1] + k; -- y = cupsDecodeLUT[c2] + k; -+ k = cups->DecodeLUT[c3]; -+ c = cups->DecodeLUT[c0] + k; -+ m = cups->DecodeLUT[c1] + k; -+ y = cups->DecodeLUT[c2] + k; - - if (c > gx_max_color_value) - prgb[0] = gx_max_color_value; -@@ -1885,7 +2012,7 @@ cups_map_color_rgb(gx_device *pdev, - break; - - case CUPS_CSPACE_CMYK : -- k = cupsDecodeLUT[c3]; -+ k = cups->DecodeLUT[c3]; - divk = gx_max_color_value - k; - if (divk == 0) - { -@@ -1907,7 +2034,7 @@ cups_map_color_rgb(gx_device *pdev, - case CUPS_CSPACE_YMCK : - case CUPS_CSPACE_GMCK : - case CUPS_CSPACE_GMCS : -- k = cupsDecodeLUT[c3]; -+ k = cups->DecodeLUT[c3]; - divk = gx_max_color_value - k; - if (divk == 0) - { -@@ -1995,7 +2122,7 @@ cups_map_rgb_color(gx_device *pdev, - * Do color correction as needed... - */ - -- if (cupsHaveProfile) -+ if (cups->HaveProfile) - { - /* - * Compute CMYK values... -@@ -2017,17 +2144,17 @@ cups_map_rgb_color(gx_device *pdev, - * Color correct CMY... - */ - -- tc = cupsMatrix[0][0][ic] + -- cupsMatrix[0][1][im] + -- cupsMatrix[0][2][iy] + -+ tc = cups->Matrix[0][0][ic] + -+ cups->Matrix[0][1][im] + -+ cups->Matrix[0][2][iy] + - ik; -- tm = cupsMatrix[1][0][ic] + -- cupsMatrix[1][1][im] + -- cupsMatrix[1][2][iy] + -+ tm = cups->Matrix[1][0][ic] + -+ cups->Matrix[1][1][im] + -+ cups->Matrix[1][2][iy] + - ik; -- ty = cupsMatrix[2][0][ic] + -- cupsMatrix[2][1][im] + -- cupsMatrix[2][2][iy] + -+ ty = cups->Matrix[2][0][ic] + -+ cups->Matrix[2][1][im] + -+ cups->Matrix[2][2][iy] + - ik; - - /* -@@ -2037,23 +2164,23 @@ cups_map_rgb_color(gx_device *pdev, - if (tc < 0) - r = gx_max_color_value; - else if (tc > gx_max_color_value) -- r = gx_max_color_value - cupsDensity[gx_max_color_value]; -+ r = gx_max_color_value - cups->Density[gx_max_color_value]; - else -- r = gx_max_color_value - cupsDensity[tc]; -+ r = gx_max_color_value - cups->Density[tc]; - - if (tm < 0) - g = gx_max_color_value; - else if (tm > gx_max_color_value) -- g = gx_max_color_value - cupsDensity[gx_max_color_value]; -+ g = gx_max_color_value - cups->Density[gx_max_color_value]; - else -- g = gx_max_color_value - cupsDensity[tm]; -+ g = gx_max_color_value - cups->Density[tm]; - - if (ty < 0) - b = gx_max_color_value; - else if (ty > gx_max_color_value) -- b = gx_max_color_value - cupsDensity[gx_max_color_value]; -+ b = gx_max_color_value - cups->Density[gx_max_color_value]; - else -- b = gx_max_color_value - cupsDensity[ty]; -+ b = gx_max_color_value - cups->Density[ty]; - } - - /* -@@ -2063,13 +2190,13 @@ cups_map_rgb_color(gx_device *pdev, - switch (cups->header.cupsColorSpace) - { - case CUPS_CSPACE_W : -- i = cupsEncodeLUT[(r * 31 + g * 61 + b * 8) / 100]; -+ i = cups->EncodeLUT[(r * 31 + g * 61 + b * 8) / 100]; - break; - - case CUPS_CSPACE_RGB : -- ic = cupsEncodeLUT[r]; -- im = cupsEncodeLUT[g]; -- iy = cupsEncodeLUT[b]; -+ ic = cups->EncodeLUT[r]; -+ im = cups->EncodeLUT[g]; -+ iy = cups->EncodeLUT[b]; - - switch (cups->header.cupsBitsPerColor) - { -@@ -2124,9 +2251,9 @@ cups_map_rgb_color(gx_device *pdev, - } - - case CUPS_CSPACE_RGBA : -- ic = cupsEncodeLUT[r]; -- im = cupsEncodeLUT[g]; -- iy = cupsEncodeLUT[b]; -+ ic = cups->EncodeLUT[r]; -+ im = cups->EncodeLUT[g]; -+ iy = cups->EncodeLUT[b]; - - switch (cups->header.cupsBitsPerColor) - { -@@ -2151,13 +2278,13 @@ cups_map_rgb_color(gx_device *pdev, - break; - - default : -- i = cupsEncodeLUT[gx_max_color_value - (r * 31 + g * 61 + b * 8) / 100]; -+ i = cups->EncodeLUT[gx_max_color_value - (r * 31 + g * 61 + b * 8) / 100]; - break; - - case CUPS_CSPACE_CMY : -- ic = cupsEncodeLUT[gx_max_color_value - r]; -- im = cupsEncodeLUT[gx_max_color_value - g]; -- iy = cupsEncodeLUT[gx_max_color_value - b]; -+ ic = cups->EncodeLUT[gx_max_color_value - r]; -+ im = cups->EncodeLUT[gx_max_color_value - g]; -+ iy = cups->EncodeLUT[gx_max_color_value - b]; - - switch (cups->header.cupsBitsPerColor) - { -@@ -2182,9 +2309,9 @@ cups_map_rgb_color(gx_device *pdev, - break; - - case CUPS_CSPACE_YMC : -- ic = cupsEncodeLUT[gx_max_color_value - r]; -- im = cupsEncodeLUT[gx_max_color_value - g]; -- iy = cupsEncodeLUT[gx_max_color_value - b]; -+ ic = cups->EncodeLUT[gx_max_color_value - r]; -+ im = cups->EncodeLUT[gx_max_color_value - g]; -+ iy = cups->EncodeLUT[gx_max_color_value - b]; - - switch (cups->header.cupsBitsPerColor) - { -@@ -2213,10 +2340,10 @@ cups_map_rgb_color(gx_device *pdev, - ik = (int)((float)ik * (float)ik * (float)ik / - ((float)mk * (float)mk)); - -- ic = cupsEncodeLUT[ic - ik]; -- im = cupsEncodeLUT[im - ik]; -- iy = cupsEncodeLUT[iy - ik]; -- ik = cupsEncodeLUT[ik]; -+ ic = cups->EncodeLUT[ic - ik]; -+ im = cups->EncodeLUT[im - ik]; -+ iy = cups->EncodeLUT[iy - ik]; -+ ik = cups->EncodeLUT[ik]; - - switch (cups->header.cupsBitsPerColor) - { -@@ -2257,10 +2384,10 @@ cups_map_rgb_color(gx_device *pdev, - ik = (int)((float)ik * (float)ik * (float)ik / - ((float)mk * (float)mk)); - -- ic = cupsEncodeLUT[ic - ik]; -- im = cupsEncodeLUT[im - ik]; -- iy = cupsEncodeLUT[iy - ik]; -- ik = cupsEncodeLUT[ik]; -+ ic = cups->EncodeLUT[ic - ik]; -+ im = cups->EncodeLUT[im - ik]; -+ iy = cups->EncodeLUT[iy - ik]; -+ ik = cups->EncodeLUT[ik]; - - switch (cups->header.cupsBitsPerColor) - { -@@ -2296,10 +2423,10 @@ cups_map_rgb_color(gx_device *pdev, - ik = (int)((float)ik * (float)ik * (float)ik / - ((float)mk * (float)mk)); - -- ic = cupsEncodeLUT[ic - ik]; -- im = cupsEncodeLUT[im - ik]; -- iy = cupsEncodeLUT[iy - ik]; -- ik = cupsEncodeLUT[ik]; -+ ic = cups->EncodeLUT[ic - ik]; -+ im = cups->EncodeLUT[im - ik]; -+ iy = cups->EncodeLUT[iy - ik]; -+ ik = cups->EncodeLUT[ik]; - if (ik) - i = 32; - else if (ic && im) -@@ -2329,10 +2456,10 @@ cups_map_rgb_color(gx_device *pdev, - ik = (int)((float)ik * (float)ik * (float)ik / - ((float)mk * (float)mk)); - -- ic = cupsEncodeLUT[ic - ik]; -- im = cupsEncodeLUT[im - ik]; -- iy = cupsEncodeLUT[iy - ik]; -- ik = cupsEncodeLUT[ik]; -+ ic = cups->EncodeLUT[ic - ik]; -+ im = cups->EncodeLUT[im - ik]; -+ iy = cups->EncodeLUT[iy - ik]; -+ ik = cups->EncodeLUT[ik]; - - switch (cups->header.cupsBitsPerColor) - { -@@ -2532,8 +2659,8 @@ cups_open(gx_device *pdev) /* I - Devic - if ((code = gdev_prn_open(pdev)) != 0) - return (code); - -- if (cupsPPD == NULL) -- cupsPPD = ppdOpenFile(getenv("PPD")); -+ if (cups->PPD == NULL) -+ cups->PPD = ppdOpenFile(getenv("PPD")); - - return (0); - } -@@ -2550,6 +2677,7 @@ cups_print_pages(gx_device_printer *pdev - int num_copies) - /* I - Number of copies */ - { -+ int code = 0; /* Error code */ - int copy; /* Copy number */ - int srcbytes; /* Byte width of scanline */ - unsigned char *src, /* Scanline data */ -@@ -2604,6 +2732,8 @@ cups_print_pages(gx_device_printer *pdev - if (src == NULL) /* can't allocate input buffer */ - return_error(gs_error_VMerror); - -+ memset(src, 0, srcbytes); -+ - /* - * Need an output buffer, too... - */ -@@ -2614,6 +2744,8 @@ cups_print_pages(gx_device_printer *pdev - if (dst == NULL) /* can't allocate working area */ - return_error(gs_error_VMerror); - -+ memset(dst, 0, 2 * cups->header.cupsBytesPerLine); -+ - /* - * See if the stream has been initialized yet... - */ -@@ -2624,7 +2756,7 @@ cups_print_pages(gx_device_printer *pdev - CUPS_RASTER_WRITE)) == NULL) - { - perror("ERROR: Unable to open raster stream - "); -- gs_exit(gs_lib_ctx_get_non_gc_memory_t(), 0); -+ return_error(gs_error_ioerror); - } - } - -@@ -2635,7 +2767,7 @@ cups_print_pages(gx_device_printer *pdev - if (num_copies < 1) - num_copies = 1; - -- if (cupsPPD != NULL && !cupsPPD->manual_copies) -+ if (cups->PPD != NULL && !cups->PPD->manual_copies) - { - cups->header.NumCopies = num_copies; - num_copies = 1; -@@ -2650,20 +2782,22 @@ cups_print_pages(gx_device_printer *pdev - cupsRasterWriteHeader(cups->stream, &(cups->header)); - - if (pdev->color_info.num_components == 1) -- cups_print_chunked(pdev, src, dst, srcbytes); -+ code = cups_print_chunked(pdev, src, dst, srcbytes); - else - switch (cups->header.cupsColorOrder) - { - case CUPS_ORDER_CHUNKED : -- cups_print_chunked(pdev, src, dst, srcbytes); -+ code = cups_print_chunked(pdev, src, dst, srcbytes); - break; - case CUPS_ORDER_BANDED : -- cups_print_banded(pdev, src, dst, srcbytes); -+ code = cups_print_banded(pdev, src, dst, srcbytes); - break; - case CUPS_ORDER_PLANAR : -- cups_print_planar(pdev, src, dst, srcbytes); -+ code = cups_print_planar(pdev, src, dst, srcbytes); - break; - } -+ if (code < 0) -+ break; - } - - /* -@@ -2673,6 +2807,9 @@ cups_print_pages(gx_device_printer *pdev - gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)src, srcbytes, 1, "cups_print_pages"); - gs_free(gs_lib_ctx_get_non_gc_memory_t(), (char *)dst, cups->header.cupsBytesPerLine, 1, "cups_print_pages"); - -+ if (code < 0) -+ return (code); -+ - cups->page ++; - dprintf1("INFO: Processing page %d...\n", cups->page); - -@@ -2707,19 +2844,14 @@ cups_put_params(gx_device *pdev, /* - gdev_prn_space_params sp; /* Space parameter data */ - int width, /* New width of page */ - height, /* New height of page */ -- colorspace, /* New color space */ -- bitspercolor; /* New bits per color */ -- static int width_old = 0, /* Previous width */ -- height_old = 0, /* Previous height */ -- colorspace_old = 0,/* Previous color space */ -- bitspercolor_old = 0;/* Previous bits per color */ -+ width_old = 0, /* Previous width of page */ -+ height_old = 0; /* Previous height of page */ - ppd_attr_t *backside = NULL, - *backsiderequiresflippedmargins = NULL; - float swap; - int xflip = 0, - yflip = 0; - int found = 0; -- static int lastpage = 0; - - dprintf2("DEBUG2: cups_put_params(%p, %p)\n", pdev, plist); - -@@ -2731,17 +2863,17 @@ cups_put_params(gx_device *pdev, /* - if ((code = param_read_string(plist, sname, &stringval)) < 0) \ - { \ - dprintf2("ERROR: Error setting %s to \"%s\"...\n", sname, \ -- (char *)stringval.data); \ -+ (char *)(stringval.data)); \ - param_signal_error(plist, sname, code); \ - return (code); \ - } \ - else if (code == 0) \ - { \ -- strncpy(cups->header.name, (const char *)stringval.data, \ -+ dprintf2("DEBUG: Setting %s to \"%s\"...\n", sname, \ -+ (char *)(stringval.data)); \ -+ strncpy(cups->header.name, (const char *)(stringval.data), \ - stringval.size); \ - cups->header.name[stringval.size] = '\0'; \ -- dprintf2("DEBUG: Setting %s to \"%s\"...\n", sname, \ -- cups->header.name); \ - } - - #define intoption(name, sname, type) \ -@@ -2821,11 +2953,11 @@ cups_put_params(gx_device *pdev, /* - param_read_int(plist, "cupsBitsPerColor", &intval) == 0; - /* We also recompute page size and margins if we simply get onto a new - page without necessarily having a page size change in the PostScript -- code, as for some printers margins have to flipped on the back sides of -+ code, as for some printers margins have to be flipped on the back sides of - the sheets (even pages) when printing duplex */ -- if (cups->page != lastpage) { -+ if (cups->page != cups->lastpage) { - size_set = 1; -- lastpage = cups->page; -+ cups->lastpage = cups->page; - } - - stringoption(MediaClass, "MediaClass") -@@ -2899,17 +3031,17 @@ cups_put_params(gx_device *pdev, /* - stringoption(cupsPageSizeName, "cupsPageSizeName"); - #endif /* CUPS_RASTER_SYNCv1 */ - -- if ((code = param_read_string(plist, "cupsProfile", &stringval)) < 0) -+ if ((code = param_read_string(plist, "cups->Profile", &stringval)) < 0) - { -- param_signal_error(plist, "cupsProfile", code); -+ param_signal_error(plist, "cups->Profile", code); - return (code); - } - else if (code == 0) - { -- if (cupsProfile != NULL) -- free(cupsProfile); -+ if (cups->Profile != NULL) -+ free(cups->Profile); - -- cupsProfile = strdup((char *)stringval.data); -+ cups->Profile = strdup((char *)stringval.data); - } - - cups_set_color_info(pdev); -@@ -2938,22 +3070,22 @@ cups_put_params(gx_device *pdev, /* - - cups->landscape = 0; - -- if (cupsPPD != NULL) -+ if (cups->PPD != NULL) - { - dprintf1("DEBUG2: cups->header.Duplex = %d\n", cups->header.Duplex); - dprintf1("DEBUG2: cups->header.Tumble = %d\n", cups->header.Tumble); - dprintf1("DEBUG2: cups->page = %d\n", cups->page); -- dprintf1("DEBUG2: cupsPPD = %p\n", cupsPPD); -+ dprintf1("DEBUG2: cups->PPD = %p\n", cups->PPD); - -- backside = ppdFindAttr(cupsPPD, "cupsBackSide", NULL); -+ backside = ppdFindAttr(cups->PPD, "cupsBackSide", NULL); - if (backside) { - dprintf1("DEBUG2: cupsBackSide = %s\n", backside->value); -- cupsPPD->flip_duplex = 0; -+ cups->PPD->flip_duplex = 0; - } -- dprintf1("DEBUG2: cupsPPD->flip_duplex = %d\n", cupsPPD->flip_duplex); -+ dprintf1("DEBUG2: cups->PPD->flip_duplex = %d\n", cups->PPD->flip_duplex); - - backsiderequiresflippedmargins = -- ppdFindAttr(cupsPPD, "APDuplexRequiresFlippedMargin", NULL); -+ ppdFindAttr(cups->PPD, "APDuplexRequiresFlippedMargin", NULL); - if (backsiderequiresflippedmargins) - dprintf1("DEBUG2: APDuplexRequiresFlippedMargin = %s\n", - backsiderequiresflippedmargins->value); -@@ -2990,7 +3122,7 @@ cups_put_params(gx_device *pdev, /* - } - else if (cups->header.Duplex && - ((!cups->header.Tumble && -- (cupsPPD->flip_duplex || -+ (cups->PPD->flip_duplex || - (backside && !strcasecmp(backside->value, "Rotated")))) || - (cups->header.Tumble && - (backside && !strcasecmp(backside->value, "ManualTumble")))) && -@@ -3020,7 +3152,7 @@ cups_put_params(gx_device *pdev, /* - - if (strlen(cups->header.cupsPageSizeName) != 0) { - found = 0; -- for (i = cupsPPD->num_sizes, size = cupsPPD->sizes; -+ for (i = cups->PPD->num_sizes, size = cups->PPD->sizes; - i > 0; - i --, size ++) - if (strcasecmp(cups->header.cupsPageSizeName, size->name) == 0) { -@@ -3036,7 +3168,7 @@ cups_put_params(gx_device *pdev, /* - * Find the matching page size... - */ - -- for (i = cupsPPD->num_sizes, size = cupsPPD->sizes; -+ for (i = cups->PPD->num_sizes, size = cups->PPD->sizes; - i > 0; - i --, size ++) - if (fabs(cups->MediaSize[1] - size->length) < 5.0 && -@@ -3071,6 +3203,8 @@ cups_put_params(gx_device *pdev, /* - - gx_device_set_media_size(pdev, size->width, size->length); - -+ cups->landscape = 0; -+ - margins[0] = size->left / 72.0; - margins[1] = size->bottom / 72.0; - margins[2] = (size->width - size->right) / 72.0; -@@ -3091,7 +3225,7 @@ cups_put_params(gx_device *pdev, /* - * landscape orientation... - */ - -- for (i = cupsPPD->num_sizes, size = cupsPPD->sizes; -+ for (i = cups->PPD->num_sizes, size = cups->PPD->sizes; - i > 0; - i --, size ++) - if (fabs(cups->MediaSize[0] - size->length) < 5.0 && -@@ -3149,8 +3283,10 @@ cups_put_params(gx_device *pdev, /* - - dprintf("DEBUG: size = Custom\n"); - -+ cups->landscape = 0; -+ - for (i = 0; i < 4; i ++) -- margins[i] = cupsPPD->custom_margins[i] / 72.0; -+ margins[i] = cups->PPD->custom_margins[i] / 72.0; - if (xflip == 1) - { - swap = margins[0]; margins[0] = margins[2]; margins[2] = swap; -@@ -3174,50 +3310,6 @@ cups_put_params(gx_device *pdev, /* - } - - /* -- * Set CUPS raster header values... -- */ -- -- cups->header.HWResolution[0] = pdev->HWResolution[0]; -- cups->header.HWResolution[1] = pdev->HWResolution[1]; -- --#ifdef CUPS_RASTER_SYNCv1 -- cups->header.cupsPageSize[0] = pdev->MediaSize[0]; -- cups->header.cupsPageSize[1] = pdev->MediaSize[1]; -- -- cups->header.cupsImagingBBox[0] = pdev->HWMargins[0]; -- cups->header.cupsImagingBBox[1] = pdev->HWMargins[1]; -- cups->header.cupsImagingBBox[2] = pdev->MediaSize[0] - pdev->HWMargins[2]; -- cups->header.cupsImagingBBox[3] = pdev->MediaSize[1] - pdev->HWMargins[3]; -- -- if ((sf = cups->header.cupsBorderlessScalingFactor) < 1.0) -- sf = 1.0; -- -- cups->header.Margins[0] = pdev->HWMargins[0] * sf; -- cups->header.Margins[1] = pdev->HWMargins[1] * sf; -- -- cups->header.PageSize[0] = pdev->MediaSize[0] * sf; -- cups->header.PageSize[1] = pdev->MediaSize[1] * sf; -- -- cups->header.ImagingBoundingBox[0] = pdev->HWMargins[0] * sf; -- cups->header.ImagingBoundingBox[1] = pdev->HWMargins[1] * sf; -- cups->header.ImagingBoundingBox[2] = (pdev->MediaSize[0] - -- pdev->HWMargins[2]) * sf; -- cups->header.ImagingBoundingBox[3] = (pdev->MediaSize[1] - -- pdev->HWMargins[3]) * sf; --#else -- cups->header.Margins[0] = pdev->HWMargins[0]; -- cups->header.Margins[1] = pdev->HWMargins[1]; -- -- cups->header.PageSize[0] = pdev->MediaSize[0]; -- cups->header.PageSize[1] = pdev->MediaSize[1]; -- -- cups->header.ImagingBoundingBox[0] = pdev->HWMargins[0]; -- cups->header.ImagingBoundingBox[1] = pdev->HWMargins[3]; -- cups->header.ImagingBoundingBox[2] = pdev->MediaSize[0] - pdev->HWMargins[2]; -- cups->header.ImagingBoundingBox[3] = pdev->MediaSize[1] - pdev->HWMargins[1]; --#endif /* CUPS_RASTER_SYNCv1 */ -- -- /* - * Reallocate memory if the size or color depth was changed... - */ - -@@ -3228,6 +3320,8 @@ cups_put_params(gx_device *pdev, /* - * does not keep track of the margins in the bitmap size... - */ - -+ width_old = pdev->width; -+ height_old = pdev->height; - if (cups->landscape) - { - width = (pdev->MediaSize[1] - pdev->HWMargins[1] - pdev->HWMargins[3]) * -@@ -3250,37 +3344,33 @@ cups_put_params(gx_device *pdev, /* - height *= cups->header.cupsBorderlessScalingFactor; - } - #endif /* CUPS_RASTER_SYNCv1 */ -- -- colorspace = cups->header.cupsColorSpace; -- bitspercolor = cups->header.cupsBitsPerColor; -+ pdev->width = width; -+ pdev->height = height; - - /* - * Don't reallocate memory unless the device has been opened... - * Also reallocate only if the size has actually changed... - */ - -- if (pdev->is_open && -- (width != width_old || height != height_old || -- colorspace != colorspace_old || bitspercolor != bitspercolor_old)) -+ if (pdev->is_open) - { - -- width_old = width; -- height_old = height; -- colorspace_old = colorspace; -- bitspercolor_old = bitspercolor; -- - /* - * Device is open and size has changed, so reallocate... - */ - -- dprintf6("DEBUG2: Reallocating memory, [%.0f %.0f] = %dx%d pixels, color space: %d, bits per color: %d...\n", -- pdev->MediaSize[0], pdev->MediaSize[1], width, height, -- colorspace, bitspercolor); -+ dprintf4("DEBUG2: Reallocating memory, [%.0f %.0f] = %dx%d pixels...\n", -+ pdev->MediaSize[0], pdev->MediaSize[1], width, height); - - sp = ((gx_device_printer *)pdev)->space_params; - -- if ((code = gdev_prn_reallocate_memory(pdev, &sp, width, height)) < 0) -+ if ((code = gdev_prn_maybe_realloc_memory((gx_device_printer *)pdev, &sp, -+ width_old, height_old, -+ cups->page_uses_transparency)) -+ < 0) - return (code); -+ dprintf4("DEBUG2: Reallocated memory, [%.0f %.0f] = %dx%d pixels...\n", -+ pdev->MediaSize[0], pdev->MediaSize[1], width, height); - } - else - { -@@ -3296,12 +3386,110 @@ cups_put_params(gx_device *pdev, /* - } - } - -- dprintf1("DEBUG2: ppd = %p\n", cupsPPD); -+ /* -+ * Set CUPS raster header values... -+ */ -+ -+ cups->header.HWResolution[0] = pdev->HWResolution[0]; -+ cups->header.HWResolution[1] = pdev->HWResolution[1]; -+ -+#ifdef CUPS_RASTER_SYNCv1 -+ -+ if (cups->landscape) -+ { -+ cups->header.cupsPageSize[0] = pdev->MediaSize[1]; -+ cups->header.cupsPageSize[1] = pdev->MediaSize[0]; -+ -+ cups->header.cupsImagingBBox[0] = pdev->HWMargins[1]; -+ cups->header.cupsImagingBBox[1] = pdev->HWMargins[2]; -+ cups->header.cupsImagingBBox[2] = pdev->MediaSize[1] - pdev->HWMargins[3]; -+ cups->header.cupsImagingBBox[3] = pdev->MediaSize[0] - pdev->HWMargins[0]; -+ -+ if ((sf = cups->header.cupsBorderlessScalingFactor) < 1.0) -+ sf = 1.0; -+ -+ cups->header.Margins[0] = pdev->HWMargins[1] * sf; -+ cups->header.Margins[1] = pdev->HWMargins[2] * sf; -+ -+ cups->header.PageSize[0] = pdev->MediaSize[1] * sf; -+ cups->header.PageSize[1] = pdev->MediaSize[0] * sf; -+ -+ cups->header.ImagingBoundingBox[0] = pdev->HWMargins[1] * sf; -+ cups->header.ImagingBoundingBox[1] = pdev->HWMargins[2] * sf; -+ cups->header.ImagingBoundingBox[2] = (pdev->MediaSize[1] - -+ pdev->HWMargins[3]) * sf; -+ cups->header.ImagingBoundingBox[3] = (pdev->MediaSize[0] - -+ pdev->HWMargins[0]) * sf; -+ } -+ else -+ { -+ cups->header.cupsPageSize[0] = pdev->MediaSize[0]; -+ cups->header.cupsPageSize[1] = pdev->MediaSize[1]; -+ -+ cups->header.cupsImagingBBox[0] = pdev->HWMargins[0]; -+ cups->header.cupsImagingBBox[1] = pdev->HWMargins[1]; -+ cups->header.cupsImagingBBox[2] = pdev->MediaSize[0] - pdev->HWMargins[2]; -+ cups->header.cupsImagingBBox[3] = pdev->MediaSize[1] - pdev->HWMargins[3]; -+ -+ if ((sf = cups->header.cupsBorderlessScalingFactor) < 1.0) -+ sf = 1.0; -+ -+ cups->header.Margins[0] = pdev->HWMargins[0] * sf; -+ cups->header.Margins[1] = pdev->HWMargins[1] * sf; -+ -+ cups->header.PageSize[0] = pdev->MediaSize[0] * sf; -+ cups->header.PageSize[1] = pdev->MediaSize[1] * sf; -+ -+ cups->header.ImagingBoundingBox[0] = pdev->HWMargins[0] * sf; -+ cups->header.ImagingBoundingBox[1] = pdev->HWMargins[1] * sf; -+ cups->header.ImagingBoundingBox[2] = (pdev->MediaSize[0] - -+ pdev->HWMargins[2]) * sf; -+ cups->header.ImagingBoundingBox[3] = (pdev->MediaSize[1] - -+ pdev->HWMargins[3]) * sf; -+ } -+ -+#else -+ -+ if (cups->landscape) -+ { -+ cups->header.Margins[0] = pdev->HWMargins[1]; -+ cups->header.Margins[1] = pdev->HWMargins[2]; -+ -+ cups->header.PageSize[0] = pdev->MediaSize[1]; -+ cups->header.PageSize[1] = pdev->MediaSize[0]; -+ -+ cups->header.ImagingBoundingBox[0] = pdev->HWMargins[1]; -+ cups->header.ImagingBoundingBox[1] = pdev->HWMargins[0]; -+ cups->header.ImagingBoundingBox[2] = pdev->MediaSize[1] - -+ pdev->HWMargins[3]; -+ cups->header.ImagingBoundingBox[3] = pdev->MediaSize[0] - -+ pdev->HWMargins[2]; -+ } -+ else -+ { -+ cups->header.Margins[0] = pdev->HWMargins[0]; -+ cups->header.Margins[1] = pdev->HWMargins[1]; -+ -+ cups->header.PageSize[0] = pdev->MediaSize[0]; -+ cups->header.PageSize[1] = pdev->MediaSize[1]; -+ -+ cups->header.ImagingBoundingBox[0] = pdev->HWMargins[0]; -+ cups->header.ImagingBoundingBox[1] = pdev->HWMargins[3]; -+ cups->header.ImagingBoundingBox[2] = pdev->MediaSize[0] - -+ pdev->HWMargins[2]; -+ cups->header.ImagingBoundingBox[3] = pdev->MediaSize[1] - -+ pdev->HWMargins[1]; -+ } -+ -+#endif /* CUPS_RASTER_SYNCv1 */ -+ cups->header.cupsWidth = cups->width; -+ cups->header.cupsHeight = cups->height; -+ -+ dprintf1("DEBUG2: ppd = %p\n", cups->PPD); - dprintf2("DEBUG2: PageSize = [ %.3f %.3f ]\n", - pdev->MediaSize[0], pdev->MediaSize[1]); -- if (size_set) -- dprintf4("DEBUG2: margins = [ %.3f %.3f %.3f %.3f ]\n", -- margins[0], margins[1], margins[2], margins[3]); -+ dprintf4("DEBUG2: margins = [ %.3f %.3f %.3f %.3f ]\n", -+ margins[0], margins[1], margins[2], margins[3]); - dprintf2("DEBUG2: HWResolution = [ %.3f %.3f ]\n", - pdev->HWResolution[0], pdev->HWResolution[1]); - dprintf2("DEBUG2: width = %d, height = %d\n", -@@ -3579,20 +3767,20 @@ cups_set_color_info(gx_device *pdev) /* - j = ((j & 255) << 8) | ((j >> 8) & 255); - #endif /* !ARCH_IS_BIG_ENDIAN */ - -- cupsEncodeLUT[i] = j; -+ cups->EncodeLUT[i] = j; - - #ifdef DEBUG -- if (i == 0 || cupsEncodeLUT[i] != cupsEncodeLUT[i - 1]) -- dprintf2("DEBUG2: cupsEncodeLUT[%d] = %d\n", i, (int)cupsEncodeLUT[i]); -+ if (i == 0 || cups->EncodeLUT[i] != cups->EncodeLUT[i - 1]) -+ dprintf2("DEBUG2: cups->EncodeLUT[%d] = %d\n", i, (int)cups->EncodeLUT[i]); - #endif /* DEBUG */ - } - -- dprintf1("DEBUG2: cupsEncodeLUT[0] = %d\n", (int)cupsEncodeLUT[0]); -- dprintf2("DEBUG2: cupsEncodeLUT[%d] = %d\n", gx_max_color_value, -- (int)cupsEncodeLUT[gx_max_color_value]); -+ dprintf1("DEBUG2: cups->EncodeLUT[0] = %d\n", (int)cups->EncodeLUT[0]); -+ dprintf2("DEBUG2: cups->EncodeLUT[%d] = %d\n", gx_max_color_value, -+ (int)cups->EncodeLUT[gx_max_color_value]); - - for (i = 0; i < cups->color_info.dither_grays; i ++) -- cupsDecodeLUT[i] = gx_max_color_value * i / max_lut; -+ cups->DecodeLUT[i] = gx_max_color_value * i / max_lut; - - dprintf2("DEBUG: num_components = %d, depth = %d\n", - cups->color_info.num_components, cups->color_info.depth); -@@ -3609,24 +3797,24 @@ cups_set_color_info(gx_device *pdev) /* - * Set the color profile as needed... - */ - -- cupsHaveProfile = 0; -+ cups->HaveProfile = 0; - - #ifdef dev_t_proc_encode_color -- if (cupsProfile) -+ if (cups->Profile) - #else -- if (cupsProfile && cups->header.cupsBitsPerColor == 8) -+ if (cups->Profile && cups->header.cupsBitsPerColor == 8) - #endif /* dev_t_proc_encode_color */ - { -- dprintf1("DEBUG: Using user-defined profile \"%s\"...\n", cupsProfile); -+ dprintf1("DEBUG: Using user-defined profile \"%s\"...\n", cups->Profile); - -- if (sscanf(cupsProfile, "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f", &d, &g, -+ if (sscanf(cups->Profile, "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f", &d, &g, - m[0] + 0, m[0] + 1, m[0] + 2, - m[1] + 0, m[1] + 1, m[1] + 2, - m[2] + 0, m[2] + 1, m[2] + 2) != 11) - dprintf("ERROR: User-defined profile does not contain 11 integers!\n"); - else - { -- cupsHaveProfile = 1; -+ cups->HaveProfile = 1; - - d *= 0.001f; - g *= 0.001f; -@@ -3642,9 +3830,9 @@ cups_set_color_info(gx_device *pdev) /* - } - } - #ifdef dev_t_proc_encode_color -- else if (cupsPPD) -+ else if (cups->PPD) - #else -- else if (cupsPPD && cups->header.cupsBitsPerColor == 8) -+ else if (cups->PPD && cups->header.cupsBitsPerColor == 8) - #endif /* dev_t_proc_encode_color */ - { - /* -@@ -3657,8 +3845,8 @@ cups_set_color_info(gx_device *pdev) /* - else - sprintf(resolution, "%.0fdpi", pdev->HWResolution[0]); - -- for (i = 0, profile = cupsPPD->profiles; -- i < cupsPPD->num_profiles; -+ for (i = 0, profile = cups->PPD->profiles; -+ i < cups->PPD->num_profiles; - i ++, profile ++) - if ((strcmp(profile->resolution, resolution) == 0 || - profile->resolution[0] == '-') && -@@ -3670,11 +3858,11 @@ cups_set_color_info(gx_device *pdev) /* - * If we found a color profile, use it! - */ - -- if (i < cupsPPD->num_profiles) -+ if (i < cups->PPD->num_profiles) - { - dprintf("DEBUG: Using color profile in PPD file!\n"); - -- cupsHaveProfile = 1; -+ cups->HaveProfile = 1; - - d = profile->density; - g = profile->gamma; -@@ -3683,34 +3871,34 @@ cups_set_color_info(gx_device *pdev) /* - } - } - -- if (cupsHaveProfile) -+ if (cups->HaveProfile) - { - for (i = 0; i < 3; i ++) - for (j = 0; j < 3; j ++) - for (k = 0; k <= CUPS_MAX_VALUE; k ++) - { -- cupsMatrix[i][j][k] = (int)((float)k * m[i][j] + 0.5); -+ cups->Matrix[i][j][k] = (int)((float)k * m[i][j] + 0.5); - - if ((k & 4095) == 0) -- dprintf4("DEBUG2: cupsMatrix[%d][%d][%d] = %d\n", -- i, j, k, cupsMatrix[i][j][k]); -+ dprintf4("DEBUG2: cups->Matrix[%d][%d][%d] = %d\n", -+ i, j, k, cups->Matrix[i][j][k]); - } - - - for (k = 0; k <= CUPS_MAX_VALUE; k ++) - { -- cupsDensity[k] = (int)((float)CUPS_MAX_VALUE * d * -+ cups->Density[k] = (int)((float)CUPS_MAX_VALUE * d * - pow((float)k / (float)CUPS_MAX_VALUE, g) + - 0.5); - - if ((k & 4095) == 0) -- dprintf2("DEBUG2: cupsDensity[%d] = %d\n", k, cupsDensity[k]); -+ dprintf2("DEBUG2: cups->Density[%d] = %d\n", k, cups->Density[k]); - } - } - else - { - for (k = 0; k <= CUPS_MAX_VALUE; k ++) -- cupsDensity[k] = k; -+ cups->Density[k] = k; - } - } - -@@ -3732,7 +3920,7 @@ cups_sync_output(gx_device *pdev) /* I - - * 'cups_print_chunked()' - Print a page of chunked pixels. - */ - --static void -+static int - cups_print_chunked(gx_device_printer *pdev, - /* I - Printer device */ - unsigned char *src, -@@ -3754,18 +3942,18 @@ cups_print_chunked(gx_device_printer *pd - dprintf1("DEBUG2: cups->header.Duplex = %d\n", cups->header.Duplex); - dprintf1("DEBUG2: cups->header.Tumble = %d\n", cups->header.Tumble); - dprintf1("DEBUG2: cups->page = %d\n", cups->page); -- dprintf1("DEBUG2: cupsPPD = %p\n", cupsPPD); -+ dprintf1("DEBUG2: cups->PPD = %p\n", cups->PPD); - -- if (cupsPPD) { -- backside = ppdFindAttr(cupsPPD, "cupsBackSide", NULL); -+ if (cups->PPD) { -+ backside = ppdFindAttr(cups->PPD, "cupsBackSide", NULL); - if (backside) { - dprintf1("DEBUG2: cupsBackSide = %s\n", backside->value); -- cupsPPD->flip_duplex = 0; -+ cups->PPD->flip_duplex = 0; - } - } -- if (cups->header.Duplex && cupsPPD && -+ if (cups->header.Duplex && cups->PPD && - ((!cups->header.Tumble && -- (cupsPPD->flip_duplex || -+ (cups->PPD->flip_duplex || - (backside && !strcasecmp(backside->value, "Rotated")))) || - (cups->header.Tumble && - (backside && (!strcasecmp(backside->value, "Flipped") || -@@ -3774,9 +3962,9 @@ cups_print_chunked(gx_device_printer *pd - xflip = 1; - else - xflip = 0; -- if (cups->header.Duplex && cupsPPD && -+ if (cups->header.Duplex && cups->PPD && - ((!cups->header.Tumble && -- (cupsPPD->flip_duplex || -+ (cups->PPD->flip_duplex || - (backside && (!strcasecmp(backside->value, "Flipped") || - !strcasecmp(backside->value, "Rotated"))))) || - (cups->header.Tumble && -@@ -3809,7 +3997,7 @@ cups_print_chunked(gx_device_printer *pd - if (gdev_prn_get_bits((gx_device_printer *)pdev, y, src, &srcptr) < 0) - { - dprintf1("ERROR: Unable to get scanline %d!\n", y); -- gs_exit(gs_lib_ctx_get_non_gc_memory_t(), 1); -+ return_error(gs_error_unknownerror); - } - - if (xflip) -@@ -3832,8 +4020,8 @@ cups_print_chunked(gx_device_printer *pd - count > 0; - count --, srcptr --, dstptr ++) - { -- *dstptr = cupsRevUpper1[*srcptr & 15] | -- cupsRevLower1[*srcptr >> 4]; -+ *dstptr = cups->RevUpper1[*srcptr & 15] | -+ cups->RevLower1[*srcptr >> 4]; - } - break; - -@@ -3842,8 +4030,8 @@ cups_print_chunked(gx_device_printer *pd - count > 0; - count --, srcptr --, dstptr ++) - { -- *dstptr = cupsRevUpper2[*srcptr & 15] | -- cupsRevLower2[*srcptr >> 4]; -+ *dstptr = cups->RevUpper2[*srcptr & 15] | -+ cups->RevLower2[*srcptr >> 4]; - } - break; - -@@ -3941,6 +4129,7 @@ cups_print_chunked(gx_device_printer *pd - cupsRasterWritePixels(cups->stream, srcptr, cups->header.cupsBytesPerLine); - } - } -+ return (0); - } - - -@@ -3948,7 +4137,7 @@ cups_print_chunked(gx_device_printer *pd - * 'cups_print_banded()' - Print a page of banded pixels. - */ - --static void -+static int - cups_print_banded(gx_device_printer *pdev, - /* I - Printer device */ - unsigned char *src, -@@ -3974,18 +4163,18 @@ cups_print_banded(gx_device_printer *pde - dprintf1("DEBUG2: cups->header.Duplex = %d\n", cups->header.Duplex); - dprintf1("DEBUG2: cups->header.Tumble = %d\n", cups->header.Tumble); - dprintf1("DEBUG2: cups->page = %d\n", cups->page); -- dprintf1("DEBUG2: cupsPPD = %p\n", cupsPPD); -+ dprintf1("DEBUG2: cups->PPD = %p\n", cups->PPD); - -- if (cupsPPD) { -- backside = ppdFindAttr(cupsPPD, "cupsBackSide", NULL); -+ if (cups->PPD) { -+ backside = ppdFindAttr(cups->PPD, "cupsBackSide", NULL); - if (backside) { - dprintf1("DEBUG2: cupsBackSide = %s\n", backside->value); -- cupsPPD->flip_duplex = 0; -+ cups->PPD->flip_duplex = 0; - } - } -- if (cups->header.Duplex && cupsPPD && -+ if (cups->header.Duplex && cups->PPD && - ((!cups->header.Tumble && -- (cupsPPD->flip_duplex || -+ (cups->PPD->flip_duplex || - (backside && !strcasecmp(backside->value, "Rotated")))) || - (cups->header.Tumble && - (backside && (!strcasecmp(backside->value, "Flipped") || -@@ -3994,9 +4183,9 @@ cups_print_banded(gx_device_printer *pde - xflip = 1; - else - xflip = 0; -- if (cups->header.Duplex && cupsPPD && -+ if (cups->header.Duplex && cups->PPD && - ((!cups->header.Tumble && -- (cupsPPD->flip_duplex || -+ (cups->PPD->flip_duplex || - (backside && (!strcasecmp(backside->value, "Flipped") || - !strcasecmp(backside->value, "Rotated"))))) || - (cups->header.Tumble && -@@ -4040,7 +4229,7 @@ cups_print_banded(gx_device_printer *pde - if (gdev_prn_get_bits((gx_device_printer *)pdev, y, src, &srcptr) < 0) - { - dprintf1("ERROR: Unable to get scanline %d!\n", y); -- gs_exit(gs_lib_ctx_get_non_gc_memory_t(), 1); -+ return_error(gs_error_unknownerror); - } - - /* -@@ -4646,6 +4835,7 @@ cups_print_banded(gx_device_printer *pde - - cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine); - } -+ return (0); - } - - -@@ -4653,7 +4843,7 @@ cups_print_banded(gx_device_printer *pde - * 'cups_print_planar()' - Print a page of planar pixels. - */ - --static void -+static int - cups_print_planar(gx_device_printer *pdev, - /* I - Printer device */ - unsigned char *src, -@@ -4690,7 +4880,7 @@ cups_print_planar(gx_device_printer *pde - if (gdev_prn_get_bits((gx_device_printer *)pdev, y, src, &srcptr) < 0) - { - dprintf1("ERROR: Unable to get scanline %d!\n", y); -- gs_exit(gs_lib_ctx_get_non_gc_memory_t(), 1); -+ return_error(gs_error_unknownerror); - } - - /* -@@ -5017,9 +5207,10 @@ cups_print_planar(gx_device_printer *pde - - cupsRasterWritePixels(cups->stream, dst, cups->header.cupsBytesPerLine); - } -+ return (0); - } - - - /* -- * End of "$Id: gdevcups.c 10631 2010-01-22 17:46:02Z till $". -+ * End of "$Id$". - */ diff --git a/ghostscript.spec b/ghostscript.spec index f285016..08b1682 100644 --- a/ghostscript.spec +++ b/ghostscript.spec @@ -5,7 +5,7 @@ Summary: A PostScript interpreter and renderer Name: ghostscript Version: %{gs_ver} -Release: 20%{?dist} +Release: 21%{?dist} # Included CMap data is Redistributable, no modification permitted, # see http://bugzilla.redhat.com/487510 @@ -44,7 +44,6 @@ Patch25: ghostscript-bbox-close.patch Patch26: ghostscript-gdevcups-ripcache.patch Patch27: ghostscript-Fontmap.local.patch Patch28: ghostscript-gdevcups-debug-uninit.patch -Patch29: ghostscript-gdevcups-segfaults.patch Requires: urw-fonts >= 1.1, ghostscript-fonts BuildRequires: xz @@ -209,9 +208,6 @@ rm -rf libpng zlib jpeg jasper # gdevcups: don't use uninitialized variables in debugging output. %patch28 -p1 -b .gdevcups-debug-uninit -# Apply some fixes from upstream to avoid gdevcups segfaults (bug #639593). -%patch29 -p1 -b .gdevcups-segfaults - # Convert manual pages to UTF-8 from8859_1() { iconv -f iso-8859-1 -t utf-8 < "$1" > "${1}_" @@ -398,6 +394,11 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/libgs.so %changelog +* Thu Nov 25 2010 Tim Waugh 8.71-21 +- Reverted gdevcups-segfaults patch from bug #639593 as it causes + artifacts in multi-page PDF documents (bug #655403). Even picking + just svn revision 11149 causes this problem. + * Thu Oct 21 2010 Tim Waugh 8.71-20 - Own more directories (bug #645075).