diff --git a/gzwrite.c b/gzwrite.c index e8defc6..2cc14f8 100644 --- a/gzwrite.c +++ b/gzwrite.c @@ -191,7 +191,7 @@ int ZEXPORT gzwrite(file, buf, len) n = state->size - strm->avail_in; if (n > len) n = len; - memcpy(strm->next_in + strm->avail_in, buf, n); + memcpy(state->in + strm->avail_in, buf, n); strm->avail_in += n; state->pos += n; buf = (char *)buf + n; @@ -207,7 +207,7 @@ int ZEXPORT gzwrite(file, buf, len) /* directly compress user buffer to file */ strm->avail_in = len; - strm->next_in = (voidp)buf; + strm->next_in = buf; state->pos += len; if (gz_comp(state, Z_NO_FLUSH) == -1) return 0; @@ -248,7 +248,7 @@ int ZEXPORT gzputc(file, c) if (strm->avail_in < state->size) { if (strm->avail_in == 0) strm->next_in = state->in; - strm->next_in[strm->avail_in++] = c; + state->in[strm->avail_in++] = c; state->pos++; return c; } diff --git a/infback.c b/infback.c index af3a8c9..4beca98 100644 --- a/infback.c +++ b/infback.c @@ -246,7 +246,7 @@ out_func out; void FAR *out_desc; { struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ + const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ diff --git a/inffast.c b/inffast.c index 2f1d60b..7acd24a 100644 --- a/inffast.c +++ b/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 */ + const unsigned char FAR *in; /* local strm->next_in */ + const unsigned 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 */ diff --git a/inflate.c b/inflate.c index a8431ab..7ce9eaf 100644 --- a/inflate.c +++ b/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, const unsigned char FAR *buf, unsigned len)); int ZEXPORT inflateReset(strm) @@ -591,7 +591,7 @@ z_streamp strm; int flush; { struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ + const unsigned char FAR *next; /* next input */ unsigned char FAR *put; /* next output */ unsigned have, left; /* available input and output */ unsigned long hold; /* bit buffer */ @@ -1321,7 +1321,7 @@ gz_headerp head; */ local unsigned syncsearch(have, buf, len) unsigned FAR *have; -unsigned char FAR *buf; +const unsigned char FAR *buf; unsigned len; { unsigned got; diff --git a/zlib.h b/zlib.h index bfbba83..361149c 100644 --- a/zlib.h +++ b/zlib.h @@ -83,7 +83,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 */ @@ -967,7 +967,7 @@ ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, the version of the header file. */ -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef unsigned (*in_func) OF((void FAR *, const unsigned char FAR * FAR *)); typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm,