Chris@43: /* inflate9.h -- internal inflate state definition Chris@43: * Copyright (C) 1995-2003 Mark Adler Chris@43: * For conditions of distribution and use, see copyright notice in zlib.h Chris@43: */ Chris@43: Chris@43: /* WARNING: this file should *not* be used by applications. It is Chris@43: part of the implementation of the compression library and is Chris@43: subject to change. Applications should only use zlib.h. Chris@43: */ Chris@43: Chris@43: /* Possible inflate modes between inflate() calls */ Chris@43: typedef enum { Chris@43: TYPE, /* i: waiting for type bits, including last-flag bit */ Chris@43: STORED, /* i: waiting for stored size (length and complement) */ Chris@43: TABLE, /* i: waiting for dynamic block table lengths */ Chris@43: LEN, /* i: waiting for length/lit code */ Chris@43: DONE, /* finished check, done -- remain here until reset */ Chris@43: BAD /* got a data error -- remain here until reset */ Chris@43: } inflate_mode; Chris@43: Chris@43: /* Chris@43: State transitions between above modes - Chris@43: Chris@43: (most modes can go to the BAD mode -- not shown for clarity) Chris@43: Chris@43: Read deflate blocks: Chris@43: TYPE -> STORED or TABLE or LEN or DONE Chris@43: STORED -> TYPE Chris@43: TABLE -> LENLENS -> CODELENS -> LEN Chris@43: Read deflate codes: Chris@43: LEN -> LEN or TYPE Chris@43: */ Chris@43: Chris@43: /* state maintained between inflate() calls. Approximately 7K bytes. */ Chris@43: struct inflate_state { Chris@43: /* sliding window */ Chris@43: unsigned char FAR *window; /* allocated sliding window, if needed */ Chris@43: /* dynamic table building */ Chris@43: unsigned ncode; /* number of code length code lengths */ Chris@43: unsigned nlen; /* number of length code lengths */ Chris@43: unsigned ndist; /* number of distance code lengths */ Chris@43: unsigned have; /* number of code lengths in lens[] */ Chris@43: code FAR *next; /* next available space in codes[] */ Chris@43: unsigned short lens[320]; /* temporary storage for code lengths */ Chris@43: unsigned short work[288]; /* work area for code table building */ Chris@43: code codes[ENOUGH]; /* space for code tables */ Chris@43: };