zlib 1.2.9
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 22f2658..14411a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@
 
 project(zlib C)
 
-set(VERSION "1.2.8.1")
+set(VERSION "1.2.9")
 
 option(ASM686 "Enable building i686 assembly implementation")
 option(AMD64 "Enable building amd64 assembly implementation")
diff --git a/ChangeLog b/ChangeLog
index ad9a55e..63d0495 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,37 @@
 
                 ChangeLog file for zlib
 
-Changes in 1.2.8.1 (xx May 2013)
-- 
+Changes in 1.2.9 (31 Dec 2016)
+- Fix contrib/minizip to permit unzipping with desktop API [Zouzou]
+- Improve contrib/blast to return unused bytes
+- Assure that gzoffset() is correct when appending
+- Improve compress() and uncompress() to support large lengths
+- Fix bug in test/example.c where error code not saved
+- Remedy Coverity warning [Randers-Pehrson]
+- Improve speed of gzprintf() in transparent mode
+- Fix inflateInit2() bug when windowBits is 16 or 32
+- Change DEBUG macro to ZLIB_DEBUG
+- Avoid uninitialized access by gzclose_w()
+- Allow building zlib outside of the source directory
+- Fix bug that accepted invalid zlib header when windowBits is zero
+- Fix gzseek() problem on MinGW due to buggy _lseeki64 there
+- Loop on write() calls in gzwrite.c in case of non-blocking I/O
+- Add --warn (-w) option to ./configure for more compiler warnings
+- Reject a window size of 256 bytes if not using the zlib wrapper
+- Fix bug when level 0 used with Z_HUFFMAN or Z_RLE
+- Add --debug (-d) option to ./configure to define ZLIB_DEBUG
+- Fix bugs in creating a very large gzip header
+- Add uncompress2() function, which returns the input size used
+- Assure that deflateParams() will not switch functions mid-block
+- Dramatically speed up deflation for level 0 (storing)
+- Add gzfread(), duplicating the interface of fread()
+- Add gzfwrite(), duplicating the interface of fwrite()
+- Add deflateGetDictionary() function
+- Use snprintf() for later versions of Microsoft C
+- Fix *Init macros to use z_ prefix when requested
+- Replace as400 with os400 for OS/400 support [Monnerat]
+- Add crc32_z() and adler32_z() functions with size_t lengths
+- Update Visual Studio project files [AraHaan]
 
 Changes in 1.2.8 (28 Apr 2013)
 - Update contrib/minizip/iowin32.c for Windows RT [Vollant]
diff --git a/Makefile.in b/Makefile.in
index 7408644..c8b487c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,5 +1,5 @@
 # Makefile for zlib
-# Copyright (C) 1995-2013 Jean-loup Gailly, Mark Adler
+# Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
 # For conditions of distribution and use, see copyright notice in zlib.h
 
 # To compile and test, type:
@@ -32,7 +32,7 @@
 
 STATICLIB=libz.a
 SHAREDLIB=libz.so
-SHAREDLIBV=libz.so.1.2.8.1
+SHAREDLIBV=libz.so.1.2.9
 SHAREDLIBM=libz.so.1
 LIBS=$(STATICLIB) $(SHAREDLIBV)
 
diff --git a/README b/README
index e7a0bc7..8002f39 100644
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
 ZLIB DATA COMPRESSION LIBRARY
 
-zlib 1.2.8.1 is a general purpose data compression library.  All the code is
+zlib 1.2.9 is a general purpose data compression library.  All the code is
 thread safe.  The data format used by the zlib library is described by RFCs
 (Request for Comments) 1950 to 1952 in the files
 http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
@@ -31,7 +31,7 @@
 issue of Dr.  Dobb's Journal; a copy of the article is available at
 http://marknelson.us/1997/01/01/zlib-engine/ .
 
-The changes made in version 1.2.8.1 are documented in the file ChangeLog.
+The changes made in version 1.2.9 are documented in the file ChangeLog.
 
 Unsupported third party contributions are provided in directory contrib/ .
 
@@ -84,7 +84,7 @@
 
 Copyright notice:
 
