[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1955-gf734274

[email protected] (Julian Smith) Fri, 22 Nov 2019 16:43:50 +0000 (UTC)
Newsgroups gmane.comp.printing.ghostscript.cvs
Message-ID <[email protected]>
The ghostpdl branch, master has been updated
       via  f734274b455c321a4089d8ee7efa7511656ae9c6 (commit)
       via  17a947dcc56fee115d7b416de7648289b04185f8 (commit)
       via  cbd8765cc2e5d67eae3d412a7584f37a9e02f2e9 (commit)
       via  3ee9bb6efff8929ff8df4fb7ca42001c2aeacdf6 (commit)
       via  67a59c12667bbdddf67e78d9496f94b34d55e702 (commit)
       via  3819f5121013dd93dd3653475e686d8f6df9b068 (commit)
       via  3b8f96dbe2dc0ab0cdbbf076cdb88e21c91639a5 (commit)
       via  4b31b05c2db5967c00d0b08023167935bbb3d015 (commit)
       via  1098cdd54a46dca9ca976b750ba25d0b714dfd9f (commit)
       via  1f60fa73b7c6b5acfae75b6e4a1fede2b75ea1c4 (commit)
       via  3e01cc30c90094bcbef2966f1048c504e6b5361e (commit)
       via  b93f218d418827b689c61b37941ffd4eef0c0d84 (commit)
       via  87cd6160bf654a164469e75a9df7cc7b690b5aaa (commit)
       via  53a370b272a89df418ea563f1abde7d774579105 (commit)
       via  7fe9289f10c47fe7557375c23b54cd87e521d11c (commit)
       via  810c897c51e28dcdd589e1561af36769e72e0893 (commit)
       via  d48555f7777a983e0d15972f3838bb5583e20657 (commit)
       via  4db291eb31b4dc8c6864e438acdd9283c3347671 (commit)
      from  0bc5d53fa1c0d7832008d1ae8e0e6804bf5f9e9e (commit)

----------------------------------------------------------------------
commit f734274b455c321a4089d8ee7efa7511656ae9c6
Author: Julian Smith <[email protected]>
Date:   Fri Nov 22 11:42:29 2019 +0000

    Removed gp_fprintf(pstream, "") call that has no affect.
    
    This was causing gcc warning because gp_fprintf() is now checked by gcc for
    printf format warnings.

diff --git a/devices/gdevmgr.c b/devices/gdevmgr.c
index c6b6605..79c299d 100644
--- a/devices/gdevmgr.c
+++ b/devices/gdevmgr.c
@@ -117,7 +117,6 @@ mgr_begin_page(gx_device_mgr *bdev, gp_file *pstream, mgr_cursor *pcur)
 
         /* Write the header */
         B_PUTHDR8(&head, bdev->width, bdev->height, bdev->mgr_depth);
-        gp_fprintf(pstream, "");
         if ( gp_fwrite(&head, 1, sizeof(head), pstream) < sizeof(head) )
                 return_error(gs_error_ioerror);
         gp_fflush(pstream);

----------------------------------------------------------------------
commit 17a947dcc56fee115d7b416de7648289b04185f8
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 18:39:21 2019 +0000

    Fix some -W -Wall warnings about printf format type mismatches.

diff --git a/contrib/gdevhl12.c b/contrib/gdevhl12.c
index 481d2a7..9f4d617 100644
--- a/contrib/gdevhl12.c
+++ b/contrib/gdevhl12.c
@@ -481,7 +481,7 @@ hl1250_compress_band(gp_file * prn_stream, hl1250_state_t * s, unsigned int band
         break;
     }
     if (s->out_count) {
-        gp_fprintf(prn_stream, "\033*b%uW", s->out_count * sizeof(u16) + 9);
+        gp_fprintf(prn_stream, "\033*b%luW", s->out_count * sizeof(u16) + 9);
         put_be16(prn_stream, s->out_count * sizeof(u16) + 7);
         put_be16(prn_stream, s->xl * 16);
         put_be16(prn_stream, band + ytop);
diff --git a/jbig2dec/jbig2.c b/jbig2dec/jbig2.c
index f25fb69..3fc6bf8 100644
--- a/jbig2dec/jbig2.c
+++ b/jbig2dec/jbig2.c
@@ -381,7 +381,7 @@ jbig2_data_in(Jbig2Ctx *ctx, const unsigned char *data, size_t size)
                 p += 4;
 
                 segment->data_length = p - s;
-                jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "unknown length determined to be %u", segment->data_length);
+                jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "unknown length determined to be %lu", (long) segment->data_length);
             }
             else if (segment->data_length > ctx->buf_wr_ix - ctx->buf_rd_ix)
                     return 0; /* need more data */
diff --git a/jbig2dec/jbig2_segment.c b/jbig2dec/jbig2_segment.c
index 2f2ca7e..2b56196 100644
--- a/jbig2dec/jbig2_segment.c
+++ b/jbig2dec/jbig2_segment.c
@@ -334,7 +334,7 @@ int
 jbig2_parse_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data)
 {
     jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number,
-                "segment %d, flags=%x, type=%d, data_length=%d", segment->number, segment->flags, segment->flags & 63, segment->data_length);
+                "segment %d, flags=%x, type=%d, data_length=%ld", segment->number, segment->flags, segment->flags & 63, (long) segment->data_length);
     switch (segment->flags & 63) {
     case 0:
         return jbig2_symbol_dictionary(ctx, segment, segment_data);

----------------------------------------------------------------------
commit cbd8765cc2e5d67eae3d412a7584f37a9e02f2e9
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 17:47:53 2019 +0000

    Bug 701932: fixed up head dependencies for pxstate_h.

diff --git a/pcl/pxl/pxl.mak b/pcl/pxl/pxl.mak
index 4866113..e5fc8df 100644
--- a/pcl/pxl/pxl.mak
+++ b/pcl/pxl/pxl.mak
@@ -64,7 +64,7 @@ pxdict_h=$(PXLSRC)pxdict.h $(pldict_h) $(pxvalue_h)
 pxgstate_h=$(PXLSRC)pxgstate.h $(gsccolor_h) $(gsiparam_h) $(gsmatrix_h) $(gsrefct_h) $(gxbitmap_h) $(gxfixed_h) $(plsymbol_h) $(pxdict_h) $(pxenum_h)
 pxoper_h=$(PXLSRC)pxoper.h $(gserrors_h) $(pxattr_h) $(pxerrors_h) $(pxvalue_h)
 pxparse_h=$(PXLSRC)pxparse.h $(pxoper_h)
-pxstate_h=$(PXLSRC)pxstate.h $(gsmemory_h) $(pxgstate_h) $(pltop_h)
+pxstate_h=$(PXLSRC)pxstate.h $(gsmemory_h) $(pxgstate_h) $(pltop_h) $(gslibctx_h) $(gxtext_h) $(pcparse_h) $(pgmand_h)
 pxpthr_h=$(PXLSRC)pxpthr.h
 
 $(PXLOBJ)pxbfont.$(OBJ): $(PXLSRC)pxbfont.c $(AK) $(stdpre_h)\

----------------------------------------------------------------------
commit 3ee9bb6efff8929ff8df4fb7ca42001c2aeacdf6
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 17:16:27 2019 +0000

    Coverity 350198: fixed jbig2_error() printf format / type mismatches.
    
    Unfortunately stdint_.h isn't available to jbig2dec code so we can't use
    PRIdSIZE. Have instead used %li with a cast to long.
    
    [This commit addresses all printf warnings from gcc -W -Wall; it probably fixes
    multiple similar coverity issues.]

diff --git a/jbig2dec/jbig2_symbol_dict.c b/jbig2dec/jbig2_symbol_dict.c
index 7545ca4..7d0c3a1 100644
--- a/jbig2dec/jbig2_symbol_dict.c
+++ b/jbig2dec/jbig2_symbol_dict.c
@@ -664,14 +664,14 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
 
                 /* SumatraPDF: prevent read access violation */
                 if (size < jbig2_huffman_offset(hs) || (size - jbig2_huffman_offset(hs) < (size_t) image->height * stride) || (size < jbig2_huffman_offset(hs))) {
-                    jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "not enough data for decoding uncompressed (%d/%d)", image->height * stride,
-                                size - jbig2_huffman_offset(hs));
+                    jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "not enough data for decoding uncompressed (%d/%li)", image->height * stride,
+                                (long) (size - jbig2_huffman_offset(hs)));
                     goto cleanup;
                 }
 
                 BMSIZE = (size_t) image->height * stride;
                 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
-                            "reading %dx%d uncompressed bitmap for %d symbols (%d bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, BMSIZE);
+                            "reading %dx%d uncompressed bitmap for %d symbols (%li bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, (long) BMSIZE);
 
                 for (j = 0; j < image->height; j++) {
                     memcpy(dst, src, stride);
@@ -683,12 +683,12 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
 
                 /* SumatraPDF: prevent read access violation */
                 if (size < jbig2_huffman_offset(hs) || size < BMSIZE || size - jbig2_huffman_offset(hs) < BMSIZE) {
-                    jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "not enough data for decoding (%d/%d)", BMSIZE, size - jbig2_huffman_offset(hs));
+                    jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "not enough data for decoding (%li/%li)", (long) BMSIZE, (long) (size - jbig2_huffman_offset(hs)));
                     goto cleanup;
                 }
 
                 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
