diff options
Diffstat (limited to 'infutil.h')
-rw-r--r-- | infutil.h | 29 |
1 files changed, 18 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 { |
@@ -70,17 +75,17 @@ struct inflate_blocks_state { | |||
70 | #define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}} | 75 | #define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<<k;k+=8;}} |
71 | #define DUMPBITS(j) {b>>=(j);k-=(j);} | 76 | #define DUMPBITS(j) {b>>=(j);k-=(j);} |
72 | /* output bytes */ | 77 | /* output bytes */ |
73 | #define WAVAIL (q<s->read?s->read-q-1:s->end-q) | 78 | #define WAVAIL (uInt)(q<s->read?s->read-q-1:s->end-q) |
74 | #define LOADOUT {q=s->write;m=WAVAIL;} | 79 | #define LOADOUT {q=s->write;m=(uInt)WAVAIL;} |
75 | #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=WAVAIL;}} | 80 | #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} | 81 | #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;} | 82 | #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--;} | 83 | #define OUTBYTE(a) {*q++=(Byte)(a);m--;} |
79 | /* load local pointers */ | 84 | /* load local pointers */ |
80 | #define LOAD {LOADIN LOADOUT} | 85 | #define LOAD {LOADIN LOADOUT} |
81 | 86 | ||
82 | /* masks for lower bits */ | 87 | /* masks for lower bits (size given to avoid silly warnings with Visual C++) */ |
83 | extern uInt inflate_mask[]; | 88 | extern uInt inflate_mask[17]; |
84 | 89 | ||
85 | /* copy as much as possible from the sliding window to the output area */ | 90 | /* copy as much as possible from the sliding window to the output area */ |
86 | extern int inflate_flush OF(( | 91 | extern int inflate_flush OF(( |
@@ -89,3 +94,5 @@ extern int inflate_flush OF(( | |||
89 | int)); | 94 | int)); |
90 | 95 | ||
91 | struct internal_state {int dummy;}; /* for buggy compilers */ | 96 | struct internal_state {int dummy;}; /* for buggy compilers */ |
97 | |||
98 | #endif | ||