1 /* $NetBSD: inflate9.h,v 1.1.1.1 2006/01/14 20:10:51 christos Exp $ */
3 /* inflate9.h -- internal inflate state definition
4 * Copyright (C) 1995-2003 Mark Adler
5 * For conditions of distribution and use, see copyright notice in zlib.h
8 /* WARNING: this file should *not* be used by applications. It is
9 part of the implementation of the compression library and is
10 subject to change. Applications should only use zlib.h.
13 /* Possible inflate modes between inflate() calls */
15 TYPE
, /* i: waiting for type bits, including last-flag bit */
16 STORED
, /* i: waiting for stored size (length and complement) */
17 TABLE
, /* i: waiting for dynamic block table lengths */
18 LEN
, /* i: waiting for length/lit code */
19 DONE
, /* finished check, done -- remain here until reset */
20 BAD
/* got a data error -- remain here until reset */
24 State transitions between above modes -
26 (most modes can go to the BAD mode -- not shown for clarity)
29 TYPE -> STORED or TABLE or LEN or DONE
31 TABLE -> LENLENS -> CODELENS -> LEN
36 /* state maintained between inflate() calls. Approximately 7K bytes. */
37 struct inflate_state
{
39 unsigned char FAR
*window
; /* allocated sliding window, if needed */
40 /* dynamic table building */
41 unsigned ncode
; /* number of code length code lengths */
42 unsigned nlen
; /* number of length code lengths */
43 unsigned ndist
; /* number of distance code lengths */
44 unsigned have
; /* number of code lengths in lens[] */
45 code FAR
*next
; /* next available space in codes[] */
46 unsigned short lens
[320]; /* temporary storage for code lengths */
47 unsigned short work
[288]; /* work area for code table building */
48 code codes
[ENOUGH
]; /* space for code tables */