jdk/src/java.base/share/native/libzip/zlib-1.2.8/zutil.h
author chegar
Sun, 17 Aug 2014 15:54:13 +0100
changeset 25859 3317bb8137f4
parent 24710 jdk/src/share/native/java/util/zip/zlib-1.2.8/zutil.h@c019dc4104b2
permissions -rw-r--r--
8054834: Modular Source Code Reviewed-by: alanb, chegar, ihse, mduigou Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24710
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
     1
/*
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
     3
 *
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
     9
 *
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    14
 * accompanied this code).
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    15
 *
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    19
 *
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    22
 * questions.
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    23
 */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    24
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    25
/* zutil.h -- internal interface and configuration of the compression library
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    26
 * Copyright (C) 1995-2013 Jean-loup Gailly.
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    27
 * For conditions of distribution and use, see copyright notice in zlib.h
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    28
 */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    29
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    30
/* WARNING: this file should *not* be used by applications. It is
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    31
   part of the implementation of the compression library and is
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    32
   subject to change. Applications should only use zlib.h.
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    33
 */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    34
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    35
/* @(#) $Id$ */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    36
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    37
#ifndef ZUTIL_H
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    38
#define ZUTIL_H
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    39
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    40
#ifdef HAVE_HIDDEN
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    41
#  define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    42
#else
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    43
#  define ZLIB_INTERNAL
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    44
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    45
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    46
#include "zlib.h"
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    47
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    48
#if defined(STDC) && !defined(Z_SOLO)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    49
#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    50
#    include <stddef.h>
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    51
#  endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    52
#  include <string.h>
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    53
#  include <stdlib.h>
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    54
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    55
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    56
#ifdef Z_SOLO
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    57
   typedef long ptrdiff_t;  /* guess -- will be caught if guess is wrong */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    58
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    59
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    60
#ifndef local
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    61
#  define local static
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    62
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    63
/* compile with -Dlocal if your debugger can't find static symbols */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    64
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    65
typedef unsigned char  uch;
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    66
typedef uch FAR uchf;
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    67
typedef unsigned short ush;
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    68
typedef ush FAR ushf;
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    69
typedef unsigned long  ulg;
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    70
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    71
extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    72
/* (size given to avoid silly warnings with Visual C++) */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    73
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    74
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    75
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    76
#define ERR_RETURN(strm,err) \
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    77
  return (strm->msg = ERR_MSG(err), (err))
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    78
/* To be used only when the state is known to be valid */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    79
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    80
        /* common constants */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    81
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    82
#ifndef DEF_WBITS
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    83
#  define DEF_WBITS MAX_WBITS
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    84
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    85
/* default windowBits for decompression. MAX_WBITS is for compression only */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    86
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    87
#if MAX_MEM_LEVEL >= 8
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    88
#  define DEF_MEM_LEVEL 8
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    89
#else
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    90
#  define DEF_MEM_LEVEL  MAX_MEM_LEVEL
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    91
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    92
/* default memLevel */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    93
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    94
#define STORED_BLOCK 0
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    95
#define STATIC_TREES 1
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    96
#define DYN_TREES    2
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    97
/* The three kinds of block type */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    98
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
    99
