[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#355616: gs-gpl: [PATCH][IJS/hpijs] Add back KRGB colorspace suport to gs IJS driver



Package: gs-gpl
Version: 8.50-1
Severity: wishlist
Tags: patch

Please apply the attached patch, to restore KRGB support to gs-gpl.  This
patch introduces KRGB support v1.2, which does not have the bugs described
in #294430 (which I just closed).

Although I have set priority to wishlist, this is actually a very important
patch to all users of just about every non-ancient HP deskjet devices.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15.5-debian7+bluesmoke+lm85
Locale: LANG=pt_BR.ISO-8859-1, LC_CTYPE=pt_BR.ISO-8859-1 (charmap=ISO-8859-1)

Versions of packages gs-gpl depends on:
ii  gs-common                 0.3.9          Common files for different Ghostsc
ii  libc6                     2.3.6-3        GNU C Library: Shared libraries an
ii  libice6                   6.9.0.dfsg.1-4 Inter-Client Exchange library
ii  libpaper1                 1.1.14-5       Library for handling paper charact
ii  libsm6                    6.9.0.dfsg.1-4 X Window System Session Management
ii  libx11-6                  6.9.0.dfsg.1-4 X Window System protocol client li
ii  libxext6                  6.9.0.dfsg.1-4 X Window System miscellaneous exte
ii  libxt6                    6.9.0.dfsg.1-4 X Toolkit Intrinsics

Versions of packages gs-gpl recommends:
ii  gsfonts               8.14+v8.11+urw-0.2 Fonts for the Ghostscript interpre
ii  psfontmgr             0.11.8-0.1         PostScript font manager -- part of

-- no debconf information

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
diff -ruN gs-gpl-8.50/debian/patches/00list gs-gpl-8.50.krgb12/debian/patches/00list
--- gs-gpl-8.50/debian/patches/00list	2006-03-06 15:44:12.000000000 -0300
+++ gs-gpl-8.50.krgb12/debian/patches/00list	2006-03-06 15:38:40.654909945 -0300
@@ -2,7 +2,7 @@
 02_fontpath_for_debian
 #03_libpaper_support
 05_docdir_fix_for_gs-gpl
-#06_ijs_krgb_support
+06_ijs_krgb_support
 #07_bbox_segv_fix
 #08_epsn_margin_workaround
 #09_brother_7x0_gdi_fix
diff -ruN gs-gpl-8.50/debian/patches/06_ijs_krgb_support.dpatch gs-gpl-8.50.krgb12/debian/patches/06_ijs_krgb_support.dpatch
--- gs-gpl-8.50/debian/patches/06_ijs_krgb_support.dpatch	2006-03-06 15:44:12.000000000 -0300
+++ gs-gpl-8.50.krgb12/debian/patches/06_ijs_krgb_support.dpatch	2006-03-06 15:38:36.410424990 -0300
@@ -1,17 +1,19 @@
 #! /bin/sh -e
-## 06_ijs_krgb_support.dpatch by Masayuki Hatta <mhatta@debian.org>
+## 06_ijs_krgb_support.dpatch by David Suffield <linux.deskjet@hp.com>
 ##
 ## All lines beginning with \`## DP:' are a description of the patch.
 ## DP: Added KRGB colorspace support to gs IJS driver.
+## DP: Patch from HPLIP upstream, distributed in the hpijs package
 
 if [ $# -ne 1 ]; then
     echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
     exit 1
 fi
 case "$1" in
-        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0
+        -patch) patch -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -p1 < $0 || exit 1
+;;
+        -unpatch) patch -R -f --no-backup-if-mismatch --dry-run -p1 < $0 && patch -f --no-backup-if-mismatch -R -p1 < $0 || exit 1
 ;;
-        -unpatch) patch -f --no-backup-if-mismatch -R -p1 < $0;;
         *)
                 echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
                 exit 1;;
@@ -19,36 +21,45 @@
 
 exit 0
 
