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