1592N/A/*
1592N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1592N/A *
1592N/A * This code is free software; you can redistribute it and/or modify it
1592N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
1592N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
1592N/A *
1592N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1592N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1592N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1592N/A * version 2 for more details (a copy is included in the LICENSE file that
1592N/A * accompanied this code).
1592N/A *
1592N/A * You should have received a copy of the GNU General Public License version
1592N/A * 2 along with this work; if not, write to the Free Software Foundation,
1592N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1592N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1592N/A */
1592N/A
1592N/A/* inftrees.h -- header to use inftrees.c
1592N/A * Copyright (C) 1995-2005 Mark Adler
1592N/A * For conditions of distribution and use, see copyright notice in zlib.h
1592N/A */
1592N/A
1592N/A/* WARNING: this file should *not* be used by applications. It is
1592N/A part of the implementation of the compression library and is
1592N/A subject to change. Applications should only use zlib.h.
1592N/A */
1592N/A
1592N/A/* Structure for decoding tables. Each entry provides either the
1592N/A information needed to do the operation requested by the code that
1592N/A indexed that table entry, or it provides a pointer to another
1592N/A table that indexes more bits of the code. op indicates whether
1592N/A the entry is a pointer to another table, a literal, a length or
1592N/A distance, an end-of-block, or an invalid code. For a table
1592N/A pointer, the low four bits of op is the number of index bits of
1592N/A that table. For a length or distance, the low four bits of op
1592N/A is the number of extra bits to get after the code. bits is
1592N/A the number of bits in this code or part of the code to drop off
1592N/A of the bit buffer. val is the actual byte to output in the case
1592N/A of a literal, the base length or distance, or the offset from
1592N/A the current table to the next table. Each entry is four bytes. */
1592N/Atypedef struct {
1592N/A unsigned char op; /* operation, extra bits, table bits */
1592N/A unsigned char bits; /* bits in this part of the code */
1592N/A unsigned short val; /* offset in table or code value */
1592N/A} code;
1592N/A
1592N/A/* op values as set by inflate_table():
1592N/A 00000000 - literal
1592N/A 0000tttt - table link, tttt != 0 is the number of table index bits
1592N/A 0001eeee - length or distance, eeee is the number of extra bits
1592N/A 01100000 - end of block
1592N/A 01000000 - invalid code
1592N/A */
1592N/A
1592N/A/* Maximum size of dynamic tree. The maximum found in a long but non-
1592N/A exhaustive search was 1444 code structures (852 for length/literals
1592N/A and 592 for distances, the latter actually the result of an
1592N/A exhaustive search). The true maximum is not known, but the value
1592N/A below is more than safe. */
1592N/A#define ENOUGH 2048
1592N/A#define MAXD 592
1592N/A
1592N/A/* Type of code to build for inftable() */
1592N/Atypedef enum {
1592N/A CODES,
1592N/A LENS,
1592N/A DISTS
1592N/A} codetype;
1592N/A
1592N/Aextern int inflate_table OF((codetype type, unsigned short FAR *lens,
1592N/A unsigned codes, code FAR * FAR *table,
1592N/A unsigned FAR *bits, unsigned short FAR *work));