-                            "reading %dx%d collective bitmap for %d symbols (%d bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, BMSIZE);
+                            "reading %dx%d collective bitmap for %d symbols (%li bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, (long) BMSIZE);
 
                 rparams.MMR = 1;
                 code = jbig2_decode_generic_mmr(ctx, segment, &rparams, data + jbig2_huffman_offset(hs), BMSIZE, image);

----------------------------------------------------------------------
commit 67a59c12667bbdddf67e78d9496f94b34d55e702
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 17:11:43 2019 +0000

    Coverity 350195: check return from process_row().

diff --git a/pcl/pcl/rtraster.c b/pcl/pcl/rtraster.c
index 7974040..114708b 100644
--- a/pcl/pcl/rtraster.c
+++ b/pcl/pcl/rtraster.c
@@ -994,7 +994,11 @@ process_ccitt_compress(gs_gstate * pgs,
 
             case 1:            /* need output, process the scanline and continue. */
                 memcpy(pout->pdata, temp_buffer, min(pout->size, wrsize));
-                process_row(prast, 0);
+                code = process_row(prast, 0);
+                if (code < 0) {
+                    s_CFD_template.release((stream_state *) & state);
+                    return gs_rethrow(code, "CCITT decompression failed\n");
+                }
                 memset(temp_buffer, 0, wrsize);
                 scw.ptr = temp_buffer - 1;
                 scw.limit = scw.ptr + wrsize;

----------------------------------------------------------------------
commit 3819f5121013dd93dd3653475e686d8f6df9b068
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 17:01:55 2019 +0000

    Coverity 350189: explicitly ignore return from hpgl_arg_c_int().
    
    We already initialised variable 'type', and we don't mind whether
    hpgl_arg_c_int() changes it before we switch on it. So cast hpgl_arg_c_int()'s
    return to void to stop Coverity from warning.

diff --git a/pcl/pcl/pgconfig.c b/pcl/pcl/pgconfig.c
index 49638bc..b17adfa 100644
--- a/pcl/pcl/pgconfig.c
+++ b/pcl/pcl/pgconfig.c
@@ -638,7 +638,7 @@ hpgl_SC(hpgl_args_t * pargs, hpgl_state_t * pgls)
             return e_Range;
         case 4:
             type = hpgl_scaling_anisotropic;
-            hpgl_arg_c_int(pgls->memory, pargs, &type);
+            (void) hpgl_arg_c_int(pgls->memory, pargs, &type);
             switch (type) {
                 case hpgl_scaling_anisotropic: /* 0 */
                     if (xy[0] == xy[1] || xy[2] == xy[3])

----------------------------------------------------------------------
commit 3b8f96dbe2dc0ab0cdbbf076cdb88e21c91639a5
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 16:52:32 2019 +0000

    Coverity 350185: fix printf format type mismatch.
    
    Unfortunately stdint_.h isn't available to jbig2dec code so we can't use
    PRIdSIZE. Have instead used %li with a cast to long.

diff --git a/jbig2dec/jbig2_generic.c b/jbig2dec/jbig2_generic.c
index 6c28352..2c84e33 100644
--- a/jbig2dec/jbig2_generic.c
+++ b/jbig2dec/jbig2_generic.c
@@ -1075,7 +1075,7 @@ jbig2_decode_generic_region(Jbig2Ctx *ctx,
 
     if (image->stride * image->height > (1 << 26) && segment->data_length < image->stride * image->height / (1 << 16)) {
         return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
-                           "region is far larger than data provided (%d << %d), aborting to prevent DOS", segment->data_length, image->stride * image->height);
+                           "region is far larger than data provided (%li << %d), aborting to prevent DOS", (long) segment->data_length, image->stride * image->height);
     }
 
     if (!params->MMR && params->TPGDON)

----------------------------------------------------------------------
commit 4b31b05c2db5967c00d0b08023167935bbb3d015
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 16:49:51 2019 +0000

    If gcc, make gcc check jbig2_error()'s format string agrees with types of parameters.

diff --git a/jbig2dec/jbig2_priv.h b/jbig2dec/jbig2_priv.h
index 0fee2b9..f84a99d 100644
--- a/jbig2dec/jbig2_priv.h
+++ b/jbig2dec/jbig2_priv.h
@@ -116,7 +116,11 @@ void *jbig2_realloc(Jbig2Allocator *allocator, void *p, size_t size, size_t num)
 
 #define jbig2_renew(ctx, p, t, size) ((t *)jbig2_realloc(ctx->allocator, (p), size, sizeof(t)))
 
-int jbig2_error(Jbig2Ctx *ctx, Jbig2Severity severity, int32_t seg_idx, const char *fmt, ...);
+int jbig2_error(Jbig2Ctx *ctx, Jbig2Severity severity, int32_t seg_idx, const char *fmt, ...)
+#ifdef __GNUC__
+    __attribute__ ((format (__printf__, 4, 5)))
+#endif
+    ;
 
 /* The word stream design is a compromise between simplicity and
    trying to amortize the number of method calls. Each ::get_next_word

----------------------------------------------------------------------
commit 1098cdd54a46dca9ca976b750ba25d0b714dfd9f
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 16:23:32 2019 +0000

    Add a --enable-mkromfs-quiet configure option.
    
    Sets MKROMFS_FLAGS=-q and pass to all invocations of mkromfs.
    
    [Makefile.in and configure.ac changes by chrisl]

diff --git a/Makefile.in b/Makefile.in
index 5b632c1..57d29c1 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -561,6 +561,9 @@ SO_LIB_VERSION_SEPARATOR=@SO_LIB_VERSION_SEPARATOR@
 #CAIRO_CFLAGS	=	@CAIRO_CFLAGS@
 #CAIRO_LIBS	=	@CAIRO_LIBS@
 
+# AUX Tools flags
+MKROMFS_FLAGS=@MKROMFS_FLAGS@
+
 # ------ Devices and features ------ #
 
 # Choose the language feature(s) to include.  See gs.mak for details.
diff --git a/base/lib.mak b/base/lib.mak
index a31bd5e..534e2dc 100644
--- a/base/lib.mak
+++ b/base/lib.mak
@@ -3306,12 +3306,12 @@ $(GLD)romfs0.dev :  $(LIB_MAK) $(ECHOGS_XE) $(LIB_MAK) $(MAKEDIRS)
 # psi
 $(GLGEN)gsromfs1_.c : $(MKROMFS_XE) $(PS_ROMFS_DEPS) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)gsromfs1_.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(PS_ROMFS_ARGS) $(PS_FONT_ROMFS_ARGS) $(GL_ROMFS_ARGS)
 
 $(GLGEN)gsromfs1_1.c : $(MKROMFS_XE) $(PS_ROMFS_DEPS) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)gsromfs1_1.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(UFST_ROMFS_ARGS) $(PS_ROMFS_ARGS) $(GL_ROMFS_ARGS)
 
 $(GLGEN)gsromfs1.c : $(GLGEN)gsromfs1_$(UFST_BRIDGE).c $(LIB_MAK) $(MAKEDIRS)
@@ -3320,13 +3320,13 @@ $(GLGEN)gsromfs1.c : $(GLGEN)gsromfs1_$(UFST_BRIDGE).c $(LIB_MAK) $(MAKEDIRS)
 # pcl
 $(GLGEN)pclromfs1_.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)pclromfs1_.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(PCLXL_FONT_ROMFS_ARGS) $(PCLXL_ROMFS_ARGS) $(PJL_ROMFS_ARGS) \
         $(PJL_ROMFS_ARGS) $(GL_ROMFS_ARGS)
 
 $(GLGEN)pclromfs1_1.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)pclromfs1_1.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(UFST_ROMFS_ARGS) $(PCLXL_ROMFS_ARGS) $(PJL_ROMFS_ARGS) \
 	$(GL_ROMFS_ARGS)
 
@@ -3335,12 +3335,12 @@ $(GLGEN)pclromfs1.c : $(GLGEN)pclromfs1_$(UFST_BRIDGE).c $(LIB_MAK) $(MAKEDIRS)
 
 $(GLGEN)pclromfs0_.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)pclromfs0_.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(GL_ROMFS_ARGS)
 
 $(GLGEN)pclromfs0_1.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)pclromfs0_1.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(GL_ROMFS_ARGS)
 
 $(GLGEN)pclromfs0.c : $(GLGEN)pclromfs0_$(UFST_BRIDGE).c $(LIB_MAK) $(MAKEDIRS)
@@ -3349,12 +3349,12 @@ $(GLGEN)pclromfs0.c : $(GLGEN)pclromfs0_$(UFST_BRIDGE).c $(LIB_MAK) $(MAKEDIRS)
 # xps
 $(GLGEN)xpsromfs1_.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)xpsromfs1_.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(XPS_ROMFS_ARGS) $(XPS_FONT_ROMFS_ARGS) $(GL_ROMFS_ARGS)
 
 $(GLGEN)xpsromfs1_1.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)xpsromfs1_1.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(XPS_ROMFS_ARGS) $(GL_ROMFS_ARGS)
 
 $(GLGEN)xpsromfs1.c : $(GLGEN)xpsromfs1_$(UFST_BRIDGE).c $(LIB_MAK) $(MAKEDIRS)
@@ -3362,12 +3362,12 @@ $(GLGEN)xpsromfs1.c : $(GLGEN)xpsromfs1_$(UFST_BRIDGE).c $(LIB_MAK) $(MAKEDIRS)
 
 $(GLGEN)xpsromfs0_.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)xpsromfs0_.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(GL_ROMFS_ARGS)
 
 $(GLGEN)xpsromfs0_1.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)xpsromfs0_1.c \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(GL_ROMFS_ARGS)
 
 $(GLGEN)xpsromfs0.c : $(GLGEN)xpsromfs0_$(UFST_BRIDGE).c $(LIB_MAK) $(MAKEDIRS)
@@ -3391,7 +3391,7 @@ $(GLGEN)pdlromfs1_c3.c : $(GLGEN)pdlromfs1_.c
 
 $(GLGEN)pdlromfs1_.c: $(MKROMFS_XE) $(PS_ROMFS_DEPS) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)pdlromfs1_.c -s 4 \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(PCLXL_ROMFS_ARGS) $(PCLXL_FONT_ROMFS_ARGS) $(PJL_ROMFS_ARGS) \
         $(XPS_ROMFS_ARGS) $(XPS_FONT_ROMFS_ARGS) \
 	$(PS_ROMFS_ARGS) $(PS_FONT_ROMFS_ARGS) $(GL_ROMFS_ARGS)
@@ -3411,7 +3411,7 @@ $(GLGEN)pdlromfs1_1c3.c : $(GLGEN)pdlromfs1_1.c
 
 $(GLGEN)pdlromfs1_1.c: $(MKROMFS_XE) $(PS_ROMFS_DEPS) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)pdlromfs1_1.c -s 4 \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(UFST_ROMFS_ARGS) $(PCLXL_ROMFS_ARGS) $(PJL_ROMFS_ARGS) $(XPS_ROMFS_ARGS) \
 	$(PS_ROMFS_ARGS) $(GL_ROMFS_ARGS)
 
@@ -3446,7 +3446,7 @@ $(GLGEN)pdlromfs0_c3.c : $(GLGEN)pdlromfs0_.c
 
 $(GLGEN)pdlromfs0_.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)pdlromfs0_.c -s 4 \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(GL_ROMFS_ARGS)
 
 # Non COMPILE_INITS + UFST variant
@@ -3464,7 +3464,7 @@ $(GLGEN)pdlromfs0_1c3.c : $(GLGEN)pdlromfs0_1.c
 
 $(GLGEN)pdlromfs0_1.c : $(MKROMFS_XE) $(LIB_MAK) $(MAKEDIRS)
 	$(EXP)$(MKROMFS_XE) -o $(GLGEN)pdlromfs0_1.c -s 4 \
-	-X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
+	$(MKROMFS_FLAGS) -X .svn -X CVS -P $(GLSRCDIR)$(D)..$(D) iccprofiles$(D)* \
 	$(GL_ROMFS_ARGS)
 
 # Rules to fold Non COMPILE_INITS +/- UFST into 1 set of targets
diff --git a/configure.ac b/configure.ac
index a404910..d6d4d6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3407,6 +3407,14 @@ if test x"$build" != x"$host"; then
 fi
 
 dnl --------------------------------------------------
+dnl AUX tool options
+dnl --------------------------------------------------
+AC_ARG_ENABLE([mkromfs-quiet], AC_HELP_STRING([--enable-mkromfs-quiet],
+       [Do not emit mkromfs verbose output]), [MKROMFS_FLAGS="-q $MKROMFS_FLAGS"])
+
+AC_SUBST(MKROMFS_FLAGS)
+
+dnl --------------------------------------------------
 dnl Do substitutions
 dnl --------------------------------------------------
 SRCDIR="$srcdir"

----------------------------------------------------------------------
commit 1f60fa73b7c6b5acfae75b6e4a1fede2b75ea1c4
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 12:52:41 2019 +0000

    mkromfs: added -q option to reduce verbose diagnostics.

diff --git a/base/mkromfs.c b/base/mkromfs.c
index f6e4d6f..e427778 100644
--- a/base/mkromfs.c
+++ b/base/mkromfs.c
@@ -383,12 +383,12 @@ int cmpstringp(const void *p1, const void *p2);
 void put_uint32(FILE *out, const unsigned int q);
 void put_bytes_padded(FILE *out, unsigned char *p, unsigned int len);
 void inode_clear(romfs_inode* node);
-void inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, int*totlen, split_data *splits);
+void inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, int*totlen, split_data *splits, int verbose);
 void process_path(char *path, const char *os_prefix, const char *rom_prefix,
                   Xlist_element *Xlist_head, int compression,
                   int compaction, int *inode_count, int *totlen, FILE *out,
-                  split_data *splits);
-FILE *prefix_open(const char *os_prefix, const char *inname);
+                  split_data *splits, int verbose);
+FILE *prefix_open(const char *os_prefix, const char *inname, int verbose);
 void prefix_add(const char *prefix, const char *filename, char *prefixed_path);
 
 /* put 4 byte integer, big endian */
@@ -467,7 +467,7 @@ void inode_clear(romfs_inode* node)
 }
 
 static unsigned long