- (C) 1995-2013 Jean-loup Gailly and Mark Adler
+ (C) 1995-2016 Jean-loup Gailly and Mark Adler
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
diff --git a/adler32.c b/adler32.c
index 019a233..d0be438 100644
--- a/adler32.c
+++ b/adler32.c
@@ -1,5 +1,5 @@
 /* adler32.c -- compute the Adler-32 checksum of a data stream
- * Copyright (C) 1995-2011 Mark Adler
+ * Copyright (C) 1995-2011, 2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/compress.c b/compress.c
index f0d0757..e2db404 100644
--- a/compress.c
+++ b/compress.c
@@ -1,5 +1,5 @@
 /* compress.c -- compress a memory buffer
- * Copyright (C) 1995-2005, 2014 Jean-loup Gailly, Mark Adler
+ * Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/contrib/delphi/ZLib.pas b/contrib/delphi/ZLib.pas
index b2cbfad..7a3cb66 100644
--- a/contrib/delphi/ZLib.pas
+++ b/contrib/delphi/ZLib.pas
@@ -152,7 +152,7 @@
   const OutBuf: Pointer; BufSize: Integer);
 
 const
-  zlib_version = '1.2.8.1';
+  zlib_version = '1.2.9';
 
 type
   EZlibError = class(Exception);
diff --git a/contrib/dotzlib/DotZLib/UnitTests.cs b/contrib/dotzlib/DotZLib/UnitTests.cs
index 5ad86d9..3d156f4 100644
--- a/contrib/dotzlib/DotZLib/UnitTests.cs
+++ b/contrib/dotzlib/DotZLib/UnitTests.cs
@@ -156,7 +156,7 @@
         public void Info_Version()

         {

             Info info = new Info();

-            Assert.AreEqual("1.2.8.1", Info.Version);

+            Assert.AreEqual("1.2.9", Info.Version);

             Assert.AreEqual(32, info.SizeOfUInt);

             Assert.AreEqual(32, info.SizeOfULong);

             Assert.AreEqual(32, info.SizeOfPointer);

diff --git a/contrib/infback9/inftree9.c b/contrib/infback9/inftree9.c
index f31e995..2103aee 100644
--- a/contrib/infback9/inftree9.c
+++ b/contrib/infback9/inftree9.c
@@ -1,5 +1,5 @@
 /* inftree9.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2013 Mark Adler
+ * Copyright (C) 1995-2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate9_copyright[] =
-   " inflate9 1.2.8.1 Copyright 1995-2013 Mark Adler ";
+   " inflate9 1.2.9 Copyright 1995-2016 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -64,7 +64,7 @@
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         128, 128, 128, 128, 128, 128, 128, 128, 129, 129, 129, 129,
         130, 130, 130, 130, 131, 131, 131, 131, 132, 132, 132, 132,
-        133, 133, 133, 133, 144, 203, 198};
+        133, 133, 133, 133, 144, 192, 79};
     static const unsigned short dbase[32] = { /* Distance codes 0..31 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49,
         65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073,
diff --git a/contrib/minizip/configure.ac b/contrib/minizip/configure.ac
index 06b9566..54d823f 100644
--- a/contrib/minizip/configure.ac
+++ b/contrib/minizip/configure.ac
@@ -1,7 +1,7 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
 
-AC_INIT([minizip], [1.2.8.1], [bugzilla.redhat.com])
+AC_INIT([minizip], [1.2.9], [bugzilla.redhat.com])
 AC_CONFIG_SRCDIR([minizip.c])
 AM_INIT_AUTOMAKE([foreign])
 LT_INIT
diff --git a/contrib/pascal/zlibpas.pas b/contrib/pascal/zlibpas.pas
index 0d1d5ff..aebaea0 100644
--- a/contrib/pascal/zlibpas.pas
+++ b/contrib/pascal/zlibpas.pas
@@ -10,8 +10,8 @@
 interface
 
 const
-  ZLIB_VERSION = '1.2.8.1';
-  ZLIB_VERNUM  = $1281;
+  ZLIB_VERSION = '1.2.9';
+  ZLIB_VERNUM  = $1290;
 
 type
   alloc_func = function(opaque: Pointer; items, size: Integer): Pointer;
diff --git a/contrib/vstudio/readme.txt b/contrib/vstudio/readme.txt
index 1646742..3954bc4 100644
--- a/contrib/vstudio/readme.txt
+++ b/contrib/vstudio/readme.txt
@@ -1,4 +1,4 @@
-Building instructions for the DLL versions of Zlib 1.2.8.1

+Building instructions for the DLL versions of Zlib 1.2.9

 ========================================================

 

 This directory contains projects that build zlib and minizip using

diff --git a/contrib/vstudio/vc10/zlib.rc b/contrib/vstudio/vc10/zlib.rc
index 3e9f7a8..d846820 100644
--- a/contrib/vstudio/vc10/zlib.rc
+++ b/contrib/vstudio/vc10/zlib.rc
@@ -2,8 +2,8 @@
 

 #define IDR_VERSION1  1

 IDR_VERSION1	VERSIONINFO	MOVEABLE IMPURE LOADONCALL DISCARDABLE

-  FILEVERSION	 1, 2, 8, 1

-  PRODUCTVERSION 1, 2, 8, 1

+  FILEVERSION	 1, 2, 9, 0

+  PRODUCTVERSION 1, 2, 9, 0

   FILEFLAGSMASK	VS_FFI_FILEFLAGSMASK

   FILEFLAGS	0

   FILEOS	VOS_DOS_WINDOWS32

@@ -17,12 +17,12 @@
 

     BEGIN

       VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"

-      VALUE "FileVersion",	"1.2.8.1\0"

+      VALUE "FileVersion",	"1.2.9\0"

       VALUE "InternalName",	"zlib\0"

       VALUE "OriginalFilename",	"zlibwapi.dll\0"

       VALUE "ProductName",	"ZLib.DLL\0"

       VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"

-      VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0"

+      VALUE "LegalCopyright", "(C) 1995-2016 Jean-loup Gailly & Mark Adler\0"

     END

   END

   BLOCK "VarFileInfo"

diff --git a/contrib/vstudio/vc10/zlibvc.def b/contrib/vstudio/vc10/zlibvc.def
index d2da2a1..54e683d 100644
--- a/contrib/vstudio/vc10/zlibvc.def
+++ b/contrib/vstudio/vc10/zlibvc.def
@@ -2,7 +2,7 @@
 ; zlib data compression and ZIP file I/O library

 

 VERSION		1.2

-
+

 EXPORTS

         adler32                                  @1

         compress                                 @2

@@ -141,3 +141,13 @@
 ; zlib1 v1.2.8 added:

         inflateGetDictionary                    @166

         gzvprintf                               @167

+

+; zlib1 v1.2.9 added:

+        inflateCodesUsed                        @168

+        inflateValidate                         @169

+        uncompress2                             @170

+        gzfread                                 @171

+        gzfwrite                                @172

+        deflateGetDictionary                    @173

+        adler32_z                               @174

+        crc32_z                                 @175

diff --git a/contrib/vstudio/vc11/zlib.rc b/contrib/vstudio/vc11/zlib.rc
index 3e9f7a8..d846820 100644
--- a/contrib/vstudio/vc11/zlib.rc
+++ b/contrib/vstudio/vc11/zlib.rc
@@ -2,8 +2,8 @@
 

 #define IDR_VERSION1  1

 IDR_VERSION1	VERSIONINFO	MOVEABLE IMPURE LOADONCALL DISCARDABLE

-  FILEVERSION	 1, 2, 8, 1

-  PRODUCTVERSION 1, 2, 8, 1

+  FILEVERSION	 1, 2, 9, 0

+  PRODUCTVERSION 1, 2, 9, 0

   FILEFLAGSMASK	VS_FFI_FILEFLAGSMASK

   FILEFLAGS	0

   FILEOS	VOS_DOS_WINDOWS32

@@ -17,12 +17,12 @@
 

     BEGIN

       VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"

-      VALUE "FileVersion",	"1.2.8.1\0"

+      VALUE "FileVersion",	"1.2.9\0"

       VALUE "InternalName",	"zlib\0"

       VALUE "OriginalFilename",	"zlibwapi.dll\0"

       VALUE "ProductName",	"ZLib.DLL\0"

       VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"

-      VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0"

+      VALUE "LegalCopyright", "(C) 1995-2016 Jean-loup Gailly & Mark Adler\0"

     END

   END

   BLOCK "VarFileInfo"

diff --git a/contrib/vstudio/vc11/zlibvc.def b/contrib/vstudio/vc11/zlibvc.def
index 66cf3fb..54e683d 100644
--- a/contrib/vstudio/vc11/zlibvc.def
+++ b/contrib/vstudio/vc11/zlibvc.def
@@ -141,3 +141,13 @@
 ; zlib1 v1.2.8 added:

         inflateGetDictionary                    @166

         gzvprintf                               @167

+

+; zlib1 v1.2.9 added:

+        inflateCodesUsed                        @168

+        inflateValidate                         @169

+        uncompress2                             @170

+        gzfread                                 @171

+        gzfwrite                                @172

+        deflateGetDictionary                    @173

+        adler32_z                               @174

+        crc32_z                                 @175

diff --git a/contrib/vstudio/vc12/zlib.rc b/contrib/vstudio/vc12/zlib.rc
index 46a7ee1..4f6396d 100644
--- a/contrib/vstudio/vc12/zlib.rc
+++ b/contrib/vstudio/vc12/zlib.rc
@@ -2,8 +2,8 @@
 
 #define IDR_VERSION1  1
 IDR_VERSION1	VERSIONINFO	MOVEABLE IMPURE LOADONCALL DISCARDABLE
-  FILEVERSION	 1, 2, 8, 1
-  PRODUCTVERSION 1, 2, 8, 1
+  FILEVERSION	 1, 2, 9, 0
+  PRODUCTVERSION 1, 2, 9, 0
   FILEFLAGSMASK	VS_FFI_FILEFLAGSMASK
   FILEFLAGS	0
   FILEOS	VOS_DOS_WINDOWS32
diff --git a/contrib/vstudio/vc12/zlibvc.def b/contrib/vstudio/vc12/zlibvc.def
index 83106b9..54e683d 100644
--- a/contrib/vstudio/vc12/zlibvc.def
+++ b/contrib/vstudio/vc12/zlibvc.def
@@ -1,143 +1,153 @@
-LIBRARY
-; zlib data compression and ZIP file I/O library
-
-VERSION		1.2
-
-EXPORTS
-        adler32                                  @1
-        compress                                 @2
-        crc32                                    @3
-        deflate                                  @4
-        deflateCopy                              @5
-        deflateEnd                               @6
-        deflateInit2_                            @7
-        deflateInit_                             @8
-        deflateParams                            @9
-        deflateReset                             @10
-        deflateSetDictionary                     @11
-        gzclose                                  @12
-        gzdopen                                  @13
-        gzerror                                  @14
-        gzflush                                  @15
-        gzopen                                   @16
-        gzread                                   @17
-        gzwrite                                  @18
-        inflate                                  @19
-        inflateEnd                               @20
-        inflateInit2_                            @21
-        inflateInit_                             @22
-        inflateReset                             @23
-        inflateSetDictionary                     @24
-        inflateSync                              @25
-        uncompress                               @26
-        zlibVersion                              @27
-        gzprintf                                 @28
-        gzputc                                   @29
-        gzgetc                                   @30
-        gzseek                                   @31
-        gzrewind                                 @32
-        gztell                                   @33
-        gzeof                                    @34
-        gzsetparams                              @35
-        zError                                   @36
-        inflateSyncPoint                         @37
-        get_crc_table                            @38
-        compress2                                @39
-        gzputs                                   @40
-        gzgets                                   @41
-        inflateCopy                              @42
-        inflateBackInit_                         @43
-        inflateBack                              @44
-        inflateBackEnd                           @45
-        compressBound                            @46
-        deflateBound                             @47
-        gzclearerr                               @48
-        gzungetc                                 @49
-        zlibCompileFlags                         @50
-        deflatePrime                             @51
-        deflatePending                           @52
-
-        unzOpen                                  @61
-        unzClose                                 @62
-        unzGetGlobalInfo                         @63
-        unzGetCurrentFileInfo                    @64
-        unzGoToFirstFile                         @65
-        unzGoToNextFile                          @66
-        unzOpenCurrentFile                       @67
-        unzReadCurrentFile                       @68
-        unzOpenCurrentFile3                      @69
-        unztell                                  @70
-        unzeof                                   @71
-        unzCloseCurrentFile                      @72
-        unzGetGlobalComment                      @73
-        unzStringFileNameCompare                 @74
-        unzLocateFile                            @75
-        unzGetLocalExtrafield                    @76
-        unzOpen2                                 @77
-        unzOpenCurrentFile2                      @78
-        unzOpenCurrentFilePassword               @79
-
-        zipOpen                                  @80
-        zipOpenNewFileInZip                      @81
-        zipWriteInFileInZip                      @82
-        zipCloseFileInZip                        @83
-        zipClose                                 @84
-        zipOpenNewFileInZip2                     @86
-        zipCloseFileInZipRaw                     @87
-        zipOpen2                                 @88
-        zipOpenNewFileInZip3                     @89
-
-        unzGetFilePos                            @100
-        unzGoToFilePos                           @101
-
-        fill_win32_filefunc                      @110
-
-; zlibwapi v1.2.4 added:
-        fill_win32_filefunc64                   @111
-        fill_win32_filefunc64A                  @112
-        fill_win32_filefunc64W                  @113
-
-        unzOpen64                               @120
-        unzOpen2_64                             @121
-        unzGetGlobalInfo64                      @122
-        unzGetCurrentFileInfo64                 @124
-        unzGetCurrentFileZStreamPos64           @125
-        unztell64                               @126
-        unzGetFilePos64                         @127
-        unzGoToFilePos64                        @128
-
-        zipOpen64                               @130
-        zipOpen2_64                             @131
-        zipOpenNewFileInZip64                   @132
-        zipOpenNewFileInZip2_64                 @133
-        zipOpenNewFileInZip3_64                 @134
-        zipOpenNewFileInZip4_64                 @135
-        zipCloseFileInZipRaw64                  @136
-
-; zlib1 v1.2.4 added:
-        adler32_combine                         @140
-        crc32_combine                           @142
-        deflateSetHeader                        @144
-        deflateTune                             @145
-        gzbuffer                                @146
-        gzclose_r                               @147
-        gzclose_w                               @148
-        gzdirect                                @149
-        gzoffset                                @150
-        inflateGetHeader                        @156
-        inflateMark                             @157
-        inflatePrime                            @158
-        inflateReset2                           @159
-        inflateUndermine                        @160
-
-; zlib1 v1.2.6 added:
-        gzgetc_                                 @161
-        inflateResetKeep                        @163
-        deflateResetKeep                        @164
-
-; zlib1 v1.2.7 added:
-        gzopen_w                                @165
-
-; zlib1 v1.2.8 added:
-        inflateGetDictionary                    @166
-        gzvprintf                               @167
+LIBRARY

+; zlib data compression and ZIP file I/O library

+

+VERSION		1.2

+

+EXPORTS

+        adler32                                  @1

+        compress                                 @2

+        crc32                                    @3

+        deflate                                  @4

+        deflateCopy                              @5

+        deflateEnd                               @6

+        deflateInit2_                            @7

+        deflateInit_                             @8

+        deflateParams                            @9

+        deflateReset                             @10

+        deflateSetDictionary                     @11

+        gzclose                                  @12

+        gzdopen                                  @13

+        gzerror                                  @14

+        gzflush                                  @15

+        gzopen                                   @16

+        gzread                                   @17

+        gzwrite                                  @18

+        inflate                                  @19

+        inflateEnd                               @20

+        inflateInit2_                            @21

+        inflateInit_                             @22

+        inflateReset                             @23

+        inflateSetDictionary                     @24

+        inflateSync                              @25

+        uncompress                               @26

+        zlibVersion                              @27

+        gzprintf                                 @28

+        gzputc                                   @29

+        gzgetc                                   @30

+        gzseek                                   @31

+        gzrewind                                 @32

+        gztell                                   @33

+        gzeof                                    @34

+        gzsetparams                              @35

+        zError                                   @36

+        inflateSyncPoint                         @37

+        get_crc_table                            @38

+        compress2                                @39

+        gzputs                                   @40

+        gzgets                                   @41

+        inflateCopy                              @42

+        inflateBackInit_                         @43

+        inflateBack                              @44

+        inflateBackEnd                           @45

+        compressBound                            @46

+        deflateBound                             @47

+        gzclearerr                               @48

+        gzungetc                                 @49

+        zlibCompileFlags                         @50

+        deflatePrime                             @51

+        deflatePending                           @52

+

+        unzOpen                                  @61

+        unzClose                                 @62

+        unzGetGlobalInfo                         @63

+        unzGetCurrentFileInfo                    @64

+        unzGoToFirstFile                         @65

+        unzGoToNextFile                          @66

+        unzOpenCurrentFile                       @67

+        unzReadCurrentFile                       @68

+        unzOpenCurrentFile3                      @69

+        unztell                                  @70

+        unzeof                                   @71

+        unzCloseCurrentFile                      @72

+        unzGetGlobalComment                      @73

+        unzStringFileNameCompare                 @74

+        unzLocateFile                            @75

+        unzGetLocalExtrafield                    @76

+        unzOpen2                                 @77

+        unzOpenCurrentFile2                      @78

+        unzOpenCurrentFilePassword               @79

+

+        zipOpen                                  @80

+        zipOpenNewFileInZip                      @81

+        zipWriteInFileInZip                      @82

+        zipCloseFileInZip                        @83

+        zipClose                                 @84

+        zipOpenNewFileInZip2                     @86

+        zipCloseFileInZipRaw                     @87

+        zipOpen2                                 @88

+        zipOpenNewFileInZip3                     @89

+

+        unzGetFilePos                            @100

+        unzGoToFilePos                           @101

+

+        fill_win32_filefunc                      @110

+

+; zlibwapi v1.2.4 added:

+        fill_win32_filefunc64                   @111

+        fill_win32_filefunc64A                  @112

+        fill_win32_filefunc64W                  @113

+

+        unzOpen64                               @120

+        unzOpen2_64                             @121

+        unzGetGlobalInfo64                      @122

+        unzGetCurrentFileInfo64                 @124

+        unzGetCurrentFileZStreamPos64           @125

+        unztell64                               @126

+        unzGetFilePos64                         @127

+        unzGoToFilePos64                        @128

+

+        zipOpen64                               @130

+        zipOpen2_64                             @131

+        zipOpenNewFileInZip64                   @132

+        zipOpenNewFileInZip2_64                 @133

+        zipOpenNewFileInZip3_64                 @134

+        zipOpenNewFileInZip4_64                 @135

+        zipCloseFileInZipRaw64                  @136

+

+; zlib1 v1.2.4 added:

+        adler32_combine                         @140

+        crc32_combine                           @142

+        deflateSetHeader                        @144

+        deflateTune                             @145

+        gzbuffer                                @146

+        gzclose_r                               @147

+        gzclose_w                               @148

+        gzdirect                                @149

+        gzoffset                                @150

+        inflateGetHeader                        @156

+        inflateMark                             @157

+        inflatePrime                            @158

+        inflateReset2                           @159

+        inflateUndermine                        @160

+

+; zlib1 v1.2.6 added:

+        gzgetc_                                 @161

+        inflateResetKeep                        @163

+        deflateResetKeep                        @164

+

+; zlib1 v1.2.7 added:

+        gzopen_w                                @165

+

+; zlib1 v1.2.8 added:

+        inflateGetDictionary                    @166

+        gzvprintf                               @167

+

+; zlib1 v1.2.9 added:

+        inflateCodesUsed                        @168

+        inflateValidate                         @169

+        uncompress2                             @170

+        gzfread                                 @171

+        gzfwrite                                @172

+        deflateGetDictionary                    @173

+        adler32_z                               @174

+        crc32_z                                 @175

diff --git a/contrib/vstudio/vc14/zlib.rc b/contrib/vstudio/vc14/zlib.rc
index 46a7ee1..4f6396d 100644
--- a/contrib/vstudio/vc14/zlib.rc
+++ b/contrib/vstudio/vc14/zlib.rc
@@ -2,8 +2,8 @@
 
 #define IDR_VERSION1  1
 IDR_VERSION1	VERSIONINFO	MOVEABLE IMPURE LOADONCALL DISCARDABLE
-  FILEVERSION	 1, 2, 8, 1
-  PRODUCTVERSION 1, 2, 8, 1
+  FILEVERSION	 1, 2, 9, 0
+  PRODUCTVERSION 1, 2, 9, 0
   FILEFLAGSMASK	VS_FFI_FILEFLAGSMASK
   FILEFLAGS	0
   FILEOS	VOS_DOS_WINDOWS32
diff --git a/contrib/vstudio/vc14/zlibvc.def b/contrib/vstudio/vc14/zlibvc.def
index 83106b9..54e683d 100644
--- a/contrib/vstudio/vc14/zlibvc.def
+++ b/contrib/vstudio/vc14/zlibvc.def
@@ -1,143 +1,153 @@
-LIBRARY
-; zlib data compression and ZIP file I/O library
-
-VERSION		1.2
-
-EXPORTS
-        adler32                                  @1
-        compress                                 @2
-        crc32                                    @3
-        deflate                                  @4
-        deflateCopy                              @5
-        deflateEnd                               @6
-        deflateInit2_                            @7
-        deflateInit_                             @8
-        deflateParams                            @9
-        deflateReset                             @10
-        deflateSetDictionary                     @11
-        gzclose                                  @12
-        gzdopen                                  @13
-        gzerror                                  @14
-        gzflush                                  @15
-        gzopen                                   @16
-        gzread                                   @17
-        gzwrite                                  @18
-        inflate                                  @19
-        inflateEnd                               @20
-        inflateInit2_                            @21
-        inflateInit_                             @22
-        inflateReset                             @23
-        inflateSetDictionary                     @24
-        inflateSync                              @25
-        uncompress                               @26
-        zlibVersion                              @27
-        gzprintf                                 @28
-        gzputc                                   @29
-        gzgetc                                   @30
-        gzseek                                   @31
-        gzrewind                                 @32
-        gztell                                   @33
-        gzeof                                    @34
-        gzsetparams                              @35
-        zError                                   @36
-        inflateSyncPoint                         @37
-        get_crc_table                            @38
-        compress2                                @39
-        gzputs                                   @40
-        gzgets                                   @41
-        inflateCopy                              @42
-        inflateBackInit_                         @43
-        inflateBack                              @44
-        inflateBackEnd                           @45
-        compressBound                            @46
-        deflateBound                             @47
-        gzclearerr                               @48
-        gzungetc                                 @49
-        zlibCompileFlags                         @50
-        deflatePrime                             @51
-        deflatePending                           @52
-
-        unzOpen                                  @61
-        unzClose                                 @62
-        unzGetGlobalInfo                         @63
-        unzGetCurrentFileInfo                    @64
-        unzGoToFirstFile                         @65
-        unzGoToNextFile                          @66
-        unzOpenCurrentFile                       @67
-        unzReadCurrentFile                       @68
-        unzOpenCurrentFile3                      @69
-        unztell                                  @70
-        unzeof                                   @71
-        unzCloseCurrentFile                      @72
-        unzGetGlobalComment                      @73
-        unzStringFileNameCompare                 @74
-        unzLocateFile                            @75
-        unzGetLocalExtrafield                    @76
-        unzOpen2                                 @77
-        unzOpenCurrentFile2                      @78
-        unzOpenCurrentFilePassword               @79
-
-        zipOpen                                  @80
-        zipOpenNewFileInZip                      @81
-        zipWriteInFileInZip                      @82
-        zipCloseFileInZip                        @83
-        zipClose                                 @84
-        zipOpenNewFileInZip2                     @86
-        zipCloseFileInZipRaw                     @87
-        zipOpen2                                 @88
-        zipOpenNewFileInZip3                     @89
-
-        unzGetFilePos                            @100
-        unzGoToFilePos                           @101
-
-        fill_win32_filefunc                      @110
-
-; zlibwapi v1.2.4 added:
-        fill_win32_filefunc64                   @111
-        fill_win32_filefunc64A                  @112
-        fill_win32_filefunc64W                  @113
-
-        unzOpen64                               @120
-        unzOpen2_64                             @121
-        unzGetGlobalInfo64                      @122
-        unzGetCurrentFileInfo64                 @124
-        unzGetCurrentFileZStreamPos64           @125
-        unztell64                               @126
-        unzGetFilePos64                         @127
-        unzGoToFilePos64                        @128
-
-        zipOpen64                               @130
-        zipOpen2_64                             @131
-        zipOpenNewFileInZip64                   @132
-        zipOpenNewFileInZip2_64                 @133
-        zipOpenNewFileInZip3_64                 @134
-        zipOpenNewFileInZip4_64                 @135
-        zipCloseFileInZipRaw64                  @136
-
-; zlib1 v1.2.4 added:
-        adler32_combine                         @140
-        crc32_combine                           @142
-        deflateSetHeader                        @144
-        deflateTune                             @145
-        gzbuffer                                @146
-        gzclose_r                               @147
-        gzclose_w                               @148
-        gzdirect                                @149
-        gzoffset                                @150
-        inflateGetHeader                        @156
-        inflateMark                             @157
-        inflatePrime                            @158
-        inflateReset2                           @159
-        inflateUndermine                        @160
-
-; zlib1 v1.2.6 added:
-        gzgetc_                                 @161
-        inflateResetKeep                        @163
-        deflateResetKeep                        @164
-
-; zlib1 v1.2.7 added:
-        gzopen_w                                @165
-
-; zlib1 v1.2.8 added:
-        inflateGetDictionary                    @166
-        gzvprintf                               @167
+LIBRARY

+; zlib data compression and ZIP file I/O library

+

+VERSION		1.2

+

+EXPORTS

+        adler32                                  @1

+        compress                                 @2

+        crc32                                    @3

+        deflate                                  @4

+        deflateCopy                              @5

+        deflateEnd                               @6

+        deflateInit2_                            @7

+        deflateInit_                             @8

+        deflateParams                            @9

+        deflateReset                             @10

+        deflateSetDictionary                     @11

+        gzclose                                  @12

+        gzdopen                                  @13

+        gzerror                                  @14

+        gzflush                                  @15

+        gzopen                                   @16

+        gzread                                   @17

+        gzwrite                                  @18

+        inflate                                  @19

+        inflateEnd                               @20

+        inflateInit2_                            @21

+        inflateInit_                             @22

+        inflateReset                             @23

+        inflateSetDictionary                     @24

+        inflateSync                              @25

+        uncompress                               @26

+        zlibVersion                              @27

+        gzprintf                                 @28

+        gzputc                                   @29

+        gzgetc                                   @30

+        gzseek                                   @31

+        gzrewind                                 @32

+        gztell                                   @33

+        gzeof                                    @34

+        gzsetparams                              @35

+        zError                                   @36

+        inflateSyncPoint                         @37

+        get_crc_table                            @38

+        compress2                                @39

+        gzputs                                   @40

+        gzgets                                   @41

+        inflateCopy                              @42

+        inflateBackInit_                         @43

+        inflateBack                              @44

+        inflateBackEnd                           @45

+        compressBound                            @46

+        deflateBound                             @47

+        gzclearerr                               @48

+        gzungetc                                 @49

+        zlibCompileFlags                         @50

+        deflatePrime                             @51

+        deflatePending                           @52

+

+        unzOpen                                  @61

+        unzClose                                 @62

+        unzGetGlobalInfo                         @63

+        unzGetCurrentFileInfo                    @64

+        unzGoToFirstFile                         @65

+        unzGoToNextFile                          @66

+        unzOpenCurrentFile                       @67

+        unzReadCurrentFile                       @68

+        unzOpenCurrentFile3                      @69

+        unztell                                  @70

+        unzeof                                   @71

+        unzCloseCurrentFile                      @72

+        unzGetGlobalComment                      @73

+        unzStringFileNameCompare                 @74

+        unzLocateFile                            @75

+        unzGetLocalExtrafield                    @76

+        unzOpen2                                 @77

+        unzOpenCurrentFile2                      @78

+        unzOpenCurrentFilePassword               @79

+

+        zipOpen                                  @80

+        zipOpenNewFileInZip                      @81

+        zipWriteInFileInZip                      @82

+        zipCloseFileInZip                        @83

+        zipClose                                 @84

+        zipOpenNewFileInZip2                     @86

+        zipCloseFileInZipRaw                     @87

+        zipOpen2                                 @88

+        zipOpenNewFileInZip3                     @89

+

+        unzGetFilePos                            @100

+        unzGoToFilePos                           @101

+

+        fill_win32_filefunc                      @110

+

+; zlibwapi v1.2.4 added:

+        fill_win32_filefunc64                   @111

+        fill_win32_filefunc64A                  @112

+        fill_win32_filefunc64W                  @113

+

+        unzOpen64                               @120

+        unzOpen2_64                             @121

+        unzGetGlobalInfo64                      @122

+        unzGetCurrentFileInfo64                 @124

+        unzGetCurrentFileZStreamPos64           @125

+        unztell64                               @126

+        unzGetFilePos64                         @127

+        unzGoToFilePos64                        @128

+

+        zipOpen64                               @130

+        zipOpen2_64                             @131

+        zipOpenNewFileInZip64                   @132

+        zipOpenNewFileInZip2_64                 @133

+        zipOpenNewFileInZip3_64                 @134

+        zipOpenNewFileInZip4_64                 @135

+        zipCloseFileInZipRaw64                  @136

+

+; zlib1 v1.2.4 added:

+        adler32_combine                         @140

+        crc32_combine                           @142

+        deflateSetHeader                        @144

+        deflateTune                             @145

+        gzbuffer                                @146

+        gzclose_r                               @147

+        gzclose_w                               @148

+        gzdirect                                @149

+        gzoffset                                @150

+        inflateGetHeader                        @156

+        inflateMark                             @157

+        inflatePrime                            @158

+        inflateReset2                           @159

+        inflateUndermine                        @160

+

+; zlib1 v1.2.6 added:

+        gzgetc_                                 @161

+        inflateResetKeep                        @163

+        deflateResetKeep                        @164

+

+; zlib1 v1.2.7 added:

+        gzopen_w                                @165

+

+; zlib1 v1.2.8 added:

+        inflateGetDictionary                    @166

+        gzvprintf                               @167

+

+; zlib1 v1.2.9 added:

+        inflateCodesUsed                        @168

+        inflateValidate                         @169

+        uncompress2                             @170

+        gzfread                                 @171

+        gzfwrite                                @172

+        deflateGetDictionary                    @173

+        adler32_z                               @174

+        crc32_z                                 @175

diff --git a/contrib/vstudio/vc9/zlib.rc b/contrib/vstudio/vc9/zlib.rc
index 3e9f7a8..d846820 100644
--- a/contrib/vstudio/vc9/zlib.rc
+++ b/contrib/vstudio/vc9/zlib.rc
@@ -2,8 +2,8 @@
 

 #define IDR_VERSION1  1

 IDR_VERSION1	VERSIONINFO	MOVEABLE IMPURE LOADONCALL DISCARDABLE

-  FILEVERSION	 1, 2, 8, 1

-  PRODUCTVERSION 1, 2, 8, 1

+  FILEVERSION	 1, 2, 9, 0

+  PRODUCTVERSION 1, 2, 9, 0

   FILEFLAGSMASK	VS_FFI_FILEFLAGSMASK

   FILEFLAGS	0

   FILEOS	VOS_DOS_WINDOWS32

@@ -17,12 +17,12 @@
 

     BEGIN

       VALUE "FileDescription", "zlib data compression and ZIP file I/O library\0"

-      VALUE "FileVersion",	"1.2.8.1\0"

+      VALUE "FileVersion",	"1.2.9\0"

       VALUE "InternalName",	"zlib\0"

       VALUE "OriginalFilename",	"zlibwapi.dll\0"

       VALUE "ProductName",	"ZLib.DLL\0"

       VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0"

-      VALUE "LegalCopyright", "(C) 1995-2013 Jean-loup Gailly & Mark Adler\0"

+      VALUE "LegalCopyright", "(C) 1995-2016 Jean-loup Gailly & Mark Adler\0"

     END

   END

   BLOCK "VarFileInfo"

diff --git a/contrib/vstudio/vc9/zlibvc.def b/contrib/vstudio/vc9/zlibvc.def
index 66cf3fb..54e683d 100644
--- a/contrib/vstudio/vc9/zlibvc.def
+++ b/contrib/vstudio/vc9/zlibvc.def
@@ -141,3 +141,13 @@
 ; zlib1 v1.2.8 added:

         inflateGetDictionary                    @166

         gzvprintf                               @167

+

+; zlib1 v1.2.9 added:

+        inflateCodesUsed                        @168

+        inflateValidate                         @169

+        uncompress2                             @170

+        gzfread                                 @171

+        gzfwrite                                @172

+        deflateGetDictionary                    @173

+        adler32_z                               @174

+        crc32_z                                 @175

diff --git a/crc32.c b/crc32.c
index ce000ef..9580440 100644
--- a/crc32.c
+++ b/crc32.c
@@ -1,5 +1,5 @@
 /* crc32.c -- compute the CRC-32 of a data stream
- * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler
+ * Copyright (C) 1995-2006, 2010, 2011, 2012, 2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  *
  * Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
diff --git a/deflate.c b/deflate.c
index 9079741..415adbf 100644
--- a/deflate.c
+++ b/deflate.c
@@ -52,7 +52,7 @@
 #include "deflate.h"
 
 const char deflate_copyright[] =
-   " deflate 1.2.8.1 Copyright 1995-2016 Jean-loup Gailly and Mark Adler ";
+   " deflate 1.2.9 Copyright 1995-2016 Jean-loup Gailly and Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
diff --git a/deflate.h b/deflate.h
index fa8577e..23ecdd3 100644
--- a/deflate.h
+++ b/deflate.h
@@ -1,5 +1,5 @@
 /* deflate.h -- internal compression state
- * Copyright (C) 1995-2012 Jean-loup Gailly
+ * Copyright (C) 1995-2016 Jean-loup Gailly
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/examples/gzlog.c b/examples/gzlog.c
index f33a862..b8c2927 100644
--- a/examples/gzlog.c
+++ b/examples/gzlog.c
@@ -1,6 +1,6 @@
 /*
  * gzlog.c
- * Copyright (C) 2004, 2008, 2012 Mark Adler, all rights reserved
+ * Copyright (C) 2004, 2008, 2012, 2016 Mark Adler, all rights reserved
  * For conditions of distribution and use, see copyright notice in gzlog.h
  * version 2.2, 14 Aug 2012
  */
