Back to home page

OSCL-LXR

 
 

    


0001 #ifndef INFTREES_H
0002 #define INFTREES_H
0003 
0004 /* inftrees.h -- header to use inftrees.c
0005  * Copyright (C) 1995-2005 Mark Adler
0006  * For conditions of distribution and use, see copyright notice in zlib.h
0007  */
0008 
0009 /* WARNING: this file should *not* be used by applications. It is
0010    part of the implementation of the compression library and is
0011    subject to change. Applications should only use zlib.h.
0012  */
0013 
0014 /* Structure for decoding tables.  Each entry provides either the
0015    information needed to do the operation requested by the code that
0016    indexed that table entry, or it provides a pointer to another
0017    table that indexes more bits of the code.  op indicates whether
0018    the entry is a pointer to another table, a literal, a length or
0019    distance, an end-of-block, or an invalid code.  For a table
0020    pointer, the low four bits of op is the number of index bits of
0021    that table.  For a length or distance, the low four bits of op
0022    is the number of extra bits to get after the code.  bits is
0023    the number of bits in this code or part of the code to drop off
0024    of the bit buffer.  val is the actual byte to output in the case
0025    of a literal, the base length or distance, or the offset from
0026    the current table to the next table.  Each entry is four bytes. */
0027 typedef struct {
0028     unsigned char op;           /* operation, extra bits, table bits */
0029     unsigned char bits;         /* bits in this part of the code */
0030     unsigned short val;         /* offset in table or code value */
0031 } code;
0032 
0033 /* op values as set by inflate_table():
0034     00000000 - literal
0035     0000tttt - table link, tttt != 0 is the number of table index bits
0036     0001eeee - length or distance, eeee is the number of extra bits
0037     01100000 - end of block
0038     01000000 - invalid code
0039  */
0040 
0041 /* Maximum size of dynamic tree.  The maximum found in a long but non-
0042    exhaustive search was 1444 code structures (852 for length/literals
0043    and 592 for distances, the latter actually the result of an
0044    exhaustive search).  The true maximum is not known, but the value
0045    below is more than safe. */
0046 #define ENOUGH 2048
0047 #define MAXD 592
0048 
0049 /* Type of code to build for inftable() */
0050 typedef enum {
0051     CODES,
0052     LENS,
0053     DISTS
0054 } codetype;
0055 
0056 extern int zlib_inflate_table (codetype type, unsigned short *lens,
0057                              unsigned codes, code **table,
0058                              unsigned *bits, unsigned short *work);
0059 #endif