• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef DFLTCC_INFLATE_H
2 #define DFLTCC_INFLATE_H
3 
4 #include "dfltcc_common.h"
5 
6 int Z_INTERNAL dfltcc_can_inflate(PREFIX3(streamp) strm);
7 typedef enum {
8     DFLTCC_INFLATE_CONTINUE,
9     DFLTCC_INFLATE_BREAK,
10     DFLTCC_INFLATE_SOFTWARE,
11 } dfltcc_inflate_action;
12 dfltcc_inflate_action Z_INTERNAL dfltcc_inflate(PREFIX3(streamp) strm, int flush, int *ret);
13 int Z_INTERNAL dfltcc_was_inflate_used(PREFIX3(streamp) strm);
14 int Z_INTERNAL dfltcc_inflate_disable(PREFIX3(streamp) strm);
15 
16 #define INFLATE_RESET_KEEP_HOOK(strm) \
17     dfltcc_reset((strm), sizeof(struct inflate_state))
18 
19 #define INFLATE_PRIME_HOOK(strm, bits, value) \
20     do { if (dfltcc_inflate_disable((strm))) return Z_STREAM_ERROR; } while (0)
21 
22 #define INFLATE_TYPEDO_HOOK(strm, flush) \
23     if (dfltcc_can_inflate((strm))) { \
24         dfltcc_inflate_action action; \
25 \
26         RESTORE(); \
27         action = dfltcc_inflate((strm), (flush), &ret); \
28         LOAD(); \
29         if (action == DFLTCC_INFLATE_CONTINUE) \
30             break; \
31         else if (action == DFLTCC_INFLATE_BREAK) \
32             goto inf_leave; \
33     }
34 
35 #define INFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_inflate((strm)))
36 
37 #define INFLATE_NEED_UPDATEWINDOW(strm) (!dfltcc_can_inflate((strm)))
38 
39 #define INFLATE_MARK_HOOK(strm) \
40     do { \
41         if (dfltcc_was_inflate_used((strm))) return -(1L << 16); \
42     } while (0)
43 
44 #endif
45