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