diff --git a/gzguts.h b/gzguts.h
index f728792..990a4d2 100644
--- a/gzguts.h
+++ b/gzguts.h
@@ -1,5 +1,5 @@
 /* gzguts.h -- zlib internal header definitions for gz* operations
- * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
+ * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/gzlib.c b/gzlib.c
index 3b2b71b..a87d3d1 100644
--- a/gzlib.c
+++ b/gzlib.c
@@ -1,5 +1,5 @@
 /* gzlib.c -- zlib functions common to reading and writing gzip files
- * Copyright (C) 2004, 2010, 2011, 2012, 2013 Mark Adler
+ * Copyright (C) 2004, 2010, 2011, 2012, 2013, 2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/gzread.c b/gzread.c
index deea79b..956b91e 100644
--- a/gzread.c
+++ b/gzread.c
@@ -1,5 +1,5 @@
 /* gzread.c -- zlib functions for reading gzip files
- * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
+ * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/gzwrite.c b/gzwrite.c
index b866251..a2ee573 100644
--- a/gzwrite.c
+++ b/gzwrite.c
@@ -1,5 +1,5 @@
 /* gzwrite.c -- zlib functions for writing gzip files
- * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler
+ * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/infback.c b/infback.c
index ea3f76a..59679ec 100644
--- a/infback.c
+++ b/infback.c
@@ -1,5 +1,5 @@
 /* infback.c -- inflate using a call-back interface
- * Copyright (C) 1995-2011 Mark Adler
+ * Copyright (C) 1995-2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/inffast.c b/inffast.c
index f0d163d..a15876d 100644
--- a/inffast.c
+++ b/inffast.c
@@ -1,5 +1,5 @@
 /* inffast.c -- fast decoding
- * Copyright (C) 1995-2008, 2010, 2013 Mark Adler
+ * Copyright (C) 1995-2008, 2010, 2013, 2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/inflate.c b/inflate.c
index 92e9139..ac333e8 100644
--- a/inflate.c
+++ b/inflate.c
@@ -1,5 +1,5 @@
 /* inflate.c -- zlib decompression
- * Copyright (C) 1995-2012 Mark Adler
+ * Copyright (C) 1995-2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/inflate.h b/inflate.h
index 047124d..a46cce6 100644
--- a/inflate.h
+++ b/inflate.h
@@ -1,5 +1,5 @@
 /* inflate.h -- internal inflate state definition
- * Copyright (C) 1995-2009 Mark Adler
+ * Copyright (C) 1995-2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/inftrees.c b/inftrees.c
index 8b2ad4f..fa27dcb 100644
--- a/inftrees.c
+++ b/inftrees.c
@@ -1,5 +1,5 @@
 /* inftrees.c -- generate Huffman trees for efficient decoding
- * Copyright (C) 1995-2013 Mark Adler
+ * Copyright (C) 1995-2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -9,7 +9,7 @@
 #define MAXBITS 15
 
 const char inflate_copyright[] =
-   " inflate 1.2.8.1 Copyright 1995-2013 Mark Adler ";
+   " inflate 1.2.9 Copyright 1995-2016 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
   in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@
         35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
     static const unsigned short lext[31] = { /* Length codes 257..285 extra */
         16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
