diff options
author | Rich Salz <rsalz@openssl.org> | 2015-01-29 21:38:57 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-01-29 21:38:57 -0500 |
commit | 4d428cd2504c7ef03bc9672ecf2862eaedb3d87e (patch) | |
tree | 2d640a824dd024e3a15db293eb8eb29e06fa3bdd /crypto/comp/c_zlib.c | |
parent | 33fc38ff8e2cb8723f7b116de3f8923c4f4eb9d5 (diff) |
Dead code removal: #if 0 bio, comp, rand
The start of removing dead code.
A remaining #if 0 in bss_conn.c needs more thought.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/comp/c_zlib.c')
-rw-r--r-- | crypto/comp/c_zlib.c | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c index 6731af8b0d..c3b064cc6e 100644 --- a/crypto/comp/c_zlib.c +++ b/crypto/comp/c_zlib.c @@ -49,28 +49,6 @@ static void zlib_zfree(void *opaque, void *address) OPENSSL_free(address); } -# if 0 -static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, - unsigned int ilen); -static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, - unsigned int ilen); - -static int zz_uncompress(Bytef *dest, uLongf * destLen, const Bytef *source, - uLong sourceLen); - -static COMP_METHOD zlib_stateless_method = { - NID_zlib_compression, - LN_zlib_compression, - NULL, - NULL, - zlib_compress_block, - zlib_expand_block, - NULL, - NULL, -}; -# endif static COMP_METHOD zlib_stateful_method = { NID_zlib_compression, @@ -247,97 +225,6 @@ static int zlib_stateful_expand_block(COMP_CTX *ctx, unsigned char *out, return olen - state->istream.avail_out; } -# if 0 -static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, - unsigned int ilen) -{ - unsigned long l; - int i; - int clear = 1; - - if (ilen > 128) { - out[0] = 1; - l = olen - 1; - i = compress(&(out[1]), &l, in, (unsigned long)ilen); - if (i != Z_OK) - return (-1); - if (ilen > l) { - clear = 0; - l++; - } - } - if (clear) { - out[0] = 0; - memcpy(&(out[1]), in, ilen); - l = ilen + 1; - } -# ifdef DEBUG_ZLIB - fprintf(stderr, "compress(%4d)->%4d %s\n", - ilen, (int)l, (clear) ? "clear" : "zlib"); -# endif - return ((int)l); -} - -static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out, - unsigned int olen, unsigned char *in, - unsigned int ilen) -{ - unsigned long l; - int i; - - if (in[0]) { - l = olen; - i = zz_uncompress(out, &l, &(in[1]), (unsigned long)ilen - 1); - if (i != Z_OK) - return (-1); - } else { - memcpy(out, &(in[1]), ilen - 1); - l = ilen - 1; - } -# ifdef DEBUG_ZLIB - fprintf(stderr, "expand (%4d)->%4d %s\n", - ilen, (int)l, in[0] ? "zlib" : "clear"); -# endif - return ((int)l); -} - -static int zz_uncompress(Bytef *dest, uLongf * destLen, const Bytef *source, - uLong sourceLen) -{ - z_stream stream; - int err; - - stream.next_in = (Bytef *)source; - stream.avail_in = (uInt) sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong) stream.avail_in != sourceLen) - return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt) * destLen; - if ((uLong) stream.avail_out != *destLen) - return Z_BUF_ERROR; - - stream.zalloc = (alloc_func) 0; - stream.zfree = (free_func) 0; - - err = inflateInit_(&stream, ZLIB_VERSION, sizeof(z_stream)); - if (err != Z_OK) - return err; - - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - return err; - } - *destLen = stream.total_out; - - err = inflateEnd(&stream); - return err; -} -# endif - #endif COMP_METHOD *COMP_zlib(void) |