| 300 | int gzclose OF((gzFile)); |
| 301 | |
| 302 | int gzclose(gz) |
| 303 | gzFile gz; |
| 304 | { |
| 305 | z_stream *strm; |
| 306 | unsigned char out[BUFLEN]; |
| 307 | |
| 308 | if (gz == NULL) |
| 309 | return Z_STREAM_ERROR; |
| 310 | strm = &(gz->strm); |
| 311 | if (gz->write) { |
| 312 | strm->next_in = Z_NULL; |
| 313 | strm->avail_in = 0; |
| 314 | do { |
| 315 | strm->next_out = out; |
| 316 | strm->avail_out = BUFLEN; |
| 317 | (void)deflate(strm, Z_FINISH); |
| 318 | fwrite(out, 1, BUFLEN - strm->avail_out, gz->file); |
| 319 | } while (strm->avail_out == 0); |
| 320 | deflateEnd(strm); |
| 321 | } |
| 322 | else |
| 323 | inflateEnd(strm); |
| 324 | fclose(gz->file); |
| 325 | free(gz); |
| 326 | return Z_OK; |
| 327 | } |
| 328 | |
| 329 | const char *gzerror OF((gzFile, int *)); |
| 330 | |