libnavajo
web server for static and dynamic pages developement in C++
zlibPatchOldVersion.h
Go to the documentation of this file.
1 //********************************************************
14 //********************************************************
15 
16 
17 typedef enum {
18  HEAD, /* i: waiting for magic header */
19  FLAGS, /* i: waiting for method and flags (gzip) */
20  TIME, /* i: waiting for modification time (gzip) */
21  OS, /* i: waiting for extra flags and operating system (gzip) */
22  EXLEN, /* i: waiting for extra length (gzip) */
23  EXTRA, /* i: waiting for extra bytes (gzip) */
24  NAME, /* i: waiting for end of file name (gzip) */
25  COMMENT, /* i: waiting for end of comment (gzip) */
26  HCRC, /* i: waiting for header crc (gzip) */
27  DICTID, /* i: waiting for dictionary check value */
28  DICT, /* waiting for inflateSetDictionary() call */
29  TYPE, /* i: waiting for type bits, including last-flag bit */
30  TYPEDO, /* i: same, but skip check to exit inflate on new block */
31  STORED, /* i: waiting for stored size (length and complement) */
32  COPY_, /* i/o: same as COPY below, but only first time in */
33  COPY, /* i/o: waiting for input or output to copy stored block */
34  TABLE, /* i: waiting for dynamic block table lengths */
35  LENLENS, /* i: waiting for code length code lengths */
36  CODELENS, /* i: waiting for length/lit and distance code lengths */
37  LEN_, /* i: same as LEN below, but only first time in */
38  LEN, /* i: waiting for length/lit/eob code */
39  LENEXT, /* i: waiting for length extra bits */
40  DIST, /* i: waiting for distance code */
41  DISTEXT, /* i: waiting for distance extra bits */
42  MATCH, /* o: waiting for output space to copy string */
43  LIT, /* o: waiting for output space to write literal */
44  CHECK, /* i: waiting for 32-bit check value */
45  LENGTH, /* i: waiting for 32-bit length (gzip) */
46  DONE, /* finished check, done -- remain here until reset */
47  BAD, /* got a data error -- remain here until reset */
48  MEM, /* got an inflate() memory error -- remain here until reset */
49  SYNC /* looking for synchronization bytes to restart inflate() */
50 } inflate_mode;
51 
53  inflate_mode mode;
54  /* current inflate mode */
55  int last;
56  /* true if processing last block */
57  int wrap;
58  /* bit 0 true for zlib, bit 1 true for gzip */
59  int havedict;
60  /* true if dictionary provided */
61  int flags;
62  /* gzip header method and flags (0 if zlib) */
63  unsigned dmax;
64  /* zlib header max distance (INFLATE_STRICT) */
65  unsigned long check;
66  /* protected copy of check value */
67  unsigned long total;
68  /* protected copy of output count */
69  gz_headerp head; /* where to save gzip header information */
70  /* sliding window */
71  unsigned wbits;
72  /* log base 2 of requested window size */
73  unsigned wsize;
74  /* window size or zero if not using window */
75  unsigned whave;
76  /* valid bytes in the window */
77  unsigned wnext;
78  /* window write index */
79  unsigned char FAR *window; /* allocated sliding window, if needed */
80 };
81 
82 
83 inline int ZEXPORT inflateGetDictionary(z_streamp strm, Bytef *dictionary, uInt *dictLength)
84 {
85 struct inflate_state2 FAR *state;
86 /* check state */
87 if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
88 state = (inflate_state2 FAR *) strm->state;
89 /* copy dictionary */
90 if (state->whave && dictionary != Z_NULL) {
91 memcpy(dictionary, state->window + state->wnext,
92  state->whave - state->wnext);
93 memcpy(dictionary + state->whave - state->wnext,
94  state->window, state->wnext);
95 }
96 if (dictLength != Z_NULL)
97 *dictLength = state->whave;
98 return Z_OK;
99 }
Definition: zlibPatchOldVersion.h:52