--- linux-2.4.34-wt1/net/tux/gzip.c Sat Feb 17 23:24:02 2007 +++ linux-2.4.34-wt1.pcw/net/tux/gzip.c Sun Feb 18 07:36:03 2007 @@ -104,6 +104,7 @@ # define FAR #endif +#ifndef ZLIB_VERSION typedef unsigned char Byte; /* 8 bits */ typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ @@ -121,8 +122,9 @@ typedef void FAR *voidpf; typedef void *voidp; +#endif -#define ZLIB_VERSION "1.0.4P" +#define TUX_ZLIB_VERSION "1.0.4P" /* The 'zlib' compression library provides in-memory compression and @@ -148,12 +150,12 @@ for some forms of corrupted input. */ -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); +typedef voidpf (*tux_zlib_alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*tux_zlib_free_func) OF((voidpf opaque, voidpf address)); struct internal_state; -typedef struct z_stream_s { +typedef struct tux_z_stream_s { Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ uLong total_in; /* total nb of input bytes read so far */ @@ -165,16 +167,16 @@ char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ + tux_zlib_alloc_func zalloc; /* used to allocate the internal state */ + tux_zlib_free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ int data_type; /* best guess about the data type: ascii or binary */ uLong adler; /* adler32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ -} z_stream; +} tux_z_stream; -typedef z_stream FAR *z_streamp; +typedef tux_z_stream FAR *tux_z_streamp; /* The application must update next_in and avail_in when avail_in has @@ -249,7 +251,7 @@ #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ -static int deflate OF((z_streamp strm, int flush)); +static int deflate OF((tux_z_streamp strm, int flush)); /* Performs one or both of the following actions: @@ -324,7 +326,7 @@ */ -static int deflateEnd OF((z_streamp strm)); +static int deflateEnd OF((tux_z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any @@ -402,7 +404,7 @@ deflate(). */ -static int deflateReset OF((z_streamp strm)); +static int deflateReset OF((tux_z_streamp strm)); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate all the internal compression state. @@ -435,16 +437,16 @@ /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ -static int deflateInit_ OF((z_streamp strm, int level, +static int deflateInit_ OF((tux_z_streamp strm, int level, const char *version, int stream_size)); -static int deflateInit2_ OF((z_streamp strm, int level, int method, +static int deflateInit2_ OF((tux_z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)); #define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) + deflateInit_((strm), (level), TUX_ZLIB_VERSION, sizeof(tux_z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) + (strategy), TUX_ZLIB_VERSION, sizeof(tux_z_stream)) uLongf *get_crc_table OF((void)); /* can be used by asm versions of crc32() */ @@ -673,7 +675,7 @@ */ typedef struct deflate_state { - z_streamp strm; /* pointer back to this zlib stream */ + tux_z_streamp strm; /* pointer back to this zlib stream */ int status; /* as the name implies */ Bytef *pending_buf; /* output still pending */ ulg pending_buf_size; /* size of pending_buf */ @@ -952,8 +954,8 @@ static block_state deflate_slow OF((deflate_state *s, int flush)); static void lm_init OF((deflate_state *s)); static void putShortMSB OF((deflate_state *s, uInt b)); -static void flush_pending OF((z_streamp strm)); -static int read_buf OF((z_streamp strm, charf *buf, unsigned size)); +static void flush_pending OF((tux_z_streamp strm)); +static int read_buf OF((tux_z_streamp strm, charf *buf, unsigned size)); #ifdef ASMV void match_init OF((void)); /* asm code initialization */ uInt longest_match OF((deflate_state *s, IPos cur_match)); @@ -1054,7 +1056,7 @@ /* ========================================================================= */ int deflateInit_(strm, level, version, stream_size) - z_streamp strm; + tux_z_streamp strm; int level; const char *version; int stream_size; @@ -1067,7 +1069,7 @@ /* ========================================================================= */ int deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size) - z_streamp strm; + tux_z_streamp strm; int level; int method; int windowBits; @@ -1078,7 +1080,7 @@ { deflate_state *s; int noheader = 0; - static char* my_version = ZLIB_VERSION; + static char* my_version = TUX_ZLIB_VERSION; ushf *overlay; /* We overlay pending_buf and d_buf+l_buf. This works since the average @@ -1086,7 +1088,7 @@ */ if (version == Z_NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { + stream_size != sizeof(tux_z_stream)) { return Z_VERSION_ERROR; } if (strm == Z_NULL) return Z_STREAM_ERROR; @@ -1154,7 +1156,7 @@ /* ========================================================================= */ int deflateReset (strm) - z_streamp strm; + tux_z_streamp strm; { deflate_state *s; @@ -1202,7 +1204,7 @@ * (See also read_buf()). */ static void flush_pending(strm) - z_streamp strm; + tux_z_streamp strm; { deflate_state *s = (deflate_state *) strm->state; unsigned len = s->pending; @@ -1225,7 +1227,7 @@ /* ========================================================================= */ int deflate (strm, flush) - z_streamp strm; + tux_z_streamp strm; int flush; { int old_flush; /* value of flush param for previous deflate call */ @@ -1362,7 +1364,7 @@ /* ========================================================================= */ int deflateEnd (strm) - z_streamp strm; + tux_z_streamp strm; { int status; deflate_state *s; @@ -1396,7 +1398,7 @@ * (See also flush_pending()). */ static int read_buf(strm, buf, size) - z_streamp strm; + tux_z_streamp strm; charf *buf; unsigned size; { @@ -3245,7 +3247,7 @@ int zlib_compress(unsigned char *data_in, unsigned char *cpage_out, __u32 *sourcelen, __u32 *dstlen) { - z_stream strm; + tux_z_stream strm; int ret; if (*dstlen <= STREAM_END_SPACE) @@ -3299,7 +3301,7 @@ void tux_gzip_start (tux_req_t *req) { - z_stream *strm; + tux_z_stream *strm; strm = kmalloc(sizeof(*strm), GFP_KERNEL); if (!strm) @@ -3315,7 +3317,7 @@ int tux_gzip_compress (void *state, unsigned char *data_in, unsigned char *data_out, __u32 *in_len, __u32 *out_len) { - z_stream *s = state; + tux_z_stream *s = state; int ret; // int zlib_compress(unsigned char *data_in, unsigned char *cpage_out, __u32 *sourcelen, __u32 *dstlen) @@ -3340,7 +3342,7 @@ void tux_gzip_end (tux_req_t *req) { - z_stream *strm = req->gzip_state; + tux_z_stream *strm = req->gzip_state; deflateEnd(strm); kfree(req->gzip_state); req->gzip_state = NULL;