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.
This commit is contained in:
@@ -305,7 +305,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;
|
||||
}
|
||||
@@ -329,7 +329,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
|
||||
uInt str, n;
|
||||
int wrap;
|
||||
unsigned avail;
|
||||
unsigned char *next;
|
||||
z_const unsigned char *next;
|
||||
|
||||
if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL)
|
||||
return Z_STREAM_ERROR;
|
||||
@@ -359,7 +359,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
|
||||
avail = strm->avail_in;
|
||||
next = strm->next_in;
|
||||
strm->avail_in = dictLength;
|
||||
strm->next_in = (Bytef *)dictionary;
|
||||
strm->next_in = (z_const Bytef *)dictionary;
|
||||
fill_window(s);
|
||||
while (s->lookahead >= MIN_MATCH) {
|
||||
str = s->strstart;
|
||||
|
||||
Reference in New Issue
Block a user