48 typedef struct { 49 unsigned char op; /* operation, extra bits, table bits */ 50 unsigned char bits; /* bits in this part of the code */ 51 unsigned short val; /* offset in table or code value */ 52 } code; 53 54 /* op values as set by inflate_table(): 55 00000000 - literal 56 0000tttt - table link, tttt != 0 is the number of table index bits 57 0001eeee - length or distance, eeee is the number of extra bits 58 01100000 - end of block 59 01000000 - invalid code 60 */ 61 62 /* Maximum size of the dynamic table. The maximum number of code structures is 63 1444, which is the sum of 852 for literal/length codes and 592 for distance 64 codes. These values were found by exhaustive searches using the program 65 examples/enough.c found in the zlib distribution. The arguments to that 66 program are the number of symbols, the initial root table size, and the 67 maximum bit length of a code. "enough 286 9 15" for literal/length codes 68 returns returns 852, and "enough 30 6 15" for distance codes returns 592. 69 The initial root table size (9 or 6) is found in the fifth argument of the 70 inflate_table() calls in inflate.c and infback.c. If the root table size is 71 changed, then these maximum sizes would be need to be recalculated and 72 updated. */ 73 #define ENOUGH_LENS 852 74 #define ENOUGH_DISTS 592 75 #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 76 77 /* Type of code to build for inflate_table() */ 78 typedef enum { 79 CODES, 80 LENS, 81 DISTS 82 } codetype; 83 84 int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, 85 unsigned codes, code FAR * FAR *table, 86 unsigned FAR *bits, unsigned short FAR *work)); |
48 typedef struct { 49 unsigned char op; /* operation, extra bits, table bits */ 50 unsigned char bits; /* bits in this part of the code */ 51 unsigned short val; /* offset in table or code value */ 52 } code; 53 54 /* op values as set by inflate_table(): 55 00000000 - literal 56 0000tttt - table link, tttt != 0 is the number of table index bits 57 0001eeee - length or distance, eeee is the number of extra bits 58 01100000 - end of block 59 01000000 - invalid code 60 */ 61 62 /* Maximum size of the dynamic table. The maximum number of code structures is 63 1444, which is the sum of 852 for literal/length codes and 592 for distance 64 codes. These values were found by exhaustive searches using the program 65 examples/enough.c found in the zlib distribution. The arguments to that 66 program are the number of symbols, the initial root table size, and the 67 maximum bit length of a code. "enough 286 9 15" for literal/length codes 68 returns 852, and "enough 30 6 15" for distance codes returns 592. The 69 initial root table size (9 or 6) is found in the fifth argument of the 70 inflate_table() calls in inflate.c and infback.c. If the root table size is 71 changed, then these maximum sizes would be need to be recalculated and 72 updated. */ 73 #define ENOUGH_LENS 852 74 #define ENOUGH_DISTS 592 75 #define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) 76 77 /* Type of code to build for inflate_table() */ 78 typedef enum { 79 CODES, 80 LENS, 81 DISTS 82 } codetype; 83 84 int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens, 85 unsigned codes, code FAR * FAR *table, 86 unsigned FAR *bits, unsigned short FAR *work); |