#define MIN_MATCH  3
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   100
#define MAX_MATCH  258
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   101
/* The minimum and maximum match lengths */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   102
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   103
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   104
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   105
        /* target dependencies */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   106
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   107
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   108
#  define OS_CODE  0x00
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   109
#  ifndef Z_SOLO
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   110
#    if defined(__TURBOC__) || defined(__BORLANDC__)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   111
#      if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   112
         /* Allow compilation with ANSI keywords only enabled */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   113
         void _Cdecl farfree( void *block );
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   114
         void *_Cdecl farmalloc( unsigned long nbytes );
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   115
#      else
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   116
#        include <alloc.h>
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   117
#      endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   118
#    else /* MSC or DJGPP */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   119
#      include <malloc.h>
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   120
#    endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   121
#  endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   122
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   123
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   124
#ifdef AMIGA
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   125
#  define OS_CODE  0x01
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   126
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   127
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   128
#if defined(VAXC) || defined(VMS)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   129
#  define OS_CODE  0x02
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   130
#  define F_OPEN(name, mode) \
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   131
     fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   132
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   133
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   134
#if defined(ATARI) || defined(atarist)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   135
#  define OS_CODE  0x05
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   136
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   137
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   138
#ifdef OS2
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   139
#  define OS_CODE  0x06
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   140
#  if defined(M_I86) && !defined(Z_SOLO)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   141
#    include <malloc.h>
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   142
#  endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   143
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   144
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   145
#if defined(MACOS) || defined(TARGET_OS_MAC)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   146
#  define OS_CODE  0x07
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   147
#  ifndef Z_SOLO
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   148
#    if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   149
#      include <unix.h> /* for fdopen */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   150
#    else
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   151
#      ifndef fdopen
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   152
#        define fdopen(fd,mode) NULL /* No fdopen() */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   153
#      endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   154
#    endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   155
#  endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   156
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   157
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   158
#ifdef TOPS20
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   159
#  define OS_CODE  0x0a
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   160
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   161
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   162
#ifdef WIN32
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   163
#  ifndef __CYGWIN__  /* Cygwin is Unix, not Win32 */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   164
#    define OS_CODE  0x0b
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   165
#  endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   166
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   167
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   168
#ifdef __50SERIES /* Prime/PRIMOS */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   169
#  define OS_CODE  0x0f
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   170
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   171
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   172
#if defined(_BEOS_) || defined(RISCOS)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   173
#  define fdopen(fd,mode) NULL /* No fdopen() */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   174
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   175
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   176
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   177
#  if defined(_WIN32_WCE)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   178
#    define fdopen(fd,mode) NULL /* No fdopen() */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   179
#    ifndef _PTRDIFF_T_DEFINED
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   180
       typedef int ptrdiff_t;
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   181
#      define _PTRDIFF_T_DEFINED
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   182
#    endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   183
#  else
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   184
#    define fdopen(fd,type)  _fdopen(fd,type)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   185
#  endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   186
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   187
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   188
#if defined(__BORLANDC__) && !defined(MSDOS)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   189
  #pragma warn -8004
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   190
  #pragma warn -8008
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   191
  #pragma warn -8066
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   192
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   193
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   194
/* provide prototypes for these when building zlib without LFS */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   195
#if !defined(_WIN32) && \
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   196
    (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   197
    ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   198
    ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   199
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   200
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   201
        /* common defaults */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   202
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   203
#ifndef OS_CODE
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   204
#  define OS_CODE  0x03  /* assume Unix */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   205
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   206
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   207
#ifndef F_OPEN
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   208
#  define F_OPEN(name, mode) fopen((name), (mode))
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   209
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   210
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   211
         /* functions */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   212
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   213
#if defined(pyr) || defined(Z_SOLO)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   214
#  define NO_MEMCPY
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   215
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   216
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   217
 /* Use our own functions for small and medium model with MSC <= 5.0.
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   218
  * You may have to use the same strategy for Borland C (untested).
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   219
  * The __SC__ check is for Symantec.
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   220
  */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   221
#  define NO_MEMCPY
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   222
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   223
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   224
#  define HAVE_MEMCPY
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   225
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   226
#ifdef HAVE_MEMCPY
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   227
#  ifdef SMALL_MEDIUM /* MSDOS small or medium model */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   228
#    define zmemcpy _fmemcpy
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   229
#    define zmemcmp _fmemcmp
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   230
#    define zmemzero(dest, len) _fmemset(dest, 0, len)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   231
#  else
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   232
#    define zmemcpy memcpy
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   233
#    define zmemcmp memcmp
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   234
#    define zmemzero(dest, len) memset(dest, 0, len)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   235
#  endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   236
#else
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   237
   void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   238
   int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   239
   void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   240
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   241
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   242
/* Diagnostic functions */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   243
#ifdef DEBUG
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   244
#  include <stdio.h>
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   245
   extern int ZLIB_INTERNAL z_verbose;
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   246
   extern void ZLIB_INTERNAL z_error OF((char *m));
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   247
#  define Assert(cond,msg) {if(!(cond)) z_error(msg);}
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   248
#  define Trace(x) {if (z_verbose>=0) fprintf x ;}
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   249
#  define Tracev(x) {if (z_verbose>0) fprintf x ;}
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   250
#  define Tracevv(x) {if (z_verbose>1) fprintf x ;}
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   251
#  define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   252
#  define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   253
#else
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   254
#  define Assert(cond,msg)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   255
#  define Trace(x)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   256
#  define Tracev(x)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   257
#  define Tracevv(x)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   258
#  define Tracec(c,x)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   259
#  define Tracecv(c,x)
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   260
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   261
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   262
#ifndef Z_SOLO
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   263
   voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   264
                                    unsigned size));
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   265
   void ZLIB_INTERNAL zcfree  OF((voidpf opaque, voidpf ptr));
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   266
#endif
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   267
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   268
#define ZALLOC(strm, items, size) \
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   269
           (*((strm)->zalloc))((strm)->opaque, (items), (size))
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   270
#define ZFREE(strm, addr)  (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   271
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   272
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   273
/* Reverse the bytes in a 32-bit value */
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   274
#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   275
                    (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   276
c019dc4104b2 8044725: Bug in zlib 1.2.5 prevents inflation of some gzipped files
sherman
parents:
diff changeset
   277
#endif /* ZUTIL_H */