Lines Matching refs:z
104 z_stream z; /* State structure for zlib. */ member
124 process_zlib_error(struct Curl_easy *data, z_stream *z) in process_zlib_error() argument
126 if(z->msg) in process_zlib_error()
128 z->msg); in process_zlib_error()
138 z_stream *z, zlibInitState *zlib_init, CURLcode result) in exit_zlib() argument
141 Curl_safefree(z->next_in); in exit_zlib()
144 if(inflateEnd(z) != Z_OK && result == CURLE_OK) in exit_zlib()
145 result = process_zlib_error(data, z); in exit_zlib()
155 z_stream *z = &zp->z; in process_trailer() local
157 uInt len = z->avail_in < zp->trailerlen ? z->avail_in : zp->trailerlen; in process_trailer()
163 z->avail_in -= len; in process_trailer()
164 z->next_in += len; in process_trailer()
165 if(z->avail_in) in process_trailer()
168 result = exit_zlib(data, z, &zp->zlib_init, result); in process_trailer()
181 z_stream *z = &zp->z; /* zlib state structure */ in inflate_stream() local
182 uInt nread = z->avail_in; in inflate_stream()
183 Bytef *orig_in = z->next_in; in inflate_stream()
193 return exit_zlib(data, z, &zp->zlib_init, CURLE_WRITE_ERROR); in inflate_stream()
199 return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY); in inflate_stream()
208 z->next_out = (Bytef *) decomp; in inflate_stream()
209 z->avail_out = DSIZ; in inflate_stream()
213 status = inflate(z, Z_BLOCK); in inflate_stream()
216 status = inflate(z, Z_SYNC_FLUSH); in inflate_stream()
220 if(z->avail_out != DSIZ) { in inflate_stream()
224 DSIZ - z->avail_out); in inflate_stream()
226 exit_zlib(data, z, &zp->zlib_init, result); in inflate_stream()
249 (void) inflateEnd(z); /* do not care about the return code */ in inflate_stream()
250 if(inflateInit2(z, -MAX_WBITS) == Z_OK) { in inflate_stream()
251 z->next_in = orig_in; in inflate_stream()
252 z->avail_in = nread; in inflate_stream()
260 result = exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); in inflate_stream()
263 result = exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); in inflate_stream()
284 z_stream *z = &zp->z; /* zlib state structure */ in deflate_do_init() local
287 z->zalloc = (alloc_func) zalloc_cb; in deflate_do_init()
288 z->zfree = (free_func) zfree_cb; in deflate_do_init()
290 if(inflateInit(z) != Z_OK) in deflate_do_init()
291 return process_zlib_error(data, z); in deflate_do_init()
301 z_stream *z = &zp->z; /* zlib state structure */ in deflate_do_write() local
307 z->next_in = (Bytef *) buf; in deflate_do_write()
308 z->avail_in = (uInt) nbytes; in deflate_do_write()
321 z_stream *z = &zp->z; /* zlib state structure */ in deflate_do_close() local
323 exit_zlib(data, z, &zp->zlib_init, CURLE_OK); in deflate_do_close()
341 z_stream *z = &zp->z; /* zlib state structure */ in gzip_do_init() local
344 z->zalloc = (alloc_func) zalloc_cb; in gzip_do_init()
345 z->zfree = (free_func) zfree_cb; in gzip_do_init()
349 if(inflateInit2(z, MAX_WBITS + 32) != Z_OK) { in gzip_do_init()
350 return process_zlib_error(data, z); in gzip_do_init()
356 if(inflateInit2(z, -MAX_WBITS) != Z_OK) { in gzip_do_init()
357 return process_zlib_error(data, z); in gzip_do_init()
458 z_stream *z = &zp->z; /* zlib state structure */ in gzip_do_write() local
465 z->next_in = (Bytef *) buf; in gzip_do_write()
466 z->avail_in = (uInt) nbytes; in gzip_do_write()
474 return exit_zlib(data, z, &zp->zlib_init, CURLE_WRITE_ERROR); in gzip_do_write()
496 z->next_in = (Bytef *) buf + hlen; in gzip_do_write()
497 z->avail_in = (uInt) (nbytes - hlen); in gzip_do_write()
509 z->avail_in = (uInt) nbytes; in gzip_do_write()
510 z->next_in = malloc(z->avail_in); in gzip_do_write()
511 if(!z->next_in) { in gzip_do_write()
512 return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY); in gzip_do_write()
514 memcpy(z->next_in, buf, z->avail_in); in gzip_do_write()
521 return exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); in gzip_do_write()
531 z->avail_in += (uInt) nbytes; in gzip_do_write()
532 z->next_in = Curl_saferealloc(z->next_in, z->avail_in); in gzip_do_write()
533 if(!z->next_in) { in gzip_do_write()
534 return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY); in gzip_do_write()
537 memcpy(z->next_in + z->avail_in - nbytes, buf, nbytes); in gzip_do_write()
539 switch(check_gzip_header(z->next_in, (ssize_t)z->avail_in, &hlen)) { in gzip_do_write()
542 free(z->next_in); in gzip_do_write()
544 z->next_in = (Bytef *) buf + hlen + nbytes - z->avail_in; in gzip_do_write()
545 z->avail_in = z->avail_in - (uInt)hlen; in gzip_do_write()
555 return exit_zlib(data, z, &zp->zlib_init, process_zlib_error(data, z)); in gzip_do_write()
562 z->next_in = (Bytef *) buf; in gzip_do_write()
563 z->avail_in = (uInt) nbytes; in gzip_do_write()
569 z->next_in = (Bytef *) buf; in gzip_do_write()
570 z->avail_in = (uInt) nbytes; in gzip_do_write()
574 if(z->avail_in == 0) { in gzip_do_write()
588 z_stream *z = &zp->z; /* zlib state structure */ in gzip_do_close() local
590 exit_zlib(data, z, &zp->zlib_init, CURLE_OK); in gzip_do_close()