summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-08-15 13:32:51 +0200
committerStefan Metzmacher <metze@samba.org>2008-08-18 15:25:40 +0200
commit5e4f668468d83b09765c4b15ff1b40b88401fb00 (patch)
treed20132113c89c212afaf0871736fc08d4674a9e5 /source4
parent41fdbffa72cab3c4f18ef5f34ab2fa0ec10d4d53 (diff)
downloadsamba-5e4f668468d83b09765c4b15ff1b40b88401fb00.tar.gz
samba-5e4f668468d83b09765c4b15ff1b40b88401fb00.tar.bz2
samba-5e4f668468d83b09765c4b15ff1b40b88401fb00.zip
zlib: fix compiler warnings
metze (This used to be commit ce44a608f66bf27070fd43d576551fde6f545d7c)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/zlib/adler32.c3
-rw-r--r--source4/lib/zlib/compress.c5
-rw-r--r--source4/lib/zlib/crc32.c4
-rw-r--r--source4/lib/zlib/deflate.c8
-rw-r--r--source4/lib/zlib/gzio.c16
-rw-r--r--source4/lib/zlib/infback.c24
-rw-r--r--source4/lib/zlib/inffast.c10
-rw-r--r--source4/lib/zlib/inflate.c46
-rw-r--r--source4/lib/zlib/trees.c12
-rw-r--r--source4/lib/zlib/uncompr.c5
-rw-r--r--source4/lib/zlib/zlib.h19
-rw-r--r--source4/lib/zlib/zutil.h2
12 files changed, 80 insertions, 74 deletions
diff --git a/source4/lib/zlib/adler32.c b/source4/lib/zlib/adler32.c
index 007ba26277..b5333d7b8e 100644
--- a/source4/lib/zlib/adler32.c
+++ b/source4/lib/zlib/adler32.c
@@ -5,8 +5,7 @@
/* @(#) $Id$ */
-#define ZLIB_INTERNAL
-#include "zlib.h"
+#include "zutil.h"
#define BASE 65521UL /* largest prime smaller than 65536 */
#define NMAX 5552
diff --git a/source4/lib/zlib/compress.c b/source4/lib/zlib/compress.c
index df04f0148e..40a53cd476 100644
--- a/source4/lib/zlib/compress.c
+++ b/source4/lib/zlib/compress.c
@@ -5,8 +5,7 @@
/* @(#) $Id$ */
-#define ZLIB_INTERNAL
-#include "zlib.h"
+#include "zutil.h"
/* ===========================================================================
Compresses the source buffer into the destination buffer. The level
@@ -29,7 +28,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
z_stream stream;
int err;
- stream.next_in = (Bytef*)source;
+ stream.next_in = source;
stream.avail_in = (uInt)sourceLen;
#ifdef MAXSEG_64K
/* Check for source > 64K on 16-bit machine: */
diff --git a/source4/lib/zlib/crc32.c b/source4/lib/zlib/crc32.c
index f658a9ef55..4d6e699e60 100644
--- a/source4/lib/zlib/crc32.c
+++ b/source4/lib/zlib/crc32.c
@@ -11,6 +11,8 @@
/* @(#) $Id$ */
+#include "zutil.h" /* for STDC and FAR definitions */
+
/*
Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
protection on the static variables used to control the first-use generation
@@ -26,8 +28,6 @@
# endif /* !DYNAMIC_CRC_TABLE */
#endif /* MAKECRCH */
-#include "zutil.h" /* for STDC and FAR definitions */
-
#define local static
/* Find a four-byte integer type for crc32_little() and crc32_big(). */
diff --git a/source4/lib/zlib/deflate.c b/source4/lib/zlib/deflate.c
index 29ce1f64a5..2720aab911 100644
--- a/source4/lib/zlib/deflate.c
+++ b/source4/lib/zlib/deflate.c
@@ -154,9 +154,6 @@ local const config configuration_table[10] = {
* meaning.
*/
-#define EQUAL 0
-/* result of memcmp for equal strings */
-
#ifndef NO_DUMMY_DECL
struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
#endif
@@ -297,7 +294,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
s->pending_buf == Z_NULL) {
s->status = FINISH_STATE;
- strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
+ strm->msg = ERR_MSG(Z_MEM_ERROR);
deflateEnd (strm);
return Z_MEM_ERROR;
}
@@ -1226,6 +1223,9 @@ local uInt longest_match_fast(s, cur_match)
}
#ifdef DEBUG
+#define EQUAL 0
+/* result of memcmp for equal strings */
+
/* ===========================================================================
* Check that the match at match_start is indeed a match.
*/
diff --git a/source4/lib/zlib/gzio.c b/source4/lib/zlib/gzio.c
index 7e90f4928f..0b51297936 100644
--- a/source4/lib/zlib/gzio.c
+++ b/source4/lib/zlib/gzio.c
@@ -7,8 +7,6 @@
/* @(#) $Id$ */
-#include <stdio.h>
-
#include "zutil.h"
#ifdef NO_DEFLATE /* for compatibility with old definition */
@@ -46,7 +44,7 @@ extern void free OF((voidpf ptr));
static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
/* gzip flag byte */
-#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
+/*#define ASCII_FLAG 0x01 *//* bit 0 set: file probably ascii text */
#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
@@ -98,7 +96,7 @@ local gzFile gz_open (path, mode, fd)
int err;
int level = Z_DEFAULT_COMPRESSION; /* compression level */
int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
- char *p = (char*)mode;
+ const char *p = mode;
gz_stream *s;
char fmode[80]; /* copy of mode, without the compression level */
char *m = fmode;
@@ -565,7 +563,7 @@ int ZEXPORT gzwrite (file, buf, len)
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
- s->stream.next_in = (Bytef*)buf;
+ s->stream.next_in = (const Bytef*)buf;
s->stream.avail_in = len;
while (s->stream.avail_in != 0) {
@@ -694,7 +692,7 @@ int ZEXPORT gzputs(file, s)
gzFile file;
const char *s;
{
- return gzwrite(file, (char*)s, (unsigned)strlen(s));
+ return gzwrite(file, (voidpc)s, (unsigned)strlen(s));
}
@@ -988,7 +986,7 @@ const char * ZEXPORT gzerror (file, errnum)
gzFile file;
int *errnum;
{
- char *m;
+ const char *m;
gz_stream *s = (gz_stream*)file;
if (s == NULL) {
@@ -998,9 +996,9 @@ const char * ZEXPORT gzerror (file, errnum)
*errnum = s->z_err;
if (*errnum == Z_OK) return (const char*)"";
- m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
+ m = (*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
- if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
+ if (m == NULL || *m == '\0') m = ERR_MSG(s->z_err);
TRYFREE(s->msg);
s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
diff --git a/source4/lib/zlib/infback.c b/source4/lib/zlib/infback.c
index 455dbc9ee8..5680937f34 100644
--- a/source4/lib/zlib/infback.c
+++ b/source4/lib/zlib/infback.c
@@ -246,7 +246,7 @@ out_func out;
void FAR *out_desc;
{
struct inflate_state FAR *state;
- unsigned char FAR *next; /* next input */
+ unsigned const char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
unsigned have, left; /* available input and output */
unsigned long hold; /* bit buffer */
@@ -308,7 +308,7 @@ void FAR *out_desc;
state->mode = TABLE;
break;
case 3:
- strm->msg = (char *)"invalid block type";
+ strm->msg = "invalid block type";
state->mode = BAD;
}
DROPBITS(2);
@@ -319,7 +319,7 @@ void FAR *out_desc;
BYTEBITS(); /* go to byte boundary */
NEEDBITS(32);
if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
+ strm->msg = "invalid stored block lengths";
state->mode = BAD;
break;
}
@@ -357,7 +357,7 @@ void FAR *out_desc;
DROPBITS(4);
#ifndef PKZIP_BUG_WORKAROUND
if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
+ strm->msg = "too many length or distance symbols";
state->mode = BAD;
break;
}
@@ -379,7 +379,7 @@ void FAR *out_desc;
ret = inflate_table(CODES, state->lens, 19, &(state->next),
&(state->lenbits), state->work);
if (ret) {
- strm->msg = (char *)"invalid code lengths set";
+ strm->msg = "invalid code lengths set";
state->mode = BAD;
break;
}
@@ -403,7 +403,7 @@ void FAR *out_desc;
NEEDBITS(this.bits + 2);
DROPBITS(this.bits);
if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
+ strm->msg = "invalid bit length repeat";
state->mode = BAD;
break;
}
@@ -426,7 +426,7 @@ void FAR *out_desc;
DROPBITS(7);
}
if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
+ strm->msg = "invalid bit length repeat";
state->mode = BAD;
break;
}
@@ -445,7 +445,7 @@ void FAR *out_desc;
ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
&(state->lenbits), state->work);
if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
+ strm->msg = "invalid literal/lengths set";
state->mode = BAD;
break;
}
@@ -454,7 +454,7 @@ void FAR *out_desc;
ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
&(state->next), &(state->distbits), state->work);
if (ret) {
- strm->msg = (char *)"invalid distances set";
+ strm->msg = "invalid distances set";
state->mode = BAD;
break;
}
@@ -512,7 +512,7 @@ void FAR *out_desc;
/* invalid code */
if (this.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
+ strm->msg = "invalid literal/length code";
state->mode = BAD;
break;
}
@@ -544,7 +544,7 @@ void FAR *out_desc;
}
DROPBITS(this.bits);
if (this.op & 64) {
- strm->msg = (char *)"invalid distance code";
+ strm->msg = "invalid distance code";
state->mode = BAD;
break;
}
@@ -559,7 +559,7 @@ void FAR *out_desc;
}
if (state->offset > state->wsize - (state->whave < state->wsize ?
left : 0)) {
- strm->msg = (char *)"invalid distance too far back";
+ strm->msg = "invalid distance too far back";
state->mode = BAD;
break;
}
diff --git a/source4/lib/zlib/inffast.c b/source4/lib/zlib/inffast.c
index bbee92ed1e..bfc727694a 100644
--- a/source4/lib/zlib/inffast.c
+++ b/source4/lib/zlib/inffast.c
@@ -69,8 +69,8 @@ z_streamp strm;
unsigned start; /* inflate()'s starting value for strm->avail_out */
{
struct inflate_state FAR *state;
- unsigned char FAR *in; /* local strm->next_in */
- unsigned char FAR *last; /* while in < last, enough input available */
+ unsigned const char FAR *in; /* local strm->next_in */
+ unsigned const char FAR *last; /* while in < last, enough input available */
unsigned char FAR *out; /* local strm->next_out */
unsigned char FAR *beg; /* inflate()'s initial strm->next_out */
unsigned char FAR *end; /* while out < end, enough space available */
@@ -187,7 +187,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
if (dist > op) { /* see if copy from window */
op = dist - op; /* distance back in window */
if (op > whave) {
- strm->msg = (char *)"invalid distance too far back";
+ strm->msg = "invalid distance too far back";
state->mode = BAD;
break;
}
@@ -263,7 +263,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
goto dodist;
}
else {
- strm->msg = (char *)"invalid distance code";
+ strm->msg = "invalid distance code";
state->mode = BAD;
break;
}
@@ -278,7 +278,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
break;
}
else {
- strm->msg = (char *)"invalid literal/length code";
+ strm->msg = "invalid literal/length code";
state->mode = BAD;
break;
}
diff --git a/source4/lib/zlib/inflate.c b/source4/lib/zlib/inflate.c
index 0c1ff17951..fbecefd8f5 100644
--- a/source4/lib/zlib/inflate.c
+++ b/source4/lib/zlib/inflate.c
@@ -97,7 +97,7 @@ local int updatewindow OF((z_streamp strm, unsigned out));
#ifdef BUILDFIXED
void makefixed OF((void));
#endif
-local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf,
+local unsigned syncsearch OF((unsigned FAR *have, unsigned const char FAR *buf,
unsigned len));
int ZEXPORT inflateReset2(strm, flags)
@@ -565,7 +565,7 @@ z_streamp strm;
int flush;
{
struct inflate_state FAR *state;
- unsigned char FAR *next; /* next input */
+ unsigned const char FAR *next; /* next input */
unsigned char FAR *put; /* next output */
unsigned have, left; /* available input and output */
unsigned long hold; /* bit buffer */
@@ -617,19 +617,19 @@ int flush;
if (
#endif
((BITS(8) << 8) + (hold >> 8)) % 31) {
- strm->msg = (char *)"incorrect header check";
+ strm->msg = "incorrect header check";
state->mode = BAD;
break;
}
if (BITS(4) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
+ strm->msg = "unknown compression method";
state->mode = BAD;
break;
}
DROPBITS(4);
len = BITS(4) + 8;
if (len > state->wbits) {
- strm->msg = (char *)"invalid window size";
+ strm->msg = "invalid window size";
state->mode = BAD;
break;
}
@@ -644,12 +644,12 @@ int flush;
NEEDBITS(16);
state->flags = (int)(hold);
if ((state->flags & 0xff) != Z_DEFLATED) {
- strm->msg = (char *)"unknown compression method";
+ strm->msg = "unknown compression method";
state->mode = BAD;
break;
}
if (state->flags & 0xe000) {
- strm->msg = (char *)"unknown header flags set";
+ strm->msg = "unknown header flags set";
state->mode = BAD;
break;
}
@@ -753,7 +753,7 @@ int flush;
if (state->flags & 0x0200) {
NEEDBITS(16);
if (hold != (state->check & 0xffff)) {
- strm->msg = (char *)"header crc mismatch";
+ strm->msg = "header crc mismatch";
state->mode = BAD;
break;
}
@@ -808,7 +808,7 @@ int flush;
state->mode = TABLE;
break;
case 3:
- strm->msg = (char *)"invalid block type";
+ strm->msg = "invalid block type";
state->mode = BAD;
}
DROPBITS(2);
@@ -817,7 +817,7 @@ int flush;
BYTEBITS(); /* go to byte boundary */
NEEDBITS(32);
if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) {
- strm->msg = (char *)"invalid stored block lengths";
+ strm->msg = "invalid stored block lengths";
state->mode = BAD;
break;
}
@@ -853,7 +853,7 @@ int flush;
DROPBITS(4);
#ifndef PKZIP_BUG_WORKAROUND
if (state->nlen > 286 || state->ndist > 30) {
- strm->msg = (char *)"too many length or distance symbols";
+ strm->msg = "too many length or distance symbols";
state->mode = BAD;
break;
}
@@ -875,7 +875,7 @@ int flush;
ret = inflate_table(CODES, state->lens, 19, &(state->next),
&(state->lenbits), state->work);
if (ret) {
- strm->msg = (char *)"invalid code lengths set";
+ strm->msg = "invalid code lengths set";
state->mode = BAD;
break;
}
@@ -899,7 +899,7 @@ int flush;
NEEDBITS(this.bits + 2);
DROPBITS(this.bits);
if (state->have == 0) {
- strm->msg = (char *)"invalid bit length repeat";
+ strm->msg = "invalid bit length repeat";
state->mode = BAD;
break;
}
@@ -922,7 +922,7 @@ int flush;
DROPBITS(7);
}
if (state->have + copy > state->nlen + state->ndist) {
- strm->msg = (char *)"invalid bit length repeat";
+ strm->msg = "invalid bit length repeat";
state->mode = BAD;
break;
}
@@ -941,7 +941,7 @@ int flush;
ret = inflate_table(LENS, state->lens, state->nlen, &(state->next),
&(state->lenbits), state->work);
if (ret) {
- strm->msg = (char *)"invalid literal/lengths set";
+ strm->msg = "invalid literal/lengths set";
state->mode = BAD;
break;
}
@@ -950,7 +950,7 @@ int flush;
ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist,
&(state->next), &(state->distbits), state->work);
if (ret) {
- strm->msg = (char *)"invalid distances set";
+ strm->msg = "invalid distances set";
state->mode = BAD;
break;
}
@@ -993,7 +993,7 @@ int flush;
break;
}
if (this.op & 64) {
- strm->msg = (char *)"invalid literal/length code";
+ strm->msg = "invalid literal/length code";
state->mode = BAD;
break;
}
@@ -1025,7 +1025,7 @@ int flush;
}
DROPBITS(this.bits);
if (this.op & 64) {
- strm->msg = (char *)"invalid distance code";
+ strm->msg = "invalid distance code";
state->mode = BAD;
break;
}
@@ -1040,13 +1040,13 @@ int flush;
}
#ifdef INFLATE_STRICT
if (state->offset > state->dmax) {
- strm->msg = (char *)"invalid distance too far back";
+ strm->msg = "invalid distance too far back";
state->mode = BAD;
break;
}
#endif
if (state->offset > state->whave + out - left) {
- strm->msg = (char *)"invalid distance too far back";
+ strm->msg = "invalid distance too far back";
state->mode = BAD;
break;
}
@@ -1098,7 +1098,7 @@ int flush;
state->flags ? hold :
#endif
REVERSE(hold)) != state->check) {
- strm->msg = (char *)"incorrect data check";
+ strm->msg = "incorrect data check";
state->mode = BAD;
break;
}
@@ -1111,7 +1111,7 @@ int flush;
if (state->wrap && state->flags) {
NEEDBITS(32);
if (hold != (state->total & 0xffffffffUL)) {
- strm->msg = (char *)"incorrect length check";
+ strm->msg = "incorrect length check";
state->mode = BAD;
break;
}
@@ -1247,7 +1247,7 @@ gz_headerp head;
*/
local unsigned syncsearch(have, buf, len)
unsigned FAR *have;
-unsigned char FAR *buf;
+unsigned const char FAR *buf;
unsigned len;
{
unsigned got;
diff --git a/source4/lib/zlib/trees.c b/source4/lib/zlib/trees.c
index 395e4e1681..eb55679adc 100644
--- a/source4/lib/zlib/trees.c
+++ b/source4/lib/zlib/trees.c
@@ -150,8 +150,8 @@ local void send_tree OF((deflate_state *s, ct_data *tree, int max_code));
local int build_bl_tree OF((deflate_state *s));
local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
int blcodes));
-local void compress_block OF((deflate_state *s, ct_data *ltree,
- ct_data *dtree));
+local void compress_block OF((deflate_state *s, const ct_data *ltree,
+ const ct_data *dtree));
local void set_data_type OF((deflate_state *s));
local unsigned bi_reverse OF((unsigned value, int length));
local void bi_windup OF((deflate_state *s));
@@ -986,7 +986,7 @@ void _tr_flush_block(s, buf, stored_len, eof)
} else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
#endif
send_bits(s, (STATIC_TREES<<1)+eof, 3);
- compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
+ compress_block(s, static_ltree, static_dtree);
#ifdef DEBUG
s->compressed_len += 3 + s->static_len;
#endif
@@ -994,7 +994,7 @@ void _tr_flush_block(s, buf, stored_len, eof)
send_bits(s, (DYN_TREES<<1)+eof, 3);
send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
max_blindex+1);
- compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
+ compress_block(s, s->dyn_ltree, s->dyn_dtree);
#ifdef DEBUG
s->compressed_len += 3 + s->opt_len;
#endif
@@ -1071,8 +1071,8 @@ int _tr_tally (s, dist, lc)
*/
local void compress_block(s, ltree, dtree)
deflate_state *s;
- ct_data *ltree; /* literal tree */
- ct_data *dtree; /* distance tree */
+ const ct_data *ltree; /* literal tree */
+ const ct_data *dtree; /* distance tree */
{
unsigned dist; /* distance of matched string */
int lc; /* match length or unmatched char (if dist == 0) */
diff --git a/source4/lib/zlib/uncompr.c b/source4/lib/zlib/uncompr.c
index b59e3d0def..a052f22e74 100644
--- a/source4/lib/zlib/uncompr.c
+++ b/source4/lib/zlib/uncompr.c
@@ -5,8 +5,7 @@
/* @(#) $Id$ */
-#define ZLIB_INTERNAL
-#include "zlib.h"
+#include "zutil.h"
/* ===========================================================================
Decompresses the source buffer into the destination buffer. sourceLen is
@@ -32,7 +31,7 @@ int ZEXPORT uncompress (dest, destLen, source, sourceLen)
z_stream stream;
int err;
- stream.next_in = (Bytef*)source;
+ stream.next_in = source;
stream.avail_in = (uInt)sourceLen;
/* Check for source > 64K on 16-bit machine: */
if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR;
diff --git a/source4/lib/zlib/zlib.h b/source4/lib/zlib/zlib.h
index e80eed9a7e..5549f9cf57 100644
--- a/source4/lib/zlib/zlib.h
+++ b/source4/lib/zlib/zlib.h
@@ -80,7 +80,7 @@ typedef void (*free_func) OF((voidpf opaque, voidpf address));
struct internal_state;
typedef struct z_stream_s {
- Bytef *next_in; /* next input byte */
+ const Bytef *next_in; /* next input byte */
uInt avail_in; /* number of bytes available at next_in */
uLong total_in; /* total nb of input bytes read so far */
@@ -88,7 +88,7 @@ typedef struct z_stream_s {
uInt avail_out; /* remaining free space at next_out */
uLong total_out; /* total nb of bytes output so far */
- char *msg; /* last error message, NULL if no error */
+ const char *msg; /* last error message, NULL if no error */
struct internal_state FAR *state; /* not visible by applications */
alloc_func zalloc; /* used to allocate the internal state */
@@ -210,6 +210,16 @@ typedef gz_header FAR *gz_headerp;
#define zlib_version zlibVersion()
/* for compatibility with versions < 1.0.2 */
+#if (__GNUC__ >= 3) && (__GNUC_MINOR__ >= 1)
+/** Use gcc attribute to check printf fns. a1 is the 1-based index of
+ * the parameter containing the format, and a2 the index of the first
+ * argument. Note that some gcc 2.x versions don't handle this
+ * properly **/
+#define _Z_PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
+#else
+#define _Z_PRINTF_ATTRIBUTE(a1, a2)
+#endif
+
/* basic functions */
ZEXTERN const char * ZEXPORT zlibVersion OF((void));
@@ -887,7 +897,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits,
match the version of the header file.
*/
-typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *));
+typedef unsigned (*in_func) OF((void FAR *, unsigned const char FAR * FAR *));
typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned));
ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,
@@ -1132,7 +1142,8 @@ ZEXTERN int ZEXPORT gzwrite OF((gzFile file,
(0 in case of error).
*/
-ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...));
+ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...))
+ _Z_PRINTF_ATTRIBUTE(2, 3);
/*
Converts, formats, and writes the args to the compressed file under
control of the format string, as in fprintf. gzprintf returns the number of
diff --git a/source4/lib/zlib/zutil.h b/source4/lib/zlib/zutil.h
index b7d5eff81b..edd8e0acbb 100644
--- a/source4/lib/zlib/zutil.h
+++ b/source4/lib/zlib/zutil.h
@@ -56,7 +56,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
#define ERR_RETURN(strm,err) \
- return (strm->msg = (char*)ERR_MSG(err), (err))
+ return (strm->msg = ERR_MSG(err), (err))
/* To be used only when the state is known to be valid */
/* common constants */