diff options
Diffstat (limited to 'infutil.h')
-rw-r--r-- | infutil.h | 30 |
1 files changed, 19 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* infutil.h -- types and macros common to blocks and codes | 1 | /* infutil.h -- types and macros common to blocks and codes |
2 | * Copyright (C) 1995 Mark Adler | 2 | * Copyright (C) 1995-1996 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ | 4 | */ |
5 | 5 | ||
@@ -8,11 +8,10 @@ | |||
8 | subject to change. Applications should only use zlib.h. | 8 | subject to change. Applications should only use zlib.h. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | /* inflate blocks semi-private state */ | 11 | #ifndef _INFUTIL_H |
12 | struct inflate_blocks_state { | 12 | #define _INFUTIL_H |
13 | 13 | ||
14 | /* mode */ | 14 | typedef enum { |
15 | enum { | ||
16 | TYPE, /* get type bits (3, including end bit) */ | 15 | TYPE, /* get type bits (3, including end bit) */ |
17 | LENS, /* get lengths for stored */ | 16 | LENS, /* get lengths for stored */ |
18 | STORED, /* processing stored block */ | 17 | STORED, /* processing stored block */ |
@@ -23,7 +22,13 @@ struct inflate_blocks_state { | |||
23 | DRY, /* output remaining window bytes */ | 22 | DRY, /* output remaining window bytes */ |
24 | DONE, /* finished last block, done */ | 23 | DONE, /* finished last block, done */ |
25 | BAD} /* got a data error--stuck here */ | 24 | BAD} /* got a data error--stuck here */ |
26 | mode; /* current inflate_block mode */ | 25 | inflate_block_mode; |
26 | |||
27 | /* inflate blocks semi-private state */ | ||
28 | struct inflate_blocks_state { | ||
29 | |||
30 | /* mode */ | ||
31 | inflate_block_mode mode; /* current inflate_block mode */ | ||
27 | 32 | ||
28 | /* mode dependent information */ | 33 | /* mode dependent information */ |
29 | union { | 34 | union { |
@@ -36,7 +41,8 @@ struct inflate_blocks_state { | |||
36 | inflate_huft *tb; /* bit length decoding tree */ | 41 | inflate_huft *tb; /* bit length decoding tree */ |
37 | } trees; /* if DTREE, decoding info for trees */ | 42 | } trees; /* if DTREE, decoding info for trees */ |
38 | struct { | 43 | struct { |
39 | inflate_huft *tl, *td; /* trees to free */ | 44 | inflate_huft *tl; |
45 | inflate_huft *td; /* trees to free */ | ||
40 | inflate_codes_statef | 46 | inflate_codes_statef |
41 | *codes; | 47 | *codes; |
42 | } decode; /* if CODES, current state */ | 48 | } decode; /* if CODES, current state */ |
@@ -71,16 +77,16 @@ struct inflate_blocks_state { | |||
71 | #define DUMPBITS(j) {b>>=(j);k-=(j);} | 77 | #define DUMPBITS(j) {b>>=(j);k-=(j);} |
72 | /* output bytes */ | 78 | /* output bytes */ |
73 | #define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q) | 79 | #define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q) |
74 | #define LOADOUT {q=s->write;m=WAVAIL;} | 80 | #define LOADOUT {q=s->write;m=(uInt)WAVAIL;} |
75 | #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=WAVAIL;}} | 81 | #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}} |
76 | #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} | 82 | #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} |
77 | #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} | 83 | #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} |
78 | #define OUTBYTE(a) {*q++=(Byte)(a);m--;} | 84 | #define OUTBYTE(a) {*q++=(Byte)(a);m--;} |
79 | /* load local pointers */ | 85 | /* load local pointers */ |
80 | #define LOAD {LOADIN LOADOUT} | 86 | #define LOAD {LOADIN LOADOUT} |
81 | 87 | ||
82 | /* masks for lower bits */ | 88 | /* masks for lower bits (size given to avoid silly warnings with Visual C++) */ |
83 | extern uInt inflate_mask[]; | 89 | extern uInt inflate_mask[17]; |
84 | 90 | ||
85 | /* copy as much as possible from the sliding window to the output area */ | 91 | /* copy as much as possible from the sliding window to the output area */ |
86 | extern int inflate_flush OF(( | 92 | extern int inflate_flush OF(( |
@@ -89,3 +95,5 @@ extern int inflate_flush OF(( | |||
89 | int)); | 95 | int)); |
90 | 96 | ||
91 | struct internal_state {int dummy;}; /* for buggy compilers */ | 97 | struct internal_state {int dummy;}; /* for buggy compilers */ |
98 | |||
99 | #endif | ||