external/zlib-1.2.11/gzclose.c
author Sam Lantinga <slouken@libsdl.org>
Fri, 26 Oct 2018 14:58:01 -0700
changeset 617 d64228a395fc
parent 521 9ed2f7d4a251
permissions -rw-r--r--
Fixed webp library detection when cross-compiling for Windows
slouken@521
     1
/* gzclose.c -- zlib gzclose() function
slouken@521
     2
 * Copyright (C) 2004, 2010 Mark Adler
slouken@521
     3
 * For conditions of distribution and use, see copyright notice in zlib.h
slouken@521
     4
 */
slouken@521
     5
slouken@521
     6
#include "gzguts.h"
slouken@521
     7
slouken@521
     8
/* gzclose() is in a separate file so that it is linked in only if it is used.
slouken@521
     9
   That way the other gzclose functions can be used instead to avoid linking in
slouken@521
    10
   unneeded compression or decompression routines. */
slouken@521
    11
int ZEXPORT gzclose(file)
slouken@521
    12
    gzFile file;
slouken@521
    13
{
slouken@521
    14
#ifndef NO_GZCOMPRESS
slouken@521
    15
    gz_statep state;
slouken@521
    16
slouken@521
    17
    if (file == NULL)
slouken@521
    18
        return Z_STREAM_ERROR;
slouken@521
    19
    state = (gz_statep)file;
slouken@521
    20
slouken@521
    21
    return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
slouken@521
    22
#else
slouken@521
    23
    return gzclose_r(file);
slouken@521
    24
#endif
slouken@521
    25
}