diff -uNr ghostscript-9.16.orig/base/gdevdgbr.c ghostscript-9.16/base/gdevdgbr.c
--- ghostscript-9.16.orig/base/gdevdgbr.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/gdevdgbr.c	2015-04-06 15:12:14.000000000 -0400
@@ -82,7 +82,7 @@
                  dev->color_info.depth : dev->color_info.num_components);
 
         if (!(requested->options & GB_SELECT_PLANES) ||
-            !(both & (GB_PACKING_PLANAR || GB_PACKING_BIT_PLANAR))
+            !(both & (GB_PACKING_PLANAR | GB_PACKING_BIT_PLANAR))
             )
             return false;
         for (i = 0; i < n; ++i)
diff -uNr ghostscript-9.16.orig/base/gscspace.c ghostscript-9.16/base/gscspace.c
--- ghostscript-9.16.orig/base/gscspace.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/gscspace.c	2015-04-06 15:09:58.000000000 -0400
@@ -166,7 +166,7 @@
 gs_cspace_new_ICC(gs_memory_t *pmem, gs_state * pgs, int components)
 {
     gsicc_manager_t *icc_manage = pgs->icc_manager;
-    int code;
+    int code = 0;
     gs_color_space *pcspace = gs_cspace_alloc(pmem, &gs_color_space_type_ICC);
 
     switch (components) {
diff -uNr ghostscript-9.16.orig/base/gsicc.c ghostscript-9.16/base/gsicc.c
--- ghostscript-9.16.orig/base/gsicc.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/gsicc.c	2015-04-06 14:59:14.000000000 -0400
@@ -468,6 +468,8 @@
     cmm_dev_profile_t *dev_profile;
 
     code = dev_proc(dev, get_profile)(dev, &dev_profile);
+    if (dev_profile == NULL)
+        return gs_throw(gs_error_Fatal, "Attempting to do ICC remap with no profile");
     num_des_comps = gsicc_get_device_profile_comps(dev_profile);
     rendering_params.black_point_comp = pis->blackptcomp;
     rendering_params.graphics_type_tag = dev->graphics_type_tag;
diff -uNr ghostscript-9.16.orig/base/gsptype1.c ghostscript-9.16/base/gsptype1.c
--- ghostscript-9.16.orig/base/gsptype1.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/gsptype1.c	2015-04-06 15:00:33.000000000 -0400
@@ -1994,7 +1994,7 @@
     int64_t offset1 = offset;
     gx_color_tile *ptile;
     int code, l;
-    tile_trans_clist_info_t trans_info = { 0 };
+    tile_trans_clist_info_t trans_info = {{{0}}};
     int cache_space_needed;
 
     if (offset == 0) {
diff -uNr ghostscript-9.16.orig/base/gxcmap.c ghostscript-9.16/base/gxcmap.c
--- ghostscript-9.16.orig/base/gxcmap.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/gxcmap.c	2015-04-06 15:10:47.000000000 -0400
@@ -551,7 +551,7 @@
 gx_remap_color(gs_state * pgs)
 {
     const gs_color_space *pcs = gs_currentcolorspace_inline(pgs);
-    int                   code;
+    int                   code = 0;
 
     /* The current color in the graphics state is always used for */
     /* the texture, never for the source. */
diff -uNr ghostscript-9.16.orig/base/gxiscale.c ghostscript-9.16/base/gxiscale.c
--- ghostscript-9.16.orig/base/gxiscale.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/gxiscale.c	2015-04-06 15:47:40.000000000 -0400
@@ -914,8 +914,8 @@
     }
     /* Go ahead and take apart any indexed color space or do the decode
        so that we can then perform the interpolation or color management */
-    need_decode = !((penum->device_color || penum->icc_setup.is_lab) &&
-                     (penum->icc_setup.need_decode == 0) ||
+    need_decode = !(((penum->device_color || penum->icc_setup.is_lab) &&
+                     (penum->icc_setup.need_decode == 0)) ||
                      gs_color_space_is_CIE(pcs));
     initial_decode(penum, buffer, data_x, h, need_decode, &stream_r, true);
     /*
@@ -1323,8 +1323,8 @@
      * OR gs_color_space_is_CIE(pcs) == 0 (i.e. we have indexed/sep or devn)
      * FIXME: Understand this! Michael says change the second || to && maybe.
      */
-    need_decode = !((penum->device_color || penum->icc_setup.is_lab) &&
-                     (penum->icc_setup.need_decode == 0) ||
+    need_decode = !(((penum->device_color || penum->icc_setup.is_lab) &&
+                     (penum->icc_setup.need_decode == 0)) ||
                      gs_color_space_is_CIE(pcs));
     initial_decode(penum, buffer, data_x, h, need_decode, &stream_r, true);
     /*
diff -uNr ghostscript-9.16.orig/base/gxpcolor.h ghostscript-9.16/base/gxpcolor.h
--- ghostscript-9.16.orig/base/gxpcolor.h	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/gxpcolor.h	2015-04-06 14:59:14.000000000 -0400
@@ -20,6 +20,7 @@
 #ifndef gxpcolor_INCLUDED
 #  define gxpcolor_INCLUDED
 
+#include "gxdcolor.h"
 #include "gspcolor.h"
 #include "gxcspace.h"
 #include "gxdevice.h"
diff -uNr ghostscript-9.16.orig/base/gxstroke.c ghostscript-9.16/base/gxstroke.c
--- ghostscript-9.16.orig/base/gxstroke.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/gxstroke.c	2015-04-06 15:26:15.000000000 -0400
@@ -1715,8 +1715,8 @@
              * line segments generated from arcs to be round. This would
              * solve some flatness issues, but makes some pathological
              * cases incredibly slow. */
-            if ((join == gs_join_round)
-                /* || (flags & nf_all_from_arc) */) {
+            if (join == gs_join_round)
+                /* || (flags & nf_all_from_arc) ) */ {
                 code = add_pie_join_fast_ccw(ppath, plp, nplp, reflected);
             } else { /* non-round join */
                 code = line_join_points_fast_ccw(pgs_lp, plp, nplp,
@@ -1755,8 +1755,8 @@
              * line segments generated from arcs to be round. This would
              * solve some flatness issues, but makes some pathological
              * cases incredibly slow. */
-            if ((join == gs_join_round)
-                /* || (flags & nf_all_from_arc) */) {
+            if (join == gs_join_round)
+                /* || (flags & nf_all_from_arc) ) */ {
                 code = add_pie_join_fast_cw(rpath, plp, nplp, reflected);
             } else { /* non-round join */
                 code = line_join_points_fast_cw(pgs_lp, plp, nplp,
diff -uNr ghostscript-9.16.orig/base/mkromfs.c ghostscript-9.16/base/mkromfs.c
--- ghostscript-9.16.orig/base/mkromfs.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/mkromfs.c	2015-04-06 14:59:14.000000000 -0400
@@ -2329,7 +2329,7 @@
 #endif
     fprintf(out,"\n#include \"stdint_.h\"\n");
     fprintf(out,"\n#include \"time_.h\"\n\n");
-    fprintf(out,"    time_t gs_romfs_buildtime = %ld;\n\n", time(NULL));
+    fprintf(out,"    time_t gs_romfs_buildtime = %lld;\n\n", (long long)time(NULL));
 
     /* process the remaining arguments (options interspersed with paths) */
     for (; atarg < argc; atarg++) {
diff -uNr ghostscript-9.16.orig/base/unistd_.h ghostscript-9.16/base/unistd_.h
--- ghostscript-9.16.orig/base/unistd_.h	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/base/unistd_.h	2015-04-06 15:15:05.000000000 -0400
@@ -53,7 +53,9 @@
    /* _XOPEN_SOURCE 500 define is needed to get
     * access to pread and pwrite */
 #  define _XOPEN_SOURCE 500
-#  define __USE_UNIX98
+#if !defined(__USE_UNIX98)
+#    define __USE_UNIX98
+# endif
 #  include <unistd.h>
 #endif
 
diff -uNr ghostscript-9.16.orig/configure ghostscript-9.16/configure
--- ghostscript-9.16.orig/configure	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/configure	2015-04-06 14:59:14.000000000 -0400
@@ -846,6 +846,7 @@
 LIBS
 CPPFLAGS
 CPP
+CPPFLAGS
 XMKMF'
 
 
@@ -6511,7 +6512,7 @@
 $as_echo_n "checking for local zlib source... " >&6; }
 # we must define ZLIBDIR regardless because png.mak does a -I$(ZLIBDIR)
 # this seems a harmless default
-ZLIBDIR=src
+ZLIBDIR=$oldincludedir
 AUX_SHARED_ZLIB=
 
 if test -d $srcdir/zlib; then
diff -uNr ghostscript-9.16.orig/configure.ac ghostscript-9.16/configure.ac
--- ghostscript-9.16.orig/configure.ac	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/configure.ac	2015-04-06 14:59:14.000000000 -0400
@@ -937,7 +937,7 @@
 dnl zlib is needed for language level 3, and libpng
 # we must define ZLIBDIR regardless because png.mak does a -I$(ZLIBDIR)
 # this seems a harmless default
-ZLIBDIR=src
+ZLIBDIR=$oldincludedir
 AUX_SHARED_ZLIB=
 
 if test -d $srcdir/zlib; then
diff -uNr ghostscript-9.16.orig/contrib/gdevhl12.c ghostscript-9.16/contrib/gdevhl12.c
--- ghostscript-9.16.orig/contrib/gdevhl12.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/contrib/gdevhl12.c	2015-04-06 15:02:21.000000000 -0400
@@ -481,7 +481,7 @@
         break;
     }
     if (s->out_count) {
-        fprintf(prn_stream, "\033*b%uW", s->out_count * sizeof(u16) + 9);
+        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 -uNr ghostscript-9.16.orig/contrib/japanese/gdevlbp3.c ghostscript-9.16/contrib/japanese/gdevlbp3.c
--- ghostscript-9.16.orig/contrib/japanese/gdevlbp3.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/contrib/japanese/gdevlbp3.c	2015-04-06 15:07:56.000000000 -0400
@@ -82,7 +82,7 @@
 
         /* ----==== Set size ====---- */
         gs_sprintf((char *)Buf, "0%ld", DataSize);
-        i = (DataSize+strlen(Buf)+1)&1;
+        i = (DataSize+strlen((const char *)Buf)+1)&1;
         /* ----==== escape to LIPS ====---- */
         fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
         fprintf(fp, "\x1bP0J\x1b\\");
@@ -111,7 +111,7 @@
 
         /* ----==== Set size ====---- */
         gs_sprintf((char *)Buf, "000%ld", DataSize);
-        i = (DataSize+strlen(Buf)+1)&3;
+        i = (DataSize+strlen((const char *)Buf)+1)&3;
         /* ----==== escape to LIPS ====---- */
         fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
         fprintf(fp, "\x1bP0J\x1b\\");
diff -uNr ghostscript-9.16.orig/contrib/pcl3/eprn/eprnfs.c ghostscript-9.16/contrib/pcl3/eprn/eprnfs.c
--- ghostscript-9.16.orig/contrib/pcl3/eprn/eprnfs.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/contrib/pcl3/eprn/eprnfs.c	2015-04-06 15:05:55.000000000 -0400
@@ -255,7 +255,7 @@
 
     /* Distribute the approximation over the bit planes */
     for (plane = 0; plane < planes; plane++) {
-      *ptr[plane] = (*ptr[plane] << 1) | approx & 0x01;
+      *ptr[plane] = (*ptr[plane] << 1) | (approx & 0x01);
       approx >>= 1;
     }
 
@@ -527,7 +527,7 @@
     plane = 0;
     for (colorant = last_colorant; colorant >= 0; colorant--) {
       while (plane < next_plane[colorant]) {
-        *ptr[plane] = (*ptr[plane] << 1) | approx[colorant] & 0x01;
+        *ptr[plane] = (*ptr[plane] << 1) | (approx[colorant] & 0x01);
         approx[colorant] >>= 1;
         plane++;
       }
diff -uNr ghostscript-9.16.orig/contrib/pcl3/eprn/eprnparm.c ghostscript-9.16/contrib/pcl3/eprn/eprnparm.c
--- ghostscript-9.16.orig/contrib/pcl3/eprn/eprnparm.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/contrib/pcl3/eprn/eprnparm.c	2015-04-06 15:20:40.000000000 -0400
@@ -1161,7 +1161,7 @@
 
   /* RGBLevels */
   if ((rc = param_read_int(plist, (pname = "RGBLevels"), &temp)) == 0) {
-    if (temp == 0 || 2 <= temp && temp <= 256) {
+    if (temp == 0 || (2 <= temp && temp <= 256)) {
       if (eprn->non_black_levels != temp && dev->is_open) gs_closedevice(dev);
       eprn->non_black_levels = temp;
     }
@@ -1211,7 +1211,7 @@
 
   /* Process parameters defined by base classes (should occur after treating
      parameters defined for the derived class, see gsparam.h) */
-  if ((rc = gdev_prn_put_params(dev, plist)) < 0 || rc > 0 && last_error >= 0)
+  if ((rc = gdev_prn_put_params(dev, plist)) < 0 || (rc > 0 && last_error >= 0))
     last_error = rc;
 
   if (last_error < 0) return_error(last_error);
diff -uNr ghostscript-9.16.orig/contrib/pcl3/eprn/eprnrend.c ghostscript-9.16/contrib/pcl3/eprn/eprnrend.c
--- ghostscript-9.16.orig/contrib/pcl3/eprn/eprnrend.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/contrib/pcl3/eprn/eprnrend.c	2015-04-06 15:04:47.000000000 -0400
@@ -730,13 +730,13 @@
        */
       comp = pixel & comp_mask;	/* black */
       for (j = 0; j < black_planes; j++) {
-        *ptr[j] = (*ptr[j] << 1) | comp & 1;
+        *ptr[j] = (*ptr[j] << 1) | (comp & 1);
         comp >>= 1;
       }
       if (non_black_planes > 0) for (l = 1; l < 4; l++) {
         comp = (pixel >> l*dev->eprn.bits_per_colorant) & comp_mask;
         for (m = 0; m < non_black_planes; m++, j++) {
-          *ptr[j] = (*ptr[j] << 1) | comp & 1;
+          *ptr[j] = (*ptr[j] << 1) | (comp & 1);
           comp >>= 1;
         }
       }
@@ -819,13 +819,13 @@
     /* Split and distribute over planes */
     comp = pixel & comp_mask;	/* black */
     for (j = 0; j < black_planes; j++) {
-      *ptr[j] = (*ptr[j] << 1) | comp & 1;
+      *ptr[j] = (*ptr[j] << 1) | (comp & 1);
       comp >>= 1;
     }
     for (l = 1; l < 4; l++) {
       comp = (pixel >> l*dev->eprn.bits_per_colorant) & comp_mask;
       for (m = 0; m < non_black_planes; m++, j++) {
-        *ptr[j] = (*ptr[j] << 1) | comp & 1;
+        *ptr[j] = (*ptr[j] << 1) | (comp & 1);
         comp >>= 1;
       }
     }
@@ -953,7 +953,7 @@
     pixel = line[k];
 
     /* Split and distribute over planes */
-    *ptr[0] = (*ptr[0] << 1) | pixel & 0x01;
+    *ptr[0] = (*ptr[0] << 1) | (pixel & 0x01);
 #define assign_bit(index) \
         *ptr[index] = (*ptr[index] << 1) | (pixel >> index) & 0x01
     assign_bit(1);
diff -uNr ghostscript-9.16.orig/contrib/pcl3/src/gdevpcl3.c ghostscript-9.16/contrib/pcl3/src/gdevpcl3.c
--- ghostscript-9.16.orig/contrib/pcl3/src/gdevpcl3.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/contrib/pcl3/src/gdevpcl3.c	2015-04-06 15:21:35.000000000 -0400
@@ -1233,7 +1233,7 @@
   /* Process parameters defined by base classes (should occur after treating
      parameters defined for the derived class, see gsparam.h) */
   if ((rc = eprn_put_params(device, plist)) < 0 ||
-    rc > 0 && last_error >= 0) last_error = rc;
+    (rc > 0 && last_error >= 0)) last_error = rc;
 
   /* Act if the colour model was changed */
   if (previous_colour_model != dev->eprn.colour_model) set_palette(dev);
diff -uNr ghostscript-9.16.orig/contrib/pcl3/src/pclgen.c ghostscript-9.16/contrib/pcl3/src/pclgen.c
--- ghostscript-9.16.orig/contrib/pcl3/src/pclgen.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/contrib/pcl3/src/pclgen.c	2015-04-06 15:06:50.000000000 -0400
@@ -308,7 +308,7 @@
 
         /* Permissible characters are HT and the octets 32-255 with the
            exception of '"' (PJLTRM, with some corrections). */
-        while (*s != '\0' && (*s == '\t' || 32 <= *s && *s != '"')) s++;
+        while (*s != '\0' && (*s == '\t' || (32 <= *s && *s != '"'))) s++;
         if (*s != '\0') {
           fprintf(stderr,
             ERRPREF "Illegal character in PJL job name (code 0x%02X).\n", *s);
diff -uNr ghostscript-9.16.orig/contrib/pcl3/src/pclsize.c ghostscript-9.16/contrib/pcl3/src/pclsize.c
--- ghostscript-9.16.orig/contrib/pcl3/src/pclsize.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/contrib/pcl3/src/pclsize.c	2015-04-06 15:22:34.000000000 -0400
@@ -126,7 +126,7 @@
     initialized = TRUE;
   }
 
-  key.mc = ms_without_flags(code) | code & PCL_CARD_FLAG;
+  key.mc = ms_without_flags(code) | (code & PCL_CARD_FLAG);
   result = (const CodeEntry *)bsearch(&key, code_map, array_size(code_map),
     sizeof(CodeEntry), cmp_by_size);
 
diff -uNr ghostscript-9.16.orig/devices/gdevlp8k.c ghostscript-9.16/devices/gdevlp8k.c
--- ghostscript-9.16.orig/devices/gdevlp8k.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/devices/gdevlp8k.c	2015-04-06 15:08:41.000000000 -0400
@@ -358,8 +358,8 @@
         fwrite("\035",1,1,prn_stream);
         fprintf(prn_stream,"%d",lnum-60);
         fwrite("Y\035",1,2,prn_stream);
-        fprintf(prn_stream,"%d;",(outp - out));
-        fprintf(prn_stream,"%d;",(in_end - inp) << 3);
+        fprintf(prn_stream,"%ld;",(outp - out));
+        fprintf(prn_stream,"%ld;",(in_end - inp) << 3);
         fwrite("1;0bi{I",1,7,prn_stream);
         fwrite(out,1,(outp - out),prn_stream);
 
diff -uNr ghostscript-9.16.orig/devices/gdevpng.c ghostscript-9.16/devices/gdevpng.c
--- ghostscript-9.16.orig/devices/gdevpng.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/devices/gdevpng.c	2015-04-06 14:59:14.000000000 -0400
@@ -721,6 +721,7 @@
 
 #if PNG_LIBPNG_VER_MINOR < 5
 
+#if 0 /* not required in 1.5 */
 /*
  * Patch around a static reference to a never-used procedure.
  * This could be avoided if we were willing to edit pngconf.h to
@@ -741,6 +742,7 @@
 }
 #endif
 #endif
+#endif
 
 static int
 pngalpha_open(gx_device * pdev)
diff -uNr ghostscript-9.16.orig/devices/rinkj/rinkj-screen-eb.c ghostscript-9.16/devices/rinkj/rinkj-screen-eb.c
--- ghostscript-9.16.orig/devices/rinkj/rinkj-screen-eb.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/devices/rinkj/rinkj-screen-eb.c	2015-04-06 15:09:21.000000000 -0400
@@ -83,7 +83,7 @@
   int strengths4[] = { 128, 50, 50, 10 };
   int strengths6[] = { 128, 50, 50, 25, 25, 10 };
   int strengths7[] = { 128, 80, 50, 50, 25, 26, 10 };
-  int *strengths;
+  int *strengths = NULL;
 
   RinkjDeviceParams out_params;
 
diff -uNr ghostscript-9.16.orig/devices/vector/gdevpdfm.c ghostscript-9.16/devices/vector/gdevpdfm.c
--- ghostscript-9.16.orig/devices/vector/gdevpdfm.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/devices/vector/gdevpdfm.c	2015-04-06 15:17:50.000000000 -0400
@@ -861,7 +861,7 @@
             const gs_param_string *pair = &pairs[i];
 
             if (pdf_key_eq(pair, "/F")) {
-                code = sscanf((const char *)pair[1].data, "%ld", &Flags);
+                code = sscanf((const char *)pair[1].data, "%d", &Flags);
                 if (code != 1)
                     emprintf(pdev->memory,
                              "Annotation has an invalid /Flags attribute\n");
diff -uNr ghostscript-9.16.orig/psi/imainarg.c ghostscript-9.16/psi/imainarg.c
--- ghostscript-9.16.orig/psi/imainarg.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/psi/imainarg.c	2015-04-06 14:59:14.000000000 -0400
@@ -217,6 +217,11 @@
 #endif
         }
     }
+
+	code = gs_main_init1(minst);
+	if (code < 0)
+		return code;
+
     while ((arg = arg_next(&args, &code, minst->heap)) != 0) {
         switch (*arg) {
             case '-':
diff -uNr ghostscript-9.16.orig/psi/iutil.c ghostscript-9.16/psi/iutil.c
--- ghostscript-9.16.orig/psi/iutil.c	2015-03-30 04:21:24.000000000 -0400
+++ ghostscript-9.16/psi/iutil.c	2015-04-06 14:58:48.000000000 -0400
@@ -438,12 +438,12 @@
                 if (truncate) {
                     if (len - *prlen < 4 - skip)
                         return 1;
-                    memcpy(w.ptr + 1, "...)" + skip, 4 - skip);
+                    memcpy(w.ptr + 1, &"...)"[skip], 4 - skip);
                     *prlen += 4 - skip;
                 } else {
                     if (len - *prlen < 1 - skip)
                         return 1;
-                    memcpy(w.ptr + 1, ")" + skip, 1 - skip);
+                    memcpy(w.ptr + 1, &")"[skip], 1 - skip);
                     *prlen += 1 - skip;
                 }
             }
