1275793eaSopenharmony_ci/* gzclose.c -- zlib gzclose() function 2275793eaSopenharmony_ci * Copyright (C) 2004, 2010 Mark Adler 3275793eaSopenharmony_ci * For conditions of distribution and use, see copyright notice in zlib.h 4275793eaSopenharmony_ci */ 5275793eaSopenharmony_ci 6275793eaSopenharmony_ci#include "gzguts.h" 7275793eaSopenharmony_ci 8275793eaSopenharmony_ci/* gzclose() is in a separate file so that it is linked in only if it is used. 9275793eaSopenharmony_ci That way the other gzclose functions can be used instead to avoid linking in 10275793eaSopenharmony_ci unneeded compression or decompression routines. */ 11275793eaSopenharmony_ciint ZEXPORT gzclose(gzFile file) { 12275793eaSopenharmony_ci#ifndef NO_GZCOMPRESS 13275793eaSopenharmony_ci gz_statep state; 14275793eaSopenharmony_ci 15275793eaSopenharmony_ci if (file == NULL) 16275793eaSopenharmony_ci return Z_STREAM_ERROR; 17275793eaSopenharmony_ci state = (gz_statep)file; 18275793eaSopenharmony_ci 19275793eaSopenharmony_ci return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); 20275793eaSopenharmony_ci#else 21275793eaSopenharmony_ci return gzclose_r(file); 22275793eaSopenharmony_ci#endif 23275793eaSopenharmony_ci} 24