aboutsummaryrefslogtreecommitdiff
path: root/deflate.h
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:09:18 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:09:18 -0700
commit23c69f10698301ae97709eb0bbfb371d66b99a08 (patch)
tree1956b671b3df8d12c315a38f33b190677ccd659e /deflate.h
parent6b834a58bdef976383cff6e2a83f353e668a9cf1 (diff)
downloadzlib-23c69f10698301ae97709eb0bbfb371d66b99a08.tar.gz
zlib-23c69f10698301ae97709eb0bbfb371d66b99a08.tar.bz2
zlib-23c69f10698301ae97709eb0bbfb371d66b99a08.zip
zlib 0.94v0.94
Diffstat (limited to 'deflate.h')
-rw-r--r--deflate.h47
1 files changed, 24 insertions, 23 deletions
diff --git a/deflate.h b/deflate.h
index fb6c233..eada3ba 100644
--- a/deflate.h
+++ b/deflate.h
@@ -58,7 +58,7 @@ typedef struct ct_data_s {
58 ush dad; /* father node in Huffman tree */ 58 ush dad; /* father node in Huffman tree */
59 ush len; /* length of bit string */ 59 ush len; /* length of bit string */
60 } dl; 60 } dl;
61} ct_data; 61} FAR ct_data;
62 62
63#define Freq fc.freq 63#define Freq fc.freq
64#define Code fc.code 64#define Code fc.code
@@ -71,10 +71,12 @@ typedef struct tree_desc_s {
71 ct_data *dyn_tree; /* the dynamic tree */ 71 ct_data *dyn_tree; /* the dynamic tree */
72 int max_code; /* largest code with non zero frequency */ 72 int max_code; /* largest code with non zero frequency */
73 static_tree_desc *stat_desc; /* the corresponding static tree */ 73 static_tree_desc *stat_desc; /* the corresponding static tree */
74} tree_desc; 74} FAR tree_desc;
75 75
76typedef ush Pos; 76typedef ush Pos;
77typedef Pos FAR Posf;
77typedef unsigned IPos; 78typedef unsigned IPos;
79
78/* A Pos is an index in the character window. We use short instead of int to 80/* A Pos is an index in the character window. We use short instead of int to
79 * save space in the various tables. IPos is used only for parameter passing. 81 * save space in the various tables. IPos is used only for parameter passing.
80 */ 82 */
@@ -82,8 +84,8 @@ typedef unsigned IPos;
82typedef struct internal_state { 84typedef struct internal_state {
83 z_stream *strm; /* pointer back to this zlib stream */ 85 z_stream *strm; /* pointer back to this zlib stream */
84 int status; /* as the name implies */ 86 int status; /* as the name implies */
85 Byte *pending_buf; /* output still pending */ 87 Bytef *pending_buf; /* output still pending */
86 Byte *pending_out; /* next pending byte to output to the stream */ 88 Bytef *pending_out; /* next pending byte to output to the stream */
87 int pending; /* nb of bytes in the pending buffer */ 89 int pending; /* nb of bytes in the pending buffer */
88 uLong adler; /* adler32 of uncompressed data */ 90 uLong adler; /* adler32 of uncompressed data */
89 int noheader; /* suppress zlib header and adler32 */ 91 int noheader; /* suppress zlib header and adler32 */
@@ -96,7 +98,7 @@ typedef struct internal_state {
96 uInt w_bits; /* log2(w_size) (8..16) */ 98 uInt w_bits; /* log2(w_size) (8..16) */
97 uInt w_mask; /* w_size - 1 */ 99 uInt w_mask; /* w_size - 1 */
98 100
99 Byte *window; 101 Bytef *window;
100 /* Sliding window. Input bytes are read into the second half of the window, 102 /* Sliding window. Input bytes are read into the second half of the window,
101 * and move to the first half later to keep a dictionary of at least wSize 103 * and move to the first half later to keep a dictionary of at least wSize
102 * bytes. With this organization, matches are limited to a distance of 104 * bytes. With this organization, matches are limited to a distance of
@@ -111,13 +113,13 @@ typedef struct internal_state {
111 * is directly used as sliding window. 113 * is directly used as sliding window.
112 */ 114 */
113 115
114 Pos *prev; 116 Posf *prev;
115 /* Link to older string with same hash index. To limit the size of this 117 /* Link to older string with same hash index. To limit the size of this
116 * array to 64K, this link is maintained only for the last 32K strings. 118 * array to 64K, this link is maintained only for the last 32K strings.
117 * An index in this array is thus a window index modulo 32K. 119 * An index in this array is thus a window index modulo 32K.
118 */ 120 */
119 121
120 Pos *head; /* Heads of the hash chains or NIL. */ 122 Posf *head; /* Heads of the hash chains or NIL. */
121 123
122 uInt ins_h; /* hash index of string to be inserted */ 124 uInt ins_h; /* hash index of string to be inserted */
123 uInt hash_size; /* number of elements in hash table */ 125 uInt hash_size; /* number of elements in hash table */
@@ -174,14 +176,14 @@ typedef struct internal_state {
174 int nice_match; /* Stop searching when current match exceeds this */ 176 int nice_match; /* Stop searching when current match exceeds this */
175 177
176 /* used by trees.c: */ 178 /* used by trees.c: */
179 /* Didn't use ct_data typedef below to supress compiler warning */
180 struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
181 struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
182 struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
177 183
178 ct_data dyn_ltree[HEAP_SIZE]; /* literal and length tree */ 184 struct tree_desc_s l_desc; /* desc. for literal tree */
179 ct_data dyn_dtree[2*D_CODES+1]; /* distance tree */ 185 struct tree_desc_s d_desc; /* desc. for distance tree */
180 ct_data bl_tree[2*BL_CODES+1]; /* Huffman tree for the bit lengths */ 186 struct tree_desc_s bl_desc; /* desc. for bit length tree */
181
182 tree_desc l_desc; /* descriptor for literal tree */
183 tree_desc d_desc; /* descriptor for distance tree */
184 tree_desc bl_desc; /* descriptor for bit length tree */
185 187
186 ush bl_count[MAX_BITS+1]; 188 ush bl_count[MAX_BITS+1];
187 /* number of codes at each bit length for an optimal tree */ 189 /* number of codes at each bit length for an optimal tree */
@@ -197,7 +199,7 @@ typedef struct internal_state {
197 /* Depth of each subtree used as tie breaker for trees of equal frequency 199 /* Depth of each subtree used as tie breaker for trees of equal frequency
198 */ 200 */
199 201
200 uch *l_buf; /* buffer for literals or lengths */ 202 uchf *l_buf; /* buffer for literals or lengths */
201 203
202 uInt lit_bufsize; 204 uInt lit_bufsize;
203 /* Size of match buffer for literals/lengths. There are 4 reasons for 205 /* Size of match buffer for literals/lengths. There are 4 reasons for
@@ -221,7 +223,7 @@ typedef struct internal_state {
221 223
222 uInt last_lit; /* running index in l_buf */ 224 uInt last_lit; /* running index in l_buf */
223 225
224 ush *d_buf; 226 ushf *d_buf;
225 /* Buffer for distances. To simplify the code, d_buf and l_buf have 227 /* Buffer for distances. To simplify the code, d_buf and l_buf have
226 * the same number of elements. To use different lengths, an extra flag 228 * the same number of elements. To use different lengths, an extra flag
227 * array would be necessary. 229 * array would be necessary.
@@ -245,8 +247,7 @@ typedef struct internal_state {
245 * are always zero. 247 * are always zero.
246 */ 248 */
247 249
248} deflate_state; 250} FAR deflate_state;
249
250 251
251/* Output a byte on the stream. 252/* Output a byte on the stream.
252 * IN assertion: there is enough room in pending_buf. 253 * IN assertion: there is enough room in pending_buf.
@@ -265,9 +266,9 @@ typedef struct internal_state {
265 */ 266 */
266 267
267 /* in trees.c */ 268 /* in trees.c */
268void ct_init __P((deflate_state *s)); 269void ct_init OF((deflate_state *s));
269int ct_tally __P((deflate_state *s, int dist, int lc)); 270int ct_tally OF((deflate_state *s, int dist, int lc));
270ulg ct_flush_block __P((deflate_state *s, char *buf, ulg stored_len, int eof)); 271ulg ct_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, int eof));
271void ct_align __P((deflate_state *s)); 272void ct_align OF((deflate_state *s));
272void ct_stored_block __P((deflate_state *s, char *buf, ulg stored_len, 273void ct_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
273 int eof)); 274 int eof));