-diff -urN gs-gpl-8.01.orig/src/gdevijs.c gs-gpl-8.01/src/gdevijs.c
---- gs-gpl-8.01.orig/src/gdevijs.c	2004-08-15 13:13:02.000000000 +0900
-+++ gs-gpl-8.01/src/gdevijs.c	2004-08-15 13:13:20.000000000 +0900
-@@ -27,15 +27,25 @@
+@DPATCH@
+diff -urNad gs-gpl-8.50~/src/gdevijs.c gs-gpl-8.50/src/gdevijs.c
+--- gs-gpl-8.50~/src/gdevijs.c	2004-08-04 16:36:13.000000000 -0300
++++ gs-gpl-8.50/src/gdevijs.c	2006-03-06 15:35:46.571020851 -0300
+@@ -27,6 +27,21 @@
   * which is a security risk, since any program can be run.
   * You should use -dSAFER which sets .LockSafetyParams to true 
   * before opening this device.
 + *
-+ * 11/26/03 David Suffield
++ * 11/26/03 David Suffield (gdevijs-krgb-1.0.patch)
 + * (c) 2003-2004 Copyright Hewlett-Packard Development Company, LP
 + *
 + * 1. Removed hpijs 1.0-1.0.2 workarounds, use hpijs 1.0.3 or higher.
 + * 2. Added krgb support.
 + *
++ * 02/21/05 David Suffield (gdevijs-krgb-1.1.patch)
++ * 1. Fixed segfault issue with 1-bit color space.
++ * 2. Fixed z-order issue with colored text on black rectangle.
++ *
++ * 02/22/06 David Suffield (gdevijs-krgb-1.2.patch)
++ * 1. Fixed krgb buffer overflow issue with out-of-band data in
++ *    fill_rectangle and copy_mono.  This buffer overflow condition 
++ *    occurred with fullbleed print jobs that had k-band images.
   */
  
  #include "unistd_.h"	/* for dup() */
- #include <stdlib.h>
-+#include <fcntl.h>
- #include "gdevprn.h"
- #include "gp.h"
+@@ -36,6 +51,11 @@
  #include "ijs.h"
  #include "ijs_client.h"
  
 +//#define KRGB_DEBUG
++#ifdef KRGB_DEBUG
++#include <fcntl.h>
++#endif
 +
  /* 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,
-@@ -51,6 +61,14 @@
+@@ -51,6 +71,14 @@
  private dev_proc_get_params(gsijs_get_params);
  private dev_proc_put_params(gsijs_put_params);
  
@@ -63,7 +74,7 @@
  private const gx_device_procs gsijs_procs =
  prn_color_params_procs(gsijs_open, gsijs_output_page, gsijs_close,
  		   gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb,
-@@ -83,6 +101,14 @@
+@@ -83,6 +111,14 @@
  
      IjsClientCtx *ctx;
      int ijs_version;
@@ -78,7 +89,7 @@
  };
  
  #define DEFAULT_DPI 74   /* See gsijs_set_resolution() below. */
-@@ -110,7 +136,12 @@
+@@ -110,7 +146,12 @@
      FALSE,	/* Tumble_set */
  
      NULL,	/* IjsClient *ctx */
@@ -92,13 +103,17 @@
  };
  
  
-@@ -126,12 +157,234 @@
+@@ -126,12 +167,355 @@
  
  /**************************************************************************/
  
 -/* ------ Private definitions ------ */
 +/* ---------------- Low-level graphic procedures ---------------- */
