1 #ifndef DFLTCC_DEFLATE_H
2 #define DFLTCC_DEFLATE_H
3 
4 #include "dfltcc_common.h"
5 
6 void Z_INTERNAL *PREFIX(dfltcc_alloc_deflate_state)(PREFIX3(streamp));
7 void Z_INTERNAL PREFIX(dfltcc_reset_deflate_state)(PREFIX3(streamp));
8 void Z_INTERNAL PREFIX(dfltcc_copy_deflate_state)(void *dst, const void *src);
9 int Z_INTERNAL PREFIX(dfltcc_can_deflate)(PREFIX3(streamp) strm);
10 int Z_INTERNAL PREFIX(dfltcc_deflate)(PREFIX3(streamp) strm, int flush, block_state *result);
11 int Z_INTERNAL PREFIX(dfltcc_deflate_params)(PREFIX3(streamp) strm, int level, int strategy, int *flush);
12 int Z_INTERNAL PREFIX(dfltcc_deflate_done)(PREFIX3(streamp) strm, int flush);
13 int Z_INTERNAL PREFIX(dfltcc_can_set_reproducible)(PREFIX3(streamp) strm, int reproducible);
14 int Z_INTERNAL PREFIX(dfltcc_deflate_set_dictionary)(PREFIX3(streamp) strm,
15                                                 const unsigned char *dictionary, uInt dict_length);
16 int Z_INTERNAL PREFIX(dfltcc_deflate_get_dictionary)(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length);
17 
18 #define ZALLOC_DEFLATE_STATE PREFIX(dfltcc_alloc_deflate_state)
19 #define ZCOPY_DEFLATE_STATE PREFIX(dfltcc_copy_deflate_state)
20 
21 #define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \
22     do { \
23         if (PREFIX(dfltcc_can_deflate)((strm))) \
24             return PREFIX(dfltcc_deflate_set_dictionary)((strm), (dict), (dict_len)); \
25     } while (0)
26 
27 #define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) \
28     do { \
29         if (PREFIX(dfltcc_can_deflate)((strm))) \
30             return PREFIX(dfltcc_deflate_get_dictionary)((strm), (dict), (dict_len)); \
31     } while (0)
32 
33 #define DEFLATE_RESET_KEEP_HOOK PREFIX(dfltcc_reset_deflate_state)
34 
35 #define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) \
36     do { \
37         int err; \
38 \
39         err = PREFIX(dfltcc_deflate_params)((strm), (level), (strategy), (hook_flush)); \
40         if (err == Z_STREAM_ERROR) \
41             return err; \
42     } while (0)
43 
44 #define DEFLATE_DONE PREFIX(dfltcc_deflate_done)
45 
46 #define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, source_len) \
47     do { \
48         if (PREFIX(dfltcc_can_deflate)((strm))) \
49             (complen) = DEFLATE_BOUND_COMPLEN(source_len); \
50     } while (0)
51 
52 #define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) (PREFIX(dfltcc_can_deflate)((strm)))
53 
54 #define DEFLATE_HOOK PREFIX(dfltcc_deflate)
55 
56 #define DEFLATE_NEED_CHECKSUM(strm) (!PREFIX(dfltcc_can_deflate)((strm)))
57 
58 #define DEFLATE_CAN_SET_REPRODUCIBLE PREFIX(dfltcc_can_set_reproducible)
59 
60 #endif
61