提交 6895cca8 编写于 作者: R Richard Levitte

Remove unused code, don't use zlib functions that are really macros

and provide missing prototypes.
上级 f82ab534
...@@ -30,6 +30,7 @@ static int zlib_stateful_compress_block(COMP_CTX *ctx, unsigned char *out, ...@@ -30,6 +30,7 @@ static int zlib_stateful_compress_block(COMP_CTX *ctx, unsigned char *out,
static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out, static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out,
unsigned int olen, unsigned char *in, unsigned int ilen); unsigned int olen, unsigned char *in, unsigned int ilen);
#if 0
static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out,
unsigned int olen, unsigned char *in, unsigned int ilen); unsigned int olen, unsigned char *in, unsigned int ilen);
static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out, static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out,
...@@ -48,6 +49,7 @@ static COMP_METHOD zlib_stateless_method={ ...@@ -48,6 +49,7 @@ static COMP_METHOD zlib_stateless_method={
NULL, NULL,
NULL, NULL,
}; };
#endif
static COMP_METHOD zlib_stateful_method={ static COMP_METHOD zlib_stateful_method={
NID_zlib_compression, NID_zlib_compression,
...@@ -79,12 +81,18 @@ static COMP_METHOD zlib_stateful_method={ ...@@ -79,12 +81,18 @@ static COMP_METHOD zlib_stateful_method={
#include <openssl/dso.h> #include <openssl/dso.h>
/* Prototypes for built in stubs */ /* Prototypes for built in stubs */
#if 0
static int stub_compress(Bytef *dest,uLongf *destLen, static int stub_compress(Bytef *dest,uLongf *destLen,
const Bytef *source, uLong sourceLen); const Bytef *source, uLong sourceLen);
#endif
static int stub_inflateEnd(z_streamp strm); static int stub_inflateEnd(z_streamp strm);
static int stub_inflate(z_streamp strm, int flush); static int stub_inflate(z_streamp strm, int flush);
static int stub_inflateInit_(z_streamp strm, const char * version, static int stub_inflateInit_(z_streamp strm, const char * version,
int stream_size); int stream_size);
static int stub_deflateEnd(z_streamp strm);
static int stub_deflate(z_streamp strm, int flush);
static int stub_deflateInit_(z_streamp strm, int level,
const char * version, int stream_size);
/* Function pointers */ /* Function pointers */
typedef int (Z_CALLCONV *compress_ft)(Bytef *dest,uLongf *destLen, typedef int (Z_CALLCONV *compress_ft)(Bytef *dest,uLongf *destLen,
...@@ -111,11 +119,9 @@ static DSO *zlib_dso = NULL; ...@@ -111,11 +119,9 @@ static DSO *zlib_dso = NULL;
#define compress stub_compress #define compress stub_compress
#define inflateEnd stub_inflateEnd #define inflateEnd stub_inflateEnd
#define inflate stub_inflate #define inflate stub_inflate
#define inflateInit stub_inflateInit
#define inflateInit_ stub_inflateInit_ #define inflateInit_ stub_inflateInit_
#define deflateEnd stub_deflateEnd #define deflateEnd stub_deflateEnd
#define deflate stub_deflate #define deflate stub_deflate
#define deflateInit stub_deflateInit
#define deflateInit_ stub_deflateInit_ #define deflateInit_ stub_deflateInit_
#endif /* ZLIB_SHARED */ #endif /* ZLIB_SHARED */
...@@ -152,7 +158,8 @@ static int zlib_stateful_init(COMP_CTX *ctx) ...@@ -152,7 +158,8 @@ static int zlib_stateful_init(COMP_CTX *ctx)
state->istream.next_out = Z_NULL; state->istream.next_out = Z_NULL;
state->istream.avail_in = 0; state->istream.avail_in = 0;
state->istream.avail_out = 0; state->istream.avail_out = 0;
err = inflateInit(&state->istream); err = inflateInit_(&state->istream,
ZLIB_VERSION, sizeof(z_stream));
if (err != Z_OK) if (err != Z_OK)
goto err; goto err;
...@@ -163,7 +170,8 @@ static int zlib_stateful_init(COMP_CTX *ctx) ...@@ -163,7 +170,8 @@ static int zlib_stateful_init(COMP_CTX *ctx)
state->ostream.next_out = Z_NULL; state->ostream.next_out = Z_NULL;
state->ostream.avail_in = 0; state->ostream.avail_in = 0;
state->ostream.avail_out = 0; state->ostream.avail_out = 0;
err = deflateInit(&state->ostream,Z_DEFAULT_COMPRESSION); err = deflateInit_(&state->ostream,Z_DEFAULT_COMPRESSION,
ZLIB_VERSION, sizeof(z_stream));
if (err != Z_OK) if (err != Z_OK)
goto err; goto err;
...@@ -243,6 +251,7 @@ static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out, ...@@ -243,6 +251,7 @@ static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out,
return olen - state->istream.avail_out; return olen - state->istream.avail_out;
} }
#if 0
static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out,
unsigned int olen, unsigned char *in, unsigned int ilen) unsigned int olen, unsigned char *in, unsigned int ilen)
{ {
...@@ -319,7 +328,8 @@ static int zz_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, ...@@ -319,7 +328,8 @@ static int zz_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source,
stream.zalloc = (alloc_func)0; stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0; stream.zfree = (free_func)0;
err = inflateInit(&stream); err = inflateInit_(&stream,
ZLIB_VERSION, sizeof(z_stream));
if (err != Z_OK) return err; if (err != Z_OK) return err;
err = inflate(&stream, Z_FINISH); err = inflate(&stream, Z_FINISH);
...@@ -332,6 +342,7 @@ static int zz_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, ...@@ -332,6 +342,7 @@ static int zz_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source,
err = inflateEnd(&stream); err = inflateEnd(&stream);
return err; return err;
} }
#endif
#endif #endif
...@@ -383,6 +394,7 @@ COMP_METHOD *COMP_zlib(void) ...@@ -383,6 +394,7 @@ COMP_METHOD *COMP_zlib(void)
} }
#ifdef ZLIB_SHARED #ifdef ZLIB_SHARED
#if 0
/* Stubs for each function to be dynamicly loaded */ /* Stubs for each function to be dynamicly loaded */
static int static int
stub_compress(Bytef *dest,uLongf *destLen,const Bytef *source, uLong sourceLen) stub_compress(Bytef *dest,uLongf *destLen,const Bytef *source, uLong sourceLen)
...@@ -392,6 +404,7 @@ stub_compress(Bytef *dest,uLongf *destLen,const Bytef *source, uLong sourceLen) ...@@ -392,6 +404,7 @@ stub_compress(Bytef *dest,uLongf *destLen,const Bytef *source, uLong sourceLen)
else else
return(Z_MEM_ERROR); return(Z_MEM_ERROR);
} }
#endif
static int static int
stub_inflateEnd(z_streamp strm) stub_inflateEnd(z_streamp strm)
...@@ -443,7 +456,7 @@ stub_deflateInit_(z_streamp strm, int level, ...@@ -443,7 +456,7 @@ stub_deflateInit_(z_streamp strm, int level,
const char * version, int stream_size) const char * version, int stream_size)
{ {
if ( p_deflateInit_ ) if ( p_deflateInit_ )
return(p_deflateInit_(strm,version,stream_size)); return(p_deflateInit_(strm,level,version,stream_size));
else else
return(Z_MEM_ERROR); return(Z_MEM_ERROR);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册