]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
ZLIB_COMPAT: add an extra 32 bits of padding in z_stream
authorR.J.V. Bertin <rjvbertin@gmail.com>
Tue, 23 May 2017 17:46:55 +0000 (19:46 +0200)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Thu, 17 Aug 2017 09:46:59 +0000 (11:46 +0200)
zlib "stock" uses an "uLong" for zstream::adler, meaning 4 bytes in 64
bit bits. The padding makes zlib-ng a drop-in replacement for libz; without,
the deflateInit2_() function returns a version error when called from
dependents that were built against "stock" zlib.

Committed from host : Portia.local

zlib.h

diff --git a/zlib.h b/zlib.h
index 05b28c2f639a6a5d04f7b7880bc2dc62c1218465..f7b460a6da66dba1b4e6dd7ca10052341a3030f4 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -109,6 +109,9 @@ typedef struct z_stream_s {
     int                   data_type;  /* best guess about the data type: binary or text
                                          for deflate, or the decoding state for inflate */
     uint32_t              adler;      /* Adler-32 or CRC-32 value of the uncompressed data */
+#if defined(ZLIB_COMPAT) && defined(X86_64)
+    uint32_t              padding;    /* pad out to the same size as the zlib struct */
+#endif
     unsigned long         reserved;   /* reserved for future use */
 } z_stream;