aboutsummaryrefslogtreecommitdiff
path: root/deflate.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2012-08-12 18:08:52 -0700
committerMark Adler <madler@alumni.caltech.edu>2012-08-13 00:02:40 -0700
commit62d6112a7981ad7c34f3b43cffdf00d4662a4f25 (patch)
treeaed93070f7e1be31868dce1d62a1de6ffc1360f9 /deflate.c
parentfb4e0599a5ddaef9eee726f786b9edef4943432b (diff)
downloadzlib-62d6112a7981ad7c34f3b43cffdf00d4662a4f25.tar.gz
zlib-62d6112a7981ad7c34f3b43cffdf00d4662a4f25.tar.bz2
zlib-62d6112a7981ad7c34f3b43cffdf00d4662a4f25.zip
Clean up the usage of z_const and respect const usage within zlib.
This patch allows zlib to compile cleanly with the -Wcast-qual gcc warning enabled, but only if ZLIB_CONST is defined, which adds const to next_in and msg in z_stream and in the in_func prototype. A --const option is added to ./configure which adds -DZLIB_CONST to the compile flags, and adds -Wcast-qual to the compile flags when ZLIBGCCWARN is set in the environment.
Diffstat (limited to 'deflate.c')
-rw-r--r--deflate.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/deflate.c b/deflate.c
index 4792345..4aa5afb 100644
--- a/deflate.c
+++ b/deflate.c
@@ -305,7 +305,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
305 if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || 305 if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
306 s->pending_buf == Z_NULL) { 306 s->pending_buf == Z_NULL) {
307 s->status = FINISH_STATE; 307 s->status = FINISH_STATE;
308 strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); 308 strm->msg = ERR_MSG(Z_MEM_ERROR);
309 deflateEnd (strm); 309 deflateEnd (strm);
310 return Z_MEM_ERROR; 310 return Z_MEM_ERROR;
311 } 311 }
@@ -329,7 +329,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
329 uInt str, n; 329 uInt str, n;
330 int wrap; 330 int wrap;
331 unsigned avail; 331 unsigned avail;
332 unsigned char *next; 332 z_const unsigned char *next;
333 333
334 if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) 334 if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
335 return Z_STREAM_ERROR; 335 return Z_STREAM_ERROR;
@@ -359,7 +359,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
359 avail = strm->avail_in; 359 avail = strm->avail_in;
360 next = strm->next_in; 360 next = strm->next_in;
361 strm->avail_in = dictLength; 361 strm->avail_in = dictLength;
362 strm->next_in = (Bytef *)dictionary; 362 strm->next_in = (z_const Bytef *)dictionary;
363 fill_window(s); 363 fill_window(s);
364 while (s->lookahead >= MIN_MATCH) { 364 while (s->lookahead >= MIN_MATCH) {
365 str = s->strstart; 365 str = s->strstart;