-        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 198};
+        19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 79};
     static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
         1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
         257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
diff --git a/os400/README400 b/os400/README400
index 601f1ae..7926d7c 100644
--- a/os400/README400
+++ b/os400/README400
@@ -1,4 +1,4 @@
-        ZLIB version 1.2.8 for OS/400 installation instructions
+        ZLIB version 1.2.9 for OS/400 installation instructions
 
 1) Download and unpack the zlib tarball to some IFS directory.
    (i.e.: /path/to/the/zlib/ifs/source/directory)
diff --git a/os400/bndsrc b/os400/bndsrc
index 934d781..5e6e0a2 100644
--- a/os400/bndsrc
+++ b/os400/bndsrc
@@ -46,6 +46,7 @@
   EXPORT SYMBOL("uncompress")
   EXPORT SYMBOL("zlibVersion")
   EXPORT SYMBOL("zError")
+  EXPORT SYMBOL("z_errmsg")
 
 /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
 /*   Version 1.2.1 additional entry points.                         */
@@ -53,6 +54,7 @@
 
   EXPORT SYMBOL("compressBound")
   EXPORT SYMBOL("deflateBound")
+  EXPORT SYMBOL("deflatePending")
   EXPORT SYMBOL("gzungetc")
   EXPORT SYMBOL("gzclearerr")
   EXPORT SYMBOL("inflateBack")
