Patch origin: in-house
Patch status: inffast.c part: submitted back to community without feedback
Patch status: deflate.c part: Solaris-specific; not suitable for upstream

--- zlib-1.2.8/zlib.h	2013-04-28 17:23:49.000000000 -0700
+++ zlib-1.2.8/zlib.h	2014-04-18 05:32:31.316290241 -0700
@@ -37,8 +37,8 @@
 extern "C" {
 #endif
 
-#define ZLIB_VERSION "1.2.8"
-#define ZLIB_VERNUM 0x1280
+#define ZLIB_VERSION "1.2.8-T4mods"
+#define ZLIB_VERNUM 0x128f
 #define ZLIB_VER_MAJOR 1
 #define ZLIB_VER_MINOR 2
 #define ZLIB_VER_REVISION 8
--- zlib-1.2.8/inffast.c	2013-03-24 22:47:59.000000000 -0700
+++ zlib-1.2.8/inffast.c	2014-02-28 01:57:57.075708259 -0800
@@ -87,7 +87,7 @@
     code const FAR *dcode;      /* local strm->distcode */
     unsigned lmask;             /* mask for first level of length codes */
     unsigned dmask;             /* mask for first level of distance codes */
-    code here;                  /* retrieved table entry */
+    code *here;                 /* retrieved table entry */
     unsigned op;                /* code bits, operation, extra bits, or */
                                 /*  window position, window bytes to copy */
     unsigned len;               /* match length, unused bytes */
@@ -124,20 +124,20 @@
             hold += (unsigned long)(PUP(in)) << bits;
             bits += 8;
         }
-        here = lcode[hold & lmask];
+        here = (code *)(&(lcode[hold & lmask]));
       dolen:
-        op = (unsigned)(here.bits);
+        op = (unsigned)(here->bits);
         hold >>= op;
         bits -= op;
-        op = (unsigned)(here.op);
+        op = (unsigned)(here->op);
         if (op == 0) {                          /* literal */
-            Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
+            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
                     "inflate:         literal '%c'\n" :
-                    "inflate:         literal 0x%02x\n", here.val));
-            PUP(out) = (unsigned char)(here.val);
+                    "inflate:         literal 0x%02x\n", here->val));
+            PUP(out) = (unsigned char)(here->val);
         }
         else if (op & 16) {                     /* length base */
-            len = (unsigned)(here.val);
+            len = (unsigned)(here->val);
             op &= 15;                           /* number of extra bits */
             if (op) {
                 if (bits < op) {
@@ -155,14 +155,14 @@
                 hold += (unsigned long)(PUP(in)) << bits;
                 bits += 8;
             }
-            here = dcode[hold & dmask];
+            here = (code *)(&(dcode[hold & dmask]));
           dodist:
-            op = (unsigned)(here.bits);
+            op = (unsigned)(here->bits);
             hold >>= op;
             bits -= op;
-            op = (unsigned)(here.op);
+            op = (unsigned)(here->op);
             if (op & 16) {                      /* distance base */
-                dist = (unsigned)(here.val);
+                dist = (unsigned)(here->val);
                 op &= 15;                       /* number of extra bits */
                 if (bits < op) {
                     hold += (unsigned long)(PUP(in)) << bits;
@@ -281,7 +281,7 @@
                 }
             }
             else if ((op & 64) == 0) {          /* 2nd level distance code */
-                here = dcode[here.val + (hold & ((1U << op) - 1))];
+                here = (code *)(&(dcode[here->val + (hold & ((1U << op) - 1))]));
                 goto dodist;
             }
             else {
@@ -291,7 +291,7 @@
             }
         }
         else if ((op & 64) == 0) {              /* 2nd level length code */
-            here = lcode[here.val + (hold & ((1U << op) - 1))];
+            here = (code *)(&(lcode[here->val + (hold & ((1U << op) - 1))]));
             goto dolen;
         }
         else if (op & 32) {                     /* end-of-block */
--- zlib-1.2.8/deflate.c	2013-04-28 15:57:10.000000000 -0700
+++ zlib-1.2.8/deflate.c	2014-02-28 02:32:02.517988885 -0800
@@ -60,6 +60,7 @@
   copyright string in the executable of your product.
  */
 
+#ifndef LONGEST_MATCH_ONLY
 /* ===========================================================================
  *  Function prototypes.
  */
@@ -89,13 +90,18 @@
       void match_init OF((void)); /* asm code initialization */
       uInt longest_match  OF((deflate_state *s, IPos cur_match));
 #else
+#ifdef ORIG_LONGEST_MATCH
 local uInt longest_match  OF((deflate_state *s, IPos cur_match));
+#else
+uInt longest_match  OF((deflate_state *s, IPos cur_match));
+#endif
 #endif
 
 #ifdef DEBUG
 local  void check_match OF((deflate_state *s, IPos start, IPos match,
                             int length));
 #endif
+#endif /* ! LONGEST_MATCH_ONLY */
 
 /* ===========================================================================
  * Local data
@@ -104,6 +110,7 @@
 #define NIL 0
 /* Tail of hash chains */
 
+#ifndef LONGEST_MATCH_ONLY
 #ifndef TOO_FAR
 #  define TOO_FAR 4096
 #endif
@@ -1130,7 +1137,9 @@
 #endif
 #endif
 }
+#endif /* ! LONGEST_MATCH_ONLY */
 
+#if defined(ORIG_LONGEST_MATCH) || defined(ORIG_LONGEST_MATCH_GLOBAL)
 #ifndef FASTEST
 /* ===========================================================================
  * Set match_start to the longest match starting at the given string and
@@ -1145,7 +1154,11 @@
 /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
  * match.S. The code will be functionally equivalent.
  */
+#ifdef ORIG_LONGEST_MATCH_GLOBAL
+uInt longest_match(s, cur_match)
+#else
 local uInt longest_match(s, cur_match)
+#endif
     deflate_state *s;
     IPos cur_match;                             /* current match */
 {
@@ -1288,6 +1301,7 @@
     return s->lookahead;
 }
 #endif /* ASMV */
+#endif /* ORIG_LONGEST_MATCHT */
 
 #else /* FASTEST */
 
@@ -1349,6 +1363,7 @@
 
 #endif /* FASTEST */
 
+#ifndef LONGEST_MATCH_ONLY
 #ifdef DEBUG
 /* ===========================================================================
  * Check that the match at match_start is indeed a match.
@@ -1965,3 +1980,4 @@
         FLUSH_BLOCK(s, 0);
     return block_done;
 }
+#endif /* ! LONGEST_MATCH_ONLY */
