inflate9.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* inflate9.h -- internal inflate state definition
  2. * Copyright (C) 1995-2003 Mark Adler
  3. * For conditions of distribution and use, see copyright notice in zlib.h
  4. */
  5. /* WARNING: this file should *not* be used by applications. It is
  6. part of the implementation of the compression library and is
  7. subject to change. Applications should only use zlib.h.
  8. */
  9. /* Possible inflate modes between inflate() calls */
  10. typedef enum {
  11. TYPE, /* i: waiting for type bits, including last-flag bit */
  12. STORED, /* i: waiting for stored size (length and complement) */
  13. TABLE, /* i: waiting for dynamic block table lengths */
  14. LEN, /* i: waiting for length/lit code */
  15. DONE, /* finished check, done -- remain here until reset */
  16. BAD /* got a data error -- remain here until reset */
  17. } inflate_mode;
  18. /*
  19. State transitions between above modes -
  20. (most modes can go to the BAD mode -- not shown for clarity)
  21. Read deflate blocks:
  22. TYPE -> STORED or TABLE or LEN or DONE
  23. STORED -> TYPE
  24. TABLE -> LENLENS -> CODELENS -> LEN
  25. Read deflate codes:
  26. LEN -> LEN or TYPE
  27. */
  28. /* state maintained between inflate() calls. Approximately 7K bytes. */
  29. struct inflate_state {
  30. /* sliding window */
  31. unsigned char FAR *window; /* allocated sliding window, if needed */
  32. /* dynamic table building */
  33. unsigned ncode; /* number of code length code lengths */
  34. unsigned nlen; /* number of length code lengths */
  35. unsigned ndist; /* number of distance code lengths */
  36. unsigned have; /* number of code lengths in lens[] */
  37. code FAR *next; /* next available space in codes[] */
  38. unsigned short lens[320]; /* temporary storage for code lengths */
  39. unsigned short work[288]; /* work area for code table building */
  40. code codes[ENOUGH]; /* space for code tables */
  41. };