abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
gzclose.c
Go to the documentation of this file.
1 /* gzclose.c -- zlib gzclose() function
2  * Copyright (C) 2004, 2010 Mark Adler
3  * For conditions of distribution and use, see copyright notice in zlib.h
4  */
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <string.h>
9 #include "misc/util/abc_global.h"
10 
11 #include "gzguts.h"
12 
14 
15 /* gzclose() is in a separate file so that it is linked in only if it is used.
16  That way the other gzclose functions can be used instead to avoid linking in
17  unneeded compression or decompression routines. */
19 {
20 #ifndef NO_GZCOMPRESS
21  gz_statep state;
22 
23  if (file == NULL)
24  return Z_STREAM_ERROR;
25  state = (gz_statep)file;
26 
27  return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
28 #else
29  return gzclose_r(file);
30 #endif
31 }
32 
#define GZ_READ
Definition: gzguts.h:89
ABC_NAMESPACE_IMPL_START int ZEXPORT gzclose(gzFile file)
Definition: gzclose.c:18
#define Z_STREAM_ERROR
Definition: zlib.h:185
voidp gzFile
Definition: zlib.h:1173
int ZEXPORT gzclose_r(gzFile file)
Definition: gzread.c:612
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
int ZEXPORT gzclose_w(gzFile file)
Definition: gzwrite.c:486
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
gz_state FAR * gz_statep
Definition: gzguts.h:129
#define ZEXPORT
Definition: zconf.h:322