activemq-cpp-3.3.0
|
00001 /* gzguts.h -- zlib internal header definitions for gz* operations 00002 * Copyright (C) 2004, 2005, 2010 Mark Adler 00003 * For conditions of distribution and use, see copyright notice in zlib.h 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 /* for compatibility with old definition */ 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 /* compile with -Dlocal if your debugger can't find static symbols */ 00043 00044 /* gz* functions always use library allocation functions */ 00045 #ifndef STDC 00046 extern voidp malloc OF((uInt size)); 00047 extern void free OF((voidpf ptr)); 00048 #endif 00049 00050 /* get errno and strerror definition */ 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 /* provide prototypes for these when building zlib without LFS */ 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 /* default i/o buffer size -- double this for output when reading */ 00072 #define GZBUFSIZE 8192 00073 00074 /* gzip modes, also provide a little integrity check on the passed structure */ 00075 #define GZ_NONE 0 00076 #define GZ_READ 7247 00077 #define GZ_WRITE 31153 00078 #define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ 00079 00080 /* values for gz_state how */ 00081 #define LOOK 0 /* look for a gzip header */ 00082 #define COPY 1 /* copy input directly */ 00083 #define GZIP 2 /* decompress a gzip stream */ 00084 00085 /* internal gzip file state data structure */ 00086 typedef struct { 00087 /* used for both reading and writing */ 00088 int mode; /* see gzip modes above */ 00089 int fd; /* file descriptor */ 00090 char *path; /* path or fd for error messages */ 00091 z_off64_t pos; /* current position in uncompressed data */ 00092 unsigned size; /* buffer size, zero if not allocated yet */ 00093 unsigned want; /* requested buffer size, default is GZBUFSIZE */ 00094 unsigned char *in; /* input buffer */ 00095 unsigned char *out; /* output buffer (double-sized when reading) */ 00096 unsigned char *next; /* next output data to deliver or write */ 00097 /* just for reading */ 00098 unsigned have; /* amount of output data unused at next */ 00099 int eof; /* true if end of input file reached */ 00100 z_off64_t start; /* where the gzip data started, for rewinding */ 00101 z_off64_t raw; /* where the raw data started, for seeking */ 00102 int how; /* 0: get header, 1: copy, 2: decompress */ 00103 int direct; /* true if last read direct, false if gzip */ 00104 /* just for writing */ 00105 int level; /* compression level */ 00106 int strategy; /* compression strategy */ 00107 /* seek request */ 00108 z_off64_t skip; /* amount to skip (already rewound if backwards) */ 00109 int seek; /* true if seek request pending */ 00110 /* error information */ 00111 int err; /* error code */ 00112 char *msg; /* error message */ 00113 /* zlib inflate or deflate stream */ 00114 z_stream strm; /* stream structure in-place (not a pointer) */ 00115 } gz_state; 00116 typedef gz_state FAR *gz_statep; 00117 00118 /* shared functions */ 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 /* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t 00125 value -- needed when comparing unsigned to z_off64_t, which is signed 00126 (possible z_off64_t types off_t, off64_t, and long are all signed) */ 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