| 1 |
#ifndef GZGUTS_H_ |
| 2 |
#define GZGUTS_H_ |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
#ifdef _LARGEFILE64_SOURCE |
| 9 |
# ifndef _LARGEFILE_SOURCE |
| 10 |
# define _LARGEFILE_SOURCE 1 |
| 11 |
# endif |
| 12 |
# ifdef _FILE_OFFSET_BITS |
| 13 |
# undef _FILE_OFFSET_BITS |
| 14 |
# endif |
| 15 |
#endif |
| 16 |
|
| 17 |
#if defined(HAVE_VISIBILITY_INTERNAL) |
| 18 |
# define Z_INTERNAL __attribute__((visibility ("internal"))) |
| 19 |
#elif defined(HAVE_VISIBILITY_HIDDEN) |
| 20 |
# define Z_INTERNAL __attribute__((visibility ("hidden"))) |
| 21 |
#else |
| 22 |
# define Z_INTERNAL |
| 23 |
#endif |
| 24 |
|
| 25 |
#include <stdio.h> |
| 26 |
#include <string.h> |
| 27 |
#include <stdlib.h> |
| 28 |
#include <limits.h> |
| 29 |
#include <fcntl.h> |
| 30 |
|
| 31 |
#if defined(ZLIB_COMPAT) |
| 32 |
# include "zlib.h" |
| 33 |
#else |
| 34 |
# include "zlib-ng.h" |
| 35 |
#endif |
| 36 |
|
| 37 |
#ifdef _WIN32 |
| 38 |
# include <stddef.h> |
| 39 |
#endif |
| 40 |
|
| 41 |
#if defined(_WIN32) |
| 42 |
# include <io.h> |
| 43 |
# define WIDECHAR |
| 44 |
#endif |
| 45 |
|
| 46 |
#ifdef WINAPI_FAMILY |
| 47 |
# define open _open |
| 48 |
# define read _read |
| 49 |
# define write _write |
| 50 |
# define close _close |
| 51 |
#endif |
| 52 |
|
| 53 |
|
| 54 |
#if !defined(STDC99) && !defined(__CYGWIN__) && !defined(__MINGW__) && defined(_WIN32) |
| 55 |
# if !defined(vsnprintf) |
| 56 |
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) |
| 57 |
# define vsnprintf _vsnprintf |
| 58 |
# endif |
| 59 |
# endif |
| 60 |
#endif |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
#if defined(_MSC_VER) && _MSC_VER < 1900 |
| 66 |
# define snprintf _snprintf |
| 67 |
#endif |
| 68 |
|
| 69 |
|
| 70 |
#ifndef NO_STRERROR |
| 71 |
# include <errno.h> |
| 72 |
# define zstrerror() strerror(errno) |
| 73 |
#else |
| 74 |
# define zstrerror() "stdio error (consult errno)" |
| 75 |
#endif |
| 76 |
|
| 77 |
|
| 78 |
#if MAX_MEM_LEVEL >= 8 |
| 79 |
# define DEF_MEM_LEVEL 8 |
| 80 |
#else |
| 81 |
# define DEF_MEM_LEVEL MAX_MEM_LEVEL |
| 82 |
#endif |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
#ifndef GZBUFSIZE |
| 87 |
# define GZBUFSIZE 131072 |
| 88 |
#endif |
| 89 |
|
| 90 |
|
| 91 |
#define GZ_NONE 0 |
| 92 |
#define GZ_READ 7247 |
| 93 |
#define GZ_WRITE 31153 |
| 94 |
#define GZ_APPEND 1 |
| 95 |
|
| 96 |
|
| 97 |
#define LOOK 0 |
| 98 |
#define COPY 1 |
| 99 |
#define GZIP 2 |
| 100 |
|
| 101 |
|
| 102 |
typedef struct { |
| 103 |
|
| 104 |
struct gzFile_s x; |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
int mode; |
| 110 |
int fd; |
| 111 |
char *path; |
| 112 |
unsigned size; |
| 113 |
unsigned want; |
| 114 |
unsigned char *in; |
| 115 |
unsigned char *out; |
| 116 |
int direct; |
| 117 |
|
| 118 |
int how; |
| 119 |
z_off64_t start; |
| 120 |
int eof; |
| 121 |
int past; |
| 122 |
|
| 123 |
int level; |
| 124 |
int strategy; |
| 125 |
int reset; |
| 126 |
|
| 127 |
z_off64_t skip; |
| 128 |
int seek; |
| 129 |
|
| 130 |
int err; |
| 131 |
char *msg; |
| 132 |
|
| 133 |
PREFIX3(stream) strm; |
| 134 |
} gz_state; |
| 135 |
typedef gz_state *gz_statep; |
| 136 |
|
| 137 |
|
| 138 |
void Z_INTERNAL gz_error(gz_state *, int, const char *); |
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
#define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) |
| 144 |
|
| 145 |
#endif |