From 5ab9f47745fe9353291b217f705086b6070575d5 Mon Sep 17 00:00:00 2001 From: Mark Adler Date: Tue, 18 Oct 2011 23:05:37 -0700 Subject: Add #define ZLIB_CONST option to use const in the z_stream interface. This permits compilers to check for the proper treatment of next_in and msg in the z_stream structure. This is an option instead of the default in order to preserve backward compatibility. Some applications make use of the z_stream structure outside of zlib, and perform operations such as free(strm->next_in), which would not be permitted when next_in is const. The #define ZLIB_CONST needs to precede the #include "zlib.h">, in order to make next_in and msg const pointers in the z_stream type. --- zconf.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'zconf.h') diff --git a/zconf.h b/zconf.h index df7ff61..fd10c6a 100644 --- a/zconf.h +++ b/zconf.h @@ -214,6 +214,12 @@ # endif #endif +#if defined(ZLIB_CONST) && !defined(z_const) +# define z_const const +#else +# define z_const +#endif + /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL -- cgit v1.2.3-55-g6feb