[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1994-ga537e5b

[email protected] (Julian Smith) Thu, 28 Nov 2019 19:02:05 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  a537e5bd4252abdbdc3f90dfdce8dc9fb621b38d (commit)
       via  35e0c3f70ba2646b4bdfb41663a708a8594eeb68 (commit)
       via  792c922fc83aed63090fb37ffc823e75ec8f9c5c (commit)
       via  efff831b1f3a00c69a32b4edd48614d583f9034a (commit)
       via  94190ff3e48c36a8538a3aba252e2b56909f6984 (commit)
       via  c9f669385954f205d395cbacb2b611d659b3ebf9 (commit)
      from  fd2b1946fe5a4a8c029324c15f9bd606a489f543 (commit)

----------------------------------------------------------------------
commit a537e5bd4252abdbdc3f90dfdce8dc9fb621b38d
Author: Julian Smith <[email protected]>
Date:   Thu Nov 28 17:00:08 2019 +0000

    Coverity 94505: converted macros into static fns.
    
    This should avoid Coverity worrying about bits 8-15 always being zero in a call
    of write_short().

diff --git a/contrib/gdevmd2k.c b/contrib/gdevmd2k.c
index afc82e9..690f22b 100644
--- a/contrib/gdevmd2k.c
+++ b/contrib/gdevmd2k.c
@@ -402,15 +402,17 @@ runlength(byte *out, byte *in, int length)
     return p_out - out;
 }
 
-#define write_short(data, stream) { \
-    gp_fputc((unsigned char) (data), stream); \
-    gp_fputc((unsigned short) (data) >> 8, stream); \
+static void write_short(unsigned data, gp_file* stream)
+{
+    gp_fputc((unsigned char) (data), stream);
+    gp_fputc((unsigned short) (data) >> 8, stream);
 }
 
-#define alps_cmd(cmd1, data, cmd2, stream) { \
-    gp_fwrite(cmd1, 1, 3, stream); \
-    write_short(data, stream); \
-    gp_fputc(cmd2, stream); \
+static void alps_cmd(const char* cmd1, unsigned data, int cmd2, gp_file* stream)
+{
+    gp_fwrite(cmd1, 1, 3, stream);
+    write_short(data, stream);
+    gp_fputc(cmd2, stream);
 }
 
 static void

----------------------------------------------------------------------
commit 35e0c3f70ba2646b4bdfb41663a708a8594eeb68
Author: Julian Smith <[email protected]>
Date:   Thu Nov 28 16:34:49 2019 +0000

    Coverity 94553: fixed possible copy&paste error in lips4_image_out().
    
    Use Len_rle instead of Len inside RLE block.

