Fork of DMemWin by
png/inftrees.h@2:0e2ef1edf01b, 2016-06-02 (annotated)
- Committer:
- destinyXfate
- Date:
- Thu Jun 02 04:52:54 2016 +0000
- Revision:
- 2:0e2ef1edf01b
;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
destinyXfate | 2:0e2ef1edf01b | 1 | /* inftrees.h -- header to use inftrees.c |
destinyXfate | 2:0e2ef1edf01b | 2 | * Copyright (C) 1995-2005 Mark Adler |
destinyXfate | 2:0e2ef1edf01b | 3 | * For conditions of distribution and use, see copyright notice in zlib.h |
destinyXfate | 2:0e2ef1edf01b | 4 | */ |
destinyXfate | 2:0e2ef1edf01b | 5 | |
destinyXfate | 2:0e2ef1edf01b | 6 | /* WARNING: this file should *not* be used by applications. It is |
destinyXfate | 2:0e2ef1edf01b | 7 | part of the implementation of the compression library and is |
destinyXfate | 2:0e2ef1edf01b | 8 | subject to change. Applications should only use zlib.h. |
destinyXfate | 2:0e2ef1edf01b | 9 | */ |
destinyXfate | 2:0e2ef1edf01b | 10 | |
destinyXfate | 2:0e2ef1edf01b | 11 | /* Structure for decoding tables. Each entry provides either the |
destinyXfate | 2:0e2ef1edf01b | 12 | information needed to do the operation requested by the code that |
destinyXfate | 2:0e2ef1edf01b | 13 | indexed that table entry, or it provides a pointer to another |
destinyXfate | 2:0e2ef1edf01b | 14 | table that indexes more bits of the code. op indicates whether |
destinyXfate | 2:0e2ef1edf01b | 15 | the entry is a pointer to another table, a literal, a length or |
destinyXfate | 2:0e2ef1edf01b | 16 | distance, an end-of-block, or an invalid code. For a table |
destinyXfate | 2:0e2ef1edf01b | 17 | pointer, the low four bits of op is the number of index bits of |
destinyXfate | 2:0e2ef1edf01b | 18 | that table. For a length or distance, the low four bits of op |
destinyXfate | 2:0e2ef1edf01b | 19 | is the number of extra bits to get after the code. bits is |
destinyXfate | 2:0e2ef1edf01b | 20 | the number of bits in this code or part of the code to drop off |
destinyXfate | 2:0e2ef1edf01b | 21 | of the bit buffer. val is the actual byte to output in the case |
destinyXfate | 2:0e2ef1edf01b | 22 | of a literal, the base length or distance, or the offset from |
destinyXfate | 2:0e2ef1edf01b | 23 | the current table to the next table. Each entry is four bytes. */ |
destinyXfate | 2:0e2ef1edf01b | 24 | typedef struct { |
destinyXfate | 2:0e2ef1edf01b | 25 | unsigned char op; /* operation, extra bits, table bits */ |
destinyXfate | 2:0e2ef1edf01b | 26 | unsigned char bits; /* bits in this part of the code */ |
destinyXfate | 2:0e2ef1edf01b | 27 | unsigned short val; /* offset in table or code value */ |
destinyXfate | 2:0e2ef1edf01b | 28 | } code; |
destinyXfate | 2:0e2ef1edf01b | 29 | |
destinyXfate | 2:0e2ef1edf01b | 30 | /* op values as set by inflate_table(): |
destinyXfate | 2:0e2ef1edf01b | 31 | 00000000 - literal |
destinyXfate | 2:0e2ef1edf01b | 32 | 0000tttt - table link, tttt != 0 is the number of table index bits |
destinyXfate | 2:0e2ef1edf01b | 33 | 0001eeee - length or distance, eeee is the number of extra bits |
destinyXfate | 2:0e2ef1edf01b | 34 | 01100000 - end of block |
destinyXfate | 2:0e2ef1edf01b | 35 | 01000000 - invalid code |
destinyXfate | 2:0e2ef1edf01b | 36 | */ |
destinyXfate | 2:0e2ef1edf01b | 37 | |
destinyXfate | 2:0e2ef1edf01b | 38 | /* Maximum size of dynamic tree. The maximum found in a long but non- |
destinyXfate | 2:0e2ef1edf01b | 39 | exhaustive search was 1444 code structures (852 for length/literals |
destinyXfate | 2:0e2ef1edf01b | 40 | and 592 for distances, the latter actually the result of an |
destinyXfate | 2:0e2ef1edf01b | 41 | exhaustive search). The true maximum is not known, but the value |
destinyXfate | 2:0e2ef1edf01b | 42 | below is more than safe. */ |
destinyXfate | 2:0e2ef1edf01b | 43 | #define ENOUGH 2048 |
destinyXfate | 2:0e2ef1edf01b | 44 | #define MAXD 592 |
destinyXfate | 2:0e2ef1edf01b | 45 | |
destinyXfate | 2:0e2ef1edf01b | 46 | /* Type of code to build for inftable() */ |
destinyXfate | 2:0e2ef1edf01b | 47 | typedef enum { |
destinyXfate | 2:0e2ef1edf01b | 48 | CODES, |
destinyXfate | 2:0e2ef1edf01b | 49 | LENS, |
destinyXfate | 2:0e2ef1edf01b | 50 | DISTS |
destinyXfate | 2:0e2ef1edf01b | 51 | } codetype; |
destinyXfate | 2:0e2ef1edf01b | 52 | |
destinyXfate | 2:0e2ef1edf01b | 53 | extern int inflate_table OF((codetype type, unsigned short FAR *lens, |
destinyXfate | 2:0e2ef1edf01b | 54 | unsigned codes, code FAR * FAR *table, |
destinyXfate | 2:0e2ef1edf01b | 55 | unsigned FAR *bits, unsigned short FAR *work)); |
destinyXfate | 2:0e2ef1edf01b | 56 |