Rev 1896 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1896 | Rev 3926 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* gzguts.h -- zlib internal header definitions for gz* operations |
1 | /* gzguts.h -- zlib internal header definitions for gz* operations |
2 | * Copyright (C) 2004, 2005, 2010 Mark Adler |
2 | * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler |
3 | * For conditions of distribution and use, see copyright notice in zlib.h |
3 | * For conditions of distribution and use, see copyright notice in zlib.h |
4 | */ |
4 | */ |
Line 5... | Line 5... | ||
5 | 5 | ||
6 | #ifdef _LARGEFILE64_SOURCE |
6 | #ifdef _LARGEFILE64_SOURCE |
Line 10... | Line 10... | ||
10 | # ifdef _FILE_OFFSET_BITS |
10 | # ifdef _FILE_OFFSET_BITS |
11 | # undef _FILE_OFFSET_BITS |
11 | # undef _FILE_OFFSET_BITS |
12 | # endif |
12 | # endif |
13 | #endif |
13 | #endif |
Line 14... | Line 14... | ||
14 | 14 | ||
15 | #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ) |
15 | #ifdef HAVE_HIDDEN |
16 | # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) |
16 | # define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) |
17 | #else |
17 | #else |
18 | # define ZLIB_INTERNAL |
18 | # define ZLIB_INTERNAL |
Line 29... | Line 29... | ||
29 | 29 | ||
30 | #ifdef NO_DEFLATE /* for compatibility with old definition */ |
30 | #ifdef NO_DEFLATE /* for compatibility with old definition */ |
31 | # define NO_GZCOMPRESS |
31 | # define NO_GZCOMPRESS |
Line 32... | Line 32... | ||
32 | #endif |
32 | #endif |
- | 33 | ||
- | 34 | #define NO_vsnprintf |
|
33 | 35 | ||
- | 36 | ||
- | 37 | /* unlike snprintf (which is required in C99, yet still not supported by |
|
34 | #ifdef _MSC_VER |
38 | Microsoft more than a decade later!), _snprintf does not guarantee null |
35 | # include |
- | |
Line 36... | Line 39... | ||
36 | # define vsnprintf _vsnprintf |
39 | termination of the result -- however this is only used in gzlib.c where |
37 | #endif |
40 | the result is assured to fit in the space provided */ |
38 | 41 | ||
39 | #ifndef local |
42 | #ifndef local |
Line 50... | Line 53... | ||
50 | /* get errno and strerror definition */ |
53 | /* get errno and strerror definition */ |
51 | #if defined UNDER_CE |
54 | #if defined UNDER_CE |
52 | # include |
55 | # include |
53 | # define zstrerror() gz_strwinerror((DWORD)GetLastError()) |
56 | # define zstrerror() gz_strwinerror((DWORD)GetLastError()) |
54 | #else |
57 | #else |
55 | # ifdef STDC |
58 | # ifndef NO_STRERROR |
56 | # include |
59 | # include |
57 | # define zstrerror() strerror(errno) |
60 | # define zstrerror() strerror(errno) |
58 | # else |
61 | # else |
59 | # define zstrerror() "stdio error (consult errno)" |
62 | # define zstrerror() "stdio error (consult errno)" |
60 | # endif |
63 | # endif |
Line 66... | Line 69... | ||
66 | ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); |
69 | ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); |
67 | ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); |
70 | ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); |
68 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); |
71 | ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); |
69 | #endif |
72 | #endif |
Line -... | Line 73... | ||
- | 73 | ||
- | 74 | /* default memLevel */ |
|
- | 75 | #if MAX_MEM_LEVEL >= 8 |
|
- | 76 | # define DEF_MEM_LEVEL 8 |
|
- | 77 | #else |
|
- | 78 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL |
|
- | 79 | #endif |
|
70 | 80 | ||
- | 81 | /* default i/o buffer size -- double this for output when reading (this and |
|
71 | /* default i/o buffer size -- double this for output when reading */ |
82 | twice this must be able to fit in an unsigned type) */ |
Line 72... | Line 83... | ||
72 | #define GZBUFSIZE 8192 |
83 | #define GZBUFSIZE 8192 |
73 | 84 | ||
74 | /* gzip modes, also provide a little integrity check on the passed structure */ |
85 | /* gzip modes, also provide a little integrity check on the passed structure */ |
Line 82... | Line 93... | ||
82 | #define COPY 1 /* copy input directly */ |
93 | #define COPY 1 /* copy input directly */ |
83 | #define GZIP 2 /* decompress a gzip stream */ |
94 | #define GZIP 2 /* decompress a gzip stream */ |
Line 84... | Line 95... | ||
84 | 95 | ||
85 | /* internal gzip file state data structure */ |
96 | /* internal gzip file state data structure */ |
- | 97 | typedef struct { |
|
- | 98 | /* exposed contents for gzgetc() macro */ |
|
- | 99 | struct gzFile_s x; /* "x" for exposed */ |
|
- | 100 | /* x.have: number of bytes available at x.next */ |
|
- | 101 | /* x.next: next output data to deliver or write */ |
|
86 | typedef struct { |
102 | /* x.pos: current position in uncompressed data */ |
87 | /* used for both reading and writing */ |
103 | /* used for both reading and writing */ |
88 | int mode; /* see gzip modes above */ |
104 | int mode; /* see gzip modes above */ |
89 | int fd; /* file descriptor */ |
105 | int fd; /* file descriptor */ |
90 | char *path; /* path or fd for error messages */ |
- | |
91 | z_off64_t pos; /* current position in uncompressed data */ |
106 | char *path; /* path or fd for error messages */ |
92 | unsigned size; /* buffer size, zero if not allocated yet */ |
107 | unsigned size; /* buffer size, zero if not allocated yet */ |
93 | unsigned want; /* requested buffer size, default is GZBUFSIZE */ |
108 | unsigned want; /* requested buffer size, default is GZBUFSIZE */ |
94 | unsigned char *in; /* input buffer */ |
109 | unsigned char *in; /* input buffer */ |
95 | unsigned char *out; /* output buffer (double-sized when reading) */ |
110 | unsigned char *out; /* output buffer (double-sized when reading) */ |
96 | unsigned char *next; /* next output data to deliver or write */ |
111 | int direct; /* 0 if processing gzip, 1 if transparent */ |
97 | /* just for reading */ |
- | |
98 | unsigned have; /* amount of output data unused at next */ |
- | |
99 | int eof; /* true if end of input file reached */ |
- | |
100 | z_off64_t start; /* where the gzip data started, for rewinding */ |
- | |
101 | z_off64_t raw; /* where the raw data started, for seeking */ |
112 | /* just for reading */ |
- | 113 | int how; /* 0: get header, 1: copy, 2: decompress */ |
|
102 | int how; /* 0: get header, 1: copy, 2: decompress */ |
114 | z_off64_t start; /* where the gzip data started, for rewinding */ |
- | 115 | int eof; /* true if end of input file reached */ |
|
103 | int direct; /* true if last read direct, false if gzip */ |
116 | int past; /* true if read requested past end */ |
104 | /* just for writing */ |
117 | /* just for writing */ |
105 | int level; /* compression level */ |
118 | int level; /* compression level */ |
106 | int strategy; /* compression strategy */ |
119 | int strategy; /* compression strategy */ |
107 | /* seek request */ |
120 | /* seek request */ |