diff --git a/contrib/lips4/gdevl4r.c b/contrib/lips4/gdevl4r.c
index 054f5ea..d826fd4 100644
--- a/contrib/lips4/gdevl4r.c
+++ b/contrib/lips4/gdevl4r.c
@@ -825,11 +825,13 @@ lips4_image_out(gx_device_printer * pdev, gp_file * prn_stream, int x, int y, in
             gp_fwrite(lprn->TmpBuf, 1, width / 8 * height, prn_stream);
         }
     } else {
+        /* 2019-11-28: changed two occurrencies of 'Len' to 'Len_rle' here, but
+        unable to test. */
         gs_sprintf(comp_str, "%c%d;%d;%d;10;%d.r", LIPS_CSI,
-                Len, width / 8, (int)pdev->x_pixels_per_inch, height);
+                Len_rle, width / 8, (int)pdev->x_pixels_per_inch, height);
         if (Len_rle < width / 8 * height - strlen(comp_str) + strlen(raw_str)) {
             gp_fprintf(prn_stream, "%s", comp_str);
-            gp_fwrite(lprn->CompBuf2, 1, Len, prn_stream);
+            gp_fwrite(lprn->CompBuf2, 1, Len_rle, prn_stream);
         } else {
             /* compression result is bad. */
             gp_fprintf(prn_stream, "%s", raw_str);

----------------------------------------------------------------------
commit 792c922fc83aed63090fb37ffc823e75ec8f9c5c
Author: Julian Smith <[email protected]>
Date:   Thu Nov 28 16:08:23 2019 +0000

    Coverity 95077: fixed various scan-build issues with contrib/japanese/gdevmjc.c.
    
    Some of these will correspond to coverity issues also.

diff --git a/contrib/japanese/gdevmjc.c b/contrib/japanese/gdevmjc.c
index a64646e..d307fc4 100644
--- a/contrib/japanese/gdevmjc.c
+++ b/contrib/japanese/gdevmjc.c
@@ -440,6 +440,7 @@ mj_put_params(gx_device *pdev,  gs_param_list *plist, int ptype)
         code = put_param_int(plist, "Magenta", &magenta, 0, INT_MAX, code);
         code = put_param_int(plist, "Yellow", &yellow, 0, INT_MAX, code);
         code = put_param_int(plist, "Black", &black, 0, INT_MAX, code);
+        (void) code;
 
         if ((code = param_read_bool(plist,
                                      (param_name = "Unidirectional"),
@@ -998,7 +999,6 @@ mj_print_page(gx_device_printer * pdev, gp_file * prn_stream, int ptype)
   plane_size = calc_buffsize(line_size, storage_bpp);
 
   if (bits_per_pixel == 1) {            /* Data printed direct from i/p */
-    databuff_size = 0;                  /* so no data buffer required, */
     outbuff_size = plane_size * 4;      /* but need separate output buffers */
   }
 
@@ -1053,6 +1053,7 @@ mj_print_page(gx_device_printer * pdev, gp_file * prn_stream, int ptype)
         p += xtalbuff_size;
         Kbuf[1] = p;
         p += xtalbuff_size;
+        (void) p;
   }
 
   storage = (word *) gs_malloc(pdev->memory->non_gc_memory, storage_size_words, W, "mj_colour_print_page");
@@ -1105,7 +1106,6 @@ mj_print_page(gx_device_printer * pdev, gp_file * prn_stream, int ptype)
       p += plane_size;
     }
     if (bits_per_pixel == 1) {
-      out_data = out_row = p;	  /* size is outbuff_size * 4 */
       data[1] += databuff_size;   /* coincides with plane_data pointers */
       data[3] += databuff_size;
     }
@@ -1174,9 +1174,6 @@ mj_print_page(gx_device_printer * pdev, gp_file * prn_stream, int ptype)
 #define MOFFSET (pdev->t_margin - MJ700V2C_PRINT_LIMIT) /* Print position */
 
   {
-    int MJ_MARGIN_MM = 55;
-    uint top_skip = (int)(( MJ_MARGIN_MM  * pdev->y_pixels_per_inch ) / 254);
-    top_skip = (top_skip ^ (-1)) & 65536;
     gp_fwrite("\033(V\2\0\0\0",sizeof(byte), 7, prn_stream);
     gp_fwrite("\033(v\2\0\0\xff",sizeof(byte), 7, prn_stream);
   }
@@ -1441,12 +1438,6 @@ mj_color_correct(gx_color_value *Rptr ,gx_color_value *Gptr , gx_color_value *Bp
                         *Gptr = M;
                         *Bptr = Y;
                         return;
-                } else if (G>B) {				/* R=G>B */
-                        D = G-B;
-                        Wa  = R;
-                } else {						/* B>R=G */
-                        D = G-B;
-                        Wa = R;
                 }
         }
 

----------------------------------------------------------------------
commit efff831b1f3a00c69a32b4edd48614d583f9034a
Author: Julian Smith <[email protected]>
Date:   Thu Nov 28 15:44:05 2019 +0000

    Coverity 95077: removed unused assignment to <H> variable.

diff --git a/contrib/japanese/gdevmjc.c b/contrib/japanese/gdevmjc.c
index 281a512..a64646e 100644
--- a/contrib/japanese/gdevmjc.c
+++ b/contrib/japanese/gdevmjc.c
@@ -1444,11 +1444,9 @@ mj_color_correct(gx_color_value *Rptr ,gx_color_value *Gptr , gx_color_value *Bp
                 } else if (G>B) {				/* R=G>B */
                         D = G-B;
                         Wa  = R;
-                        H  = 256;
                 } else {						/* B>R=G */
                         D = G-B;
                         Wa = R;
-                        H = 1024;
                 }
         }
 

