[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1785-g255eef0

[email protected] (Robin Watts) Thu, 31 Oct 2019 17:04:59 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  255eef0a7d9d24962ebbcbb4b1858e44b803f16b (commit)
       via  351a2251b4a80fa31ac15229036318b01d124532 (commit)
      from  f54414c8b15b2c27d1dcadd92cfe84f6d15f18dc (commit)

----------------------------------------------------------------------
commit 255eef0a7d9d24962ebbcbb4b1858e44b803f16b
Author: Robin Watts <[email protected]>
Date:   Thu Oct 31 16:22:01 2019 +0000

    mgr4 device: clear any unused trailing bits for each line.
    
    This avoids valgrind errors and varying md5sums in the alldevs
    cluster test.

diff --git a/devices/gdevmgr.c b/devices/gdevmgr.c
index 6f1f8d5..07761da 100644
--- a/devices/gdevmgr.c
+++ b/devices/gdevmgr.c
@@ -154,18 +154,25 @@ static int
 mgr_print_page(gx_device_printer *pdev, gp_file *pstream)
 {	mgr_cursor cur;
         int mgr_wide;
+        int mask = 0xff;
         int code = mgr_begin_page(bdev, pstream, &cur);
         if ( code < 0 ) return code;
 
         mgr_wide = bdev->width;
         if (mgr_wide & 7)
+        {
+           mask <<= (mgr_wide&7);
            mgr_wide += 8 - (mgr_wide & 7);
+        }
 
+        mgr_wide >>= 3;
         while ( !(code = mgr_next_row(&cur)) )
-           {	if ( gp_fwrite(cur.data, sizeof(char), mgr_wide / 8, pstream) <
-                    mgr_wide / 8)
+        {
+            cur.data[mgr_wide-1] &= mask;
+            if ( gp_fwrite(cur.data, sizeof(char), mgr_wide, pstream) <
+                    mgr_wide)
                 return_error(gs_error_ioerror);
-           }
+        }
         return (code < 0 ? code : 0);
 }
 
@@ -284,6 +291,7 @@ cmgrN_print_page(gx_device_printer *pdev, gp_file *pstream)
         ushort prgb[3];
         unsigned char table[256], backtable[256];
         gx_device_mgr *mgr = (gx_device_mgr *)pdev;
+	int mask = 0xff;
 
         int code = mgr_begin_page(bdev, pstream, &cur);
         if ( code < 0 ) return code;
@@ -292,7 +300,10 @@ cmgrN_print_page(gx_device_printer *pdev, gp_file *pstream)
 
         mgr_wide = bdev->width;
         if (bdev->mgr_depth == 4 && mgr_wide & 1)
+	{
             mgr_wide++;
+	    mask = 0;
+	}
         mgr_line_size = mgr_wide / (8 / bdev->mgr_depth);
         data = (byte *)gs_malloc(pdev->memory, mgr_line_size, 1, "cmgrN_print_page");
 
@@ -320,6 +331,7 @@ cmgrN_print_page(gx_device_printer *pdev, gp_file *pstream)
                                         *dp =  *(bp++) << 4;
                                     *(dp++) |= *(bp++) & 0x0f;
                                 }
+				dp[-1] &= mask;
                                 if ( gp_fwrite(data, sizeof(byte), mgr_line_size, pstream) < mgr_line_size )
                                         return_error(gs_error_ioerror);
                                 break;

----------------------------------------------------------------------
commit 351a2251b4a80fa31ac15229036318b01d124532
Author: Robin Watts <[email protected]>
Date:   Thu Oct 31 16:21:06 2019 +0000

    Squash warning caused by previous fix.
    
    Include the correct header for 'free' before using it.

diff --git a/contrib/eplaser/gdevescv.c b/contrib/eplaser/gdevescv.c
index 7044eb7..3f1ffa2 100644
--- a/contrib/eplaser/gdevescv.c
+++ b/contrib/eplaser/gdevescv.c
@@ -33,7 +33,7 @@
 
  */
 
-#include <string.h>
+#include <stdlib.h>		/* for abs() and free */
 
 /* Get this definition in before we read memento.h */
 static void
@@ -44,6 +44,7 @@ unvectored_free(void *x)
 
 #if ( 6 > GS_VERSION_MAJOR )
 
+#include <string.h>
 #include <sys/utsname.h>	/* for uname(2) */
 #include <ctype.h>		/* for toupper(3) */
 
@@ -67,7 +68,6 @@ unvectored_free(void *x)
 #else /* 6 <= GS_VERSION_MAJOR */
 
 #include "math_.h"
-#include <stdlib.h>		/* for abs() */
 #include <sys/utsname.h>	/* for uname(2) */
 #include <ctype.h>		/* for toupper(3) */
 


Summary of changes:
 contrib/eplaser/gdevescv.c |  4 ++--
 devices/gdevmgr.c          | 18 +++++++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)