return ret;
}
+#ifdef HAVE_LIBZ
+
static int
get_wbits (gnutls_compression_method_t algorithm)
{
return ret;
}
+#endif
+
/* returns the gnutls internal ID of the TLS compression
* method num
*/
_gnutls_comp_init (gnutls_compression_method_t method, int d)
{
comp_hd_t ret;
- int err;
ret = gnutls_malloc (sizeof (struct comp_hd_t_STRUCT));
if (ret == NULL)
switch (method)
{
-#ifdef HAVE_LIBZ
case GNUTLS_COMP_DEFLATE:
+#ifdef HAVE_LIBZ
{
int window_bits, mem_level;
int comp_level;
z_stream *zhandle;
+ int err;
window_bits = get_wbits (method);
mem_level = get_mem_level (method);
gnutls_free (ret->handle);
goto cleanup_ret;
}
- break;
}
+ break;
#endif
case GNUTLS_COMP_LZO:
#ifdef USE_LZO
goto cleanup_ret;
}
}
-#endif
break;
+#endif
case GNUTLS_COMP_NULL:
case GNUTLS_COMP_UNKNOWN:
break;
}
+
return ret;
cleanup_ret:
void
_gnutls_comp_deinit (comp_hd_t handle, int d)
{
- int err;
-
if (handle != NULL)
{
switch (handle->algo)
{
#ifdef HAVE_LIBZ
case GNUTLS_COMP_DEFLATE:
- if (d)
- err = inflateEnd (handle->handle);
- else
- err = deflateEnd (handle->handle);
- break;
+ {
+ int err;
+
+ if (d)
+ err = inflateEnd (handle->handle);
+ else
+ err = deflateEnd (handle->handle);
+ break;
+ }
#endif
default:
break;
size_t max_comp_size)
{
int compressed_size = GNUTLS_E_COMPRESSION_FAILED;
- int err;
/* NULL compression is not handled here
*/
{
lzo_uint out_len;
size_t size;
+ int err;
if (_gnutls_lzo1x_1_compress == NULL)
return GNUTLS_E_COMPRESSION_FAILED;
{
uLongf size;
z_stream *zhandle;
+ int err;
size = (plain_size + plain_size) + 10;
*compressed = gnutls_malloc (size);
size_t compressed_size, opaque ** plain,
size_t max_record_size)
{
- int plain_size = GNUTLS_E_DECOMPRESSION_FAILED, err;
- int cur_pos;
+ int plain_size = GNUTLS_E_DECOMPRESSION_FAILED;
if (compressed_size > max_record_size + EXTRA_COMP_SIZE)
{
{
lzo_uint out_size;
lzo_uint new_size;
+ int err;
if (_gnutls_lzo1x_decompress_safe == NULL)
return GNUTLS_E_DECOMPRESSION_FAILED;
{
uLongf out_size;
z_stream *zhandle;
+ int cur_pos;
+ int err;
*plain = NULL;
out_size = compressed_size + compressed_size;