jdk/src/java.base/share/native/libzip/zlib/gzclose.c
author sherman
Wed, 15 Feb 2017 22:50:35 -0800
changeset 43810 a8fca792a14b
permissions -rw-r--r--
8175053: March 5 builds failed on Windows/install repo after JDK-8173207 Reviewed-by: mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
43810
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
     1
/*
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
     3
 *
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
     9
 *
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    14
 * accompanied this code).
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    15
 *
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    19
 *
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    22
 * questions.
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    23
 */
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    24
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    25
/* gzclose.c -- zlib gzclose() function
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    26
 * Copyright (C) 2004, 2010 Mark Adler
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    27
 * For conditions of distribution and use, see copyright notice in zlib.h
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    28
 */
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    29
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    30
#include "gzguts.h"
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    31
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    32
/* gzclose() is in a separate file so that it is linked in only if it is used.
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    33
   That way the other gzclose functions can be used instead to avoid linking in
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    34
   unneeded compression or decompression routines. */
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    35
int ZEXPORT gzclose(file)
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    36
    gzFile file;
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    37
{
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    38
#ifndef NO_GZCOMPRESS
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    39
    gz_statep state;
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    40
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    41
    if (file == NULL)
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    42
        return Z_STREAM_ERROR;
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    43
    state = (gz_statep)file;
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    44
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    45
    return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    46
#else
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    47
    return gzclose_r(file);
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    48
#endif
a8fca792a14b 8175053: March 5 builds failed on Windows/install repo after JDK-8173207
sherman
parents:
diff changeset
    49
}