[ghostscript] Replaced width-and-height patch with the one actually used upstream.

Tim Waugh twaugh at fedoraproject.org
Mon Jan 10 17:02:31 UTC 2011


commit 8f7093b3259a165e06a5a5cdd2f25e405ea979b2
Author: Tim Waugh <twaugh at redhat.com>
Date:   Mon Jan 10 16:54:20 2011 +0000

    Replaced width-and-height patch with the one actually used upstream.

 ghostscript-gdevcups-691733.patch |  106 +++++++++++++++++++++++++++++++++++++
 ghostscript-width-height.patch    |   12 ----
 ghostscript.spec                  |   18 ++++---
 3 files changed, 116 insertions(+), 20 deletions(-)
---
diff --git a/ghostscript-gdevcups-691733.patch b/ghostscript-gdevcups-691733.patch
new file mode 100644
index 0000000..9537ad6
--- /dev/null
+++ b/ghostscript-gdevcups-691733.patch
@@ -0,0 +1,106 @@
+diff -up ghostscript-9.00/cups/gdevcups.c.gdevcups-691733 ghostscript-9.00/cups/gdevcups.c
+--- ghostscript-9.00/cups/gdevcups.c.gdevcups-691733	2011-01-10 16:48:57.381703112 +0000
++++ ghostscript-9.00/cups/gdevcups.c	2011-01-10 16:52:02.021813786 +0000
+@@ -2898,11 +2898,12 @@ cups_put_params(gx_device     *pdev,	/* 
+   int			margins_set;	/* Were the margins set? */
+   int			size_set;	/* Was the size set? */
+   int			color_set;	/* Were the color attrs set? */
+-  gdev_prn_space_params	sp;		/* Space parameter data */
++  gdev_prn_space_params	sp_old;	        /* Space parameter data */
+   int			width,		/* New width of page */
+                         height,		/* New height of page */
+                         width_old = 0,  /* Previous width of page */
+                         height_old = 0; /* Previous height of page */
++  bool                  transp_old = 0; /* Previous transparency usage state */
+   ppd_attr_t            *backside = NULL,
+                         *backsiderequiresflippedmargins = NULL;
+   float                 swap;
+@@ -2996,11 +2997,23 @@ cups_put_params(gx_device     *pdev,	/* 
+     } \
+   }
+ 
++  sp_old = ((gx_device_printer *)pdev)->space_params;
++  width_old = pdev->width;
++  height_old = pdev->height;
++  transp_old = cups->page_uses_transparency;
+   size_set    = param_read_float_array(plist, ".MediaSize", &arrayval) == 0 ||
+                 param_read_float_array(plist, "PageSize", &arrayval) == 0;
+   margins_set = param_read_float_array(plist, "Margins", &arrayval) == 0;
+   color_set   = param_read_int(plist, "cupsColorSpace", &intval) == 0 ||
+                 param_read_int(plist, "cupsBitsPerColor", &intval) == 0;
++  /* We set the old dimensions to 1 if we have a color depth change, so
++     that memory reallocation gets forced. This is perhaps not the correct
++     approach to prevent crashes like in bug 690435. We keep it for the
++     time being until we decide finally */
++  if (color_set) {
++    width_old = 1;
++    height_old = 1;
++  }
+   /* 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 be flipped on the back sides of
+@@ -3081,9 +3094,9 @@ cups_put_params(gx_device     *pdev,	/* 
+   stringoption(cupsPageSizeName, "cupsPageSizeName");
+ #endif /* CUPS_RASTER_SYNCv1 */
+ 
+-  if ((code = param_read_string(plist, "cups->Profile", &stringval)) < 0)
++  if ((code = param_read_string(plist, "cupsProfile", &stringval)) < 0)
+   {
+-    param_signal_error(plist, "cups->Profile", code);
++    param_signal_error(plist, "cupsProfile", code);
+     return (code);
+   }
+   else if (code == 0)
+@@ -3096,7 +3109,7 @@ cups_put_params(gx_device     *pdev,	/* 
+ 
+   cups_set_color_info(pdev);
+ 
+- /*
++  /*
+   * Then process standard page device options...
+   */
+ 
+@@ -3404,17 +3417,6 @@ cups_put_params(gx_device     *pdev,	/* 
+     * does not keep track of the margins in the bitmap size...
+     */
+ 
+-    /* We set the old dimensions to -1 if we have a color depth change, so
+-       that memory reallocation gets forced. This is perhaps not the correct
+-       approach to preven crashes like in bug 690435. We keep it for the
+-       time being until we decide finally */
+-    if (color_set) {
+-      width_old = -1;
+-      height_old = -1;
+-    } else {
+-      width_old = pdev->width;
+-      height_old = pdev->height;
+-    }
+     if (cups->landscape)
+     {
+       width  = (pdev->MediaSize[1] - pdev->HWMargins[1] - pdev->HWMargins[3]) *
+@@ -3457,11 +3459,10 @@ cups_put_params(gx_device     *pdev,	/* 
+ 	       pdev->MediaSize[0], pdev->MediaSize[1], width, height);
+ #endif /* DEBUG */
+ 
+-      sp = ((gx_device_printer *)pdev)->space_params;
+-
+-      if ((code = gdev_prn_maybe_realloc_memory((gx_device_printer *)pdev, &sp, 
++      if ((code = gdev_prn_maybe_realloc_memory((gx_device_printer *)pdev,
++                                                &sp_old, 
+ 						width_old, height_old,
+-						cups->page_uses_transparency))
++						transp_old))
+ 	  < 0)
+ 	return (code);
+ #ifdef DEBUG
+@@ -3642,6 +3643,10 @@ cups_set_color_info(gx_device *pdev)	/* 
+         cups->header.cupsBitsPerPixel   = cups->header.cupsBitsPerColor;
+         cups->color_info.depth          = cups->header.cupsBitsPerPixel;
+         cups->color_info.num_components = 1;
++        cups->color_info.dither_grays = 1L << cups->header.cupsBitsPerColor;
++        cups->color_info.dither_colors = 1L << cups->header.cupsBitsPerColor;
++        cups->color_info.max_gray = cups->color_info.dither_grays - 1;
++        cups->color_info.max_color = cups->color_info.dither_grays - 1;
+         break;
+ 
+     case CUPS_CSPACE_CMY :
diff --git a/ghostscript.spec b/ghostscript.spec
index 011ae60..43d093b 100644
--- a/ghostscript.spec
+++ b/ghostscript.spec
@@ -5,7 +5,7 @@ Summary: A PostScript interpreter and renderer
 Name: ghostscript
 Version: %{gs_ver}
 
-Release: 8%{?dist}
+Release: 9%{?dist}
 
 # Included CMap data is Redistributable, no modification permitted,
 # see http://bugzilla.redhat.com/487510
@@ -29,8 +29,8 @@ Patch21: ghostscript-jbig2-image-refcount.patch
 Patch27: ghostscript-Fontmap.local.patch
 Patch28: ghostscript-iccprofiles-initdir.patch
 Patch29: ghostscript-gdevcups-debug-uninit.patch
-Patch30: ghostscript-width-height.patch
-Patch31: ghostscript-icc-fix.patch
+Patch30: ghostscript-icc-fix.patch
+Patch31: ghostscript-gdevcups-691733.patch
 
 Requires: urw-fonts >= 1.1, ghostscript-fonts
 BuildRequires: xz
@@ -147,12 +147,11 @@ rm -rf libpng zlib jpeg jasper
 # gdevcups: don't use uninitialized variables in debugging output.
 %patch29 -p1 -b .gdevcups-debug-uninit
 
-# gdevcups: use correct width and height values when allocating memory
-# (upstream bug 691733).
-%patch30 -p1 -b .width-height
-
 # Applied upstream ICC fix (bug #655449).
-%patch31 -p1 -b .icc-fix
+%patch30 -p1 -b .icc-fix
+
+# Applied fix for upstream bug #691733.
+%patch31 -p1 -b .gdevcups-691733
 
 # Convert manual pages to UTF-8
 from8859_1() {
@@ -341,6 +340,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libgs.so
 
 %changelog
+* Mon Jan 10 2011 Tim Waugh <twaugh at redhat.com> 9.00-9
+- Replaced width-and-height patch with the one actually used upstream.
+
 * Fri Jan  7 2011 Tim Waugh <twaugh at redhat.com> 9.00-8
 - Applied upstream ICC fix (bug #655449).
 - gdevcups: use correct width and height values when allocating memory


More information about the scm-commits mailing list