dfltcc_deflate.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef DFLTCC_DEFLATE_H
  2. #define DFLTCC_DEFLATE_H
  3. #include "deflate.h"
  4. #include "dfltcc_common.h"
  5. void Z_INTERNAL PREFIX(dfltcc_reset_deflate_state)(PREFIX3(streamp));
  6. int Z_INTERNAL PREFIX(dfltcc_can_deflate)(PREFIX3(streamp) strm);
  7. int Z_INTERNAL PREFIX(dfltcc_deflate)(PREFIX3(streamp) strm, int flush, block_state *result);
  8. int Z_INTERNAL PREFIX(dfltcc_deflate_params)(PREFIX3(streamp) strm, int level, int strategy, int *flush);
  9. int Z_INTERNAL PREFIX(dfltcc_deflate_done)(PREFIX3(streamp) strm, int flush);
  10. int Z_INTERNAL PREFIX(dfltcc_can_set_reproducible)(PREFIX3(streamp) strm, int reproducible);
  11. int Z_INTERNAL PREFIX(dfltcc_deflate_set_dictionary)(PREFIX3(streamp) strm,
  12. const unsigned char *dictionary, uInt dict_length);
  13. int Z_INTERNAL PREFIX(dfltcc_deflate_get_dictionary)(PREFIX3(streamp) strm, unsigned char *dictionary, uInt* dict_length);
  14. #define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) \
  15. do { \
  16. if (PREFIX(dfltcc_can_deflate)((strm))) \
  17. return PREFIX(dfltcc_deflate_set_dictionary)((strm), (dict), (dict_len)); \
  18. } while (0)
  19. #define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) \
  20. do { \
  21. if (PREFIX(dfltcc_can_deflate)((strm))) \
  22. return PREFIX(dfltcc_deflate_get_dictionary)((strm), (dict), (dict_len)); \
  23. } while (0)
  24. #define DEFLATE_RESET_KEEP_HOOK PREFIX(dfltcc_reset_deflate_state)
  25. #define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) \
  26. do { \
  27. int err; \
  28. \
  29. err = PREFIX(dfltcc_deflate_params)((strm), (level), (strategy), (hook_flush)); \
  30. if (err == Z_STREAM_ERROR) \
  31. return err; \
  32. } while (0)
  33. #define DEFLATE_DONE PREFIX(dfltcc_deflate_done)
  34. #define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, source_len) \
  35. do { \
  36. if (deflateStateCheck((strm)) || PREFIX(dfltcc_can_deflate)((strm))) \
  37. (complen) = DEFLATE_BOUND_COMPLEN(source_len); \
  38. } while (0)
  39. #define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) (PREFIX(dfltcc_can_deflate)((strm)))
  40. #define DEFLATE_HOOK PREFIX(dfltcc_deflate)
  41. #define DEFLATE_NEED_CHECKSUM(strm) (!PREFIX(dfltcc_can_deflate)((strm)))
  42. #define DEFLATE_CAN_SET_REPRODUCIBLE PREFIX(dfltcc_can_set_reproducible)
  43. #define DEFLATE_ADJUST_WINDOW_SIZE(n) MAX(n, HB_SIZE)
  44. #endif