1 /*-------------------------------------------------------------------------
2 * Filename: mini_inflate.h
3 * Version: $Id: mini_inflate.h,v 1.2 2002/01/17 00:53:20 nyet Exp $
4 * Copyright: Copyright (C) 2001, Russ Dill
5 * Author: Russ Dill <Russ.Dill@asu.edu>
6 * Description: Mini deflate implementation
7 *-----------------------------------------------------------------------*/
9 * SPDX-License-Identifier: GPL-2.0+
12 typedef __SIZE_TYPE__ size;
15 #define COMP_UNKNOWN 1 /* The specififed bytype is invalid */
16 #define CODE_NOT_FOUND 2 /* a huffman code in the stream could not be decoded */
17 #define TOO_MANY_BITS 3 /* pull_bits was passed an argument that is too
20 /* This struct represents an entire huffman code set. It has various lookup
21 * tables to speed decoding */
23 int bits; /* maximum bit length */
24 int num_symbols; /* Number of symbols this code can represent */
25 int *lengths; /* The bit length of symbols */
26 int *symbols; /* All of the symbols, sorted by the huffman code */
27 int *count; /* the number of codes of this bit length */
28 int *first; /* the first code of this bit length */
29 int *pos; /* the symbol that first represents (in the symbols
34 unsigned char *data; /* increments as we move from byte to byte */
35 unsigned char bit; /* 0 to 7 */
36 void *(*memcpy)(void *, const void *, size);
37 unsigned long decoded; /* The number of bytes decoded */
40 int distance_count[16];
41 int distance_first[16];
43 int distance_lengths[32];
44 int distance_symbols[32];
55 int length_lengths[288];
56 int length_symbols[288];
58 struct huffman_set codes;
59 struct huffman_set lengths;
60 struct huffman_set distance;
65 #define DYNAMIC_COMP 2
67 long decompress_block(unsigned char *dest, unsigned char *source,
68 void *(*inflate_memcpy)(void *dest, const void *src, size n));