Lines Matching refs:gz
49 # define GZ_SUFFIX "-gz"
53 # define GZ_SUFFIX "-gz"
131 # define GZ_SUFFIX ".gz"
146 /* for Z_SOLO, create simplified gz* functions using deflate and inflate */
201 gzFile gz;
204 gz = malloc(sizeof(struct gzFile_s));
205 if (gz == NULL)
207 gz->write = strchr(mode, 'w') != NULL;
208 gz->strm.zalloc = myalloc;
209 gz->strm.zfree = myfree;
210 gz->strm.opaque = Z_NULL;
211 if (gz->write)
212 ret = deflateInit2(&(gz->strm), -1, 8, 15 + 16, 8, 0);
214 gz->strm.next_in = 0;
215 gz->strm.avail_in = Z_NULL;
216 ret = inflateInit2(&(gz->strm), 15 + 16);
219 free(gz);
222 gz->file = path == NULL ? fdopen(fd, gz->write ? "wb" : "rb") :
223 fopen(path, gz->write ? "wb" : "rb");
224 if (gz->file == NULL) {
225 gz->write ? deflateEnd(&(gz->strm)) : inflateEnd(&(gz->strm));
226 free(gz);
229 gz->err = 0;
230 gz->msg = "";
231 return gz;
236 int gzwrite(gz, buf, len)
237 gzFile gz;
244 if (gz == NULL || !gz->write)
246 strm = &(gz->strm);
253 fwrite(out, 1, BUFLEN - strm->avail_out, gz->file);
260 int gzread(gz, buf, len)
261 gzFile gz;
270 if (gz == NULL || gz->write)
272 if (gz->err)
274 strm = &(gz->strm);
278 got = fread(in, 1, 1, gz->file);
285 gz->err = Z_DATA_ERROR;
286 gz->msg = strm->msg;
297 int gzclose(gz)
298 gzFile gz;
303 if (gz == NULL)
305 strm = &(gz->strm);
306 if (gz->write) {
313 fwrite(out, 1, BUFLEN - strm->avail_out, gz->file);
319 fclose(gz->file);
320 free(gz);
326 const char *gzerror(gz, err)
327 gzFile gz;
330 *err = gz->err;
331 return gz->msg;
454 * Compress the given file: create a corresponding .gz file and remove the