-+
+ 
+-/* Versions 1.0 through 1.0.2 of hpijs report IJS version 0.29, and
+-   require some workarounds. When more up-to-date hpijs versions
+-   become ubiquitous, all these workarounds should be removed. */
+-#define HPIJS_1_0_VERSION 29
 +static unsigned char xmask[] =
 +{
 +   0x80,    /* x=0 */
@@ -119,24 +134,62 @@
 +   if (ijsdev->krgb_mode && ijsdev->k_path && y >= 0 && x >= 0) 
 +   {
 +      int raster = (ijsdev->k_width+7) >> 3;
-+      register unsigned char *dest=ijsdev->k_band+(raster*y)+(x >> 3);
-+      int dest_start_bit = x & 7;
-+      int i,j,w1;
++      register unsigned char *dest;
++      int dest_start_bit;
++      int band_height = ijsdev->k_band_size/raster;
++      int i,j,x1,y1,w1,h1;
 +
 +      if (h <= 0 || w <= 0)
 +         return 0;
 +
-+      if ((x+w) > ijsdev->k_width)
-+         w1 = ijsdev->k_width - x; 
++      /* Check for out-of-band graphic. */
++      if (x >= ijsdev->k_width || y >= band_height)
++         return 0;  /* out-of-band */
++
++      /* Check for x clipping. */
++      if (x < 0)
++      {
++         x1 = 0;
++         w1 = w + x;
++      }
++      else if ((x+w) > ijsdev->k_width)
++      {
++         x1 = x;
++         w1 = ijsdev->k_width - x;
++      }
 +      else
++      { 
++         x1 = x;
 +         w1 = w;
++      }
++
++      dest_start_bit = x1 & 7;
++
++      /* Check for y clipping. */
++      if (y < 0)
++      {
++         y1 = 0;
++         h1 = h + y;
++      }
++      else if ((y+h) > band_height)
++      {
++         y1 = y;
++         h1 = band_height - y;
++      }
++      else 
++      {
++         y1 = y;
++         h1 = h;
++      }
++
++      dest=ijsdev->k_band+(raster*y1)+(x1 >> 3);
 +
 +      /* Note x,y orgin 0,0 is stored first byte 0 left to right. */
 +
 +      if (color==0x0)
 +      { 
 +         /* Color is black, store in k plane band instead of regular band. */
-+         for (j=0; j<h; j++)
++         for (j=0; j<h1; j++)
 +         {
 +            for (i=0; i<w1; i++)
 +               dest[(dest_start_bit+i)>>3] |= xmask[(dest_start_bit+i)&7];
@@ -146,8 +199,9 @@
 +      }
 +      else
 +      {
-+         /* Color is not black, remove any k plane bits for z-order dependencies, store in regular band. */
-+         for (j=0; j<h; j++)
++         /* Color is not black, remove any k plane bits
++	  * for z-order dependencies, store in regular band. */
++         for (j=0; j<h1; j++)
 +         {
 +            for (i=0; i<w1; i++)
 +               dest[(dest_start_bit+i)>>3] &= ~xmask[(dest_start_bit+i)&7];
@@ -161,37 +215,106 @@
 +
 +private int gsijs_copy_mono(gx_device * dev, const byte * data,
 +      int dx, int draster, gx_bitmap_id id,
-+      int x, int y, int w, int h, gx_color_index zero, gx_color_index one)
++      int x, int y, int w, int height, gx_color_index zero, gx_color_index one)
 +{
 +   gx_device_ijs *ijsdev = (gx_device_ijs *)((gx_device_forward *)dev)->target;
 +
-+   if (ijsdev->krgb_mode && ijsdev->k_path && one==0x0) 
++   //   if (ijsdev->krgb_mode && ijsdev->k_path && one==0x0) 
++   if (ijsdev->krgb_mode && ijsdev->k_path) 
 +   {
 +      /* Store in k plane band instead of regular band. */
-+      int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes, byte aligned */
-+      register unsigned char *dest=ijsdev->k_band+(raster*y)+(x >> 3);
-+      register const unsigned char *scan=data+(dx >> 3);
-+      int dest_start_bit = x & 7;
-+      int scan_start_bit = dx & 7;
-+      int i;
++      int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes,
++						      byte aligned */
++      register unsigned char *dest;
++      register const unsigned char *scan;
++      int dest_start_bit;
++      int scan_start_bit;
++      int band_height = ijsdev->k_band_size/raster;
++      int i,x1,y1,w1,h1,h=height;
 +      
 +      if (h <= 0 || w <= 0)
 +         return 0;
 +
-+      while (h-- > 0)
++      /* Check for out-of-band graphic. */
++      if (x >= ijsdev->k_width || y >= band_height)
++         return 0;  /* out-of-band */
++
++      /* Check for x clipping. */
++      if (x < 0)
++      {
++         x1 = 0;
++         w1 = w + x;
++         /* adj dx here?? */
++      }
++      else if ((x+w) > ijsdev->k_width)
++      {
++         x1 = x;
++         w1 = ijsdev->k_width - x;
++      }
++      else
++      { 
++         x1 = x;
++         w1 = w;
++      }
++
++      scan=data+(dx >> 3);
++      dest_start_bit = x1 & 7;
++      scan_start_bit = dx & 7;
++
++      /* Check for y clipping. */
++      if (y < 0)
++      {
++         y1 = 0;
++         h1 = h + y;
++         scan+=draster*(h-h1);
++      }
++      else if ((y+h) > band_height)
++      {
++         y1 = y;
++         h1 = band_height - y;
++      }
++      else 
++      {
++         y1 = y;
++         h1 = h;
++      }
++
++      dest=ijsdev->k_band+(raster*y1)+(x1 >> 3);
++
++      if (one==0x0)
 +      {
-+         for (i=0; i<w; i++)
++         /* Color is black, store in k plane band instead of regular band. */
++         while (h1-- > 0)
 +         {
-+            if (scan[(scan_start_bit+i)>>3] & xmask[(scan_start_bit+i)&7])
-+               dest[(dest_start_bit+i)>>3] |= xmask[(dest_start_bit+i)&7];
++            for (i=0; i<w1; i++)
++            {
++               if (scan[(scan_start_bit+i)>>3] & xmask[(scan_start_bit+i)&7])
++                  dest[(dest_start_bit+i)>>3] |= xmask[(dest_start_bit+i)&7];
++            }
++            scan+=draster;
++            dest+=raster;
 +         }
-+         scan+=draster;
-+         dest+=raster;
++         return 0;
 +      }
-+      return 0;   
++      else
++      {
++         /* Color is not black, remove any k plane bits for
++	  * z-order dependencies, store in regular band. */
++         while (h1-- > 0)
++         {
++            for (i=0; i<w1; i++)
++            {
++               if (scan[(scan_start_bit+i)>>3] & xmask[(scan_start_bit+i)&7])
++                  dest[(dest_start_bit+i)>>3] &= ~xmask[(dest_start_bit+i)&7];
++            }
++            scan+=draster;
++            dest+=raster;
++         }
++      }   
 +   }
 +
-+   return (*ijsdev->prn_procs.copy_mono)(dev, data, dx, draster, id, x, y, w, h, zero, one);
++   return (*ijsdev->prn_procs.copy_mono)(dev, data, dx, draster, id,
++		   x, y, w, height, zero, one);
 +}
 +
 +/* ---------------- High-level graphic procedures ---------------- */
@@ -207,7 +330,8 @@
 +
 +   ijsdev->k_path = 1;
 +
-+   code = (*ijsdev->prn_procs.fill_mask)(dev, data, dx, raster, id, x, y, w, h, pdcolor, depth, lop, pcpath);
++   code = (*ijsdev->prn_procs.fill_mask)(dev, data, dx, raster, id,
++		   x, y, w, h, pdcolor, depth, lop, pcpath);
 +
 +   ijsdev->k_path = 0;
 +
@@ -224,7 +348,8 @@
 +
 +   ijsdev->k_path = 1;
 +
-+   code = (*ijsdev->prn_procs.fill_path)(dev, pis, ppath, params, pdcolor, pcpath);
++   code = (*ijsdev->prn_procs.fill_path)(dev, pis, ppath, params,
++		   pdcolor, pcpath);
 +
 +   ijsdev->k_path = 0;
 +
@@ -240,12 +365,9 @@
 +   int code;
 +
 +   ijsdev->k_path = 1;
- 
--/* Versions 1.0 through 1.0.2 of hpijs report IJS version 0.29, and
--   require some workarounds. When more up-to-date hpijs versions
--   become ubiquitous, all these workarounds should be removed. */
--#define HPIJS_1_0_VERSION 29
-+   code = (*ijsdev->prn_procs.stroke_path)(dev, pis, ppath, params, pdcolor, pcpath);
++
++   code = (*ijsdev->prn_procs.stroke_path)(dev, pis, ppath, params,
++		   pdcolor, pcpath);
 +
 +   ijsdev->k_path = 0;
 +
@@ -260,25 +382,30 @@
 +   gx_device_clist_common *cdev = (gx_device_clist_common *)pdev;
 +   int band_height = cdev->page_info.band_params.BandHeight;
 +   int band_number = y/band_height;
-+   int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes, byte aligned */
++   int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes,
++						   byte aligned */
 +   int y1=raster*(y-(band_height*band_number));
 + 
 +   if (y1 == 0)
 +   {
-+      /* First raster for band, clear k_band. Banding playback occurs on first raster. */
++      /* First raster for band, clear k_band.
++       * Banding playback occurs on first raster. */
 +      memset(ijsdev->k_band, 0, ijsdev->k_band_size); 
 +   }
 +
-+   return gdev_prn_get_bits(pdev, y, str, actual_data);  /* get raster from regular band */
++   return gdev_prn_get_bits(pdev, y, str, actual_data);  /* get raster from
++							    regular band */
 +}
 +
-+private int gsijs_k_get_bits(gx_device_printer * pdev, int y, byte ** actual_data)
++private int gsijs_k_get_bits(gx_device_printer * pdev, int y,
++		byte ** actual_data)
 +{
 +   gx_device_ijs *ijsdev = (gx_device_ijs *)pdev;
 +   gx_device_clist_common *cdev = (gx_device_clist_common *)pdev;
 +   int band_height = cdev->page_info.band_params.BandHeight;
 +   int band_number = y/band_height;
-+   int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes, byte aligned */
++   int raster = (ijsdev->k_width+7) >> 3;       /* raster width in bytes,
++						   byte aligned */
 +   int y1=raster*(y-(band_height*band_number));
 + 
 +   *actual_data = ijsdev->k_band+y1;
@@ -287,14 +414,18 @@
 +}
 +
 +private int gsijs_create_buf_device(gx_device **pbdev, gx_device *target,
-+            const gx_render_plane_t *render_plane, gs_memory_t *mem, bool for_band)
++            const gx_render_plane_t *render_plane, gs_memory_t *mem,
++	    bool for_band)
 +{
 +   gx_device_ijs *ijsdev = (gx_device_ijs *)target;
-+   int code = gx_default_create_buf_device(pbdev, target, render_plane, mem, for_band);
-+   if (code < 0)
++   int n_chan = ijsdev->color_info.num_components;
++   int code = gx_default_create_buf_device(pbdev, target, render_plane,
++		   mem, for_band);
++   if (code < 0 || n_chan != 3)
 +      return code;
 +
-+   /* Save buffer (vector) procedures so that we can hook them during banding playback. */
++   /* Save buffer (vector) procedures so that
++    * we can hook them during banding playback. */
 +   ijsdev->prn_procs = (*pbdev)->procs;
 +
 +   /* Replace buffer procedures with krgb procedures. */
@@ -319,7 +450,8 @@
 +        return 0;    /* no krgb support, not RGB colorspace */
 +
 +    buf[0] = 0;
-+    code = ijs_client_enum_param(ijsdev->ctx, 0, "ColorSpace", buf, sizeof(buf)-1);
++    code = ijs_client_enum_param(ijsdev->ctx, 0, "ColorSpace",
++		    buf, sizeof(buf)-1);
 +    if (code >= 0)
 +        buf[code] = 0;
 +    if (strstr(buf, "KRGB") == NULL)
@@ -332,7 +464,7 @@
  
  private int
  gsijs_parse_wxh (const char *val, int size, double *pw, double *ph)
-@@ -169,34 +422,6 @@
+@@ -169,34 +553,6 @@
  }
  
  /**
@@ -367,7 +499,7 @@
   * gsijs_set_generic_params: Set generic IJS parameters.
   **/
  private int
-@@ -207,9 +432,6 @@
+@@ -207,9 +563,6 @@
      int i, j;
      char *value;
  
@@ -377,7 +509,7 @@
      /* Split IjsParams into separate parameters and send to ijs server */
      value = NULL;
      for (i=0, j=0; (j < ijsdev->IjsParams_size) && (i < sizeof(buf)-1); j++) {
-@@ -250,68 +472,6 @@
+@@ -250,68 +603,6 @@
  }
  
  /**
@@ -446,7 +578,7 @@
   * gsijs_set_margin_params: Do margin negotiation with IJS server.
   **/
  private int
-@@ -322,9 +482,6 @@
+@@ -322,9 +613,6 @@
      int i, j;
      char *value;
  
@@ -456,7 +588,7 @@
      /* Split IjsParams into separate parameters and send to ijs server */
      value = NULL;
      for (i=0, j=0; (j < ijsdev->IjsParams_size) && (i < sizeof(buf)-1); j++) {
-@@ -491,12 +648,18 @@
+@@ -491,12 +779,19 @@
      char buf[256];
      bool use_outputfd;
      int fd = -1;
@@ -469,13 +601,14 @@
  
 +    ijsdev->space_params.MaxBitmap = 0;	/* force banding */
 +
-+    /* Set create_buf_device in printer device, so that we can hook the banding playback procedures. */
++    /* Set create_buf_device in printer device,
++     * so that we can hook the banding playback procedures. */
 +    ijsdev->printer_procs.buf_procs.create_buf_device = gsijs_create_buf_device;
 +
      /* Decide whether to use OutputFile or OutputFD. Note: how to
         determine this is a tricky question, so we just allow the
         user to set it.
-@@ -511,6 +674,8 @@
+@@ -511,6 +806,8 @@
      if (code < 0)
  	return code;
  
@@ -484,7 +617,7 @@
      if (use_outputfd) {
  	/* Note: dup() may not be portable to all interesting IJS
  	   platforms. In that case, this branch should be #ifdef'ed out.
-@@ -570,6 +735,9 @@
+@@ -570,6 +867,9 @@
      if (code >= 0)
  	code = gsijs_set_margin_params(ijsdev);
  
@@ -494,7 +627,7 @@
      return code;
  }
  
-@@ -629,21 +797,6 @@
+@@ -629,21 +929,6 @@
      return min(width, end);
  }
  
@@ -516,7 +649,7 @@
  /* Print a page.  Don't use normal printer gdev_prn_output_page 
   * because it opens the output file.
   */
-@@ -654,8 +807,9 @@
+@@ -654,8 +939,9 @@
      gx_device_printer *pdev = (gx_device_printer *)dev;
      int raster = gdev_prn_raster(pdev);
      int ijs_width, ijs_height;
@@ -527,15 +660,16 @@
      unsigned char *data;
      char buf[256];
      double xres = pdev->HWResolution[0];
-@@ -671,13 +825,23 @@
+@@ -671,13 +957,24 @@
  
      /* Determine bitmap width and height */
      ijs_height = gdev_prn_print_scan_lines(dev);
 -    if (ijsdev->ijs_version == HPIJS_1_0_VERSION) {
 -	ijs_width = pdev->width;
 -    } else {
- 	ijs_width = gsijs_raster_width(dev);
+-	ijs_width = gsijs_raster_width(dev);
 -    }
++    ijs_width = gsijs_raster_width(dev);
 +
      row_bytes = (ijs_width * pdev->color_info.depth + 7) >> 3;
  
@@ -548,14 +682,15 @@
 +        /* Create banding buffer for k plane. */
 +        ijsdev->k_width = ijs_width;
 +        ijsdev->k_band_size = band_height * k_row_bytes;   
-+        if ((ijsdev->k_band = gs_malloc(ijsdev->k_band_size, 1, "gsijs_output_page")) == (unsigned char *)NULL)
++        if ((ijsdev->k_band = gs_malloc(pdev->memory, ijsdev->k_band_size,
++			1, "gsijs_output_page")) == (unsigned char *)NULL)
 +           return gs_note_error(gs_error_VMerror);
 +    }
 +
      /* Required page parameters */
      sprintf(buf, "%d", n_chan);
      gsijs_client_set_param(ijsdev, "NumChan", buf);
-@@ -686,44 +850,71 @@
+@@ -686,44 +983,76 @@
  
      /* This needs to become more sophisticated for DeviceN. */
      strcpy(buf, (n_chan == 4) ? "DeviceCMYK" : 
@@ -584,9 +719,11 @@
 +    char sz[128];
 +    kfd = open("/tmp/k.pbm", O_CREAT | O_TRUNC | O_RDWR, 0644);
 +    rgbfd = open("/tmp/rgb.ppm", O_CREAT | O_TRUNC | O_RDWR, 0644);
-+    snprintf(sz, sizeof(sz), "P4\n#gdevijs test\n%d\n%d\n", ijs_width, ijs_height);
++    snprintf(sz, sizeof(sz), "P4\n#gdevijs test\n%d\n%d\n",
++		    ijs_width, ijs_height);
 +    write(kfd, sz, strlen(sz));
-+    snprintf(sz, sizeof(sz), "P6\n#gdevijs test\n%d\n%d\n255\n", ijs_width, ijs_height);
++    snprintf(sz, sizeof(sz), "P6\n#gdevijs test\n%d\n%d\n255\n",
++		    ijs_width, ijs_height);
 +    write(rgbfd, sz, strlen(sz));
 +#endif
 +
@@ -608,7 +745,8 @@
 +#ifdef KRGB_DEBUG
 +            write(rgbfd, actual_data, row_bytes);
 +#endif
-+            status = ijs_client_send_data_wait(ijsdev->ctx, 0, (char *)actual_data, row_bytes);
++            status = ijs_client_send_data_wait(ijsdev->ctx, 0,
++			    (char *)actual_data, row_bytes);
 +            if (status)
 +                break;
  
@@ -627,7 +765,8 @@
 +#ifdef KRGB_DEBUG
 +                write(kfd, actual_data, k_row_bytes);
 +#endif
-+                status = ijs_client_send_data_wait(ijsdev->ctx, 0, (char *)actual_data, k_row_bytes);
++                status = ijs_client_send_data_wait(ijsdev->ctx, 0,
++				(char *)actual_data, k_row_bytes);
 +                if (status)
 +                    break;
 +	    }
@@ -642,12 +781,13 @@
 +#endif
 +
 +    if(krgb_mode)
-+        gs_free(ijsdev->k_band, ijsdev->k_band_size, 1, "gsijs_output_page");
++        gs_free(pdev->memory, ijsdev->k_band, ijsdev->k_band_size,
++			1, "gsijs_output_page");
 +
      gs_free_object(pdev->memory, data, "gsijs_output_page");
  
      endcode = (pdev->buffer_space && !pdev->is_async_renderer ?
-@@ -1027,7 +1218,6 @@
+@@ -1027,7 +1356,6 @@
  	dprintf2("ijs: Can't set parameter %s=%s\n", key, value);
      return code;
  }

Reply to: