diff options
Diffstat (limited to 'infutil.h')
-rw-r--r-- | infutil.h | 27 |
1 files changed, 10 insertions, 17 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-1996 Mark Adler | 2 | * Copyright (C) 1995 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,10 +8,11 @@ | |||
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 | #ifndef _INFUTIL_H | 11 | /* inflate blocks semi-private state */ |
12 | #define _INFUTIL_H | 12 | struct inflate_blocks_state { |
13 | 13 | ||
14 | typedef enum { | 14 | /* mode */ |
15 | enum { | ||
15 | TYPE, /* get type bits (3, including end bit) */ | 16 | TYPE, /* get type bits (3, including end bit) */ |
16 | LENS, /* get lengths for stored */ | 17 | LENS, /* get lengths for stored */ |
17 | STORED, /* processing stored block */ | 18 | STORED, /* processing stored block */ |
@@ -22,13 +23,7 @@ typedef enum { | |||
22 | DRY, /* output remaining window bytes */ | 23 | DRY, /* output remaining window bytes */ |
23 | DONE, /* finished last block, done */ | 24 | DONE, /* finished last block, done */ |
24 | BAD} /* got a data error--stuck here */ | 25 | BAD} /* got a data error--stuck here */ |
25 | inflate_block_mode; | 26 | mode; /* current 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 */ | ||
32 | 27 | ||
33 | /* mode dependent information */ | 28 | /* mode dependent information */ |
34 | union { | 29 | union { |
@@ -76,16 +71,16 @@ struct inflate_blocks_state { | |||
76 | #define DUMPBITS(j) {b>>=(j);k-=(j);} | 71 | #define DUMPBITS(j) {b>>=(j);k-=(j);} |
77 | /* output bytes */ | 72 | /* output bytes */ |
78 | #define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q) | 73 | #define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q) |
79 | #define LOADOUT {q=s->write;m=(uInt)WAVAIL;} | 74 | #define LOADOUT {q=s->write;m=WAVAIL;} |
80 | #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}} | 75 | #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=WAVAIL;}} |
81 | #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} | 76 | #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} |
82 | #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} | 77 | #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} |
83 | #define OUTBYTE(a) {*q++=(Byte)(a);m--;} | 78 | #define OUTBYTE(a) {*q++=(Byte)(a);m--;} |
84 | /* load local pointers */ | 79 | /* load local pointers */ |
85 | #define LOAD {LOADIN LOADOUT} | 80 | #define LOAD {LOADIN LOADOUT} |
86 | 81 | ||
87 | /* masks for lower bits (size given to avoid silly warnings with Visual C++) */ | 82 | /* masks for lower bits */ |
88 | extern uInt inflate_mask[17]; | 83 | extern uInt inflate_mask[]; |
89 | 84 | ||
90 | /* copy as much as possible from the sliding window to the output area */ | 85 | /* copy as much as possible from the sliding window to the output area */ |
91 | extern int inflate_flush OF(( | 86 | extern int inflate_flush OF(( |
@@ -94,5 +89,3 @@ extern int inflate_flush OF(( | |||
94 | int)); | 89 | int)); |
95 | 90 | ||
96 | struct internal_state {int dummy;}; /* for buggy compilers */ | 91 | struct internal_state {int dummy;}; /* for buggy compilers */ |
97 | |||
98 | #endif | ||