diff options
Diffstat (limited to 'deflate.c')
-rw-r--r-- | deflate.c | 24 |
1 files changed, 13 insertions, 11 deletions
@@ -52,7 +52,7 @@ | |||
52 | #include "deflate.h" | 52 | #include "deflate.h" |
53 | 53 | ||
54 | const char deflate_copyright[] = | 54 | const char deflate_copyright[] = |
55 | " deflate 1.2.0.4 Copyright 1995-2003 Jean-loup Gailly "; | 55 | " deflate 1.2.0.5 Copyright 1995-2003 Jean-loup Gailly "; |
56 | /* | 56 | /* |
57 | If you use the zlib library in a product, an acknowledgment is welcome | 57 | If you use the zlib library in a product, an acknowledgment is welcome |
58 | in the documentation of your product. If for some reason you cannot | 58 | in the documentation of your product. If for some reason you cannot |
@@ -188,7 +188,7 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ | |||
188 | #else | 188 | #else |
189 | #define INSERT_STRING(s, str, match_head) \ | 189 | #define INSERT_STRING(s, str, match_head) \ |
190 | (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ | 190 | (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ |
191 | s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \ | 191 | match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ |
192 | s->head[s->ins_h] = (Pos)(str)) | 192 | s->head[s->ins_h] = (Pos)(str)) |
193 | #endif | 193 | #endif |
194 | 194 | ||
@@ -240,11 +240,11 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | |||
240 | if (strm == Z_NULL) return Z_STREAM_ERROR; | 240 | if (strm == Z_NULL) return Z_STREAM_ERROR; |
241 | 241 | ||
242 | strm->msg = Z_NULL; | 242 | strm->msg = Z_NULL; |
243 | if (strm->zalloc == Z_NULL) { | 243 | if (strm->zalloc == (alloc_func)0) { |
244 | strm->zalloc = zcalloc; | 244 | strm->zalloc = zcalloc; |
245 | strm->opaque = (voidpf)0; | 245 | strm->opaque = (voidpf)0; |
246 | } | 246 | } |
247 | if (strm->zfree == Z_NULL) strm->zfree = zcfree; | 247 | if (strm->zfree == (free_func)0) strm->zfree = zcfree; |
248 | 248 | ||
249 | #ifdef FASTEST | 249 | #ifdef FASTEST |
250 | if (level != 0) level = 1; | 250 | if (level != 0) level = 1; |
@@ -258,7 +258,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | |||
258 | } | 258 | } |
259 | #ifdef GZIP | 259 | #ifdef GZIP |
260 | else if (windowBits > 15) { | 260 | else if (windowBits > 15) { |
261 | wrap = 2; /* write gzip wrapper instead */ | 261 | wrap = 2; /* write gzip wrapper instead */ |
262 | windowBits -= 16; | 262 | windowBits -= 16; |
263 | } | 263 | } |
264 | #endif | 264 | #endif |
@@ -361,7 +361,9 @@ int ZEXPORT deflateReset (strm) | |||
361 | deflate_state *s; | 361 | deflate_state *s; |
362 | 362 | ||
363 | if (strm == Z_NULL || strm->state == Z_NULL || | 363 | if (strm == Z_NULL || strm->state == Z_NULL || |
364 | strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR; | 364 | strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { |
365 | return Z_STREAM_ERROR; | ||
366 | } | ||
365 | 367 | ||
366 | strm->total_in = strm->total_out = 0; | 368 | strm->total_in = strm->total_out = 0; |
367 | strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ | 369 | strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ |
@@ -554,7 +556,7 @@ int ZEXPORT deflate (strm, flush) | |||
554 | { | 556 | { |
555 | uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; | 557 | uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; |
556 | uInt level_flags; | 558 | uInt level_flags; |
557 | 559 | ||
558 | if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) | 560 | if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) |
559 | level_flags = 0; | 561 | level_flags = 0; |
560 | else if (s->level < 6) | 562 | else if (s->level < 6) |
@@ -566,10 +568,10 @@ int ZEXPORT deflate (strm, flush) | |||
566 | header |= (level_flags << 6); | 568 | header |= (level_flags << 6); |
567 | if (s->strstart != 0) header |= PRESET_DICT; | 569 | if (s->strstart != 0) header |= PRESET_DICT; |
568 | header += 31 - (header % 31); | 570 | header += 31 - (header % 31); |
569 | 571 | ||
570 | s->status = BUSY_STATE; | 572 | s->status = BUSY_STATE; |
571 | putShortMSB(s, header); | 573 | putShortMSB(s, header); |
572 | 574 | ||
573 | /* Save the adler32 of the preset dictionary: */ | 575 | /* Save the adler32 of the preset dictionary: */ |
574 | if (s->strstart != 0) { | 576 | if (s->strstart != 0) { |
575 | putShortMSB(s, (uInt)(strm->adler >> 16)); | 577 | putShortMSB(s, (uInt)(strm->adler >> 16)); |
@@ -1092,7 +1094,7 @@ local void fill_window(s) | |||
1092 | if (sizeof(int) <= 2) { | 1094 | if (sizeof(int) <= 2) { |
1093 | if (more == 0 && s->strstart == 0 && s->lookahead == 0) { | 1095 | if (more == 0 && s->strstart == 0 && s->lookahead == 0) { |
1094 | more = wsize; | 1096 | more = wsize; |
1095 | 1097 | ||
1096 | } else if (more == (unsigned)(-1)) { | 1098 | } else if (more == (unsigned)(-1)) { |
1097 | /* Very unlikely, but possible on 16 bit machine if | 1099 | /* Very unlikely, but possible on 16 bit machine if |
1098 | * strstart == 0 && lookahead == 1 (input done a byte at time) | 1100 | * strstart == 0 && lookahead == 1 (input done a byte at time) |
@@ -1412,7 +1414,7 @@ local block_state deflate_slow(s, flush) | |||
1412 | /* longest_match() or longest_match_fast() sets match_start */ | 1414 | /* longest_match() or longest_match_fast() sets match_start */ |
1413 | 1415 | ||
1414 | if (s->match_length <= 5 && (s->strategy == Z_FILTERED | 1416 | if (s->match_length <= 5 && (s->strategy == Z_FILTERED |
1415 | #if TOO_FAR < 32768 | 1417 | #if TOO_FAR <= 32767 |
1416 | || (s->match_length == MIN_MATCH && | 1418 | || (s->match_length == MIN_MATCH && |
1417 | s->strstart - s->match_start > TOO_FAR) | 1419 | s->strstart - s->match_start > TOO_FAR) |
1418 | #endif | 1420 | #endif |