----------------------------------------------------------------------
commit 94190ff3e48c36a8538a3aba252e2b56909f6984
Author: Julian Smith <[email protected]>
Date:   Thu Nov 28 12:05:43 2019 +0000

    Coverity 95034: avoid warnings about ignoring return from gs_note_error().

diff --git a/contrib/pcl3/src/gdevpcl3.c b/contrib/pcl3/src/gdevpcl3.c
index dc6d897..1782464 100644
--- a/contrib/pcl3/src/gdevpcl3.c
+++ b/contrib/pcl3/src/gdevpcl3.c
@@ -1479,7 +1479,7 @@ static int pcl3_print_page(gx_device_printer *device, gp_file *out)
       dev->configure_every_page) {
     rc = convert(pcl3_init_file(device->memory, out, &dev->file_data));
     if (rc) {
-        gs_note_error(rc);
+        (void) gs_note_error(rc);
         goto end;
     }
     dev->configured = true;
@@ -1545,12 +1545,12 @@ static int pcl3_print_page(gx_device_printer *device, gp_file *out)
   /* Open the page and start raster mode */
   rc = convert(pcl3_begin_page(out, &dev->file_data));
   if (rc) {
-    gs_note_error(rc);
+    (void) gs_note_error(rc);
     goto end;
   }
   rc = convert(pcl3_begin_raster(out, &rd));
   if (rc) {
-    gs_note_error(rc);
+    (void) gs_note_error(rc);
     goto end;
   }
 
@@ -1588,14 +1588,14 @@ static int pcl3_print_page(gx_device_printer *device, gp_file *out)
       if (blank_lines > 0) {
         rc = convert(pcl3_skip_groups(out, &rd, blank_lines));
         if (rc) {
-          gs_note_error(rc);
+          (void) gs_note_error(rc);
           goto end;
         }
         blank_lines = 0;
       }
       rc = convert(pcl3_transfer_group(out, &rd));
       if (rc) {
-        gs_note_error(rc);
+        (void) gs_note_error(rc);
         goto end;
       }
     }
@@ -1604,12 +1604,12 @@ static int pcl3_print_page(gx_device_printer *device, gp_file *out)
   /* Terminate raster mode and close the page */
   rc = convert(pcl3_end_raster(out, &rd));
   if (rc) {
-    gs_note_error(rc);
+    (void) gs_note_error(rc);
     goto end;
   }
   rc = convert(pcl3_end_page(out, &dev->file_data));
   if (rc) {
-    gs_note_error(rc);
+    (void) gs_note_error(rc);
     goto end;
   }
 

----------------------------------------------------------------------
commit c9f669385954f205d395cbacb2b611d659b3ebf9
Author: Julian Smith <[email protected]>
Date:   Thu Nov 28 11:32:14 2019 +0000

    Coverity 350199: add '-tainted_data_return' annotation.
    
    This makes this annotation match what has worked elsewhere.

diff --git a/base/scfe.c b/base/scfe.c
index 9ed4a07..db120f7 100644
--- a/base/scfe.c
+++ b/base/scfe.c
@@ -381,7 +381,8 @@ s_CFE_process(stream_state * st, stream_cursor_read * pr,
 
 /* Encode a 1-D scan line. */
 /* Attempt to stop coverity thinking skip_white_pixels() taints lbuf:*/
-/* coverity [ -tainted_data_argument arg-1 ] */
+/* coverity[ -tainted_data_return ] */
+/* coverity[ -tainted_data_argument arg-1 ] */
 static void
 cf_encode_1d(stream_CFE_state * ss, const byte * lbuf, stream_cursor_write * pw)
 {


Summary of changes:
 base/scfe.c                 |  3 ++-
 contrib/gdevmd2k.c          | 16 +++++++++-------
 contrib/japanese/gdevmjc.c  | 15 ++-------------
 contrib/lips4/gdevl4r.c     |  6 ++++--
 contrib/pcl3/src/gdevpcl3.c | 14 +++++++-------
 5 files changed, 24 insertions(+), 30 deletions(-)