inflate.h (131377) | inflate.h (157043) |
---|---|
1/* inflate.h -- internal inflate state definition | 1/* inflate.h -- internal inflate state definition |
2 * Copyright (C) 1995-2003 Mark Adler | 2 * Copyright (C) 1995-2004 Mark Adler |
3 * For conditions of distribution and use, see copyright notice in zlib.h 4 */ 5 6/* WARNING: this file should *not* be used by applications. It is 7 part of the implementation of the compression library and is 8 subject to change. Applications should only use zlib.h. 9 */ 10 11/* define NO_GZIP when compiling if you want to disable gzip header and 12 trailer decoding by inflate(). NO_GZIP would be used to avoid linking in 13 the crc code when it is not needed. For shared libraries, gzip decoding 14 should be left enabled. */ 15#ifndef NO_GZIP 16# define GUNZIP 17#endif 18 19/* Possible inflate modes between inflate() calls */ 20typedef enum { 21 HEAD, /* i: waiting for magic header */ | 3 * For conditions of distribution and use, see copyright notice in zlib.h 4 */ 5 6/* WARNING: this file should *not* be used by applications. It is 7 part of the implementation of the compression library and is 8 subject to change. Applications should only use zlib.h. 9 */ 10 11/* define NO_GZIP when compiling if you want to disable gzip header and 12 trailer decoding by inflate(). NO_GZIP would be used to avoid linking in 13 the crc code when it is not needed. For shared libraries, gzip decoding 14 should be left enabled. */ 15#ifndef NO_GZIP 16# define GUNZIP 17#endif 18 19/* Possible inflate modes between inflate() calls */ 20typedef enum { 21 HEAD, /* i: waiting for magic header */ |
22#ifdef GUNZIP | |
23 FLAGS, /* i: waiting for method and flags (gzip) */ 24 TIME, /* i: waiting for modification time (gzip) */ 25 OS, /* i: waiting for extra flags and operating system (gzip) */ 26 EXLEN, /* i: waiting for extra length (gzip) */ 27 EXTRA, /* i: waiting for extra bytes (gzip) */ 28 NAME, /* i: waiting for end of file name (gzip) */ 29 COMMENT, /* i: waiting for end of comment (gzip) */ 30 HCRC, /* i: waiting for header crc (gzip) */ | 22 FLAGS, /* i: waiting for method and flags (gzip) */ 23 TIME, /* i: waiting for modification time (gzip) */ 24 OS, /* i: waiting for extra flags and operating system (gzip) */ 25 EXLEN, /* i: waiting for extra length (gzip) */ 26 EXTRA, /* i: waiting for extra bytes (gzip) */ 27 NAME, /* i: waiting for end of file name (gzip) */ 28 COMMENT, /* i: waiting for end of comment (gzip) */ 29 HCRC, /* i: waiting for header crc (gzip) */ |
31#endif | |
32 DICTID, /* i: waiting for dictionary check value */ 33 DICT, /* waiting for inflateSetDictionary() call */ 34 TYPE, /* i: waiting for type bits, including last-flag bit */ 35 TYPEDO, /* i: same, but skip check to exit inflate on new block */ 36 STORED, /* i: waiting for stored size (length and complement) */ 37 COPY, /* i/o: waiting for input or output to copy stored block */ 38 TABLE, /* i: waiting for dynamic block table lengths */ 39 LENLENS, /* i: waiting for code length code lengths */ 40 CODELENS, /* i: waiting for length/lit and distance code lengths */ 41 LEN, /* i: waiting for length/lit code */ 42 LENEXT, /* i: waiting for length extra bits */ 43 DIST, /* i: waiting for distance code */ 44 DISTEXT, /* i: waiting for distance extra bits */ 45 MATCH, /* o: waiting for output space to copy string */ 46 LIT, /* o: waiting for output space to write literal */ 47 CHECK, /* i: waiting for 32-bit check value */ | 30 DICTID, /* i: waiting for dictionary check value */ 31 DICT, /* waiting for inflateSetDictionary() call */ 32 TYPE, /* i: waiting for type bits, including last-flag bit */ 33 TYPEDO, /* i: same, but skip check to exit inflate on new block */ 34 STORED, /* i: waiting for stored size (length and complement) */ 35 COPY, /* i/o: waiting for input or output to copy stored block */ 36 TABLE, /* i: waiting for dynamic block table lengths */ 37 LENLENS, /* i: waiting for code length code lengths */ 38 CODELENS, /* i: waiting for length/lit and distance code lengths */ 39 LEN, /* i: waiting for length/lit code */ 40 LENEXT, /* i: waiting for length extra bits */ 41 DIST, /* i: waiting for distance code */ 42 DISTEXT, /* i: waiting for distance extra bits */ 43 MATCH, /* o: waiting for output space to copy string */ 44 LIT, /* o: waiting for output space to write literal */ 45 CHECK, /* i: waiting for 32-bit check value */ |
48#ifdef GUNZIP | |
49 LENGTH, /* i: waiting for 32-bit length (gzip) */ | 46 LENGTH, /* i: waiting for 32-bit length (gzip) */ |
50#endif | |
51 DONE, /* finished check, done -- remain here until reset */ 52 BAD, /* got a data error -- remain here until reset */ 53 MEM, /* got an inflate() memory error -- remain here until reset */ 54 SYNC /* looking for synchronization bytes to restart inflate() */ 55} inflate_mode; 56 57/* 58 State transitions between above modes - --- 20 unchanged lines hidden (view full) --- 79 80/* state maintained between inflate() calls. Approximately 7K bytes. */ 81struct inflate_state { 82 inflate_mode mode; /* current inflate mode */ 83 int last; /* true if processing last block */ 84 int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ 85 int havedict; /* true if dictionary provided */ 86 int flags; /* gzip header method and flags (0 if zlib) */ | 47 DONE, /* finished check, done -- remain here until reset */ 48 BAD, /* got a data error -- remain here until reset */ 49 MEM, /* got an inflate() memory error -- remain here until reset */ 50 SYNC /* looking for synchronization bytes to restart inflate() */ 51} inflate_mode; 52 53/* 54 State transitions between above modes - --- 20 unchanged lines hidden (view full) --- 75 76/* state maintained between inflate() calls. Approximately 7K bytes. */ 77struct inflate_state { 78 inflate_mode mode; /* current inflate mode */ 79 int last; /* true if processing last block */ 80 int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ 81 int havedict; /* true if dictionary provided */ 82 int flags; /* gzip header method and flags (0 if zlib) */ |
83 unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ |
|
87 unsigned long check; /* protected copy of check value */ 88 unsigned long total; /* protected copy of output count */ | 84 unsigned long check; /* protected copy of check value */ 85 unsigned long total; /* protected copy of output count */ |
86 gz_headerp head; /* where to save gzip header information */ |
|
89 /* sliding window */ 90 unsigned wbits; /* log base 2 of requested window size */ 91 unsigned wsize; /* window size or zero if not using window */ 92 unsigned whave; /* valid bytes in the window */ 93 unsigned write; /* window write index */ 94 unsigned char FAR *window; /* allocated sliding window, if needed */ 95 /* bit accumulator */ 96 unsigned long hold; /* input bit accumulator */ --- 21 unchanged lines hidden --- | 87 /* sliding window */ 88 unsigned wbits; /* log base 2 of requested window size */ 89 unsigned wsize; /* window size or zero if not using window */ 90 unsigned whave; /* valid bytes in the window */ 91 unsigned write; /* window write index */ 92 unsigned char FAR *window; /* allocated sliding window, if needed */ 93 /* bit accumulator */ 94 unsigned long hold; /* input bit accumulator */ --- 21 unchanged lines hidden --- |