jdk/src/share/native/java/util/zip/zlib-1.2.3/inftrees.h
changeset 11112 6d340c7b6a32
parent 11111 6d84419a893a
child 11113 f7248a4db8db
child 11114 005ec2ce55e9
equal deleted inserted replaced
11111:6d84419a893a 11112:6d340c7b6a32
     1 /*
       
     2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     3  *
       
     4  * This code is free software; you can redistribute it and/or modify it
       
     5  * under the terms of the GNU General Public License version 2 only, as
       
     6  * published by the Free Software Foundation.  Oracle designates this
       
     7  * particular file as subject to the "Classpath" exception as provided
       
     8  * by Oracle in the LICENSE file that accompanied this code.
       
     9  *
       
    10  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    13  * version 2 for more details (a copy is included in the LICENSE file that
       
    14  * accompanied this code).
       
    15  *
       
    16  * You should have received a copy of the GNU General Public License version
       
    17  * 2 along with this work; if not, write to the Free Software Foundation,
       
    18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    19  *
       
    20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    21  * or visit www.oracle.com if you need additional information or have any
       
    22  * questions.
       
    23  */
       
    24 
       
    25 /* inftrees.h -- header to use inftrees.c
       
    26  * Copyright (C) 1995-2005 Mark Adler
       
    27  * For conditions of distribution and use, see copyright notice in zlib.h
       
    28  */
       
    29 
       
    30 /* WARNING: this file should *not* be used by applications. It is
       
    31    part of the implementation of the compression library and is
       
    32    subject to change. Applications should only use zlib.h.
       
    33  */
       
    34 
       
    35 /* Structure for decoding tables.  Each entry provides either the
       
    36    information needed to do the operation requested by the code that
       
    37    indexed that table entry, or it provides a pointer to another
       
    38    table that indexes more bits of the code.  op indicates whether
       
    39    the entry is a pointer to another table, a literal, a length or
       
    40    distance, an end-of-block, or an invalid code.  For a table
       
    41    pointer, the low four bits of op is the number of index bits of
       
    42    that table.  For a length or distance, the low four bits of op
       
    43    is the number of extra bits to get after the code.  bits is
       
    44    the number of bits in this code or part of the code to drop off
       
    45    of the bit buffer.  val is the actual byte to output in the case
       
    46    of a literal, the base length or distance, or the offset from
       
    47    the current table to the next table.  Each entry is four bytes. */
       
    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 dynamic tree.  The maximum found in a long but non-
       
    63    exhaustive search was 1444 code structures (852 for length/literals
       
    64    and 592 for distances, the latter actually the result of an
       
    65    exhaustive search).  The true maximum is not known, but the value
       
    66    below is more than safe. */
       
    67 #define ENOUGH 2048
       
    68 #define MAXD 592
       
    69 
       
    70 /* Type of code to build for inftable() */
       
    71 typedef enum {
       
    72     CODES,
       
    73     LENS,
       
    74     DISTS
       
    75 } codetype;
       
    76 
       
    77 extern int inflate_table OF((codetype type, unsigned short FAR *lens,
       
    78                              unsigned codes, code FAR * FAR *table,
       
    79                              unsigned FAR *bits, unsigned short FAR *work));