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