/* inftrees.h -- header to use inftrees.c1* Copyright (C) 1995-2005, 2010 Mark Adler2* For conditions of distribution and use, see copyright notice in zlib.h3*/45/* WARNING: this file should *not* be used by applications. It is6part of the implementation of the compression library and is7subject to change. Applications should only use zlib.h.8*/910/* Structure for decoding tables. Each entry provides either the11information needed to do the operation requested by the code that12indexed that table entry, or it provides a pointer to another13table that indexes more bits of the code. op indicates whether14the entry is a pointer to another table, a literal, a length or15distance, an end-of-block, or an invalid code. For a table16pointer, the low four bits of op is the number of index bits of17that table. For a length or distance, the low four bits of op18is the number of extra bits to get after the code. bits is19the number of bits in this code or part of the code to drop off20of the bit buffer. val is the actual byte to output in the case21of a literal, the base length or distance, or the offset from22the current table to the next table. Each entry is four bytes. */23typedef struct {24unsigned char op; /* operation, extra bits, table bits */25unsigned char bits; /* bits in this part of the code */26unsigned short val; /* offset in table or code value */27} code;2829/* op values as set by inflate_table():3000000000 - literal310000tttt - table link, tttt != 0 is the number of table index bits320001eeee - length or distance, eeee is the number of extra bits3301100000 - end of block3401000000 - invalid code35*/3637/* Maximum size of the dynamic table. The maximum number of code structures is381444, which is the sum of 852 for literal/length codes and 592 for distance39codes. These values were found by exhaustive searches using the program40examples/enough.c found in the zlib distribution. The arguments to that41program are the number of symbols, the initial root table size, and the42maximum bit length of a code. "enough 286 9 15" for literal/length codes43returns 852, and "enough 30 6 15" for distance codes returns 592. The44initial root table size (9 or 6) is found in the fifth argument of the45inflate_table() calls in inflate.c and infback.c. If the root table size is46changed, then these maximum sizes would be need to be recalculated and47updated. */48#define ENOUGH_LENS 85249#define ENOUGH_DISTS 59250#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)5152/* Type of code to build for inflate_table() */53typedef enum {54CODES,55LENS,56DISTS57} codetype;5859int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,60unsigned codes, code FAR * FAR *table,61unsigned FAR *bits, unsigned short FAR *work);626364