/* ========================================================================= */
int ZEXPORT deflateGetDictionary (z_stream *strm, unsigned char *dictionary, unsigned int *dictLength) {
deflate_state *s;
+ unsigned int len;
if (deflateStateCheck(strm))
return Z_STREAM_ERROR;
s = strm->state;
- unsigned int len = s->strstart + s->lookahead;
+ len = s->strstart + s->lookahead;
if (len > s->w_size)
len = s->w_size;
if (dictionary != NULL && len)
* code following this won't be able to either.
*/
if (flush != Z_NO_FLUSH && s->strm->avail_in == 0 &&
- s->strstart == s->block_start)
+ (long)s->strstart == s->block_start)
return flush == Z_FINISH ? finish_done : block_done;
/* Fill the window with any remaining input. */
have = s->window_size - s->strstart - 1;
- if (s->strm->avail_in > have && s->block_start >= s->w_size) {
+ if (s->strm->avail_in > have && s->block_start >= (long)s->w_size) {
/* Slide the window down. */
s->block_start -= s->w_size;
s->strstart -= s->w_size;
/* directly compress user buffer to file */
state->strm.next_in = (const unsigned char *)buf;
do {
- unsigned n = -1;
+ unsigned n = (unsigned)-1;
if (n > len)
n = len;
state->strm.avail_in = n;
extra = lext;
match = 257;
break;
- case DISTS:
+ default: /* DISTS */
base = dbase;
extra = dext;
match = 0;
for (;;) {
/* create table entry */
here.bits = (unsigned char)(len - drop);
- if (work[sym] + 1 < match) {
+ if (work[sym] + 1U < match) {
here.op = (unsigned char)0;
here.val = work[sym];
} else if (work[sym] >= match) {
bi_windup(s); /* align on byte boundary */
put_short(s, (uint16_t)stored_len);
put_short(s, (uint16_t)~stored_len);
- memcpy(s->pending_buf + s->pending, buf, stored_len);
+ memcpy(s->pending_buf + s->pending, (unsigned char *)buf, stored_len);
s->pending += stored_len;
#ifdef ZLIB_DEBUG
s->compressed_len = (s->compressed_len + 3 + 7) & (unsigned long)~7L;