annotate src/zlib-1.2.7/gzguts.h @ 169:223a55898ab9 tip default

Add null config files
author Chris Cannam <cannam@all-day-breakfast.com>
date Mon, 02 Mar 2020 14:03:47 +0000
parents 8a15ff55d9af
children
rev   line source
cannam@89 1 /* gzguts.h -- zlib internal header definitions for gz* operations
cannam@89 2 * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler
cannam@89 3 * For conditions of distribution and use, see copyright notice in zlib.h
cannam@89 4 */
cannam@89 5
cannam@89 6 #ifdef _LARGEFILE64_SOURCE
cannam@89 7 # ifndef _LARGEFILE_SOURCE
cannam@89 8 # define _LARGEFILE_SOURCE 1
cannam@89 9 # endif
cannam@89 10 # ifdef _FILE_OFFSET_BITS
cannam@89 11 # undef _FILE_OFFSET_BITS
cannam@89 12 # endif
cannam@89 13 #endif
cannam@89 14
cannam@89 15 #ifdef HAVE_HIDDEN
cannam@89 16 # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
cannam@89 17 #else
cannam@89 18 # define ZLIB_INTERNAL
cannam@89 19 #endif
cannam@89 20
cannam@89 21 #include <stdio.h>
cannam@89 22 #include "zlib.h"
cannam@89 23 #ifdef STDC
cannam@89 24 # include <string.h>
cannam@89 25 # include <stdlib.h>
cannam@89 26 # include <limits.h>
cannam@89 27 #endif
cannam@89 28 #include <fcntl.h>
cannam@89 29
cannam@89 30 #ifdef _WIN32
cannam@89 31 # include <stddef.h>
cannam@89 32 #endif
cannam@89 33
cannam@89 34 #if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
cannam@89 35 # include <io.h>
cannam@89 36 #endif
cannam@89 37
cannam@89 38 #ifdef NO_DEFLATE /* for compatibility with old definition */
cannam@89 39 # define NO_GZCOMPRESS
cannam@89 40 #endif
cannam@89 41
cannam@89 42 #if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
cannam@89 43 # ifndef HAVE_VSNPRINTF
cannam@89 44 # define HAVE_VSNPRINTF
cannam@89 45 # endif
cannam@89 46 #endif
cannam@89 47
cannam@89 48 #if defined(__CYGWIN__)
cannam@89 49 # ifndef HAVE_VSNPRINTF
cannam@89 50 # define HAVE_VSNPRINTF
cannam@89 51 # endif
cannam@89 52 #endif
cannam@89 53
cannam@89 54 #if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410)
cannam@89 55 # ifndef HAVE_VSNPRINTF
cannam@89 56 # define HAVE_VSNPRINTF
cannam@89 57 # endif
cannam@89 58 #endif
cannam@89 59
cannam@89 60 #ifndef HAVE_VSNPRINTF
cannam@89 61 # ifdef MSDOS
cannam@89 62 /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
cannam@89 63 but for now we just assume it doesn't. */
cannam@89 64 # define NO_vsnprintf
cannam@89 65 # endif
cannam@89 66 # ifdef __TURBOC__
cannam@89 67 # define NO_vsnprintf
cannam@89 68 # endif
cannam@89 69 # ifdef WIN32
cannam@89 70 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
cannam@89 71 # if !defined(vsnprintf) && !defined(NO_vsnprintf)
cannam@89 72 # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
cannam@89 73 # define vsnprintf _vsnprintf
cannam@89 74 # endif
cannam@89 75 # endif
cannam@89 76 # endif
cannam@89 77 # ifdef __SASC
cannam@89 78 # define NO_vsnprintf
cannam@89 79 # endif
cannam@89 80 # ifdef VMS
cannam@89 81 # define NO_vsnprintf
cannam@89 82 # endif
cannam@89 83 # ifdef __OS400__
cannam@89 84 # define NO_vsnprintf
cannam@89 85 # endif
cannam@89 86 # ifdef __MVS__
cannam@89 87 # define NO_vsnprintf
cannam@89 88 # endif
cannam@89 89 #endif
cannam@89 90
cannam@89 91 #ifndef local
cannam@89 92 # define local static
cannam@89 93 #endif
cannam@89 94 /* compile with -Dlocal if your debugger can't find static symbols */
cannam@89 95
cannam@89 96 /* gz* functions always use library allocation functions */
cannam@89 97 #ifndef STDC
cannam@89 98 extern voidp malloc OF((uInt size));
cannam@89 99 extern void free OF((voidpf ptr));
cannam@89 100 #endif
cannam@89 101
cannam@89 102 /* get errno and strerror definition */
cannam@89 103 #if defined UNDER_CE
cannam@89 104 # include <windows.h>
cannam@89 105 # define zstrerror() gz_strwinerror((DWORD)GetLastError())
cannam@89 106 #else
cannam@89 107 # ifndef NO_STRERROR
cannam@89 108 # include <errno.h>
cannam@89 109 # define zstrerror() strerror(errno)
cannam@89 110 # else
cannam@89 111 # define zstrerror() "stdio error (consult errno)"
cannam@89 112 # endif
cannam@89 113 #endif
cannam@89 114
cannam@89 115 /* provide prototypes for these when building zlib without LFS */
cannam@89 116 #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
cannam@89 117 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
cannam@89 118 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
cannam@89 119 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
cannam@89 120 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
cannam@89 121 #endif
cannam@89 122
cannam@89 123 /* default memLevel */
cannam@89 124 #if MAX_MEM_LEVEL >= 8
cannam@89 125 # define DEF_MEM_LEVEL 8
cannam@89 126 #else
cannam@89 127 # define DEF_MEM_LEVEL MAX_MEM_LEVEL
cannam@89 128 #endif
cannam@89 129
cannam@89 130 /* default i/o buffer size -- double this for output when reading */
cannam@89 131 #define GZBUFSIZE 8192
cannam@89 132
cannam@89 133 /* gzip modes, also provide a little integrity check on the passed structure */
cannam@89 134 #define GZ_NONE 0
cannam@89 135 #define GZ_READ 7247
cannam@89 136 #define GZ_WRITE 31153
cannam@89 137 #define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
cannam@89 138
cannam@89 139 /* values for gz_state how */
cannam@89 140 #define LOOK 0 /* look for a gzip header */
cannam@89 141 #define COPY 1 /* copy input directly */
cannam@89 142 #define GZIP 2 /* decompress a gzip stream */
cannam@89 143
cannam@89 144 /* internal gzip file state data structure */
cannam@89 145 typedef struct {
cannam@89 146 /* exposed contents for gzgetc() macro */
cannam@89 147 struct gzFile_s x; /* "x" for exposed */
cannam@89 148 /* x.have: number of bytes available at x.next */
cannam@89 149 /* x.next: next output data to deliver or write */
cannam@89 150 /* x.pos: current position in uncompressed data */
cannam@89 151 /* used for both reading and writing */
cannam@89 152 int mode; /* see gzip modes above */
cannam@89 153 int fd; /* file descriptor */
cannam@89 154 char *path; /* path or fd for error messages */
cannam@89 155 unsigned size; /* buffer size, zero if not allocated yet */
cannam@89 156 unsigned want; /* requested buffer size, default is GZBUFSIZE */
cannam@89 157 unsigned char *in; /* input buffer */
cannam@89 158 unsigned char *out; /* output buffer (double-sized when reading) */
cannam@89 159 int direct; /* 0 if processing gzip, 1 if transparent */
cannam@89 160 /* just for reading */
cannam@89 161 int how; /* 0: get header, 1: copy, 2: decompress */
cannam@89 162 z_off64_t start; /* where the gzip data started, for rewinding */
cannam@89 163 int eof; /* true if end of input file reached */
cannam@89 164 int past; /* true if read requested past end */
cannam@89 165 /* just for writing */
cannam@89 166 int level; /* compression level */
cannam@89 167 int strategy; /* compression strategy */
cannam@89 168 /* seek request */
cannam@89 169 z_off64_t skip; /* amount to skip (already rewound if backwards) */
cannam@89 170 int seek; /* true if seek request pending */
cannam@89 171 /* error information */
cannam@89 172 int err; /* error code */
cannam@89 173 char *msg; /* error message */
cannam@89 174 /* zlib inflate or deflate stream */
cannam@89 175 z_stream strm; /* stream structure in-place (not a pointer) */
cannam@89 176 } gz_state;
cannam@89 177 typedef gz_state FAR *gz_statep;
cannam@89 178
cannam@89 179 /* shared functions */
cannam@89 180 void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
cannam@89 181 #if defined UNDER_CE
cannam@89 182 char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
cannam@89 183 #endif
cannam@89 184
cannam@89 185 /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
cannam@89 186 value -- needed when comparing unsigned to z_off64_t, which is signed
cannam@89 187 (possible z_off64_t types off_t, off64_t, and long are all signed) */
cannam@89 188 #ifdef INT_MAX
cannam@89 189 # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
cannam@89 190 #else
cannam@89 191 unsigned ZLIB_INTERNAL gz_intmax OF((void));
cannam@89 192 # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
cannam@89 193 #endif