| 1 | /* infutil.h -- types and macros common to blocks and codes
|
|---|
| 2 | * Copyright (C) 1995-2002 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 | #ifndef _INFUTIL_H
|
|---|
| 12 | #define _INFUTIL_H
|
|---|
| 13 |
|
|---|
| 14 | typedef enum {
|
|---|
| 15 | TYPE, /* get type bits (3, including end bit) */
|
|---|
| 16 | LENS, /* get lengths for stored */
|
|---|
| 17 | STORED, /* processing stored block */
|
|---|
| 18 | TABLE, /* get table lengths */
|
|---|
| 19 | BTREE, /* get bit lengths tree for a dynamic block */
|
|---|
| 20 | DTREE, /* get length, distance trees for a dynamic block */
|
|---|
| 21 | CODES, /* processing fixed or dynamic block */
|
|---|
| 22 | DRY, /* output remaining window bytes */
|
|---|
| 23 | DONE, /* finished last block, done */
|
|---|
| 24 | BAD} /* got a data error--stuck here */
|
|---|
| 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 */
|
|---|
| 32 |
|
|---|
| 33 | /* mode dependent information */
|
|---|
| 34 | union {
|
|---|
| 35 | uInt left; /* if STORED, bytes left to copy */
|
|---|
| 36 | struct {
|
|---|
| 37 | uInt table; /* table lengths (14 bits) */
|
|---|
| 38 | uInt index; /* index into blens (or border) */
|
|---|
| 39 | uIntf *blens; /* bit lengths of codes */
|
|---|
| 40 | uInt bb; /* bit length tree depth */
|
|---|
| 41 | inflate_huft *tb; /* bit length decoding tree */
|
|---|
| 42 | } trees; /* if DTREE, decoding info for trees */
|
|---|
| 43 | struct {
|
|---|
| 44 | inflate_codes_statef
|
|---|
| 45 | *codes;
|
|---|
| 46 | } decode; /* if CODES, current state */
|
|---|
| 47 | } sub; /* submode */
|
|---|
| 48 | uInt last; /* true if this block is the last block */
|
|---|
|
|---|