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
*-----------------------------------------------------------------------*/
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
typedef __SIZE_TYPE__ size;
29
#define COMP_UNKNOWN 1 /* The specififed bytype is invalid */
30
#define CODE_NOT_FOUND 2 /* a huffman code in the stream could not be decoded */
31
#define TOO_MANY_BITS 3 /* pull_bits was passed an argument that is too
34
/* This struct represents an entire huffman code set. It has various lookup
35
* tables to speed decoding */
37
int bits; /* maximum bit length */
38
int num_symbols; /* Number of symbols this code can represent */
39
int *lengths; /* The bit length of symbols */
40
int *symbols; /* All of the symbols, sorted by the huffman code */
41
int *count; /* the number of codes of this bit length */
42
int *first; /* the first code of this bit length */
43
int *pos; /* the symbol that first represents (in the symbols
48
unsigned char *data; /* increments as we move from byte to byte */
49
unsigned char bit; /* 0 to 7 */
50
void *(*memcpy)(void *, const void *, size);
51
unsigned long decoded; /* The number of bytes decoded */
54
int distance_count[16];
55
int distance_first[16];
57
int distance_lengths[32];
58
int distance_symbols[32];
69
int length_lengths[288];
70
int length_symbols[288];
72
struct huffman_set codes;
73
struct huffman_set lengths;
74
struct huffman_set distance;
79
#define DYNAMIC_COMP 2
81
long decompress_block(unsigned char *dest, unsigned char *source,
82
void *(*inflate_memcpy)(void *dest, const void *src, size n));