-do_inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, int *totlen, int split)
+do_inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, int *totlen, int split, int verbose)
 {
     int i, offset;
     int blocks = (node->length+ROMFS_BLOCKSIZE-1)/ROMFS_BLOCKSIZE;
@@ -504,12 +504,14 @@ do_inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, i
     }
     fprintf(out, "\t0 };\t/* end-of-node */\n");
 
-    printf("node '%s' len=%ld", node->name, node->length);
-    printf(" %d blocks", blocks);
-    if (compression) {
-        printf(", compressed size=%d", clen);
+    if (verbose) {
+        printf("node '%s' len=%ld", node->name, node->length);
+        printf(" %d blocks", blocks);
+        if (compression) {
+            printf(", compressed size=%d", clen);
+        }
+        printf("\n");
     }
-    printf("\n");
     if (compression)
         return clen;
     return node->length;
@@ -548,7 +550,7 @@ start_file(FILE *out)
 
 /* write out an inode and its file data */
 void
-inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, int *totlen, split_data *splits)
+inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, int *totlen, split_data *splits, int verbose)
 {
     prepare_splits(splits);
     if (splits->max_splits) {
@@ -568,10 +570,10 @@ inode_write(FILE *out, romfs_inode *node, int compression, int inode_count, int
         } else {
             out2 = fopen(splits->outname_formatted, "a");
         }
-        splits->sizes[which] += do_inode_write(out2, node, compression, inode_count, totlen, 1);
+        splits->sizes[which] += do_inode_write(out2, node, compression, inode_count, totlen, 1, verbose);
         fclose(out2);
     } else
-        (void)do_inode_write(out, node, compression, inode_count, totlen, 0);
+        (void)do_inode_write(out, node, compression, inode_count, totlen, 0, verbose);
 }
 
 void
