Blame thirdparty/zlib-1.2.8/gzclose.c
|
kusano |
fc6ab3 |
/* gzclose.c -- zlib gzclose() function
|
|
kusano |
fc6ab3 |
* Copyright (C) 2004, 2010 Mark Adler
|
|
kusano |
fc6ab3 |
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
kusano |
fc6ab3 |
*/
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
#include "gzguts.h"
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
/* gzclose() is in a separate file so that it is linked in only if it is used.
|
|
kusano |
fc6ab3 |
That way the other gzclose functions can be used instead to avoid linking in
|
|
kusano |
fc6ab3 |
unneeded compression or decompression routines. */
|
|
kusano |
fc6ab3 |
int ZEXPORT gzclose(file)
|
|
kusano |
fc6ab3 |
gzFile file;
|
|
kusano |
fc6ab3 |
{
|
|
kusano |
fc6ab3 |
#ifndef NO_GZCOMPRESS
|
|
kusano |
fc6ab3 |
gz_statep state;
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
if (file == NULL)
|
|
kusano |
fc6ab3 |
return Z_STREAM_ERROR;
|
|
kusano |
fc6ab3 |
state = (gz_statep)file;
|
|
kusano |
fc6ab3 |
|
|
kusano |
fc6ab3 |
return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
|
|
kusano |
fc6ab3 |
#else
|
|
kusano |
fc6ab3 |
return gzclose_r(file);
|
|
kusano |
fc6ab3 |
#endif
|
|
kusano |
fc6ab3 |
}
|