| 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 | |
| 19 | #define ZALLOC_INFLATE_STATE PREFIX(dfltcc_alloc_inflate_state) |
| 20 | #define ZCOPY_INFLATE_STATE PREFIX(dfltcc_copy_inflate_state) |
| 21 | |
| 22 | #define INFLATE_RESET_KEEP_HOOK PREFIX(dfltcc_reset_inflate_state) |
| 23 | |
| 24 | #define INFLATE_PRIME_HOOK(strm, bits, value) \ |
| 25 | do { if (PREFIX(dfltcc_inflate_disable)((strm))) return Z_STREAM_ERROR; } while (0) |
| 26 | |
| 27 | #define INFLATE_TYPEDO_HOOK(strm, flush) \ |
| 28 | if (PREFIX(dfltcc_can_inflate)((strm))) { \ |
| 29 | dfltcc_inflate_action action; \ |
| 30 | \ |
| 31 | RESTORE(); \ |
| 32 | action = PREFIX(dfltcc_inflate)((strm), (flush), &ret); \ |
| 33 | LOAD(); \ |
| 34 | if (action == DFLTCC_INFLATE_CONTINUE) \ |
| 35 | break; \ |
| 36 | else if (action == DFLTCC_INFLATE_BREAK) \ |
| 37 | goto inf_leave; \ |
| 38 | } |
| 39 | |
| 40 | #define INFLATE_NEED_CHECKSUM(strm) (!PREFIX(dfltcc_can_inflate)((strm))) |
| 41 | |
| 42 | #define INFLATE_NEED_UPDATEWINDOW(strm) (!PREFIX(dfltcc_can_inflate)((strm))) |
| 43 | |
| 44 | #define INFLATE_MARK_HOOK(strm) \ |
| 45 | do { \ |
| 46 | if (PREFIX(dfltcc_was_inflate_used)((strm))) return -(1L << 16); \ |
| 47 | } while (0) |
| 48 | |
| 49 | #define INFLATE_SYNC_POINT_HOOK(strm) \ |
| 50 | do { \ |
| 51 | if (PREFIX(dfltcc_was_inflate_used)((strm))) return Z_STREAM_ERROR; \ |
| 52 | } while (0) |
| 53 | |
| 54 | #endif |