@@ -1666,7 +1668,7 @@ int cmpstringp(const void *p1, const void *p2)
 void process_path(char *path, const char *os_prefix, const char *rom_prefix,
                   Xlist_element *Xlist_head, int compression,
                   int compaction, int *inode_count, int *totlen, FILE *out,
-                  split_data *splits)
+                  split_data *splits, int verbose)
 {
     int i, namelen, excluded, save_count=*inode_count;
     Xlist_element *Xlist_scan;
@@ -1799,7 +1801,7 @@ void process_path(char *path, const char *os_prefix, const char *rom_prefix,
         }
 
         /* write out data for this file */
-        inode_write(out, node, compression, *inode_count, totlen, splits);
+        inode_write(out, node, compression, *inode_count, totlen, splits, verbose);
         /* clean up */
         inode_clear(node);
         free(node);
@@ -1835,7 +1837,7 @@ void process_path(char *path, const char *os_prefix, const char *rom_prefix,
  * will be converted to a binary token.
  */
 /* Forward references */
-void merge_to_ps(const char *os_prefix, const char *inname, FILE * in, FILE * config);
+void merge_to_ps(const char *os_prefix, const char *inname, FILE * in, FILE * config, int verbose);
 int write_init(char *);
 bool rl(FILE * in, char *str, int len);
 void wsc(const byte *str, int len);
@@ -1845,7 +1847,7 @@ char *doit(char *line, bool intact);
 void hex_string_to_binary(FILE *in);
 void flush_buf(char *buf);
 void mergefile(const char *os_prefix, const char *inname, FILE * in, FILE * config,
-               bool intact);
+               bool intact, int verbose);
 void flush_line_buf(int len);
 
 typedef struct in_block_s in_block_t;
@@ -1894,7 +1896,7 @@ static int ib_feof(in_block_file *ibf)
 static int
 process_initfile(char *initfile, char *gconfig_h, const char *os_prefix,
                  const char *rom_prefix, int compression, int *inode_count,
-                 int *totlen, FILE *out, split_data *splits)
+                 int *totlen, FILE *out, split_data *splits, int verbose)
 {
     int ret, block, blocks;
     romfs_inode *node = NULL;
@@ -1939,7 +1941,7 @@ process_initfile(char *initfile, char *gconfig_h, const char *os_prefix,
     node = calloc(1, sizeof(romfs_inode));
     node->name = rom_filename;	/* without -P prefix, with -d rom_prefix */
 
-    merge_to_ps(os_prefix, initfile, in, config);
+    merge_to_ps(os_prefix, initfile, in, config, verbose);
 
     fclose(in);
     fclose(config);
@@ -2018,7 +2020,7 @@ process_initfile(char *initfile, char *gconfig_h, const char *os_prefix,
     }
 
     /* write data for this file */
-    inode_write(out, node, compression, *inode_count, totlen, splits);
+    inode_write(out, node, compression, *inode_count, totlen, splits, verbose);
     /* clean up */
     inode_clear(node);
     (*inode_count)++;
@@ -2280,7 +2282,7 @@ flush_buf(char *buf)
 }
 
 FILE *
-prefix_open(const char *os_prefix, const char *filename)
+prefix_open(const char *os_prefix, const char *filename, int verbose)
 {
     char *prefixed_path;
     FILE *filep;
@@ -2291,7 +2293,9 @@ prefix_open(const char *os_prefix, const char *filename)
         return NULL;
     }
     prefix_add(os_prefix, filename, prefixed_path);
-    printf("including: '%s'\n", prefixed_path);
+    if (verbose) {
+        printf("including: '%s'\n", prefixed_path);
+    }
     filep = fopen(prefixed_path, "rb");
     free(prefixed_path);
     return filep;
@@ -2299,7 +2303,7 @@ prefix_open(const char *os_prefix, const char *filename)
 
 void
 mergefile(const char *os_prefix, const char *inname, FILE * in, FILE * config,
-          bool intact)
+          bool intact, int verbose)
 {
     char line[LINE_SIZE + 1];
     char buf[LINE_SIZE + 1];
@@ -2324,12 +2328,12 @@ mergefile(const char *os_prefix, const char *inname, FILE * in, FILE * config,
                 FILE *ps;
 
                 psname[strlen(psname) - 1] = 0;
-                ps = prefix_open(os_prefix, psname + 1);
+                ps = prefix_open(os_prefix, psname + 1, verbose);
                 if (ps == 0) {
                     fprintf(stderr, "Failed to open '%s' - aborting\n", psname+1);
                     exit(1);
                 }
-                mergefile(os_prefix, psname + 1, ps, config, intact || do_intact);
+                mergefile(os_prefix, psname + 1, ps, config, intact || do_intact, verbose);
             } else if (!strcmp(psname, "INITFILES")) {
                 /*
                  * We don't want to bind config.h into geninit, so
@@ -2344,10 +2348,10 @@ mergefile(const char *os_prefix, const char *inname, FILE * in, FILE * config,
                             exit(1);
 
                         *quote = 0;
-                        ps = prefix_open(os_prefix, psname + 9);
+                        ps = prefix_open(os_prefix, psname + 9, verbose);
                         if (ps == 0)
                             exit(1);
-                        mergefile(os_prefix, psname + 9, ps, config, false);
+                        mergefile(os_prefix, psname + 9, ps, config, false, verbose);
                     }
             } else {
                 printf("Unknown %%%% Replace %d %s\n",
@@ -2400,7 +2404,7 @@ mergefile(const char *os_prefix, const char *inname, FILE * in, FILE * config,
 
 /* Merge and produce a PostScript file. */
 void
-merge_to_ps(const char *os_prefix, const char *inname, FILE * in, FILE * config)
+merge_to_ps(const char *os_prefix, const char *inname, FILE * in, FILE * config, int verbose)
 {
     char line[LINE_SIZE + 1];
 
@@ -2408,7 +2412,7 @@ merge_to_ps(const char *os_prefix, const char *inname, FILE * in, FILE * config)
         sprintf(linebuf, "%s", line );
         wl(linebuf);
     }
-    mergefile(os_prefix, inname, in, config, false);
+    mergefile(os_prefix, inname, in, config, false, verbose);
 }
 
 static void
@@ -2460,6 +2464,7 @@ main(int argc, char *argv[])
     int atarg = 1;
     int compression = 1;			/* default to doing compression */
     int compaction = 0;
+    int verbose = 1;
     Xlist_element *Xlist_scan = NULL, *Xlist_head = NULL;
     char pa[PATH_STR_LEN];
     time_t buildtime = 0;
@@ -2475,6 +2480,7 @@ main(int argc, char *argv[])
                 "           options:\n"
                 "               -o outputfile   default: obj/gsromfs.c if this option present, must be first.\n"
                 "               -P prefix       use prefix to find path. prefix not included in %%rom%%\n"
+                "               -q              reduce diagnostics\n"
                 "               -X path         exclude the path from further processing.\n"
                 "                         Note: The tail of any path encountered will be tested so .svn on the -X\n"
                 "                               list will exclude that path in all subsequent paths enumerated.\n"
@@ -2539,6 +2545,9 @@ main(int argc, char *argv[])
               case 'C':
                 compaction = 1;
                 break;
+              case 'q':
+                verbose = 0;
+                break;
               case 'd':
                 if (++atarg == argc) {
                     printf("   option %s missing required argument\n", argv[atarg-1]);
@@ -2570,7 +2579,7 @@ main(int argc, char *argv[])
                     atarg++;
                     strncpy(gconfig_h, argv[atarg], PATH_STR_LEN - 1);
                     process_initfile(initfile, gconfig_h, os_prefix, rom_prefix, compression,
-                                    &inode_count, &totlen, out, &splits);
+                                    &inode_count, &totlen, out, &splits, verbose);
                 }
                 break;
               case 'P':
@@ -2601,7 +2610,7 @@ main(int argc, char *argv[])
         /* process a path or file */
         strncpy(pa, argv[atarg], PATH_STR_LEN - (strlen(os_prefix) < strlen(rom_prefix) ? strlen(rom_prefix) : strlen(os_prefix)));
         process_path(pa, os_prefix, rom_prefix, Xlist_head,
-                     compression, compaction, &inode_count, &totlen, out, &splits);
+                     compression, compaction, &inode_count, &totlen, out, &splits, verbose);
     }
 
     /* Now allow for the (probably never happening) case where we are splitting, but haven't written anything to one of the files */

----------------------------------------------------------------------
commit 3e01cc30c90094bcbef2966f1048c504e6b5361e
Author: Julian Smith <[email protected]>
Date:   Fri Nov 15 16:45:33 2019 +0000

    configure.ac: add -W -Wall to sanitize builds if supported.