@@ -62,21 +64,25 @@
   EXPORT SYMBOL("zlibCompileFlags")
 
 /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
-/*   Version 1.2.5 additional entry points.                         */
+/*   Version 1.2.4 additional entry points.                         */
 /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
 
   EXPORT SYMBOL("adler32_combine")
   EXPORT SYMBOL("adler32_combine64")
   EXPORT SYMBOL("crc32_combine")
   EXPORT SYMBOL("crc32_combine64")
+  EXPORT SYMBOL("deflateSetHeader")
+  EXPORT SYMBOL("deflateTune")
   EXPORT SYMBOL("gzbuffer")
+  EXPORT SYMBOL("gzclose_r")
+  EXPORT SYMBOL("gzclose_w")
+  EXPORT SYMBOL("gzdirect")
   EXPORT SYMBOL("gzoffset")
   EXPORT SYMBOL("gzoffset64")
   EXPORT SYMBOL("gzopen64")
   EXPORT SYMBOL("gzseek64")
   EXPORT SYMBOL("gztell64")
-  EXPORT SYMBOL("gzclose_r")
-  EXPORT SYMBOL("gzclose_w")
+  EXPORT SYMBOL("inflateGetHeader")
   EXPORT SYMBOL("inflateMark")
   EXPORT SYMBOL("inflatePrime")
   EXPORT SYMBOL("inflateReset2")
@@ -87,7 +93,6 @@
 /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
 
   EXPORT SYMBOL("deflateResetKeep")
-  EXPORT SYMBOL("deflatePending")
   EXPORT SYMBOL("gzgetc_")
   EXPORT SYMBOL("inflateResetKeep")
 
@@ -95,6 +100,20 @@
 /*   Version 1.2.8 additional entry points.                         */
 /*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
 
+  EXPORT SYMBOL("gzvprintf")
   EXPORT SYMBOL("inflateGetDictionary")
 
+/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
+/*   Version 1.2.9 additional entry points.                         */
+/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
+
+  EXPORT SYMBOL("adler32_z")
+  EXPORT SYMBOL("crc32_z")
+  EXPORT SYMBOL("deflateGetDictionary")
+  EXPORT SYMBOL("gzfread")
+  EXPORT SYMBOL("gzfwrite")
+  EXPORT SYMBOL("inflateCodesUsed")
+  EXPORT SYMBOL("inflateValidate")
+  EXPORT SYMBOL("uncompress2")
+
 ENDPGMEXP
diff --git a/os400/zlib.inc b/os400/zlib.inc
index 7341a6d..5431e54 100644
--- a/os400/zlib.inc
+++ b/os400/zlib.inc
@@ -1,7 +1,7 @@
       *  ZLIB.INC - Interface to the general purpose compression library
       *
       *  ILE RPG400 version by Patrick Monnerat, DATASPHERE.
-      *  Version 1.2.8
+      *  Version 1.2.9
       *
       *
       *  WARNING:
@@ -22,12 +22,12 @@
       *
       *  Versioning information.
       *
-     D ZLIB_VERSION    C                   '1.2.8'
-     D ZLIB_VERNUM     C                   X'1280'
+     D ZLIB_VERSION    C                   '1.2.9'
+     D ZLIB_VERNUM     C                   X'1290'
      D ZLIB_VER_MAJOR  C                   1
      D ZLIB_VER_MINOR  C                   2
      D ZLIB_VER_REVISION...
-     D                 C                   8
+     D                 C                   9
      D ZLIB_VER_SUBREVISION...
      D                 C                   0
       *
@@ -50,7 +50,7 @@
      D Z_DATA_ERROR    C                   -3
      D Z_MEM_ERROR     C                   -4
      D Z_BUF_ERROR     C                   -5
-     DZ_VERSION_ERROR  C                   -6
+     D Z_VERSION_ERROR C                   -6
       *
      D Z_NO_COMPRESSION...
      D                 C                   0
@@ -80,6 +80,7 @@
       *
      D z_streamp       S               *                                        Stream struct ptr
      D gzFile          S               *                                        File pointer
+     D gz_headerp      S               *
      D z_off_t         S             10i 0                                      Stream offsets
      D z_off64_t       S             20i 0                                      Stream offsets
       *
@@ -132,6 +133,12 @@
      D  source                    65535    const options(*varsize)              Source buffer
      D  sourceLen                    10U 0 value                                Source length
       *
+     D uncompress2     PR            10I 0 extproc('uncompress2')
+     D  dest                      65535    options(*varsize)                    Destination buffer
+     D  destLen                      10U 0                                      Destination length
+     D  source                    65535    const options(*varsize)              Source buffer
+     D  sourceLen                    10U 0                                      Source length
+      *
       /if not defined(LARGE_FILES)
      D gzopen          PR                  extproc('gzopen')
      D                                     like(gzFile)
@@ -168,11 +175,23 @@
      D  buf                       65535    options(*varsize)                    Buffer
      D  len                          10u 0 value                                Buffer length
       *
+     D gzfread          PR           20I 0 extproc('gzfread')
+     D  buf                       65535    options(*varsize)                    Buffer
+     D  size                         20u 0 value                                Buffer length
+     D  nitems                       20u 0 value                                Buffer length
+     D  file                               value like(gzFile)                   File pointer
+      *
      D gzwrite         PR            10I 0 extproc('gzwrite')
      D  file                               value like(gzFile)                   File pointer
      D  buf                       65535    const options(*varsize)              Buffer
      D  len                          10u 0 value                                Buffer length
       *
+     D gzfwrite         PR           20I 0 extproc('gzfwrite')
+     D  buf                       65535    options(*varsize)                    Buffer
+     D  size                         20u 0 value                                Buffer length
+     D  nitems                       20u 0 value                                Buffer length
+     D  file                               value like(gzFile)                   File pointer
+      *
      D gzputs          PR            10I 0 extproc('gzputs')
      D  file                               value like(gzFile)                   File pointer
      D  s                              *   value options(*string)               String to output
@@ -254,6 +273,9 @@
      D gzeof           PR            10i 0 extproc('gzeof')
      D  file                               value like(gzFile)                   File pointer
       *
+     D gzdirect        PR            10i 0 extproc('gzdirect')
+     D  file                               value like(gzFile)                   File pointer
+      *
      D gzclose_r       PR            10i 0 extproc('gzclose_r')
      D  file                               value like(gzFile)                   File pointer
       *
@@ -311,7 +333,7 @@
      D  method                       10I 0 value                                Compression method
      D  windowBits                   10I 0 value                                log2(window size)
      D  memLevel                     10I 0 value                                Mem/cmpress tradeoff
-     D  strategy                     10I 0 value                                Compression stategy
+     D  strategy                     10I 0 value                                Compression strategy
      D  version                        *   value options(*string)               Version string
      D  stream_size                  10i 0 value                                Stream struct. size
       *
@@ -331,7 +353,14 @@
      D deflateParams   PR            10I 0 extproc('deflateParams')             Change level & strat
      D  strm                               like(z_stream)                       Compression stream
      D  level                        10I 0 value                                Compression level
-     D  strategy                     10I 0 value                                Compression stategy
+     D  strategy                     10I 0 value                                Compression strategy
+      *
+     D deflateTune     PR            10I 0 extproc('deflateTune')
+     D  strm                               like(z_stream)                       Compression stream
+     D  good                         10I 0 value
+     D  lazy                         10I 0 value
+     D  nice                         10I 0 value
+     D  chain                        10I 0 value
       *
      D deflateBound    PR            10U 0 extproc('deflateBound')              Change level & strat
      D  strm                               like(z_stream)                       Compression stream
@@ -365,6 +394,12 @@
      D  dictionary                65535    options(*varsize)                    Dictionary bytes
      D  dictLength                   10U 0                                      Dictionary length
       *
+     D deflateGetDictionary...
+     D                 PR            10I 0 extproc('deflateGetDictionary')      Get dictionary
+     D  strm                               like(z_stream)                       Expansion stream
+     D  dictionary                65535    options(*varsize)                    Dictionary bytes
+     D  dictLength                   10U 0                                      Dictionary length
+      *
      D inflateSync     PR            10I 0 extproc('inflateSync')               Sync. expansion
      D  strm                               like(z_stream)                       Expansion stream
       *
@@ -387,6 +422,25 @@
      D inflateMark     PR            10I 0 extproc('inflateMark')               Get inflate info
      D  strm                               like(z_stream)                       Expansion stream
       *
