1
1
/* deflate.h -- internal compression state
2
* Copyright (C) 1995-2004 Jean-loup Gailly
2
* Copyright (C) 1995-2012 Jean-loup Gailly
3
3
* For conditions of distribution and use, see copyright notice in zlib.h
101
104
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
102
105
gz_headerp gzhead; /* gzip header information to write */
103
106
uInt gzindex; /* where in extra, name, or comment */
104
Byte method; /* STORED (for zip only) or DEFLATED */
107
Byte method; /* can only be DEFLATED */
105
108
int last_flush; /* value of flush param for previous deflate call */
107
110
/* used by deflate.c: */
188
191
int nice_match; /* Stop searching when current match exceeds this */
190
193
/* used by trees.c: */
191
/* Didn't use ct_data typedef below to supress compiler warning */
194
/* Didn't use ct_data typedef below to suppress compiler warning */
192
195
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
193
196
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
194
197
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
244
247
ulg opt_len; /* bit length of current block with optimal trees */
245
248
ulg static_len; /* bit length of current block with static trees */
246
249
uInt matches; /* number of string matches in current block */
247
int last_eob_len; /* bit length of EOB code for last block */
250
uInt insert; /* bytes at end of window left to insert */
250
253
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
260
263
* are always zero.
267
/* High water mark offset in window for initialized bytes -- bytes above
268
* this are set to zero in order to avoid memory check warnings when
269
* longest match routines access bytes past the input. This is then
270
* updated to the new high water mark.
263
273
} FAR deflate_state;
265
275
/* Output a byte on the stream.
278
288
* distances are limited to MAX_DIST instead of WSIZE.
291
#define WIN_INIT MAX_MATCH
292
/* Number of bytes after end of data in window to initialize in order to avoid
293
memory checker errors from longest match routines */
282
void _tr_init OF((deflate_state *s));
283
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
284
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
286
void _tr_align OF((deflate_state *s));
287
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
296
void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
297
int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
298
void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
299
ulg stored_len, int last));
300
void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
301
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
302
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
303
ulg stored_len, int last));
290
305
#define d_code(dist) \
291
306
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
298
313
/* Inline versions of _tr_tally for speed: */
300
315
#if defined(GEN_TREES_H) || !defined(STDC)
301
extern uch _length_code[];
302
extern uch _dist_code[];
316
extern uch ZLIB_INTERNAL _length_code[];
317
extern uch ZLIB_INTERNAL _dist_code[];
304
extern const uch _length_code[];
305
extern const uch _dist_code[];
319
extern const uch ZLIB_INTERNAL _length_code[];
320
extern const uch ZLIB_INTERNAL _dist_code[];
308
323
# define _tr_tally_lit(s, c, flush) \