diff options
Diffstat (limited to 'deflate.c')
-rw-r--r-- | deflate.c | 36 |
1 files changed, 17 insertions, 19 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.0.8 Copyright 1995-1998 Jean-loup Gailly "; | 55 | " deflate 1.0.9 Copyright 1995-1998 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 |
@@ -80,7 +80,7 @@ local block_state deflate_slow OF((deflate_state *s, int flush)); | |||
80 | local void lm_init OF((deflate_state *s)); | 80 | local void lm_init OF((deflate_state *s)); |
81 | local void putShortMSB OF((deflate_state *s, uInt b)); | 81 | local void putShortMSB OF((deflate_state *s, uInt b)); |
82 | local void flush_pending OF((z_streamp strm)); | 82 | local void flush_pending OF((z_streamp strm)); |
83 | local int read_buf OF((z_streamp strm, charf *buf, unsigned size)); | 83 | local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); |
84 | #ifdef ASMV | 84 | #ifdef ASMV |
85 | void match_init OF((void)); /* asm code initialization */ | 85 | void match_init OF((void)); /* asm code initialization */ |
86 | uInt longest_match OF((deflate_state *s, IPos cur_match)); | 86 | uInt longest_match OF((deflate_state *s, IPos cur_match)); |
@@ -175,10 +175,10 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ | |||
175 | */ | 175 | */ |
176 | #define CLEAR_HASH(s) \ | 176 | #define CLEAR_HASH(s) \ |
177 | s->head[s->hash_size-1] = NIL; \ | 177 | s->head[s->hash_size-1] = NIL; \ |
178 | zmemzero((charf *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); | 178 | zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); |
179 | 179 | ||
180 | /* ========================================================================= */ | 180 | /* ========================================================================= */ |
181 | int EXPORT deflateInit_(strm, level, version, stream_size) | 181 | int ZEXPORT deflateInit_(strm, level, version, stream_size) |
182 | z_streamp strm; | 182 | z_streamp strm; |
183 | int level; | 183 | int level; |
184 | const char *version; | 184 | const char *version; |
@@ -190,7 +190,7 @@ int EXPORT deflateInit_(strm, level, version, stream_size) | |||
190 | } | 190 | } |
191 | 191 | ||
192 | /* ========================================================================= */ | 192 | /* ========================================================================= */ |
193 | int EXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | 193 | int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, |
194 | version, stream_size) | 194 | version, stream_size) |
195 | z_streamp strm; | 195 | z_streamp strm; |
196 | int level; | 196 | int level; |
@@ -276,7 +276,7 @@ int EXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, | |||
276 | } | 276 | } |
277 | 277 | ||
278 | /* ========================================================================= */ | 278 | /* ========================================================================= */ |
279 | int EXPORT deflateSetDictionary (strm, dictionary, dictLength) | 279 | int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) |
280 | z_streamp strm; | 280 | z_streamp strm; |
281 | const Bytef *dictionary; | 281 | const Bytef *dictionary; |
282 | uInt dictLength; | 282 | uInt dictLength; |
@@ -299,7 +299,7 @@ int EXPORT deflateSetDictionary (strm, dictionary, dictLength) | |||
299 | dictionary += dictLength - length; /* use the tail of the dictionary */ | 299 | dictionary += dictLength - length; /* use the tail of the dictionary */ |
300 | #endif | 300 | #endif |
301 | } | 301 | } |
302 | zmemcpy((charf *)s->window, dictionary, length); | 302 | zmemcpy(s->window, dictionary, length); |
303 | s->strstart = length; | 303 | s->strstart = length; |
304 | s->block_start = (long)length; | 304 | s->block_start = (long)length; |
305 | 305 | ||
@@ -317,7 +317,7 @@ int EXPORT deflateSetDictionary (strm, dictionary, dictLength) | |||
317 | } | 317 | } |
318 | 318 | ||
319 | /* ========================================================================= */ | 319 | /* ========================================================================= */ |
320 | int EXPORT deflateReset (strm) | 320 | int ZEXPORT deflateReset (strm) |
321 | z_streamp strm; | 321 | z_streamp strm; |
322 | { | 322 | { |
323 | deflate_state *s; | 323 | deflate_state *s; |
@@ -347,7 +347,7 @@ int EXPORT deflateReset (strm) | |||
347 | } | 347 | } |
348 | 348 | ||
349 | /* ========================================================================= */ | 349 | /* ========================================================================= */ |
350 | int EXPORT deflateParams(strm, level, strategy) | 350 | int ZEXPORT deflateParams(strm, level, strategy) |
351 | z_streamp strm; | 351 | z_streamp strm; |
352 | int level; | 352 | int level; |
353 | int strategy; | 353 | int strategy; |
@@ -421,7 +421,7 @@ local void flush_pending(strm) | |||
421 | } | 421 | } |
422 | 422 | ||
423 | /* ========================================================================= */ | 423 | /* ========================================================================= */ |
424 | int EXPORT deflate (strm, flush) | 424 | int ZEXPORT deflate (strm, flush) |
425 | z_streamp strm; | 425 | z_streamp strm; |
426 | int flush; | 426 | int flush; |
427 | { | 427 | { |
@@ -555,7 +555,7 @@ int EXPORT deflate (strm, flush) | |||
555 | } | 555 | } |
556 | 556 | ||
557 | /* ========================================================================= */ | 557 | /* ========================================================================= */ |
558 | int EXPORT deflateEnd (strm) | 558 | int ZEXPORT deflateEnd (strm) |
559 | z_streamp strm; | 559 | z_streamp strm; |
560 | { | 560 | { |
561 | int status; | 561 | int status; |
@@ -585,7 +585,7 @@ int EXPORT deflateEnd (strm) | |||
585 | * To simplify the source, this is not supported for 16-bit MSDOS (which | 585 | * To simplify the source, this is not supported for 16-bit MSDOS (which |
586 | * doesn't have enough memory anyway to duplicate compression states). | 586 | * doesn't have enough memory anyway to duplicate compression states). |
587 | */ | 587 | */ |
588 | int EXPORT deflateCopy (dest, source) | 588 | int ZEXPORT deflateCopy (dest, source) |
589 | z_streamp dest; | 589 | z_streamp dest; |
590 | z_streamp source; | 590 | z_streamp source; |
591 | { | 591 | { |
@@ -647,7 +647,7 @@ int EXPORT deflateCopy (dest, source) | |||
647 | */ | 647 | */ |
648 | local int read_buf(strm, buf, size) | 648 | local int read_buf(strm, buf, size) |
649 | z_streamp strm; | 649 | z_streamp strm; |
650 | charf *buf; | 650 | Bytef *buf; |
651 | unsigned size; | 651 | unsigned size; |
652 | { | 652 | { |
653 | unsigned len = strm->avail_in; | 653 | unsigned len = strm->avail_in; |
@@ -857,8 +857,8 @@ local void check_match(s, start, match, length) | |||
857 | int length; | 857 | int length; |
858 | { | 858 | { |
859 | /* check that the match is indeed a match */ | 859 | /* check that the match is indeed a match */ |
860 | if (zmemcmp((charf *)s->window + match, | 860 | if (zmemcmp(s->window + match, |
861 | (charf *)s->window + start, length) != EQUAL) { | 861 | s->window + start, length) != EQUAL) { |
862 | fprintf(stderr, " start %u, match %u, length %d\n", | 862 | fprintf(stderr, " start %u, match %u, length %d\n", |
863 | start, match, length); | 863 | start, match, length); |
864 | do { | 864 | do { |
@@ -911,8 +911,7 @@ local void fill_window(s) | |||
911 | */ | 911 | */ |
912 | } else if (s->strstart >= wsize+MAX_DIST(s)) { | 912 | } else if (s->strstart >= wsize+MAX_DIST(s)) { |
913 | 913 | ||
914 | zmemcpy((charf *)s->window, (charf *)s->window+wsize, | 914 | zmemcpy(s->window, s->window+wsize, (unsigned)wsize); |
915 | (unsigned)wsize); | ||
916 | s->match_start -= wsize; | 915 | s->match_start -= wsize; |
917 | s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ | 916 | s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ |
918 | s->block_start -= (long) wsize; | 917 | s->block_start -= (long) wsize; |
@@ -956,8 +955,7 @@ local void fill_window(s) | |||
956 | */ | 955 | */ |
957 | Assert(more >= 2, "more < 2"); | 956 | Assert(more >= 2, "more < 2"); |
958 | 957 | ||
959 | n = read_buf(s->strm, (charf *)s->window + s->strstart + s->lookahead, | 958 | n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); |
960 | more); | ||
961 | s->lookahead += n; | 959 | s->lookahead += n; |
962 | 960 | ||
963 | /* Initialize the hash value now that we have some input: */ | 961 | /* Initialize the hash value now that we have some input: */ |