Przemyslaw Skibinski | f0d7da7 | 2016-11-29 18:02:34 +0100 | [diff] [blame] | 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 | |
Przemyslaw Skibinski | 3bf9a72 | 2016-11-24 18:26:30 +0100 | [diff] [blame] | 4 | /* gzclose.c -- zlib gzclose() function |
| 5 | * Copyright (C) 2004, 2010 Mark Adler |
Przemyslaw Skibinski | 622d741 | 2016-12-13 19:44:07 +0100 | [diff] [blame] | 6 | * For conditions of distribution and use, see http://www.zlib.net/zlib_license.html |
Przemyslaw Skibinski | 3bf9a72 | 2016-11-24 18:26:30 +0100 | [diff] [blame] | 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. */ |
| 14 | int ZEXPORT gzclose(file) |
| 15 | gzFile file; |
| 16 | { |
| 17 | #ifndef NO_GZCOMPRESS |
| 18 | gz_statep state; |
| 19 | |
| 20 | if (file == NULL) |
| 21 | return Z_STREAM_ERROR; |
| 22 | state = (gz_statep)file; |
| 23 | |
Przemyslaw Skibinski | a1f6063 | 2016-11-29 15:50:28 +0100 | [diff] [blame] | 24 | return state.state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); |
Przemyslaw Skibinski | 3bf9a72 | 2016-11-24 18:26:30 +0100 | [diff] [blame] | 25 | #else |
| 26 | return gzclose_r(file); |
| 27 | #endif |
| 28 | } |