generic.h 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. #ifndef DECOMPRESS_GENERIC_H
  2. #define DECOMPRESS_GENERIC_H
  3. /* Minimal chunksize to be read.
  4. *Bzip2 prefers at least 4096
  5. *Lzma prefers 0x10000 */
  6. #define COMPR_IOBUF_SIZE 4096
  7. typedef int (*decompress_fn) (unsigned char *inbuf, int len,
  8. int(*fill)(void*, unsigned int),
  9. int(*writebb)(void*, unsigned int),
  10. unsigned char *output,
  11. int *posp,
  12. void(*error)(char *x));
  13. /* inbuf - input buffer
  14. *len - len of pre-read data in inbuf
  15. *fill - function to fill inbuf if empty
  16. *writebb - function to write out outbug
  17. *posp - if non-null, input position (number of bytes read) will be
  18. * returned here
  19. *
  20. *If len != 0, the inbuf is initialized (with as much data), and fill
  21. *should not be called
  22. *If len = 0, the inbuf is allocated, but empty. Its size is IOBUF_SIZE
  23. *fill should be called (repeatedly...) to read data, at most IOBUF_SIZE
  24. */
  25. /* Utility routine to detect the decompression method */
  26. decompress_fn decompress_method(const unsigned char *inbuf, int len,
  27. const char **name);
  28. #endif