Alain Knaff | bc22c17 | 2009-01-04 22:46:16 +0100 | [diff] [blame] | 1 | #ifndef DECOMPRESS_GENERIC_H |
| 2 | #define DECOMPRESS_GENERIC_H |
| 3 | |
| 4 | /* Minimal chunksize to be read. |
| 5 | *Bzip2 prefers at least 4096 |
| 6 | *Lzma prefers 0x10000 */ |
| 7 | #define COMPR_IOBUF_SIZE 4096 |
| 8 | |
| 9 | typedef int (*decompress_fn) (unsigned char *inbuf, int len, |
| 10 | int(*fill)(void*, unsigned int), |
| 11 | int(*writebb)(void*, unsigned int), |
| 12 | unsigned char *output, |
| 13 | int *posp, |
| 14 | void(*error)(char *x)); |
| 15 | |
| 16 | /* inbuf - input buffer |
| 17 | *len - len of pre-read data in inbuf |
| 18 | *fill - function to fill inbuf if empty |
| 19 | *writebb - function to write out outbug |
| 20 | *posp - if non-null, input position (number of bytes read) will be |
| 21 | * returned here |
| 22 | * |
| 23 | *If len != 0, the inbuf is initialized (with as much data), and fill |
| 24 | *should not be called |
| 25 | *If len = 0, the inbuf is allocated, but empty. Its size is IOBUF_SIZE |
| 26 | *fill should be called (repeatedly...) to read data, at most IOBUF_SIZE |
| 27 | */ |
| 28 | |
H. Peter Anvin | 889c92d | 2009-01-08 15:14:17 -0800 | [diff] [blame] | 29 | /* Utility routine to detect the decompression method */ |
| 30 | decompress_fn decompress_method(const unsigned char *inbuf, int len, |
| 31 | const char **name); |
Alain Knaff | bc22c17 | 2009-01-04 22:46:16 +0100 | [diff] [blame] | 32 | |
| 33 | #endif |