diff options
Diffstat (limited to 'deflate.c')
-rw-r--r-- | deflate.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -47,7 +47,7 @@ | |||
47 | * | 47 | * |
48 | */ | 48 | */ |
49 | 49 | ||
50 | /* $Id: deflate.c,v 1.4 1995/04/14 19:49:46 jloup Exp $ */ | 50 | /* $Id: deflate.c,v 1.5 1995/04/29 16:52:05 jloup Exp $ */ |
51 | 51 | ||
52 | #include "deflate.h" | 52 | #include "deflate.h" |
53 | 53 | ||
@@ -117,8 +117,10 @@ local void fill_window __P((deflate_state *s)); | |||
117 | local int deflate_fast __P((deflate_state *s, int flush)); | 117 | local int deflate_fast __P((deflate_state *s, int flush)); |
118 | local int deflate_slow __P((deflate_state *s, int flush)); | 118 | local int deflate_slow __P((deflate_state *s, int flush)); |
119 | local void lm_init __P((deflate_state *s)); | 119 | local void lm_init __P((deflate_state *s)); |
120 | |||
121 | local int longest_match __P((deflate_state *s, IPos cur_match)); | 120 | local int longest_match __P((deflate_state *s, IPos cur_match)); |
121 | local void putShortMSB __P((deflate_state *s, uInt b)); | ||
122 | local void flush_pending __P((z_stream *strm)); | ||
123 | local int read_buf __P((z_stream *strm, char *buf, unsigned size)); | ||
122 | #ifdef ASMV | 124 | #ifdef ASMV |
123 | void match_init __P((void)); /* asm code initialization */ | 125 | void match_init __P((void)); /* asm code initialization */ |
124 | #endif | 126 | #endif |
@@ -225,7 +227,7 @@ int deflateInit2 (strm, level, method, windowBits, memLevel, strategy) | |||
225 | 227 | ||
226 | s->level = level; | 228 | s->level = level; |
227 | s->strategy = strategy; | 229 | s->strategy = strategy; |
228 | s->method = method; | 230 | s->method = (Byte)method; |
229 | 231 | ||
230 | return deflateReset(strm); | 232 | return deflateReset(strm); |
231 | } | 233 | } |
@@ -265,8 +267,8 @@ local void putShortMSB (s, b) | |||
265 | deflate_state *s; | 267 | deflate_state *s; |
266 | uInt b; | 268 | uInt b; |
267 | { | 269 | { |
268 | put_byte(s, b >> 8); | 270 | put_byte(s, (Byte)(b >> 8)); |
269 | put_byte(s, b & 0xff); | 271 | put_byte(s, (Byte)(b & 0xff)); |
270 | } | 272 | } |
271 | 273 | ||
272 | /* ========================================================================= | 274 | /* ========================================================================= |
@@ -346,17 +348,18 @@ int deflate (strm, flush) | |||
346 | } | 348 | } |
347 | Assert(strm->avail_out > 0, "bug2"); | 349 | Assert(strm->avail_out > 0, "bug2"); |
348 | 350 | ||
349 | if (flush != Z_FINISH || strm->state->noheader) return Z_OK; | 351 | if (flush != Z_FINISH) return Z_OK; |
352 | if (strm->state->noheader) return Z_STREAM_END; | ||
350 | 353 | ||
351 | /* Write the zlib trailer (adler32) */ | 354 | /* Write the zlib trailer (adler32) */ |
352 | putShortMSB(strm->state, strm->state->adler >> 16); | 355 | putShortMSB(strm->state, (uInt)(strm->state->adler >> 16)); |
353 | putShortMSB(strm->state, strm->state->adler & 0xffff); | 356 | putShortMSB(strm->state, (uInt)(strm->state->adler & 0xffff)); |
354 | flush_pending(strm); | 357 | flush_pending(strm); |
355 | /* If avail_out is zero, the application will call deflate again | 358 | /* If avail_out is zero, the application will call deflate again |
356 | * to flush the rest. | 359 | * to flush the rest. |
357 | */ | 360 | */ |
358 | strm->state->noheader = 1; /* write the trailer only once! */ | 361 | strm->state->noheader = 1; /* write the trailer only once! */ |
359 | return Z_OK; | 362 | return strm->state->pending != 0 ? Z_OK : Z_STREAM_END; |
360 | } | 363 | } |
361 | 364 | ||
362 | /* ========================================================================= */ | 365 | /* ========================================================================= */ |