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