| 1 |
#ifndef DFLTCC_INFLATE_H |
| 2 |
#define DFLTCC_INFLATE_H |
| 3 |
|
| 4 |
#include "dfltcc_common.h" |
| 5 |
|
| 6 |
struct inflate_state Z_INTERNAL *PREFIX(dfltcc_alloc_inflate_state)(PREFIX3(streamp) strm); |
| 7 |
void Z_INTERNAL PREFIX(dfltcc_reset_inflate_state)(PREFIX3(streamp) strm); |
| 8 |
void Z_INTERNAL PREFIX(dfltcc_copy_inflate_state)(struct inflate_state *dst, const struct inflate_state *src); |
| 9 |
int Z_INTERNAL PREFIX(dfltcc_can_inflate)(PREFIX3(streamp) strm); |
| 10 |
typedef enum { |
| 11 |
DFLTCC_INFLATE_CONTINUE, |
| 12 |
DFLTCC_INFLATE_BREAK, |
| 13 |
DFLTCC_INFLATE_SOFTWARE, |
| 14 |
} dfltcc_inflate_action; |
| 15 |
dfltcc_inflate_action Z_INTERNAL PREFIX(dfltcc_inflate)(PREFIX3(streamp) strm, int flush, int *ret); |
| 16 |
int Z_INTERNAL PREFIX(dfltcc_was_inflate_used)(PREFIX3(streamp) strm); |
| 17 |
int Z_INTERNAL PREFIX(dfltcc_inflate_disable)(PREFIX3(streamp) strm); |
| 18 |
int Z_INTERNAL PREFIX(dfltcc_inflate_set_dictionary)(PREFIX3(streamp) strm, |
| 19 |
const unsigned char *dictionary, uInt dict_length); |
| 20 |
int Z_INTERNAL PREFIX(dfltcc_inflate_get_dictionary)(PREFIX3(streamp) strm, |
| 21 |
unsigned char *dictionary, uInt* dict_length); |
| 22 |
|
| 23 |
#define ZALLOC_INFLATE_STATE PREFIX(dfltcc_alloc_inflate_state) |
| 24 |
#define ZCOPY_INFLATE_STATE PREFIX(dfltcc_copy_inflate_state) |
| 25 |
|
| 26 |
#define INFLATE_RESET_KEEP_HOOK PREFIX(dfltcc_reset_inflate_state) |
| 27 |
|
| 28 |
#define INFLATE_PRIME_HOOK(strm, bits, value) \ |
| 29 |
do { if (PREFIX(dfltcc_inflate_disable)((strm))) return Z_STREAM_ERROR; } while (0) |
| 30 |
|
| 31 |
#define INFLATE_TYPEDO_HOOK(strm, flush) \ |
| 32 |
if (PREFIX(dfltcc_can_inflate)((strm))) { \ |
| 33 |
dfltcc_inflate_action action; \ |
| 34 |
\ |
| 35 |
RESTORE(); \ |
| 36 |
action = PREFIX(dfltcc_inflate)((strm), (flush), &ret); \ |
| 37 |
LOAD(); \ |
| 38 |
if (action == DFLTCC_INFLATE_CONTINUE) \ |
| 39 |
break; \ |
| 40 |
else if (action == DFLTCC_INFLATE_BREAK) \ |
| 41 |
goto inf_leave; \ |
| 42 |
} |
| 43 |
|
| 44 |
#define INFLATE_NEED_CHECKSUM(strm) (!PREFIX(dfltcc_can_inflate)((strm))) |
| 45 |
|
| 46 |
#define INFLATE_NEED_UPDATEWINDOW(strm) (!PREFIX(dfltcc_can_inflate)((strm))) |
| 47 |
|
| 48 |
#define INFLATE_MARK_HOOK(strm) \ |
| 49 |
do { \ |
| 50 |
if (PREFIX(dfltcc_was_inflate_used)((strm))) return -(1L << 16); \ |
| 51 |
} while (0) |
| 52 |
|
| 53 |
#define INFLATE_SYNC_POINT_HOOK(strm) \ |
| 54 |
do { \ |
| 55 |
if (PREFIX(dfltcc_was_inflate_used)((strm))) return Z_STREAM_ERROR; \ |
| 56 |
} while (0) |
| 57 |
|
| 58 |
#define INFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \ |
| 59 |
do { \ |
| 60 |
if (PREFIX(dfltcc_can_inflate)((strm))) \ |
| 61 |
return PREFIX(dfltcc_inflate_set_dictionary)((strm), (dict), (dict_len)); \ |
| 62 |
} while (0) |
| 63 |
|
| 64 |
#define INFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) \ |
| 65 |
do { \ |
| 66 |
if (PREFIX(dfltcc_can_inflate)((strm))) \ |
| 67 |
return PREFIX(dfltcc_inflate_get_dictionary)((strm), (dict), (dict_len)); \ |
| 68 |
} while (0) |
| 69 |
|
| 70 |
#endif |