diff --git a/configure.ac b/configure.ac
index b4dfe0a..a404910 100644
--- a/configure.ac
+++ b/configure.ac
@@ -465,6 +465,27 @@ AC_LINK_IFELSE(
 CFLAGS="$CFLAGS_SAVED"
 
 AC_MSG_RESULT([ ...done.])
+
+
+dnl ----------------------------
+dnl check for sanitize build warnings support
+dnl ----------------------------
+AC_MSG_CHECKING([compiler/linker address santizer build warnings support])
+
+CFLAGS_SANITIZE_TRY="$CFLAGS_SANITIZE -W -Wall -Wno-unused-parameter -Wno-sign-compare -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-shift-negative-value -Wno-old-style-declaration -Wno-unused-but-set-parameter"
+CFLAGS_SAVED="$CFLAGS"
+CFLAGS="$CFLAGS_SANITIZE_TRY"
+
+AC_LINK_IFELSE(
+  [AC_LANG_PROGRAM([#include <stdio.h>], [
+  return(0);
+  ])],
+  [CFLAGS_SANITIZE="$CFLAGS"], [echo 'extra warnings not supported'])
+
+CFLAGS="$CFLAGS_SAVED"
+AC_MSG_RESULT([ ...done.])
+
+
 dnl ----------------------------
 dnl check for big/little endian
 dnl ----------------------------

----------------------------------------------------------------------
commit b93f218d418827b689c61b37941ffd4eef0c0d84
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 13:41:37 2019 +0000

    Mark gp_fprintf() with gcc's __attribute__ ((format (__printf__, 2, 3))).
    
    This makes gcc check types match the format string.

diff --git a/base/gp.h b/base/gp.h
index 7ea0b90..948bbdb 100644
--- a/base/gp.h
+++ b/base/gp.h
@@ -334,7 +334,11 @@ gp_rewind(gp_file *f) {
 
 char *gp_fgets(char *buffer, size_t n, gp_file *f);
 
-int gp_fprintf(gp_file *f, const char *fmt, ...);
+int gp_fprintf(gp_file *f, const char *fmt, ...)
+#ifdef __GNUC__
+    __attribute__ ((format (__printf__, 2, 3)))
+#endif
+    ;
 
 /* ------ Reading from stdin, unbuffered if possible ------ */
 

----------------------------------------------------------------------
commit 87cd6160bf654a164469e75a9df7cc7b690b5aaa
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 13:40:45 2019 +0000

    Coverity 350172: fix gp_fprintf() call to use PRIdSIZE for ptrdiff_t.

diff --git a/contrib/japanese/gdevp201.c b/contrib/japanese/gdevp201.c
index 11f8f98..bb7e88e 100644
--- a/contrib/japanese/gdevp201.c
+++ b/contrib/japanese/gdevp201.c
@@ -242,7 +242,7 @@ pr201_print_page(gx_device_printer *pdev, gp_file *prn_stream)
                 out_beg -= (out_beg - out) % bytes_per_column;
 
                 /* Dot addressing */
-                gp_fprintf(pdev->file, "\033F%04d",
+                gp_fprintf(pdev->file, "\033F%04" PRIdSIZE,
                            (out_beg - out) / bytes_per_column);
 
                 /* Dot graphics */

----------------------------------------------------------------------
commit 53a370b272a89df418ea563f1abde7d774579105
Author: Julian Smith <[email protected]>
Date:   Thu Nov 21 12:24:48 2019 +0000

    Coverity 350169: avoid buffer overflow when writing to cups->pageSizeRequested.

diff --git a/cups/gdevcups.c b/cups/gdevcups.c
index 3df3f03..390a613 100644
--- a/cups/gdevcups.c
+++ b/cups/gdevcups.c
@@ -2860,7 +2860,7 @@ cups_open(gx_device *pdev)		/* I - Device info */
     cups->PPD = ppdOpenFile(getenv("PPD"));
 
   if (cups->pageSizeRequested[0] == '\0') {
-    strncpy(cups->pageSizeRequested, cups->header.cupsPageSizeName, 64);
+    (void) snprintf(cups->pageSizeRequested, sizeof(cups->pageSizeRequested), "%s", cups->header.cupsPageSizeName);
 #ifdef CUPS_DEBUG
     dmprintf1(pdev->memory, "DEBUG: Page size requested: %s\n",
 	      cups->header.cupsPageSizeName);

----------------------------------------------------------------------
commit 7fe9289f10c47fe7557375c23b54cd87e521d11c
Author: Julian Smith <[email protected]>
Date:   Wed Nov 20 19:30:55 2019 +0000

    Bug 701932: moved more global_* into px_state_s.
    
    Specifically:
    
        gs_point global_char_shear;
        gs_point global_char_scale;
        float global_char_bold_value;
        float global_char_angle;

diff --git a/pcl/pxl/pxpthr.c b/pcl/pxl/pxpthr.c
index 1d1ab35..e55d537 100644
--- a/pcl/pxl/pxpthr.c
+++ b/pcl/pxl/pxpthr.c
@@ -42,15 +42,6 @@
 #include "pjtop.h"
 #include "pxptable.h"
 
-/* NB - globals needing cleanup
- */
-
-/* store away the current font attributes PCL can't set these,
- * they persist for XL */
-gs_point global_char_shear;
-gs_point global_char_scale;
-float global_char_bold_value;
-float global_char_angle;
 
 /* forward decl */
 void pxpcl_release(px_state_t* pxs);
@@ -108,12 +99,12 @@ pxPassthrough_pcl_state_nonpage_exceptions(px_state_t * pxs)
         pxs->pcs->underline_start = pxs->pcs->cap;
 
 
-    global_char_angle = pxs->pxgs->char_angle;
-    global_char_shear.x = pxs->pxgs->char_shear.x;
-    global_char_shear.y = pxs->pxgs->char_shear.y;
-    global_char_scale.x = pxs->pxgs->char_scale.x;
-    global_char_scale.y = pxs->pxgs->char_scale.y;
-    global_char_bold_value = pxs->pxgs->char_bold_value;
+    pxs->char_angle = pxs->pxgs->char_angle;
+    pxs->char_shear.x = pxs->pxgs->char_shear.x;
+    pxs->char_shear.y = pxs->pxgs->char_shear.y;
+    pxs->char_scale.x = pxs->pxgs->char_scale.x;
+    pxs->char_scale.y = pxs->pxgs->char_scale.y;
+    pxs->char_bold_value = pxs->pxgs->char_bold_value;
 
     return 0;
 }
@@ -335,12 +326,12 @@ pxpcl_release(px_state_t * pxs)
         pxs->pcs = NULL;
         pxs->this_pass_contiguous = false;
         pxs->pass_first = true;
-        global_char_angle = 0;
-        global_char_shear.x = 0;
-        global_char_shear.y = 0;
-        global_char_scale.x = 1.0;
-        global_char_scale.y = 1.0;
-        global_char_bold_value = 0.0;
+        pxs->char_angle = 0;
+        pxs->char_shear.x = 0;
+        pxs->char_shear.y = 0;
+        pxs->char_scale.x = 1.0;
+        pxs->char_scale.y = 1.0;
+        pxs->char_bold_value = 0.0;
     }
 }
 
@@ -365,12 +356,12 @@ pxpcl_endpassthroughcontiguous(px_state_t * pxs)
         pxBeginPageFromPassthrough(pxs);
     }
 
-    pxs->pxgs->char_angle = global_char_angle;
-    pxs->pxgs->char_shear.x = global_char_shear.x;
-    pxs->pxgs->char_shear.y = global_char_shear.y;
-    pxs->pxgs->char_scale.x = global_char_scale.x;
-    pxs->pxgs->char_scale.y = global_char_scale.y;
-    pxs->pxgs->char_bold_value = global_char_bold_value;
+    pxs->pxgs->char_angle = pxs->char_angle;
+    pxs->pxgs->char_shear.x = pxs->char_shear.x;
+    pxs->pxgs->char_shear.y = pxs->char_shear.y;
+    pxs->pxgs->char_scale.x = pxs->char_scale.x;
+    pxs->pxgs->char_scale.y = pxs->char_scale.y;
+    pxs->pxgs->char_bold_value = pxs->char_bold_value;
 }
 int
 pxpcl_selectfont(px_args_t * par, px_state_t * pxs)
diff --git a/pcl/pxl/pxstate.h b/pcl/pxl/pxstate.h
index ed5bbaf..85380e4 100644
--- a/pcl/pxl/pxstate.h
+++ b/pcl/pxl/pxstate.h
@@ -175,6 +175,14 @@ struct px_state_s
     bool                this_pass_contiguous;
 
     bool                pass_first;
+
+    /* store away the current font attributes PCL can't set these,
+     * they persist for XL */
+    gs_point            char_shear;
+    gs_point            char_scale;
+    float               char_bold_value;
+    float               char_angle;
+
 };
 
 /* Allocate a px_state_t. */

----------------------------------------------------------------------
commit 810c897c51e28dcdd589e1561af36769e72e0893
Author: Julian Smith <[email protected]>
Date:   Wed Nov 20 19:16:48 2019 +0000

    Bug 701932: moved more global_* into px_state_s.
    
    Specifically:
    
        static pcl_parser_state_t global_pcl_parser_state;
        static hpgl_parser_state_t global_gl_parser_state;
        static bool global_this_pass_contiguous = false;
        static bool global_pass_first = true;

diff --git a/pcl/pxl/pxparse.c b/pcl/pxl/pxparse.c
index 33bf4f5..6938a7c 100644
--- a/pcl/pxl/pxparse.c
+++ b/pcl/pxl/pxparse.c
@@ -559,7 +559,7 @@ px_process(px_parser_state_t * st, px_state_t * pxs, stream_cursor_read * pr)
                    preceded by another passthrough operator or a
                    different xl operator */
                 if (tag == pxtPassThrough) {
-                    pxpcl_passthroughcontiguous(st->last_operator == tag);
+                    pxpcl_passthroughcontiguous(pxs, st->last_operator == tag);
                 } else if (st->last_operator == pxtPassThrough) {
                     pxpcl_endpassthroughcontiguous(pxs);
                 }
diff --git a/pcl/pxl/pxpthr.c b/pcl/pxl/pxpthr.c
index 73c2dac..1d1ab35 100644
--- a/pcl/pxl/pxpthr.c
+++ b/pcl/pxl/pxpthr.c
@@ -45,18 +45,6 @@
 /* NB - globals needing cleanup
  */
 
-static pcl_parser_state_t global_pcl_parser_state;
-
-static hpgl_parser_state_t global_gl_parser_state;
-
-/* if this is a contiguous passthrough meaning that 2 passtrough
-   operators have been given back to back and pxl should not regain
-   control. */
-static bool global_this_pass_contiguous = false;
-
-/* this is the first passthrough on this page */
-static bool global_pass_first = true;
-
 /* store away the current font attributes PCL can't set these,
  * they persist for XL */
 gs_point global_char_shear;
@@ -190,9 +178,9 @@ pxPassthrough_init(px_state_t * pxs)
     pxs->pcs->xfm_state.paper_size = pcl_get_default_paper(pxs->pcs);
     pcl_do_resets(pxs->pcs, pcl_reset_initial);
     /* set the parser state and initialize the pcl parser */
