File indexing completed on 2025-05-11 08:24:10
0001
0002
0003
0004
0005
0006 #ifdef _LARGEFILE64_SOURCE
0007 # ifndef _LARGEFILE_SOURCE
0008 # define _LARGEFILE_SOURCE 1
0009 # endif
0010 # ifdef _FILE_OFFSET_BITS
0011 # undef _FILE_OFFSET_BITS
0012 # endif
0013 #endif
0014
0015 #ifdef HAVE_HIDDEN
0016 # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
0017 #else
0018 # define ZLIB_INTERNAL
0019 #endif
0020
0021 #include <stdio.h>
0022 #include "zlib.h"
0023 #ifdef STDC
0024 # include <string.h>
0025 # include <stdlib.h>
0026 # include <limits.h>
0027 #endif
0028
0029 #ifndef _POSIX_SOURCE
0030 # define _POSIX_SOURCE
0031 #endif
0032 #include <fcntl.h>
0033
0034 #ifdef _WIN32
0035 # include <stddef.h>
0036 #endif
0037
0038 #if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
0039 # include <io.h>
0040 #endif
0041
0042 #if defined(_WIN32)
0043 # define WIDECHAR
0044 #endif
0045
0046 #ifdef WINAPI_FAMILY
0047 # define open _open
0048 # define read _read
0049 # define write _write
0050 # define close _close
0051 #endif
0052
0053 #ifdef NO_DEFLATE
0054 # define NO_GZCOMPRESS
0055 #endif
0056
0057 #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
0058 # ifndef HAVE_VSNPRINTF
0059 # define HAVE_VSNPRINTF
0060 # endif
0061 #endif
0062
0063 #if defined(__CYGWIN__)
0064 # ifndef HAVE_VSNPRINTF
0065 # define HAVE_VSNPRINTF
0066 # endif
0067 #endif
0068
0069 #if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
0070 # ifndef HAVE_VSNPRINTF
0071 # define HAVE_VSNPRINTF
0072 # endif
0073 #endif
0074
0075 #ifndef HAVE_VSNPRINTF
0076 # ifdef MSDOS
0077
0078
0079 # define NO_vsnprintf
0080 # endif
0081 # ifdef __TURBOC__
0082 # define NO_vsnprintf
0083 # endif
0084 # ifdef WIN32
0085
0086 # if !defined(vsnprintf) && !defined(NO_vsnprintf)
0087 # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
0088 # define vsnprintf _vsnprintf
0089 # endif
0090 # endif
0091 # endif
0092 # ifdef __SASC
0093 # define NO_vsnprintf
0094 # endif
0095 # ifdef VMS
0096 # define NO_vsnprintf
0097 # endif
0098 # ifdef __OS400__
0099 # define NO_vsnprintf
0100 # endif
0101 # ifdef __MVS__
0102 # define NO_vsnprintf
0103 # endif
0104 #endif
0105
0106
0107
0108
0109 #if defined(_MSC_VER) && _MSC_VER < 1900
0110 # define snprintf _snprintf
0111 #endif
0112
0113 #ifndef local
0114 # define local static
0115 #endif
0116
0117
0118
0119
0120
0121 #ifndef STDC
0122 extern voidp malloc OF((uInt size));
0123 extern void free OF((voidpf ptr));
0124 #endif
0125
0126
0127 #if defined UNDER_CE
0128 # include <windows.h>
0129 # define zstrerror() gz_strwinerror((DWORD)GetLastError())
0130 #else
0131 # ifndef NO_STRERROR
0132 # include <errno.h>
0133 # define zstrerror() strerror(errno)
0134 # else
0135 # define zstrerror() "stdio error (consult errno)"
0136 # endif
0137 #endif
0138
0139
0140 #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
0141 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
0142 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
0143 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
0144 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
0145 #endif
0146
0147
0148 #if MAX_MEM_LEVEL >= 8
0149 # define DEF_MEM_LEVEL 8
0150 #else
0151 # define DEF_MEM_LEVEL MAX_MEM_LEVEL
0152 #endif
0153
0154
0155
0156 #define GZBUFSIZE 8192
0157
0158
0159 #define GZ_NONE 0
0160 #define GZ_READ 7247
0161 #define GZ_WRITE 31153
0162 #define GZ_APPEND 1
0163
0164
0165 #define LOOK 0
0166 #define COPY 1
0167 #define GZIP 2
0168
0169
0170 typedef struct {
0171
0172 struct gzFile_s x;
0173
0174
0175
0176
0177 int mode;
0178 int fd;
0179 char *path;
0180 unsigned size;
0181 unsigned want;
0182 unsigned char *in;
0183 unsigned char *out;
0184 int direct;
0185
0186 int how;
0187 z_off64_t start;
0188 int eof;
0189 int past;
0190
0191 int level;
0192 int strategy;
0193 int reset;
0194
0195 z_off64_t skip;
0196 int seek;
0197
0198 int err;
0199 char *msg;
0200
0201 z_stream strm;
0202 } gz_state;
0203 typedef gz_state FAR *gz_statep;
0204
0205
0206 void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
0207 #if defined UNDER_CE
0208 char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
0209 #endif
0210
0211
0212
0213
0214 #ifdef INT_MAX
0215 # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
0216 #else
0217 unsigned ZLIB_INTERNAL gz_intmax OF((void));
0218 # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
0219 #endif