+     D inflateCodesUsed...
+                       PR            20U 0 extproc('inflateCodesUsed')
+     D  strm                               like(z_stream)                       Expansion stream
+      *
+     D inflateValidate...
+                       PR            20U 0 extproc('inflateValidate')
+     D  strm                               like(z_stream)                       Expansion stream
+     D  check                        10I 0 value
+      *
+     D inflateGetHeader...
+                       PR            10U 0 extproc('inflateGetHeader')
+     D  strm                               like(z_stream)                       Expansion stream
+     D  head                               like(gz_headerp)
+      *
+     D deflateSetHeader...
+                       PR            10U 0 extproc('deflateSetHeader')
+     D  strm                               like(z_stream)                       Expansion stream
+     D  head                               like(gz_headerp)
+      *
      D inflateBackInit...
      D                 PR            10I 0 extproc('inflateBackInit_')
      D  strm                               like(z_stream)                       Expansion stream
@@ -417,11 +471,33 @@
      D  buf                       65535    const options(*varsize)              Bytes to accumulate
      D  len                          10U 0 value                                Buffer length
       *
+     D adler32_combine...
+                       PR            10U 0 extproc('adler32_combine')           New checksum
+     D  adler1                       10U 0 value                                Old checksum
+     D  adler2                       10U 0 value                                Old checksum
+     D  len2                         20U 0 value                                Buffer length
+      *
+     D adler32_z       PR            10U 0 extproc('adler32_z')                 New checksum
+     D  adler                        10U 0 value                                Old checksum
+     D  buf                       65535    const options(*varsize)              Bytes to accumulate
+     D  len                          20U 0 value                                Buffer length
+      *
      D crc32           PR            10U 0 extproc('crc32')                     New checksum
      D  crc                          10U 0 value                                Old checksum
      D  buf                       65535    const options(*varsize)              Bytes to accumulate
      D  len                          10U 0 value                                Buffer length
       *
+     D crc32_combine...
+                       PR            10U 0 extproc('crc32_combine')             New checksum
+     D  crc1                         10U 0 value                                Old checksum
+     D  crc2                         10U 0 value                                Old checksum
+     D  len2                         20U 0 value                                Buffer length
+      *
+     D crc32_z         PR            10U 0 extproc('crc32_z')                   New checksum
+     D  crc                          10U 0 value                                Old checksum
+     D  buf                       65535    const options(*varsize)              Bytes to accumulate
+     D  len                          20U 0 value                                Buffer length
+      *
       **************************************************************************
       *                     Miscellaneous function prototypes
       **************************************************************************
diff --git a/qnx/package.qpg b/qnx/package.qpg
index c186113..67a8777 100644
--- a/qnx/package.qpg
+++ b/qnx/package.qpg
@@ -25,10 +25,10 @@
       <QPG:Files>
          <QPG:Add file="../zconf.h" install="/opt/include/" user="root:sys" permission="644"/>
          <QPG:Add file="../zlib.h" install="/opt/include/" user="root:sys" permission="644"/>
-         <QPG:Add file="../libz.so.1.2.8.1" install="/opt/lib/" user="root:bin" permission="644"/>
-         <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.8.1"/>
-         <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.8.1"/>
-         <QPG:Add file="../libz.so.1.2.8.1" install="/opt/lib/" component="slib"/>
+         <QPG:Add file="../libz.so.1.2.9" install="/opt/lib/" user="root:bin" permission="644"/>
+         <QPG:Add file="libz.so" install="/opt/lib/" component="dev" filetype="symlink" linkto="libz.so.1.2.9"/>
+         <QPG:Add file="libz.so.1" install="/opt/lib/" filetype="symlink" linkto="libz.so.1.2.9"/>
+         <QPG:Add file="../libz.so.1.2.9" install="/opt/lib/" component="slib"/>
       </QPG:Files>
 
       <QPG:PackageFilter>
@@ -63,7 +63,7 @@
             </QPM:ProductDescription>
 
             <QPM:ReleaseDescription>
-               <QPM:ReleaseVersion>1.2.8.1</QPM:ReleaseVersion>
+               <QPM:ReleaseVersion>1.2.9</QPM:ReleaseVersion>
                <QPM:ReleaseUrgency>Medium</QPM:ReleaseUrgency>
                <QPM:ReleaseStability>Stable</QPM:ReleaseStability>
                <QPM:ReleaseNoteMinor></QPM:ReleaseNoteMinor>
