00001
00002
00003
00004
00005
00006 #ifdef _LARGEFILE64_SOURCE
00007 # ifndef _LARGEFILE_SOURCE
00008 # define _LARGEFILE_SOURCE 1
00009 # endif
00010 # ifdef _FILE_OFFSET_BITS
00011 # undef _FILE_OFFSET_BITS
00012 # endif
00013 #endif
00014
00015 #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
00016 # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
00017 #else
00018 # define ZLIB_INTERNAL
00019 #endif
00020
00021 #include <stdio.h>
00022 #include "zlib.h"
00023 #ifdef STDC
00024 # include <string.h>
00025 # include <stdlib.h>
00026 # include <limits.h>
00027 #endif
00028 #include <fcntl.h>
00029
00030 #ifdef NO_DEFLATE
00031 # define NO_GZCOMPRESS
00032 #endif
00033
00034 #ifdef _MSC_VER
00035 # include <io.h>
00036 # define vsnprintf _vsnprintf
00037 #endif
00038
00039 #ifndef local
00040 # define local static
00041 #endif
00042
00043
00044
00045 #ifndef STDC
00046 extern voidp malloc OF((uInt size));
00047 extern void free OF((voidpf ptr));
00048 #endif
00049
00050
00051 #if defined UNDER_CE
00052 # include <windows.h>
00053 # define zstrerror() gz_strwinerror((DWORD)GetLastError())
00054 #else
00055 # ifdef STDC
00056 # include <errno.h>
00057 # define zstrerror() strerror(errno)
00058 # else
00059 # define zstrerror() "stdio error (consult errno)"
00060 # endif
00061 #endif
00062
00063
00064 #if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
00065 ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
00066 ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
00067 ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
00068 ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
00069 #endif
00070
00071
00072 #define GZBUFSIZE 8192
00073
00074
00075 #define GZ_NONE 0
00076 #define GZ_READ 7247
00077 #define GZ_WRITE 31153
00078 #define GZ_APPEND 1
00079
00080
00081 #define LOOK 0
00082 #define COPY 1
00083 #define GZIP 2
00084
00085
00086 typedef struct {
00087
00088 int mode;
00089 int fd;
00090 char *path;
00091 z_off64_t pos;
00092 unsigned size;
00093 unsigned want;
00094 unsigned char *in;
00095 unsigned char *out;
00096 unsigned char *next;
00097
00098 unsigned have;
00099 int eof;
00100 z_off64_t start;
00101 z_off64_t raw;
00102 int how;
00103 int direct;
00104
00105 int level;
00106 int strategy;
00107
00108 z_off64_t skip;
00109 int seek;
00110
00111 int err;
00112 char *msg;
00113
00114 z_stream strm;
00115 } gz_state;
00116 typedef gz_state FAR *gz_statep;
00117
00118
00119 void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
00120 #if defined UNDER_CE
00121 char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
00122 #endif
00123
00124
00125
00126
00127 #ifdef INT_MAX
00128 # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
00129 #else
00130 unsigned ZLIB_INTERNAL gz_intmax OF((void));
00131 # define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
00132 #endif