]> granicus.if.org Git - curl/commitdiff
Fix compiler warnings
authorYang Tse <yangsita@gmail.com>
Thu, 22 Feb 2007 06:19:39 +0000 (06:19 +0000)
committerYang Tse <yangsita@gmail.com>
Thu, 22 Feb 2007 06:19:39 +0000 (06:19 +0000)
"case label value exceeds maximum value for type" and
"comparison is always false due to limited range of data type"

Both triggered when using a bool variable as the switch variable
in a switch statement and using enums for the case targets.

lib/content_encoding.c
lib/urldata.h

index 97f834177437f5956b42dcc98d9d175fbc64e255..a363f6db06908c6de1f484de2479b251e4f951a1 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
 #define COMMENT      0x10 /* bit 4 set: file comment present */
 #define RESERVED     0xE0 /* bits 5..7: reserved */
 
-enum zlibState {
-  ZLIB_UNINIT,          /* uninitialized */
-  ZLIB_INIT,            /* initialized */
-  ZLIB_GZIP_HEADER,     /* reading gzip header */
-  ZLIB_GZIP_INFLATING,  /* inflating gzip stream */
-  ZLIB_INIT_GZIP        /* initialized in transparent gzip mode */
-};
-
 static CURLcode
 process_zlib_error(struct connectdata *conn, z_stream *z)
 {
@@ -76,7 +68,7 @@ process_zlib_error(struct connectdata *conn, z_stream *z)
 }
 
 static CURLcode
-exit_zlib(z_stream *z, bool *zlib_init, CURLcode result)
+exit_zlib(z_stream *z, zlibInitState *zlib_init, CURLcode result)
 {
   inflateEnd(z);
   *zlib_init = ZLIB_UNINIT;
index 3325699d7c8e81ddfd4fb524aa955325136b8d3c..6a1f7045eee85a3940cafd3fd6f6a93d206ce3e2 100644 (file)
@@ -521,6 +521,16 @@ struct hostname {
 #define KEEP_WRITE_HOLD 8 /* when set, no writing should be done but there
                              might still be data to write */
 
+#ifdef HAVE_LIBZ
+typedef enum {
+  ZLIB_UNINIT,          /* uninitialized */
+  ZLIB_INIT,            /* initialized */
+  ZLIB_GZIP_HEADER,     /* reading gzip header */
+  ZLIB_GZIP_INFLATING,  /* inflating gzip stream */
+  ZLIB_INIT_GZIP        /* initialized in transparent gzip mode */
+} zlibInitState;
+#endif
+
 /*
  * This struct is all the previously local variables from Curl_perform() moved
  * to struct to allow the function to return and get re-invoked better without
@@ -581,7 +591,7 @@ struct Curl_transfer_keeper {
 #define COMPRESS 3              /* Not handled, added for completeness */
 
 #ifdef HAVE_LIBZ
-  bool zlib_init;               /* True if zlib already initialized;
+  zlibInitState zlib_init;      /* possible zlib init state;
                                    undefined if Content-Encoding header. */
   z_stream z;                   /* State structure for zlib. */
 #endif