diff options
Diffstat (limited to 'inflate.h')
-rw-r--r-- | inflate.h | 26 |
1 files changed, 16 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* inflate.h -- internal inflate state definition | 1 | /* inflate.h -- internal inflate state definition |
2 | * Copyright (C) 1995-2006 Mark Adler | 2 | * Copyright (C) 1995-2009 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 | ||
@@ -32,11 +32,13 @@ typedef enum { | |||
32 | TYPE, /* i: waiting for type bits, including last-flag bit */ | 32 | TYPE, /* i: waiting for type bits, including last-flag bit */ |
33 | TYPEDO, /* i: same, but skip check to exit inflate on new block */ | 33 | TYPEDO, /* i: same, but skip check to exit inflate on new block */ |
34 | STORED, /* i: waiting for stored size (length and complement) */ | 34 | STORED, /* i: waiting for stored size (length and complement) */ |
35 | COPY_, /* i/o: same as COPY below, but only first time in */ | ||
35 | COPY, /* i/o: waiting for input or output to copy stored block */ | 36 | COPY, /* i/o: waiting for input or output to copy stored block */ |
36 | TABLE, /* i: waiting for dynamic block table lengths */ | 37 | TABLE, /* i: waiting for dynamic block table lengths */ |
37 | LENLENS, /* i: waiting for code length code lengths */ | 38 | LENLENS, /* i: waiting for code length code lengths */ |
38 | CODELENS, /* i: waiting for length/lit and distance code lengths */ | 39 | CODELENS, /* i: waiting for length/lit and distance code lengths */ |
39 | LEN, /* i: waiting for length/lit code */ | 40 | LEN_, /* i: same as LEN below, but only first time in */ |
41 | LEN, /* i: waiting for length/lit/eob code */ | ||
40 | LENEXT, /* i: waiting for length extra bits */ | 42 | LENEXT, /* i: waiting for length extra bits */ |
41 | DIST, /* i: waiting for distance code */ | 43 | DIST, /* i: waiting for distance code */ |
42 | DISTEXT, /* i: waiting for distance extra bits */ | 44 | DISTEXT, /* i: waiting for distance extra bits */ |
@@ -53,19 +55,21 @@ typedef enum { | |||
53 | /* | 55 | /* |
54 | State transitions between above modes - | 56 | State transitions between above modes - |
55 | 57 | ||
56 | (most modes can go to the BAD or MEM mode -- not shown for clarity) | 58 | (most modes can go to BAD or MEM on error -- not shown for clarity) |
57 | 59 | ||
58 | Process header: | 60 | Process header: |
59 | HEAD -> (gzip) or (zlib) | 61 | HEAD -> (gzip) or (zlib) or (raw) |
60 | (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME | 62 | (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> |
61 | NAME -> COMMENT -> HCRC -> TYPE | 63 | HCRC -> TYPE |
62 | (zlib) -> DICTID or TYPE | 64 | (zlib) -> DICTID or TYPE |
63 | DICTID -> DICT -> TYPE | 65 | DICTID -> DICT -> TYPE |
66 | (raw) -> TYPEDO | ||
64 | Read deflate blocks: | 67 | Read deflate blocks: |
65 | TYPE -> STORED or TABLE or LEN or CHECK | 68 | TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK |
66 | STORED -> COPY -> TYPE | 69 | STORED -> COPY_ -> COPY -> TYPE |
67 | TABLE -> LENLENS -> CODELENS -> LEN | 70 | TABLE -> LENLENS -> CODELENS -> LEN_ |
68 | Read deflate codes: | 71 | LEN_ -> LEN |
72 | Read deflate codes in fixed or dynamic block: | ||
69 | LEN -> LENEXT or LIT or TYPE | 73 | LEN -> LENEXT or LIT or TYPE |
70 | LENEXT -> DIST -> DISTEXT -> MATCH -> LEN | 74 | LENEXT -> DIST -> DISTEXT -> MATCH -> LEN |
71 | LIT -> LEN | 75 | LIT -> LEN |
@@ -113,4 +117,6 @@ struct inflate_state { | |||
113 | unsigned short work[288]; /* work area for code table building */ | 117 | unsigned short work[288]; /* work area for code table building */ |
114 | code codes[ENOUGH]; /* space for code tables */ | 118 | code codes[ENOUGH]; /* space for code tables */ |
115 | int sane; /* if false, allow invalid distance too far */ | 119 | int sane; /* if false, allow invalid distance too far */ |
120 | int back; /* bits back of last unprocessed length/lit */ | ||
121 | unsigned was; /* initial length of match */ | ||
116 | }; | 122 | }; |