From dbd36858fd58f8250911d3d0761482baa604b016 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Sun, 2 Nov 2003 15:41:47 +0000 Subject: [PATCH] Removed the z_streams and bz_streams as member variables because they are initialized in each call to compress()/decompress(). --- src/common/compression.cpp | 8 +++++++- src/common/compression.h | 6 ------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common/compression.cpp b/src/common/compression.cpp index bf9027864..b761caf18 100644 --- a/src/common/compression.cpp +++ b/src/common/compression.cpp @@ -88,6 +88,7 @@ unsigned char *zlib_compression_c::decompress(unsigned char *buffer, int &size) { unsigned char *dst; int result, dstsize; + z_stream d_stream; dst = (unsigned char *)safemalloc(size * 20); @@ -122,10 +123,13 @@ unsigned char *zlib_compression_c::decompress(unsigned char *buffer, unsigned char *zlib_compression_c::compress(unsigned char *buffer, int &size) { unsigned char *dst; int result, dstsize; + z_stream c_stream; dst = (unsigned char *)safemalloc(size * 2); - memset(&c_stream, 0, sizeof(c_stream)); + c_stream.zalloc = (alloc_func)0; + c_stream.zfree = (free_func)0; + c_stream.opaque = (voidpf)0; result = deflateInit(&c_stream, 9); if (result != Z_OK) mxerror("deflateInit() failed. Result: %d\n", result); @@ -168,6 +172,7 @@ bzlib_compression_c::~bzlib_compression_c() { unsigned char *bzlib_compression_c::decompress(unsigned char *buffer, int &size) { int result; + bz_stream d_stream; die("bzlib_compression_c::decompress() not implemented\n"); @@ -187,6 +192,7 @@ unsigned char *bzlib_compression_c::compress(unsigned char *buffer, int &size) { unsigned char *dst; int result, dstsize; + bz_stream c_stream; dst = (unsigned char *)safemalloc(size * 2); diff --git a/src/common/compression.h b/src/common/compression.h index 5f88edc90..55050076d 100644 --- a/src/common/compression.h +++ b/src/common/compression.h @@ -81,9 +81,6 @@ public: #include class zlib_compression_c: public compression_c { -protected: - z_stream c_stream, d_stream; - public: zlib_compression_c(); virtual ~zlib_compression_c(); @@ -97,9 +94,6 @@ public: #include class bzlib_compression_c: public compression_c { -protected: - bz_stream c_stream, d_stream; - public: bzlib_compression_c(); virtual ~bzlib_compression_c();