c_zlib.c revision 9dc0df1bac950d6e491f9a7c7e4888f2b301cb15
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
COMP_METHOD *COMP_zlib(void );
static COMP_METHOD zlib_method_nozlib={
"(undef)",
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};
#ifndef ZLIB
#else
#include <zlib.h>
#if 0
static COMP_METHOD zlib_stateless_method={
NULL,
NULL,
NULL,
NULL,
};
#endif
static COMP_METHOD zlib_stateful_method={
NULL,
NULL,
};
/*
* When OpenSSL is built on Windows, we do not want to require that
* the ZLIB.DLL be available in order for the OpenSSL DLLs to
* work. Therefore, all ZLIB routines are loaded at run time
* and we do not link to a .LIB file.
*/
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
# include <windows.h>
# define Z_CALLCONV _stdcall
# ifndef ZLIB_SHARED
# define ZLIB_SHARED
# endif
#else
# define Z_CALLCONV
#endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */
#ifdef ZLIB_SHARED
/* Prototypes for built in stubs */
#if 0
#endif
int stream_size);
const char * version, int stream_size);
/* Function pointers */
const char * version, int stream_size);
const char * version, int stream_size);
static int zlib_loaded = 0; /* only attempt to init func pts once */
#define compress stub_compress
#define inflateEnd stub_inflateEnd
#define inflate stub_inflate
#define inflateInit_ stub_inflateInit_
#define deflateEnd stub_deflateEnd
#define deflate stub_deflate
#define deflateInit_ stub_deflateInit_
#endif /* ZLIB_SHARED */
struct zlib_state
{
};
static int zlib_stateful_ex_idx = -1;
{
}
{
int err;
struct zlib_state *state =
goto err;
ZLIB_VERSION, sizeof(z_stream));
goto err;
ZLIB_VERSION, sizeof(z_stream));
goto err;
if (zlib_stateful_ex_idx == -1)
{
if (zlib_stateful_ex_idx == -1)
if (zlib_stateful_ex_idx == -1)
goto err;
}
return 1;
err:
return 0;
}
{
}
{
struct zlib_state *state =
return -1;
if (ilen > 0)
return -1;
#ifdef DEBUG_ZLIB
#endif
}
{
struct zlib_state *state =
return 0;
if (ilen > 0)
return -1;
#ifdef DEBUG_ZLIB
#endif
}
#if 0
{
unsigned long l;
int i;
int clear=1;
if (ilen > 128)
{
out[0]=1;
l=olen-1;
if (i != Z_OK)
return(-1);
if (ilen > l)
{
clear=0;
l++;
}
}
if (clear)
{
out[0]=0;
l=ilen+1;
}
#ifdef DEBUG_ZLIB
#endif
return((int)l);
}
{
unsigned long l;
int i;
if (in[0])
{
l=olen;
if (i != Z_OK)
return(-1);
}
else
{
l=ilen-1;
}
#ifdef DEBUG_ZLIB
#endif
return((int)l);
}
{
int err;
/* Check for source > 64K on 16-bit machine: */
ZLIB_VERSION, sizeof(z_stream));
if (err != Z_STREAM_END) {
inflateEnd(&stream);
return err;
}
return err;
}
#endif
#endif
COMP_METHOD *COMP_zlib(void)
{
#ifdef ZLIB_SHARED
if (!zlib_loaded)
{
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
if (!zlib_dso)
{
if (zlib_dso)
{
/* Clear the errors from the first failed
DSO_load() */
}
}
#else
#endif
{
"compress");
"inflateEnd");
"inflate");
"inflateInit_");
"deflateEnd");
"deflate");
"deflateInit_");
zlib_loaded++;
}
}
#endif
#if defined(ZLIB) || defined(ZLIB_SHARED)
#endif
return(meth);
}
#ifdef ZLIB_SHARED
#if 0
/* Stubs for each function to be dynamicly loaded */
static int
{
if (p_compress)
else
return(Z_MEM_ERROR);
}
#endif
static int
{
if ( p_inflateEnd )
return(p_inflateEnd(strm));
else
return(Z_MEM_ERROR);
}
static int
{
if ( p_inflate )
else
return(Z_MEM_ERROR);
}
static int
{
if ( p_inflateInit_ )
else
return(Z_MEM_ERROR);
}
static int
{
if ( p_deflateEnd )
return(p_deflateEnd(strm));
else
return(Z_MEM_ERROR);
}
static int
{
if ( p_deflate )
else
return(Z_MEM_ERROR);
}
static int
const char * version, int stream_size)
{
if ( p_deflateInit_ )
else
return(Z_MEM_ERROR);
}
#endif /* ZLIB_SHARED */