diff --git a/test/example.c b/test/example.c
index f008749..eee17ce 100644
--- a/test/example.c
+++ b/test/example.c
@@ -1,5 +1,5 @@
 /* example.c -- usage example of the zlib compression library
- * Copyright (C) 1995-2006, 2011 Jean-loup Gailly.
+ * Copyright (C) 1995-2006, 2011, 2016 Jean-loup Gailly
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/test/infcover.c b/test/infcover.c
index 3153234..2be0164 100644
--- a/test/infcover.c
+++ b/test/infcover.c
@@ -1,5 +1,5 @@
 /* infcover.c -- test zlib's inflate routines with full code coverage
- * Copyright (C) 2011 Mark Adler
+ * Copyright (C) 2011, 2016 Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/test/minigzip.c b/test/minigzip.c
index b392304..e22fb08 100644
--- a/test/minigzip.c
+++ b/test/minigzip.c
@@ -1,5 +1,5 @@
 /* minigzip.c -- simulate gzip using the zlib compression library
- * Copyright (C) 1995-2006, 2010, 2011 Jean-loup Gailly.
+ * Copyright (C) 1995-2006, 2010, 2011, 2016 Jean-loup Gailly
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/treebuild.xml b/treebuild.xml
index d3732d8..931ee5a 100644
--- a/treebuild.xml
+++ b/treebuild.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" ?>
-<package name="zlib" version="1.2.8.1">
-    <library name="zlib" dlversion="1.2.8.1" dlname="z">
+<package name="zlib" version="1.2.9">
+    <library name="zlib" dlversion="1.2.9" dlname="z">
 	<property name="description"> zip compression library </property>
 	<property name="include-target-dir" value="$(@PACKAGE/install-includedir)" />
 
diff --git a/trees.c b/trees.c
index 559a0de..357f313 100644
--- a/trees.c
+++ b/trees.c
@@ -1,5 +1,5 @@
 /* trees.c -- output deflated data using Huffman coding
- * Copyright (C) 1995-2012 Jean-loup Gailly
+ * Copyright (C) 1995-2016 Jean-loup Gailly
  * detect_data_type() function provided freely by Cosmin Truta, 2006
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
diff --git a/win32/README-WIN32.txt b/win32/README-WIN32.txt
index 4a74e3e..5002f3c 100644
--- a/win32/README-WIN32.txt
+++ b/win32/README-WIN32.txt
@@ -1,6 +1,6 @@
 ZLIB DATA COMPRESSION LIBRARY
 
-zlib 1.2.8.1 is a general purpose data compression library.  All the code is
+zlib 1.2.9 is a general purpose data compression library.  All the code is
 thread safe.  The data format used by the zlib library is described by RFCs
 (Request for Comments) 1950 to 1952 in the files
 http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
@@ -22,7 +22,7 @@
 
 Manifest:
 
-The package zlib-1.2.8.1-win32-x86.zip will contain the following files:
+The package zlib-1.2.9-win32-x86.zip will contain the following files:
 
   README-WIN32.txt This document
   ChangeLog        Changes since previous zlib packages
diff --git a/win32/zlib.def b/win32/zlib.def
index face655..784b138 100644
--- a/win32/zlib.def
+++ b/win32/zlib.def
@@ -1,86 +1,94 @@
-; zlib data compression library
-EXPORTS
-; basic functions
-    zlibVersion
-    deflate
-    deflateEnd
-    inflate
-    inflateEnd
-; advanced functions
-    deflateSetDictionary
-    deflateCopy
-    deflateReset
-    deflateParams
-    deflateTune
-    deflateBound
-    deflatePending
-    deflatePrime
-    deflateSetHeader
-    inflateSetDictionary
-    inflateGetDictionary
-    inflateSync
-    inflateCopy
-    inflateReset
-    inflateReset2
-    inflatePrime
-    inflateMark
-    inflateGetHeader
-    inflateBack
-    inflateBackEnd
-    zlibCompileFlags
-; utility functions
-    compress
-    compress2
-    compressBound
-    uncompress
-    gzopen
-    gzdopen
-    gzbuffer
-    gzsetparams
-    gzread
-    gzwrite
-    gzprintf
-    gzvprintf
-    gzputs
-    gzgets
-    gzputc
-    gzgetc
-    gzungetc
-    gzflush
-    gzseek
-    gzrewind
-    gztell
-    gzoffset
-    gzeof
-    gzdirect
-    gzclose
-    gzclose_r
-    gzclose_w
-    gzerror
-    gzclearerr
-; large file functions
-    gzopen64
-    gzseek64
-    gztell64
-    gzoffset64
-    adler32_combine64
-    crc32_combine64
-; checksum functions
-    adler32
-    crc32
-    adler32_combine
-    crc32_combine
-; various hacks, don't look :)
-    deflateInit_
-    deflateInit2_
-    inflateInit_
-    inflateInit2_
-    inflateBackInit_
-    gzgetc_
-    zError
-    inflateSyncPoint
-    get_crc_table
-    inflateUndermine
-    inflateResetKeep
-    deflateResetKeep
-    gzopen_w
+; zlib data compression library

+EXPORTS

+; basic functions

+    zlibVersion

+    deflate

+    deflateEnd

+    inflate

+    inflateEnd

+; advanced functions

+    deflateSetDictionary

+    deflateGetDictionary

+    deflateCopy

+    deflateReset

+    deflateParams

+    deflateTune

+    deflateBound

+    deflatePending

+    deflatePrime

+    deflateSetHeader

+    inflateSetDictionary

+    inflateGetDictionary

+    inflateSync

+    inflateCopy

+    inflateReset

+    inflateReset2

+    inflatePrime

+    inflateMark

+    inflateGetHeader

+    inflateBack

+    inflateBackEnd

+    zlibCompileFlags

+; utility functions

+    compress

+    compress2

+    compressBound

+    uncompress

+    uncompress2

+    gzopen

+    gzdopen

+    gzbuffer

+    gzsetparams

+    gzread

+    gzfread

+    gzwrite

+    gzfwrite

+    gzprintf

+    gzvprintf

+    gzputs

+    gzgets

+    gzputc

+    gzgetc

+    gzungetc

+    gzflush

+    gzseek

+    gzrewind

+    gztell

+    gzoffset

+    gzeof

+    gzdirect

+    gzclose

+    gzclose_r

+    gzclose_w

+    gzerror

+    gzclearerr

+; large file functions

+    gzopen64

+    gzseek64

+    gztell64

+    gzoffset64

+    adler32_combine64

+    crc32_combine64

+; checksum functions

+    adler32

+    adler32_z

+    crc32

+    crc32_z

+    adler32_combine

+    crc32_combine

+; various hacks, don't look :)

+    deflateInit_

+    deflateInit2_

+    inflateInit_

+    inflateInit2_

+    inflateBackInit_

+    gzgetc_

+    zError

+    inflateSyncPoint

+    get_crc_table

+    inflateUndermine

+    inflateValidate

+    inflateCodesUsed

+    inflateResetKeep

+    deflateResetKeep

+    gzopen_w

diff --git a/zconf.h b/zconf.h
index ca1eb81..5e1d68a 100644
--- a/zconf.h
+++ b/zconf.h
@@ -1,5 +1,5 @@
 /* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2013 Jean-loup Gailly.
+ * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -29,6 +29,7 @@
 #  define adler32               z_adler32
 #  define adler32_combine       z_adler32_combine
 #  define adler32_combine64     z_adler32_combine64
+#  define adler32_z             z_adler32_z
 #  ifndef Z_SOLO
 #    define compress              z_compress
 #    define compress2             z_compress2
@@ -37,10 +38,12 @@
 #  define crc32                 z_crc32
 #  define crc32_combine         z_crc32_combine
 #  define crc32_combine64       z_crc32_combine64
+#  define crc32_z               z_crc32_z
 #  define deflate               z_deflate
 #  define deflateBound          z_deflateBound
 #  define deflateCopy           z_deflateCopy
 #  define deflateEnd            z_deflateEnd
+#  define deflateGetDictionary  z_deflateGetDictionary
 #  define deflateInit           z_deflateInit
 #  define deflateInit2          z_deflateInit2
 #  define deflateInit2_         z_deflateInit2_
@@ -69,6 +72,8 @@
 #    define gzeof                 z_gzeof
 #    define gzerror               z_gzerror
 #    define gzflush               z_gzflush
+#    define gzfread               z_gzfread
+#    define gzfwrite              z_gzfwrite
 #    define gzgetc                z_gzgetc
 #    define gzgetc_               z_gzgetc_
 #    define gzgets                z_gzgets
@@ -80,7 +85,6 @@
 #      define gzopen_w              z_gzopen_w
 #    endif
 #    define gzprintf              z_gzprintf
-#    define gzvprintf             z_gzvprintf
 #    define gzputc                z_gzputc
 #    define gzputs                z_gzputs
 #    define gzread                z_gzread
@@ -91,6 +95,7 @@
 #    define gztell                z_gztell
 #    define gztell64              z_gztell64
 #    define gzungetc              z_gzungetc
+#    define gzvprintf             z_gzvprintf
 #    define gzwrite               z_gzwrite
 #  endif
 #  define inflate               z_inflate
@@ -98,8 +103,10 @@
 #  define inflateBackEnd        z_inflateBackEnd
 #  define inflateBackInit       z_inflateBackInit
 #  define inflateBackInit_      z_inflateBackInit_
+#  define inflateCodesUsed      z_inflateCodesUsed
 #  define inflateCopy           z_inflateCopy
 #  define inflateEnd            z_inflateEnd
+#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateGetHeader      z_inflateGetHeader
 #  define inflateInit           z_inflateInit
 #  define inflateInit2          z_inflateInit2
@@ -109,17 +116,18 @@
 #  define inflatePrime          z_inflatePrime
 #  define inflateReset          z_inflateReset
 #  define inflateReset2         z_inflateReset2
+#  define inflateResetKeep      z_inflateResetKeep
 #  define inflateSetDictionary  z_inflateSetDictionary
-#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateSync           z_inflateSync
 #  define inflateSyncPoint      z_inflateSyncPoint
 #  define inflateUndermine      z_inflateUndermine
-#  define inflateResetKeep      z_inflateResetKeep
+#  define inflateValidate       z_inflateValidate
 #  define inflate_copyright     z_inflate_copyright
 #  define inflate_fast          z_inflate_fast
 #  define inflate_table         z_inflate_table
 #  ifndef Z_SOLO
 #    define uncompress            z_uncompress
+#    define uncompress2           z_uncompress2
 #  endif
 #  define zError                z_zError
 #  ifndef Z_SOLO
diff --git a/zconf.h.cmakein b/zconf.h.cmakein
index 27a220b..a7f24cc 100644
--- a/zconf.h.cmakein
+++ b/zconf.h.cmakein
@@ -1,5 +1,5 @@
 /* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2013 Jean-loup Gailly.
+ * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -31,6 +31,7 @@
 #  define adler32               z_adler32
 #  define adler32_combine       z_adler32_combine
 #  define adler32_combine64     z_adler32_combine64
+#  define adler32_z             z_adler32_z
 #  ifndef Z_SOLO
 #    define compress              z_compress
 #    define compress2             z_compress2
@@ -39,10 +40,12 @@
 #  define crc32                 z_crc32
 #  define crc32_combine         z_crc32_combine
 #  define crc32_combine64       z_crc32_combine64
+#  define crc32_z               z_crc32_z
 #  define deflate               z_deflate
 #  define deflateBound          z_deflateBound
 #  define deflateCopy           z_deflateCopy
 #  define deflateEnd            z_deflateEnd
+#  define deflateGetDictionary  z_deflateGetDictionary
 #  define deflateInit           z_deflateInit
 #  define deflateInit2          z_deflateInit2
 #  define deflateInit2_         z_deflateInit2_
@@ -71,6 +74,8 @@
 #    define gzeof                 z_gzeof
 #    define gzerror               z_gzerror
 #    define gzflush               z_gzflush
+#    define gzfread               z_gzfread
+#    define gzfwrite              z_gzfwrite
 #    define gzgetc                z_gzgetc
 #    define gzgetc_               z_gzgetc_
 #    define gzgets                z_gzgets
@@ -82,7 +87,6 @@
 #      define gzopen_w              z_gzopen_w
 #    endif
 #    define gzprintf              z_gzprintf
-#    define gzvprintf             z_gzvprintf
 #    define gzputc                z_gzputc
 #    define gzputs                z_gzputs
 #    define gzread                z_gzread
@@ -93,6 +97,7 @@
 #    define gztell                z_gztell
 #    define gztell64              z_gztell64
 #    define gzungetc              z_gzungetc
+#    define gzvprintf             z_gzvprintf
 #    define gzwrite               z_gzwrite
 #  endif
 #  define inflate               z_inflate
@@ -100,8 +105,10 @@
 #  define inflateBackEnd        z_inflateBackEnd
 #  define inflateBackInit       z_inflateBackInit
 #  define inflateBackInit_      z_inflateBackInit_
+#  define inflateCodesUsed      z_inflateCodesUsed
 #  define inflateCopy           z_inflateCopy
 #  define inflateEnd            z_inflateEnd
+#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateGetHeader      z_inflateGetHeader
 #  define inflateInit           z_inflateInit
 #  define inflateInit2          z_inflateInit2
@@ -111,17 +118,18 @@
 #  define inflatePrime          z_inflatePrime
 #  define inflateReset          z_inflateReset
 #  define inflateReset2         z_inflateReset2
+#  define inflateResetKeep      z_inflateResetKeep
 #  define inflateSetDictionary  z_inflateSetDictionary
-#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateSync           z_inflateSync
 #  define inflateSyncPoint      z_inflateSyncPoint
 #  define inflateUndermine      z_inflateUndermine
-#  define inflateResetKeep      z_inflateResetKeep
+#  define inflateValidate       z_inflateValidate
 #  define inflate_copyright     z_inflate_copyright
 #  define inflate_fast          z_inflate_fast
 #  define inflate_table         z_inflate_table
 #  ifndef Z_SOLO
 #    define uncompress            z_uncompress
+#    define uncompress2           z_uncompress2
 #  endif
 #  define zError                z_zError
 #  ifndef Z_SOLO
diff --git a/zconf.h.in b/zconf.h.in
index ca1eb81..5e1d68a 100644
--- a/zconf.h.in
+++ b/zconf.h.in
@@ -1,5 +1,5 @@
 /* zconf.h -- configuration of the zlib compression library
- * Copyright (C) 1995-2013 Jean-loup Gailly.
+ * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
@@ -29,6 +29,7 @@
 #  define adler32               z_adler32
 #  define adler32_combine       z_adler32_combine
 #  define adler32_combine64     z_adler32_combine64
+#  define adler32_z             z_adler32_z
 #  ifndef Z_SOLO
 #    define compress              z_compress
 #    define compress2             z_compress2
@@ -37,10 +38,12 @@
 #  define crc32                 z_crc32
 #  define crc32_combine         z_crc32_combine
 #  define crc32_combine64       z_crc32_combine64
+#  define crc32_z               z_crc32_z
 #  define deflate               z_deflate
 #  define deflateBound          z_deflateBound
 #  define deflateCopy           z_deflateCopy
 #  define deflateEnd            z_deflateEnd
+#  define deflateGetDictionary  z_deflateGetDictionary
 #  define deflateInit           z_deflateInit
 #  define deflateInit2          z_deflateInit2
 #  define deflateInit2_         z_deflateInit2_
@@ -69,6 +72,8 @@
 #    define gzeof                 z_gzeof
 #    define gzerror               z_gzerror
 #    define gzflush               z_gzflush
+#    define gzfread               z_gzfread
+#    define gzfwrite              z_gzfwrite
 #    define gzgetc                z_gzgetc
 #    define gzgetc_               z_gzgetc_
 #    define gzgets                z_gzgets
@@ -80,7 +85,6 @@
 #      define gzopen_w              z_gzopen_w
 #    endif
 #    define gzprintf              z_gzprintf
-#    define gzvprintf             z_gzvprintf
 #    define gzputc                z_gzputc
 #    define gzputs                z_gzputs
 #    define gzread                z_gzread
@@ -91,6 +95,7 @@
 #    define gztell                z_gztell
 #    define gztell64              z_gztell64
 #    define gzungetc              z_gzungetc
+#    define gzvprintf             z_gzvprintf
 #    define gzwrite               z_gzwrite
 #  endif
 #  define inflate               z_inflate
@@ -98,8 +103,10 @@
 #  define inflateBackEnd        z_inflateBackEnd
 #  define inflateBackInit       z_inflateBackInit
 #  define inflateBackInit_      z_inflateBackInit_
+#  define inflateCodesUsed      z_inflateCodesUsed
 #  define inflateCopy           z_inflateCopy
 #  define inflateEnd            z_inflateEnd
+#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateGetHeader      z_inflateGetHeader
 #  define inflateInit           z_inflateInit
 #  define inflateInit2          z_inflateInit2
@@ -109,17 +116,18 @@
 #  define inflatePrime          z_inflatePrime
 #  define inflateReset          z_inflateReset
 #  define inflateReset2         z_inflateReset2
+#  define inflateResetKeep      z_inflateResetKeep
 #  define inflateSetDictionary  z_inflateSetDictionary
-#  define inflateGetDictionary  z_inflateGetDictionary
 #  define inflateSync           z_inflateSync
 #  define inflateSyncPoint      z_inflateSyncPoint
 #  define inflateUndermine      z_inflateUndermine
-#  define inflateResetKeep      z_inflateResetKeep
+#  define inflateValidate       z_inflateValidate
 #  define inflate_copyright     z_inflate_copyright
 #  define inflate_fast          z_inflate_fast
 #  define inflate_table         z_inflate_table
 #  ifndef Z_SOLO
 #    define uncompress            z_uncompress
+#    define uncompress2           z_uncompress2
 #  endif
 #  define zError                z_zError
 #  ifndef Z_SOLO
diff --git a/zlib.3 b/zlib.3
index 1cc3805..cbac458 100644
--- a/zlib.3
+++ b/zlib.3
@@ -1,4 +1,4 @@
-.TH ZLIB 3 "7 July 2015"
+.TH ZLIB 3 "31 Dec 2016"
 .SH NAME
 zlib \- compression/decompression library
 .SH SYNOPSIS
@@ -48,32 +48,10 @@
 that accompanies the source.
 .LP
 .I zlib
-is available in Java using the java.util.zip package:
-.IP
-http://java.sun.com/developer/technicalArticles/Programming/compression/
+is built in to many languages and operating systems, including but not limited to
+Java, Python, .NET, PHP, Perl, Ruby, Swift, and Go.
 .LP
-A Perl interface to
-.IR zlib ,
-written by Paul Marquess (pmqs@cpan.org),
-is available at CPAN (Comprehensive Perl Archive Network) sites,
-including:
-.IP
-http://search.cpan.org/~pmqs/IO-Compress-Zlib/
-.LP
-A Python interface to
-.IR zlib ,
-written by A.M. Kuchling (amk@magnet.com),
-is available in Python 1.5 and later versions:
-.IP
-http://docs.python.org/library/zlib.html
-.LP
-.I zlib
-is built into
-.IR tcl:
-.IP
-http://wiki.tcl.tk/4610
-.LP
-An experimental package to read and write files in .zip format,
+An experimental package to read and write files in the .zip format,
 written on top of
 .I zlib
 by Gilles Vollant (info@winimage.com),
@@ -92,7 +70,9 @@
 .IP
 http://zlib.net/
 .LP
-The data format used by the zlib library is described by RFC
+The data format used by the
+.I zlib
+library is described by RFC
 (Request for Comments) 1950 to 1952 in the files:
 .IP
 http://tools.ietf.org/html/rfc1950 (for the zlib header and trailer format)
@@ -125,9 +105,9 @@
 Send questions and/or comments to zlib@gzip.org,
 or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
 .SH AUTHORS AND LICENSE
-Version 1.2.8.1
+Version 1.2.9
 .LP
-Copyright (C) 1995-2015 Jean-loup Gailly and Mark Adler
+Copyright (C) 1995-2016 Jean-loup Gailly and Mark Adler
 .LP
 This software is provided 'as-is', without any express or implied
 warranty.  In no event will the authors be held liable for any damages
diff --git a/zlib.3.pdf b/zlib.3.pdf
index 7073f1a..5c71eed 100644
--- a/zlib.3.pdf
+++ b/zlib.3.pdf
Binary files differ
diff --git a/zlib.h b/zlib.h
index 0f9816d..69fbb97 100644
--- a/zlib.h
+++ b/zlib.h
@@ -1,7 +1,7 @@
 /* zlib.h -- interface of the 'zlib' general purpose compression library
-  version 1.2.8.1, May xxth, 2013
+  version 1.2.9, December 31st, 2016
 
-  Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
+  Copyright (C) 1995-2016 Jean-loup Gailly and Mark Adler
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
@@ -37,12 +37,12 @@
 extern "C" {
 #endif
 
-#define ZLIB_VERSION "1.2.8.1-motley"
-#define ZLIB_VERNUM 0x1281
+#define ZLIB_VERSION "1.2.9"
+#define ZLIB_VERNUM 0x1290
 #define ZLIB_VER_MAJOR 1
 #define ZLIB_VER_MINOR 2
-#define ZLIB_VER_REVISION 8
-#define ZLIB_VER_SUBREVISION 1
+#define ZLIB_VER_REVISION 9
+#define ZLIB_VER_SUBREVISION 0
 
 /*
     The 'zlib' compression library provides in-memory compression and
diff --git a/zlib.map b/zlib.map
index 55c6647..40fa9db 100644
--- a/zlib.map
+++ b/zlib.map
@@ -1,83 +1,94 @@
-ZLIB_1.2.0 {
-  global:
-    compressBound;
-    deflateBound;
-    inflateBack;
-    inflateBackEnd;
-    inflateBackInit_;
-    inflateCopy;
-  local:
-    deflate_copyright;
-    inflate_copyright;
-    inflate_fast;
-    inflate_table;
-    zcalloc;
-    zcfree;
-    z_errmsg;
-    gz_error;
-    gz_intmax;
-    _*;
-};
-
-ZLIB_1.2.0.2 {
-    gzclearerr;
-    gzungetc;
-    zlibCompileFlags;
-} ZLIB_1.2.0;
-
-ZLIB_1.2.0.8 {
-    deflatePrime;
-} ZLIB_1.2.0.2;
-
-ZLIB_1.2.2 {
-    adler32_combine;
-    crc32_combine;
-    deflateSetHeader;
-    inflateGetHeader;
-} ZLIB_1.2.0.8;
-
-ZLIB_1.2.2.3 {
-    deflateTune;
-    gzdirect;
-} ZLIB_1.2.2;
-
-ZLIB_1.2.2.4 {
-    inflatePrime;
-} ZLIB_1.2.2.3;
-
-ZLIB_1.2.3.3 {
-    adler32_combine64;
-    crc32_combine64;
-    gzopen64;
-    gzseek64;
-    gztell64;
-    inflateUndermine;
-} ZLIB_1.2.2.4;
-
-ZLIB_1.2.3.4 {
-    inflateReset2;
-    inflateMark;
-} ZLIB_1.2.3.3;
-
-ZLIB_1.2.3.5 {
-    gzbuffer;
-    gzoffset;
-    gzoffset64;
-    gzclose_r;
-    gzclose_w;
-} ZLIB_1.2.3.4;
-
-ZLIB_1.2.5.1 {
-    deflatePending;
-} ZLIB_1.2.3.5;
-
-ZLIB_1.2.5.2 {
-    deflateResetKeep;
-    gzgetc_;
-    inflateResetKeep;
-} ZLIB_1.2.5.1;
-
-ZLIB_1.2.7.1 {
-    inflateGetDictionary;
-    gzvprintf;
-} ZLIB_1.2.5.2;
+ZLIB_1.2.0 {

+  global:

+    compressBound;

+    deflateBound;

+    inflateBack;

+    inflateBackEnd;

+    inflateBackInit_;

+    inflateCopy;

+  local:

+    deflate_copyright;

+    inflate_copyright;

+    inflate_fast;

+    inflate_table;

+    zcalloc;

+    zcfree;

+    z_errmsg;

+    gz_error;

+    gz_intmax;

+    _*;

+};

+

+ZLIB_1.2.0.2 {

+    gzclearerr;

+    gzungetc;

+    zlibCompileFlags;

+} ZLIB_1.2.0;

+

+ZLIB_1.2.0.8 {

+    deflatePrime;

+} ZLIB_1.2.0.2;

+

+ZLIB_1.2.2 {

+    adler32_combine;

+    crc32_combine;

+    deflateSetHeader;

+    inflateGetHeader;

+} ZLIB_1.2.0.8;

+

+ZLIB_1.2.2.3 {

+    deflateTune;

+    gzdirect;

+} ZLIB_1.2.2;

+

+ZLIB_1.2.2.4 {

+    inflatePrime;

+} ZLIB_1.2.2.3;

+

+ZLIB_1.2.3.3 {

+    adler32_combine64;

+    crc32_combine64;

+    gzopen64;

+    gzseek64;

+    gztell64;

+    inflateUndermine;

+} ZLIB_1.2.2.4;

+

+ZLIB_1.2.3.4 {

+    inflateReset2;

+    inflateMark;

+} ZLIB_1.2.3.3;

+

+ZLIB_1.2.3.5 {

+    gzbuffer;

+    gzoffset;

+    gzoffset64;

+    gzclose_r;

+    gzclose_w;

+} ZLIB_1.2.3.4;

+

+ZLIB_1.2.5.1 {

+    deflatePending;

+} ZLIB_1.2.3.5;

+

+ZLIB_1.2.5.2 {

+    deflateResetKeep;

+    gzgetc_;

+    inflateResetKeep;

+} ZLIB_1.2.5.1;

+

+ZLIB_1.2.7.1 {

+    inflateGetDictionary;

+    gzvprintf;

+} ZLIB_1.2.5.2;

+

+ZLIB_1.2.9 {

+    inflateCodesUsed;

+    inflateValidate;

+    uncompress2;

+    gzfread;

+    gzfwrite;

+    deflateGetDictionary;

+    adler32_z;

+    crc32_z;

+} ZLIB_1.2.7.1;

diff --git a/zutil.c b/zutil.c
index 74e48aa..3b4d904 100644
--- a/zutil.c
+++ b/zutil.c
@@ -1,5 +1,5 @@
 /* zutil.c -- target dependent utility functions for the compression library
- * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly.
+ * Copyright (C) 1995-2005, 2010, 2011, 2012, 2016 Jean-loup Gailly
  * For conditions of distribution and use, see copyright notice in zlib.h
  */
 
diff --git a/zutil.h b/zutil.h
index 96cc90f..b079ea6 100644
--- a/zutil.h
+++ b/zutil.h
@@ -1,5 +1,5 @@
 /* zutil.h -- internal interface and configuration of the compression library
- * Copyright (C) 1995-2013 Jean-loup Gailly.
+ * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
  * For conditions of distribution and use, see copyright notice in zlib.h
  */