-    global_pcl_parser_state.definitions = pxs->pcs->pcl_commands;
-    global_pcl_parser_state.hpgl_parser_state = &global_gl_parser_state;
-    pcl_process_init(&global_pcl_parser_state, pxs->pcs);
+    pxs->pcl_parser_state.definitions = pxs->pcs->pcl_commands;
+    pxs->pcl_parser_state.hpgl_parser_state = &pxs->gl_parser_state;
+    pcl_process_init(&pxs->pcl_parser_state, pxs->pcs);
     /* default 600 to match XL allow PCL to override */
     pxs->pcs->uom_cp = 7200L / 600L;
     return gs_setgray(pxs->pcs->pgs, 0);
@@ -269,18 +257,18 @@ pxPassthrough(px_args_t * par, px_state_t * pxs)
                 pxPassthrough_init(pxs);
 
             /* this is the first passthrough on this page */
-            if (global_pass_first) {
+            if (pxs->pass_first) {
                 code = pxPassthrough_setpagestate(pxs);
                 if (code < 0)
                     return code;
                 code = pxPassthrough_pcl_state_nonpage_exceptions(pxs);
                 if (code < 0)
                     return code;
-                global_pass_first = false;
+                pxs->pass_first = false;
             } else {
                 /* there was a previous passthrough check if there were
                    any intervening XL commands */
-                if (global_this_pass_contiguous == false) {
+                if (pxs->this_pass_contiguous == false) {
                     code = pxPassthrough_pcl_state_nonpage_exceptions(pxs);
                     if (code < 0)
                         return code;
@@ -294,7 +282,7 @@ pxPassthrough(px_args_t * par, px_state_t * pxs)
     /* set pcl data stream pointers to xl's and process this batch of data. */
     r.ptr = par->source.data - 1;
     r.limit = par->source.data + par->source.available - 1;
-    code = pcl_process(&global_pcl_parser_state, pxs->pcs, &r);
+    code = pcl_process(&pxs->pcl_parser_state, pxs->pcs, &r);
     /* updata xl's parser position to reflect what pcl has consumed. */
     used = (r.ptr + 1 - par->source.data);
     par->source.available -= used;
@@ -322,7 +310,7 @@ pxPassthrough(px_args_t * par, px_state_t * pxs)
 void
 pxpcl_pagestatereset(px_state_t* pxs)
 {
-    global_pass_first = true;
+    pxs->pass_first = true;
     if (pxs->pcs) {
         pxs->pcs->xfm_state.left_offset_cp = 0.0;
         pxs->pcs->xfm_state.top_offset_cp = 0.0;
@@ -345,8 +333,8 @@ pxpcl_release(px_state_t * pxs)
         pxs->pcs->end_page = pcl_end_page_top;        /* pcl_end_page handling */
         pxpcl_pagestatereset(pxs);
         pxs->pcs = NULL;
-        global_this_pass_contiguous = false;
-        global_pass_first = true;
+        pxs->this_pass_contiguous = false;
+        pxs->pass_first = true;
         global_char_angle = 0;
         global_char_shear.x = 0;
         global_char_shear.y = 0;
@@ -358,9 +346,9 @@ pxpcl_release(px_state_t * pxs)
 
 /* the pxl parser must give us this information */
 void
-pxpcl_passthroughcontiguous(bool cont)
+pxpcl_passthroughcontiguous(px_state_t * pxs, bool cont)
 {
-    global_this_pass_contiguous = cont;
+    pxs->this_pass_contiguous = cont;
 }
 
 /* copy state from pcl to pxl after a non-snippet passthrough
@@ -399,18 +387,18 @@ pxpcl_selectfont(px_args_t * par, px_state_t * pxs)
         pxPassthrough_init(pxs);
 
     /* this is the first passthrough on this page */
-    if (global_pass_first) {
+    if (pxs->pass_first) {
         code = pxPassthrough_setpagestate(pxs);
         if (code < 0)
             return code;
         code = pxPassthrough_pcl_state_nonpage_exceptions(pxs);
         if (code < 0)
             return code;
-        global_pass_first = false;
+        pxs->pass_first = false;
     } else {
         /* there was a previous passthrough check if there were
            any intervening XL commands */
-        if (global_this_pass_contiguous == false) {
+        if (pxs->this_pass_contiguous == false) {
             code = pxPassthrough_pcl_state_nonpage_exceptions(pxs);
             if (code < 0)
                 return code;
@@ -419,7 +407,7 @@ pxpcl_selectfont(px_args_t * par, px_state_t * pxs)
     r.ptr = str - 1;
     r.limit = str + len - 1;
 
-    code = pcl_process(&global_pcl_parser_state, pxs->pcs, &r);
+    code = pcl_process(&pxs->pcl_parser_state, pxs->pcs, &r);
     if (code < 0)
         return code;
 
diff --git a/pcl/pxl/pxpthr.h b/pcl/pxl/pxpthr.h
index 21c3aa0..fe443f6 100644
--- a/pcl/pxl/pxpthr.h
+++ b/pcl/pxl/pxpthr.h
@@ -21,7 +21,7 @@
 #  define pxpthr_INCLUDED
 
 /* set passthrough contiguous mode */
-void pxpcl_passthroughcontiguous(bool contiguous);
+void pxpcl_passthroughcontiguous(px_state_t * pxs, bool contiguous);
 
 /* end passthrough contiguous mode */
 void pxpcl_endpassthroughcontiguous(px_state_t * pxs);
diff --git a/pcl/pxl/pxstate.c b/pcl/pxl/pxstate.c
index 0f8d445..a5f03ea 100644
--- a/pcl/pxl/pxstate.c
+++ b/pcl/pxl/pxstate.c
@@ -51,6 +51,8 @@ px_state_alloc(gs_memory_t * memory)
         goto fail;
 
     pxs->pcs = NULL;
+    pxs->this_pass_contiguous = false;
+    pxs->pass_first = true;
 
     return pxs;
 
diff --git a/pcl/pxl/pxstate.h b/pcl/pxl/pxstate.h
index 28dfd70..ed5bbaf 100644
--- a/pcl/pxl/pxstate.h
+++ b/pcl/pxl/pxstate.h
@@ -26,6 +26,9 @@
 #include "gslibctx.h"
 #include "gxtext.h"
 
+#include "pcparse.h"
+#include "pgmand.h"
+
 /* Define an abstract type for an image enumerator. */
 #ifndef px_image_enum_DEFINED
 #  define px_image_enum_DEFINED
@@ -161,6 +164,17 @@ struct px_state_s
     pl_interp_implementation_t *pcls;
 
     struct pcl_state_s *pcs;
+
+    pcl_parser_state_t  pcl_parser_state;
+
+    hpgl_parser_state_t gl_parser_state;
+
+    /* if this is a contiguous passthrough meaning that 2 passtrough
+       operators have been given back to back and pxl should not regain
+       control. */
+    bool                this_pass_contiguous;
+
+    bool                pass_first;
 };
 
 /* Allocate a px_state_t. */

----------------------------------------------------------------------
commit d48555f7777a983e0d15972f3838bb5583e20657
Author: Julian Smith <[email protected]>
Date:   Wed Nov 20 17:39:58 2019 +0000

    Bug 701932: moved global_pcs into px_state_s.

diff --git a/pcl/pxl/pxpthr.c b/pcl/pxl/pxpthr.c
index f103fc3..73c2dac 100644
--- a/pcl/pxl/pxpthr.c
+++ b/pcl/pxl/pxpthr.c
@@ -44,7 +44,6 @@
 
 /* NB - globals needing cleanup
  */
-static pcl_state_t *global_pcs = NULL;
 
 static pcl_parser_state_t global_pcl_parser_state;
 
@@ -66,9 +65,9 @@ float global_char_bold_value;
 float global_char_angle;
 
 /* forward decl */
-void pxpcl_release(void);
+void pxpcl_release(px_state_t* pxs);
 
-void pxpcl_pagestatereset(void);
+void pxpcl_pagestatereset(px_state_t* pxs);
 
 /* NB: tests for this function are used to flag pxl snippet mode
  */
@@ -89,7 +88,7 @@ pxPassthrough_pcl_state_nonpage_exceptions(px_state_t * pxs)
 
     /* make the pcl ctm active, after resets the hpgl/2 ctm is
        active. */
-    code = pcl_set_graphics_state(global_pcs);
+    code = pcl_set_graphics_state(pxs->pcs);
     if (code < 0) {
         return code;
     }
@@ -100,25 +99,25 @@ pxPassthrough_pcl_state_nonpage_exceptions(px_state_t * pxs)
        state initialization - pcl's origin */
     if (gs_currentpoint(pxs->pgs, &xlcp) ||
         gs_transform(pxs->pgs, xlcp.x, xlcp.y, &dp) ||
-        gs_itransform(global_pcs->pgs, dp.x, dp.y, &pclcp)) {
-        global_pcs->cap.x = 0;
-        global_pcs->cap.y = inch2coord(2.0 / 6.0);      /* 1/6" off by 2x in resolution. */
+        gs_itransform(pxs->pcs->pgs, dp.x, dp.y, &pclcp)) {
+        pxs->pcs->cap.x = 0;
+        pxs->pcs->cap.y = inch2coord(2.0 / 6.0);      /* 1/6" off by 2x in resolution. */
         if (gs_debug_c('i'))
             dmprintf2(pxs->memory,
                       "passthrough: changing cap NO currentpoint (%d, %d) \n",
-                      global_pcs->cap.x, global_pcs->cap.y);
+                      pxs->pcs->cap.x, pxs->pcs->cap.y);
     } else {
         if (gs_debug_c('i'))
             dmprintf8(pxs->memory,
                       "passthrough: changing cap from (%d,%d) (%d,%d) (%d, %d) (%d, %d) \n",
-                      global_pcs->cap.x, global_pcs->cap.y, (coord) xlcp.x,
+                      pxs->pcs->cap.x, pxs->pcs->cap.y, (coord) xlcp.x,
                       (coord) xlcp.y, (coord) dp.x, (coord) dp.y,
                       (coord) pclcp.x, (coord) pclcp.y);
-        global_pcs->cap.x = (coord) pclcp.x;
-        global_pcs->cap.y = (coord) pclcp.y;
+        pxs->pcs->cap.x = (coord) pclcp.x;
+        pxs->pcs->cap.y = (coord) pclcp.y;
     }
-    if (global_pcs->underline_enabled)
-        global_pcs->underline_start = global_pcs->cap;
+    if (pxs->pcs->underline_enabled)
+        pxs->pcs->underline_start = pxs->pcs->cap;
 
 
     global_char_angle = pxs->pxgs->char_angle;
@@ -139,25 +138,25 @@ pxPassthrough_init(px_state_t * pxs)
 
     if (gs_debug_c('i'))
         dmprintf(pxs->memory, "passthrough: initializing global pcl state\n");
-    global_pcs = pcl_get_gstate(pxs->pcls);
+    pxs->pcs = pcl_get_gstate(pxs->pcls);
 
     if (pxs->have_page) {
         if (gs_debug_c('i'))
             dmprintf(pxs->memory, "passthrough: snippet mode\n");
         /* disable an end page in pcl, also used to flag in snippet mode */
-        global_pcs->end_page = pcl_end_page_noop;
+        pxs->pcs->end_page = pcl_end_page_noop;
     }
 
     /* default to pcl5c */
-    global_pcs->personality = 0;
+    pxs->pcs->personality = 0;
     /* for now we do not support intepolation in XL passthrough mode. */
-    global_pcs->interpolate = false;
+    pxs->pcs->interpolate = false;
     /* we don't see a nice way to support the following options with
        passthrough at this time (NB) */
-    global_pcs->page_set_on_command_line = false;
-    global_pcs->res_set_on_command_line = false;
-    global_pcs->high_level_device = false;
-    global_pcs->scanconverter = GS_SCANCONVERTER_DEFAULT;
+    pxs->pcs->page_set_on_command_line = false;
+    pxs->pcs->res_set_on_command_line = false;
+    pxs->pcs->high_level_device = false;
+    pxs->pcs->scanconverter = GS_SCANCONVERTER_DEFAULT;
 
     {
         char buf[100];
@@ -177,26 +176,26 @@ pxPassthrough_init(px_state_t * pxs)
     /* do an initial reset to set up a permanent reset.  The
        motivation here is to avoid tracking down a slew of memory
        leaks */
-    global_pcs->xfm_state.paper_size = pcl_get_default_paper(global_pcs);
-    pcl_do_resets(global_pcs, pcl_reset_initial);
-    pcl_do_resets(global_pcs, pcl_reset_permanent);
+    pxs->pcs->xfm_state.paper_size = pcl_get_default_paper(pxs->pcs);
+    pcl_do_resets(pxs->pcs, pcl_reset_initial);
+    pcl_do_resets(pxs->pcs, pcl_reset_permanent);
 
     /* initialize pcl and install xl's page device in pcl's state */
-    pcl_init_state(global_pcs, pxs->memory);
-    code = gs_setdevice_no_erase(global_pcs->pgs, gs_currentdevice(pxs->pgs));
+    pcl_init_state(pxs->pcs, pxs->memory);
+    code = gs_setdevice_no_erase(pxs->pcs->pgs, gs_currentdevice(pxs->pgs));
     if (code < 0)
         return code;
 
     /* yet another reset with the new page device */
-    global_pcs->xfm_state.paper_size = pcl_get_default_paper(global_pcs);
-    pcl_do_resets(global_pcs, pcl_reset_initial);
+    pxs->pcs->xfm_state.paper_size = pcl_get_default_paper(pxs->pcs);
+    pcl_do_resets(pxs->pcs, pcl_reset_initial);
     /* set the parser state and initialize the pcl parser */
-    global_pcl_parser_state.definitions = global_pcs->pcl_commands;
+    global_pcl_parser_state.definitions = pxs->pcs->pcl_commands;
     global_pcl_parser_state.hpgl_parser_state = &global_gl_parser_state;
-    pcl_process_init(&global_pcl_parser_state, global_pcs);
+    pcl_process_init(&global_pcl_parser_state, pxs->pcs);
     /* default 600 to match XL allow PCL to override */
-    global_pcs->uom_cp = 7200L / 600L;
-    return gs_setgray(global_pcs->pgs, 0);
+    pxs->pcs->uom_cp = 7200L / 600L;
+    return gs_setgray(pxs->pcs->pgs, 0);
 }
 
 static int
@@ -210,27 +209,27 @@ pxPassthrough_setpagestate(px_state_t * pxs)
         if (gs_debug_c('i'))
             dmprintf(pxs->memory, "passthrough: snippet mode\n");
         /* disable an end page in pcl, also used to flag in snippet mode */
-        global_pcs->end_page = pcl_end_page_noop;
+        pxs->pcs->end_page = pcl_end_page_noop;
         /* set the page size and orientation.  Really just sets
            the page tranformation does not feed a page (see noop
            above) */
-        code = pcl_new_logical_page_for_passthrough(global_pcs,
+        code = pcl_new_logical_page_for_passthrough(pxs->pcs,
                                              (int)pxs->orientation,
                                              &pxs->media_dims);
 
         if (gs_debug_c('i'))
             dmprintf2(pxs->memory,
                       "passthrough: snippet mode changing orientation from %d to %d\n",
-                      global_pcs->xfm_state.lp_orient, (int)pxs->orientation);
+                      pxs->pcs->xfm_state.lp_orient, (int)pxs->orientation);
 
     } else {                    /* not snippet mode - full page mode */
         /* pcl can feed the page and presumedely pcl commands will
            be used to set pcl's state. */
-        global_pcs->end_page = pcl_end_page_top;
+        pxs->pcs->end_page = pcl_end_page_top;
         /* clean the pcl page if it was marked by a previous snippet
            and set to full page mode. */
-        global_pcs->page_marked = 0;
-        code = pcl_new_logical_page_for_passthrough(global_pcs,
+        pxs->pcs->page_marked = 0;
+        code = pcl_new_logical_page_for_passthrough(pxs->pcs,
                                              (int)pxs->orientation,
                                              &pxs->media_dims);
         if (gs_debug_c('i'))
@@ -266,7 +265,7 @@ pxPassthrough(px_args_t * par, px_state_t * pxs)
                 dmprintf(pxs->memory,
                          "passthrough starting getting more data\n");
 
-            if (!global_pcs)
+            if (!pxs->pcs)
                 pxPassthrough_init(pxs);
 
             /* this is the first passthrough on this page */
@@ -295,7 +294,7 @@ pxPassthrough(px_args_t * par, px_state_t * pxs)
     /* set pcl data stream pointers to xl's and process this batch of data. */
     r.ptr = par->source.data - 1;
     r.limit = par->source.data + par->source.available - 1;
-    code = pcl_process(&global_pcl_parser_state, global_pcs, &r);
+    code = pcl_process(&global_pcl_parser_state, pxs->pcs, &r);
     /* updata xl's parser position to reflect what pcl has consumed. */
     used = (r.ptr + 1 - par->source.data);
     par->source.available -= used;
@@ -321,31 +320,31 @@ pxPassthrough(px_args_t * par, px_state_t * pxs)
 }
 
 void
-pxpcl_pagestatereset()
+pxpcl_pagestatereset(px_state_t* pxs)
 {
     global_pass_first = true;
-    if (global_pcs) {
-        global_pcs->xfm_state.left_offset_cp = 0.0;
-        global_pcs->xfm_state.top_offset_cp = 0.0;
-        global_pcs->margins.top = 0;
-        global_pcs->margins.left = 0;
+    if (pxs->pcs) {
+        pxs->pcs->xfm_state.left_offset_cp = 0.0;
+        pxs->pcs->xfm_state.top_offset_cp = 0.0;
+        pxs->pcs->margins.top = 0;
+        pxs->pcs->margins.left = 0;
     }
 }
 
 void
-pxpcl_release(void)
+pxpcl_release(px_state_t * pxs)
 {
-    if (global_pcs) {
+    if (pxs->pcs) {
         if (gs_debug_c('i'))
-            dmprintf(global_pcs->memory,
+            dmprintf(pxs->pcs->memory,
                      "passthrough: releasing global pcl state\n");
-        pcl_grestore(global_pcs);
-        gs_grestore_only(global_pcs->pgs);
-        gs_nulldevice(global_pcs->pgs);
-        pcl_do_resets(global_pcs, pcl_reset_permanent);
-        global_pcs->end_page = pcl_end_page_top;        /* pcl_end_page handling */
-        pxpcl_pagestatereset();
-        global_pcs = NULL;
+        pcl_grestore(pxs->pcs);
+        gs_grestore_only(pxs->pcs->pgs);
+        gs_nulldevice(pxs->pcs->pgs);
+        pcl_do_resets(pxs->pcs, pcl_reset_permanent);
+        pxs->pcs->end_page = pcl_end_page_top;        /* pcl_end_page handling */
+        pxpcl_pagestatereset(pxs);
+        pxs->pcs = NULL;
         global_this_pass_contiguous = false;
         global_pass_first = true;
         global_char_angle = 0;
@@ -369,12 +368,12 @@ pxpcl_passthroughcontiguous(bool cont)
 void
 pxpcl_endpassthroughcontiguous(px_state_t * pxs)
 {
-    if (global_pcs->end_page == pcl_end_page_top &&
-        global_pcs->page_marked &&
-        pxs->orientation != global_pcs->xfm_state.lp_orient) {
+    if (pxs->pcs->end_page == pcl_end_page_top &&
+        pxs->pcs->page_marked &&
+        pxs->orientation != pxs->pcs->xfm_state.lp_orient) {
 
         /* end of pcl whole job; need to reflect pcl orientation changes */
-        pxs->orientation = global_pcs->xfm_state.lp_orient;
+        pxs->orientation = pxs->pcs->xfm_state.lp_orient;
         pxBeginPageFromPassthrough(pxs);
     }
 
@@ -396,7 +395,7 @@ pxpcl_selectfont(px_args_t * par, px_state_t * pxs)
     px_gstate_t *pxgs = pxs->pxgs;
     pcl_font_selection_t *pfp;
 
-    if (!global_pcs)
+    if (!pxs->pcs)
         pxPassthrough_init(pxs);
 
     /* this is the first passthrough on this page */
@@ -420,19 +419,19 @@ pxpcl_selectfont(px_args_t * par, px_state_t * pxs)
     r.ptr = str - 1;
     r.limit = str + len - 1;
 
-    code = pcl_process(&global_pcl_parser_state, global_pcs, &r);
+    code = pcl_process(&global_pcl_parser_state, pxs->pcs, &r);
     if (code < 0)
         return code;
 
-    code = pcl_recompute_font(global_pcs, false);       /* select font */
+    code = pcl_recompute_font(pxs->pcs, false);       /* select font */
     if (code < 0)
         return code;
 
-    code = gs_setfont(pxs->pgs, global_pcs->font->pfont);
+    code = gs_setfont(pxs->pgs, pxs->pcs->font->pfont);
     if (code < 0)
         return code;
 
-    pfp = &global_pcs->font_selection[global_pcs->font_selected];
+    pfp = &pxs->pcs->font_selection[pxs->pcs->font_selected];
 
     {
 #define CP_PER_INCH         (7200.0)
@@ -448,20 +447,20 @@ pxpcl_selectfont(px_args_t * par, px_state_t * pxs)
 
         gs_point sz;
 
-        pcl_font_scale(global_pcs, &sz);
+        pcl_font_scale(pxs->pcs, &sz);
         pxgs->char_size = sz.x /
             centipoints_per_measure[pxs->measure] * pxs->units_per_measure.x;
     }
     pxgs->symbol_set = pfp->params.symbol_set;
 
-    if (pcl_downloaded_and_bound(global_pcs->font)) {
+    if (pcl_downloaded_and_bound(pxs->pcs->font)) {
         pxgs->symbol_map = 0;
     } else {
-        px_set_symbol_map(pxs, global_pcs->font->font_type == plft_16bit);
+        px_set_symbol_map(pxs, pxs->pcs->font->font_type == plft_16bit);
     }
 
     {
-        pl_font_t *plf = global_pcs->font;
+        pl_font_t *plf = pxs->pcs->font;
 
         /* unfortunately the storage identifier is inconsistent
            between PCL and PCL XL, NB we should use the pxfont.h
diff --git a/pcl/pxl/pxpthr.h b/pcl/pxl/pxpthr.h
index 881ffbb..21c3aa0 100644
--- a/pcl/pxl/pxpthr.h
+++ b/pcl/pxl/pxpthr.h
@@ -27,10 +27,10 @@ void pxpcl_passthroughcontiguous(bool contiguous);
 void pxpcl_endpassthroughcontiguous(px_state_t * pxs);
 
 /* reset pcl's page */
-void pxpcl_pagestatereset(void);
+void pxpcl_pagestatereset(px_state_t* pxs);
 
 /* release the passthrough state */
-void pxpcl_release(void);
+void pxpcl_release(px_state_t* pxs);
 
 /* set variables in pcl's state that are special to pass through mode,
    these override the default pcl state variables when pcl is
diff --git a/pcl/pxl/pxsessio.c b/pcl/pxl/pxsessio.c
index 0102ac5..ce4b82d 100644
--- a/pcl/pxl/pxsessio.c
+++ b/pcl/pxl/pxsessio.c
@@ -146,7 +146,7 @@ px_end_page_cleanup(px_state_t * pxs)
     pxPopGS(NULL, pxs);
     pxNewPath(NULL, pxs);
     px_purge_pattern_cache(pxs, ePagePattern);
-    pxpcl_pagestatereset();
+    pxpcl_pagestatereset(pxs);
 }
 
 /* Purge all */
@@ -187,7 +187,7 @@ px_end_session_cleanup(px_state_t * pxs)
     px_dict_release(&pxs->stream_dict);
     /* delete downloaded fonts on end of session */
     px_dict_release(&pxs->font_dict);
-    pxpcl_release();
+    pxpcl_release(pxs);
 }
 
 /* ---------------- Non-operator procedures ---------------- */
diff --git a/pcl/pxl/pxstate.c b/pcl/pxl/pxstate.c
index 1bc68cc..0f8d445 100644
--- a/pcl/pxl/pxstate.c
+++ b/pcl/pxl/pxstate.c
@@ -50,6 +50,8 @@ px_state_alloc(gs_memory_t * memory)
     if (pxs->font_dir == 0)
         goto fail;
 
+    pxs->pcs = NULL;
+
     return pxs;
 
 fail:
diff --git a/pcl/pxl/pxstate.h b/pcl/pxl/pxstate.h
index 977d1d8..28dfd70 100644
--- a/pcl/pxl/pxstate.h
+++ b/pcl/pxl/pxstate.h
@@ -159,6 +159,8 @@ struct px_state_s
     pl_interp_implementation_t *pjls;
     /* ---------------- PCL state -------------------- */
     pl_interp_implementation_t *pcls;
+
+    struct pcl_state_s *pcs;
 };
 
 /* Allocate a px_state_t. */

----------------------------------------------------------------------
commit 4db291eb31b4dc8c6864e438acdd9283c3347671
Author: Julian Smith <[email protected]>
Date:   Wed Nov 20 12:42:16 2019 +0000

    Coverity 350170: cope with -ve from gs_vsprintf().

diff --git a/pcl/pcl/pcstatus.c b/pcl/pcl/pcstatus.c
index 5e6d0b4..afffdd4 100644
--- a/pcl/pcl/pcstatus.c
+++ b/pcl/pcl/pcstatus.c
@@ -71,13 +71,16 @@ stputs(stream * s, const char *str)
 static void
 stprintf(stream * s, const char *fmt, ...)
 {
-    uint count;
+    int count;
     va_list args;
     char buf[1024];
 
     va_start(args, fmt);
     count = gs_vsprintf(buf, fmt, args);
-    sputs(s, (const byte *)buf, count, &count);
+    if (count >= 0) {
+        unsigned count_u = count;
+        sputs(s, (const byte *)buf, count_u, &count_u);
+    }
     va_end(args);
 }
 


Summary of changes:
 Makefile.in                  |   3 +
 base/gp.h                    |   6 +-
 base/lib.mak                 |  28 +++---
 base/mkromfs.c               |  69 ++++++++------
 configure.ac                 |  29 ++++++
 contrib/gdevhl12.c           |   2 +-
 contrib/japanese/gdevp201.c  |   2 +-
 cups/gdevcups.c              |   2 +-
 devices/gdevmgr.c            |   1 -
 jbig2dec/jbig2.c             |   2 +-
 jbig2dec/jbig2_generic.c     |   2 +-
 jbig2dec/jbig2_priv.h        |   6 +-
 jbig2dec/jbig2_segment.c     |   2 +-
 jbig2dec/jbig2_symbol_dict.c |  10 +-
 pcl/pcl/pcstatus.c           |   7 +-
 pcl/pcl/pgconfig.c           |   2 +-
 pcl/pcl/rtraster.c           |   6 +-
 pcl/pxl/pxl.mak              |   2 +-
 pcl/pxl/pxparse.c            |   2 +-
 pcl/pxl/pxpthr.c             | 218 +++++++++++++++++++------------------------
 pcl/pxl/pxpthr.h             |   6 +-
 pcl/pxl/pxsessio.c           |   4 +-
 pcl/pxl/pxstate.c            |   4 +
 pcl/pxl/pxstate.h            |  24 +++++
 24 files changed, 250 insertions(+), 189 deletions(-)