| 1 | n/a | /* gzclose.c -- zlib gzclose() function |
|---|
| 2 | n/a | * Copyright (C) 2004, 2010 Mark Adler |
|---|
| 3 | n/a | * For conditions of distribution and use, see copyright notice in zlib.h |
|---|
| 4 | n/a | */ |
|---|
| 5 | n/a | |
|---|
| 6 | n/a | #include "gzguts.h" |
|---|
| 7 | n/a | |
|---|
| 8 | n/a | /* gzclose() is in a separate file so that it is linked in only if it is used. |
|---|
| 9 | n/a | That way the other gzclose functions can be used instead to avoid linking in |
|---|
| 10 | n/a | unneeded compression or decompression routines. */ |
|---|
| 11 | n/a | int ZEXPORT gzclose(file) |
|---|
| 12 | n/a | gzFile file; |
|---|
| 13 | n/a | { |
|---|
| 14 | n/a | #ifndef NO_GZCOMPRESS |
|---|
| 15 | n/a | gz_statep state; |
|---|
| 16 | n/a | |
|---|
| 17 | n/a | if (file == NULL) |
|---|
| 18 | n/a | return Z_STREAM_ERROR; |
|---|
| 19 | n/a | state = (gz_statep)file; |
|---|
| 20 | n/a | |
|---|
| 21 | n/a | return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); |
|---|
| 22 | n/a | #else |
|---|
| 23 | n/a | return gzclose_r(file); |
|---|
| 24 | n/a | #endif |
|---|
| 25 | n/a | } |
|---|