dfltcc_inflate.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: Zlib
  2. #ifndef DFLTCC_INFLATE_H
  3. #define DFLTCC_INFLATE_H
  4. #include "dfltcc.h"
  5. /* External functions */
  6. void dfltcc_reset_inflate_state(z_streamp strm);
  7. int dfltcc_can_inflate(z_streamp strm);
  8. typedef enum {
  9. DFLTCC_INFLATE_CONTINUE,
  10. DFLTCC_INFLATE_BREAK,
  11. DFLTCC_INFLATE_SOFTWARE,
  12. } dfltcc_inflate_action;
  13. dfltcc_inflate_action dfltcc_inflate(z_streamp strm,
  14. int flush, int *ret);
  15. #define INFLATE_RESET_HOOK(strm) \
  16. dfltcc_reset_inflate_state((strm))
  17. #define INFLATE_TYPEDO_HOOK(strm, flush) \
  18. if (dfltcc_can_inflate((strm))) { \
  19. dfltcc_inflate_action action; \
  20. \
  21. RESTORE(); \
  22. action = dfltcc_inflate((strm), (flush), &ret); \
  23. LOAD(); \
  24. if (action == DFLTCC_INFLATE_CONTINUE) \
  25. break; \
  26. else if (action == DFLTCC_INFLATE_BREAK) \
  27. goto inf_leave; \
  28. }
  29. #define INFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_inflate((strm)))
  30. #define INFLATE_NEED_UPDATEWINDOW(strm) (!dfltcc_can_inflate((strm)))
  31. #endif /* DFLTCC_DEFLATE_H */