]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Fix warnings.
authorSimon Josefsson <simon@josefsson.org>
Mon, 17 Nov 2008 23:57:20 +0000 (00:57 +0100)
committerSimon Josefsson <simon@josefsson.org>
Mon, 17 Nov 2008 23:57:20 +0000 (00:57 +0100)
lib/gnutls_compress.c

index 038ac572322d5b8c04d381b5c1cd2a382a109e22..6ff1db73f2c2bda8a846dd2084d922c178c06f6f 100644 (file)
@@ -189,6 +189,8 @@ _gnutls_compression_get_num (gnutls_compression_method_t algorithm)
   return ret;
 }
 
+#ifdef HAVE_LIBZ
+
 static int
 get_wbits (gnutls_compression_method_t algorithm)
 {
@@ -216,6 +218,8 @@ get_comp_level (gnutls_compression_method_t algorithm)
   return ret;
 }
 
+#endif
+
 /* returns the gnutls internal ID of the TLS compression
  * method num
  */
@@ -318,7 +322,6 @@ comp_hd_t
 _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)
@@ -332,12 +335,13 @@ _gnutls_comp_init (gnutls_compression_method_t method, int d)
 
   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);
@@ -370,8 +374,8 @@ _gnutls_comp_init (gnutls_compression_method_t method, int d)
            gnutls_free (ret->handle);
            goto cleanup_ret;
          }
-       break;
       }
+      break;
 #endif
     case GNUTLS_COMP_LZO:
 #ifdef USE_LZO
@@ -388,12 +392,13 @@ _gnutls_comp_init (gnutls_compression_method_t method, int d)
              goto cleanup_ret;
            }
        }
-#endif
       break;
+#endif
     case GNUTLS_COMP_NULL:
     case GNUTLS_COMP_UNKNOWN:
       break;
     }
+
   return ret;
 
 cleanup_ret:
@@ -407,19 +412,21 @@ 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;
@@ -439,7 +446,6 @@ _gnutls_compress (comp_hd_t handle, const opaque * plain,
                  size_t max_comp_size)
 {
   int compressed_size = GNUTLS_E_COMPRESSION_FAILED;
-  int err;
 
   /* NULL compression is not handled here
    */
@@ -456,6 +462,7 @@ _gnutls_compress (comp_hd_t handle, const opaque * plain,
       {
        lzo_uint out_len;
        size_t size;
+       int err;
 
        if (_gnutls_lzo1x_1_compress == NULL)
          return GNUTLS_E_COMPRESSION_FAILED;
@@ -488,6 +495,7 @@ _gnutls_compress (comp_hd_t handle, const opaque * plain,
       {
        uLongf size;
        z_stream *zhandle;
+       int err;
 
        size = (plain_size + plain_size) + 10;
        *compressed = gnutls_malloc (size);
@@ -545,8 +553,7 @@ _gnutls_decompress (comp_hd_t handle, opaque * compressed,
                    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)
     {
@@ -570,6 +577,7 @@ _gnutls_decompress (comp_hd_t handle, opaque * compressed,
       {
        lzo_uint out_size;
        lzo_uint new_size;
+       int err;
 
        if (_gnutls_lzo1x_decompress_safe == NULL)
          return GNUTLS_E_DECOMPRESSION_FAILED;
@@ -614,6 +622,8 @@ _gnutls_decompress (comp_hd_t handle, opaque * compressed,
       {
        uLongf out_size;
        z_stream *zhandle;
+       int cur_pos;
+       int err;
 
        *plain = NULL;
        out_size = compressed_size + compressed_size;