Path: blob/master/src/java.base/share/native/libzip/zlib/gzclose.c
41153 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324/* gzclose.c -- zlib gzclose() function25* Copyright (C) 2004, 2010 Mark Adler26* For conditions of distribution and use, see copyright notice in zlib.h27*/2829#include "gzguts.h"3031/* gzclose() is in a separate file so that it is linked in only if it is used.32That way the other gzclose functions can be used instead to avoid linking in33unneeded compression or decompression routines. */34int ZEXPORT gzclose(file)35gzFile file;36{37#ifndef NO_GZCOMPRESS38gz_statep state;3940if (file == NULL)41return Z_STREAM_ERROR;42state = (gz_statep)file;4344return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);45#else46return gzclose_r(file);47#endif48}495051