Lines Matching defs:strm

253 /* decompress gzip file "name", return strm with a deflate stream ready to
257 local int gzscan(char *name, z_stream *strm, int level)
281 strm->zalloc = Z_NULL;
282 strm->zfree = Z_NULL;
283 strm->opaque = Z_NULL;
284 ret = inflateInit2(strm, -15);
291 strm->avail_in = gz.left;
292 strm->next_in = gz.next;
297 if (strm->avail_in == 0) {
299 strm->avail_in = gz.left;
300 strm->next_in = gz.next;
304 strm->avail_out = DSIZE - have;
305 strm->next_out = window + have;
308 ret = inflate(strm, Z_BLOCK);
315 crc = crc32(crc, window + have, DSIZE - have - strm->avail_out);
316 if (strm->avail_out)
317 have = DSIZE - strm->avail_out;
324 if (strm->data_type & 128) {
325 if (strm->data_type & 64)
326 left = strm->data_type & 0x1f;
328 lastbit = strm->data_type & 0x1f;
329 lastoff = lseek(gz.fd, 0L, SEEK_CUR) - strm->avail_in;
333 inflateEnd(strm);
334 gz.left = strm->avail_in;
335 gz.next = strm->next_in;
343 tot = strm->total_out;
366 ret = deflateInit2(strm, level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY);
368 deflateSetDictionary(strm, window, have);
369 strm->adler = crc;
370 strm->total_in = tot;
374 deflatePrime(strm, 8 - left, *gz.buf);
384 /* append file "name" to gzip file gd using deflate stream strm -- if last
386 local void gztack(char *name, int gd, z_stream *strm, int last)
416 strm->avail_in = (unsigned)len;
417 strm->next_in = in;
418 if (len) strm->adler = crc32(strm->adler, in, (unsigned)len);
422 strm->avail_out = CHUNK;
423 strm->next_out = out;
424 ret = deflate(strm, last && len == 0 ? Z_FINISH : Z_NO_FLUSH);
425 left = CHUNK - strm->avail_out;
427 len = write(gd, out + CHUNK - strm->avail_out - left, left);
431 } while (strm->avail_out == 0 && ret != Z_STREAM_END);
436 deflateEnd(strm);
437 out[0] = (unsigned char)(strm->adler);
438 out[1] = (unsigned char)(strm->adler >> 8);
439 out[2] = (unsigned char)(strm->adler >> 16);
440 out[3] = (unsigned char)(strm->adler >> 24);
441 out[4] = (unsigned char)(strm->total_in);
442 out[5] = (unsigned char)(strm->total_in >> 8);
443 out[6] = (unsigned char)(strm->total_in >> 16);
444 out[7] = (unsigned char)(strm->total_in >> 24);
467 z_stream strm;
490 gd = gzscan(*argv++, &strm, level);
494 gztack(NULL, gd, &strm, 1);
497 gztack(*argv, gd, &strm, argv[1] == NULL);