[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1788-gdbdb5f8

[email protected] (Robin Watts) Thu, 31 Oct 2019 18:22:57 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  dbdb5f8527007b482d4e6037b558dbf3e6a06d3a (commit)
      from  f5673b5a50f141440329c62ee5b53eefcd585a3f (commit)

----------------------------------------------------------------------
commit dbdb5f8527007b482d4e6037b558dbf3e6a06d3a
Author: Robin Watts <[email protected]>
Date:   Thu Oct 31 18:21:01 2019 +0000

    Fix spurious rangechecks from cljet5pr device.
    
    The device would rangecheck whenever it was called with a
    param list that didn't contain HWResolution. Now, if it's
    not given an HWResolution, look at the device's current
    value.

diff --git a/devices/gdevclj.c b/devices/gdevclj.c
index a293ec4..1585ffc 100644
--- a/devices/gdevclj.c
+++ b/devices/gdevclj.c
@@ -247,15 +247,24 @@ clj_get_params(gx_device *pdev, gs_param_list *plist)
  * on error.
  */
 static int
-clj_media_size(float mediasize[2], gs_param_list *plist)
+clj_media_size(float mediasize[2], gs_param_list *plist, gx_device *dev)
 {
     gs_param_float_array fres;
     gs_param_float_array fsize;
     gs_param_int_array hwsize;
     int have_pagesize = 0;
+    float res[2];
 
-    if ( param_read_float_array(plist, "HWResolution", &fres) != 0 ||
-          !is_supported_resolution(fres.data) )
+    if ( param_read_float_array(plist, "HWResolution", &fres) == 0) {
+        res[0] = fres.data[0];
+        res[1] = fres.data[1];
+    }
+    else
+    {
+        res[0] = dev->HWResolution[0];
+        res[1] = dev->HWResolution[1];
+    }
+    if (!is_supported_resolution(res) )
         return_error(gs_error_rangecheck);
 
     if ( (param_read_float_array(plist, "PageSize", &fsize) == 0) ||
@@ -286,7 +295,7 @@ clj_put_params(
 {
     float		    mediasize[2];
     bool                    rotate = false;
-    int                     have_pagesize = clj_media_size(mediasize, plist);
+    int                     have_pagesize = clj_media_size(mediasize, plist, pdev);
 
     if (have_pagesize < 0)
         return have_pagesize;
@@ -623,7 +632,7 @@ clj_pr_put_params(
     float		    mediasize[2];
     int                     code = 0;
     bool                    rotate = false;
-    int                     have_pagesize = clj_media_size(mediasize, plist);
+    int                     have_pagesize = clj_media_size(mediasize, plist, pdev);
 
     if (have_pagesize < 0)
         return have_pagesize;


Summary of changes:
 devices/gdevclj.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)