]> granicus.if.org Git - curl/commitdiff
Fixed some minor mismatched types found by splint.
authorDan Fandrich <dan@coneharvesters.com>
Sun, 26 Aug 2007 05:53:26 +0000 (05:53 +0000)
committerDan Fandrich <dan@coneharvesters.com>
Sun, 26 Aug 2007 05:53:26 +0000 (05:53 +0000)
lib/dict.c
lib/easy.c
lib/escape.c
lib/hostip.c
lib/http.c
lib/http.h
lib/multi.c
lib/multiif.h
lib/url.c
lib/urldata.h

index c1da557e2fceeadac9b8eca87b01ddf7eba0fdb8..43bc72ebf8ec915513c84318a89c55d95770877d 100644 (file)
 /* The last #include file should be: */
 #include "memdebug.h"
 
-static char *unescape_word(struct SessionHandle *data, char *inp)
+static char *unescape_word(struct SessionHandle *data, const char *inp)
 {
   char *newp;
   char *dictp;
   char *ptr;
   int len;
-  unsigned char byte;
+  char byte;
   int olen=0;
 
   newp = curl_easy_unescape(data, inp, 0, &len);
@@ -100,7 +100,7 @@ static char *unescape_word(struct SessionHandle *data, char *inp)
     /* According to RFC2229 section 2.2, these letters need to be escaped with
        \[letter] */
     for(ptr = newp;
-        (byte = (unsigned char)*ptr) != 0;
+        (byte = *ptr) != 0;
         ptr++) {
       if ((byte <= 32) || (byte == 127) ||
           (byte == '\'') || (byte == '\"') || (byte == '\\')) {
index 54915fb8848f67936e9f6ec5ef1594896bd2af1c..d008bb0f6265c725477687dfd87d509e6eb95e37 100644 (file)
@@ -886,7 +886,8 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
   } else {
 #ifdef HAVE_ICONV
     /* do the translation ourselves */
-    char *input_ptr, *output_ptr;
+    const char *input_ptr;
+    char *output_ptr;
     size_t in_bytes, out_bytes, rc;
     int error;
 
@@ -907,7 +908,7 @@ CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
     /* call iconv */
     input_ptr = output_ptr = buffer;
     in_bytes = out_bytes = length;
-    rc = iconv(data->utf8_cd, (const char**)&input_ptr, &in_bytes,
+    rc = iconv(data->utf8_cd, &input_ptr, &in_bytes,
                &output_ptr, &out_bytes);
     if ((rc == ICONV_ERROR) || (in_bytes != 0)) {
       error = ERRNO;
index 06ac04d71da709371d06ae3c4b0eeb97faa92eb8..fd08451de83862280774683c20b3d67c50ba5e8a 100644 (file)
@@ -59,7 +59,7 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
   size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;
   char *ns;
   char *testing_ptr = NULL;
-  unsigned char in;
+  char in;
   size_t newlen = alloc;
   int strindex=0;
   size_t length;
index 189d0683d83d4f44baa3eddd0e8c0cf818d60dad..02f4da06f1f27847007d9124e085371a7230173a 100644 (file)
@@ -200,7 +200,7 @@ create_hostcache_id(const char *server, int port)
 }
 
 struct hostcache_prune_data {
-  int cache_timeout;
+  long cache_timeout;
   time_t now;
 };
 
@@ -232,7 +232,7 @@ hostcache_timestamp_remove(void *datap, void *hc)
  * Prune the DNS cache. This assumes that a lock has already been taken.
  */
 static void
-hostcache_prune(struct curl_hash *hostcache, int cache_timeout, time_t now)
+hostcache_prune(struct curl_hash *hostcache, long cache_timeout, time_t now)
 {
   struct hostcache_prune_data user;
 
index e72ed43e1165f602336c0efccb9bb8ea618de44a..715031658c1b52cf2124f2e9e596a5ffc56bbbc3 100644 (file)
@@ -1055,7 +1055,7 @@ CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size)
  * Pass headers WITH the colon.
  */
 bool
-Curl_compareheader(char *headerline,    /* line to check */
+Curl_compareheader(const char *headerline, /* line to check */
                    const char *header,  /* header keyword _with_ colon */
                    const char *content) /* content string to find */
 {
@@ -1067,8 +1067,8 @@ Curl_compareheader(char *headerline,    /* line to check */
   size_t hlen = strlen(header);
   size_t clen;
   size_t len;
-  char *start;
-  char *end;
+  const char *start;
+  const char *end;
 
   if(!strnequal(headerline, header, hlen))
     return FALSE; /* doesn't start with header */
@@ -1119,7 +1119,7 @@ Curl_compareheader(char *headerline,    /* line to check */
 CURLcode Curl_proxyCONNECT(struct connectdata *conn,
                            int sockindex,
                            char *hostname,
-                           int remote_port)
+                           unsigned short remote_port)
 {
   int subversion=0;
   struct SessionHandle *data=conn->data;
index 0f4b58f72c93297dbb483489866bbb17e27ea725..cd75f0802f6bd522a93dcdd5047764e826229448 100644 (file)
  * $Id$
  ***************************************************************************/
 #ifndef CURL_DISABLE_HTTP
-bool Curl_compareheader(char *headerline,     /* line to check */
+bool Curl_compareheader(const char *headerline,  /* line to check */
                         const char *header,   /* header keyword _with_ colon */
                         const char *content); /* content string to find */
 
 /* ftp can use this as well */
 CURLcode Curl_proxyCONNECT(struct connectdata *conn,
                            int tunnelsocket,
-                           char *hostname, int remote_port);
+                           char *hostname, unsigned short remote_port);
 
 /* protocol-specific functions set up to be called by the main engine */
 CURLcode Curl_http(struct connectdata *conn, bool *done);
index 0bdfd6170366fe92357271a72b3070ec25f7f30e..42294eeb623c89b55b3c0a823d5d3340cb17c4f3 100644 (file)
@@ -690,7 +690,7 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
     return CURLM_BAD_EASY_HANDLE; /* twasn't found */
 }
 
-bool Curl_multi_canPipeline(struct Curl_multi* multi)
+bool Curl_multi_canPipeline(const struct Curl_multi* multi)
 {
   return multi->pipelining_enabled;
 }
index 2a8b06c2795b1c11f0b9268c057ab9ed2f5ff715..35bfbcc5f044ae560fb0cc988bf65bf2ebb64994 100644 (file)
@@ -30,7 +30,7 @@ void Curl_expire(struct SessionHandle *data, long milli);
 
 void Curl_multi_rmeasy(void *multi, CURL *data);
 
-bool Curl_multi_canPipeline(struct Curl_multi* multi);
+bool Curl_multi_canPipeline(const struct Curl_multi* multi);
 void Curl_multi_handlePipeBreak(struct SessionHandle *data);
 
 /* the write bits start at bit 16 for the *getsock() bitmap */
index ca7f51431c37464377974e7bf839147c8d086446..c4b87d34098d6532199db8e8e66f8de1815e09f0 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -158,8 +158,8 @@ static bool ConnectionExists(struct SessionHandle *data,
                              struct connectdata **usethis);
 static long ConnectionStore(struct SessionHandle *data,
                             struct connectdata *conn);
-static bool IsPipeliningPossible(struct SessionHandle *handle);
-static bool IsPipeliningEnabled(struct SessionHandle *handle);
+static bool IsPipeliningPossible(const struct SessionHandle *handle);
+static bool IsPipeliningEnabled(const struct SessionHandle *handle);
 static void conn_free(struct connectdata *conn);
 
 static void signalPipeClose(struct curl_llist *pipe);
@@ -292,7 +292,7 @@ CURLcode Curl_close(struct SessionHandle *data)
 
   if(data->state.connc && data->state.connc->type == CONNCACHE_MULTI) {
     struct conncache *c = data->state.connc;
-    int i;
+    long i;
     struct curl_llist *pipe;
     struct curl_llist_element *curr;
     struct connectdata *connptr;
@@ -536,7 +536,7 @@ CURLcode Curl_ch_connc(struct SessionHandle *data,
 void Curl_rm_connc(struct conncache *c)
 {
   if(c->connects) {
-    int i;
+    long i;
     for(i = 0; i < c->num; ++i)
       conn_free(c->connects[i]);
 
@@ -2010,7 +2010,7 @@ static bool SocketIsDead(curl_socket_t sock)
   return ret_val;
 }
 
-static bool IsPipeliningPossible(struct SessionHandle *handle)
+static bool IsPipeliningPossible(const struct SessionHandle *handle)
 {
   if (handle->multi && Curl_multi_canPipeline(handle->multi) &&
       (handle->set.httpreq == HTTPREQ_GET ||
@@ -2021,7 +2021,7 @@ static bool IsPipeliningPossible(struct SessionHandle *handle)
   return FALSE;
 }
 
-static bool IsPipeliningEnabled(struct SessionHandle *handle)
+static bool IsPipeliningEnabled(const struct SessionHandle *handle)
 {
   if (handle->multi && Curl_multi_canPipeline(handle->multi))
     return TRUE;
@@ -2430,24 +2430,27 @@ static CURLcode ConnectPlease(struct SessionHandle *data,
     conn->dns_entry = hostaddr;
     conn->ip_addr = addr;
 
-    Curl_store_ip_addr(conn);
+    result = Curl_store_ip_addr(conn);
 
-    switch(data->set.proxytype) {
-    case CURLPROXY_SOCKS5:
-      result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, conn->host.name,
-                           conn->remote_port, FIRSTSOCKET, conn);
-      break;
-    case CURLPROXY_HTTP:
-      /* do nothing here. handled later. */
-      break;
-    case CURLPROXY_SOCKS4:
-      result = Curl_SOCKS4(conn->proxyuser, conn->host.name, conn->remote_port,
-                           FIRSTSOCKET, conn);
-      break;
-    default:
-      failf(data, "unknown proxytype option given");
-      result = CURLE_COULDNT_CONNECT;
-      break;
+    if(CURLE_OK == result) {
+
+      switch(data->set.proxytype) {
+      case CURLPROXY_SOCKS5:
+       result = Curl_SOCKS5(conn->proxyuser, conn->proxypasswd, conn->host.name,
+                            conn->remote_port, FIRSTSOCKET, conn);
+       break;
+      case CURLPROXY_HTTP:
+       /* do nothing here. handled later. */
+       break;
+      case CURLPROXY_SOCKS4:
+       result = Curl_SOCKS4(conn->proxyuser, conn->host.name, conn->remote_port,
+                            FIRSTSOCKET, conn);
+       break;
+      default:
+       failf(data, "unknown proxytype option given");
+       result = CURLE_COULDNT_CONNECT;
+       break;
+      }
     }
   }
   if(result)
@@ -2867,7 +2870,7 @@ static CURLcode setup_range(struct SessionHandle *data)
 
   req->resume_from = data->set.set_resume_from;
   if (req->resume_from || data->set.str[STRING_SET_RANGE]) {
-    if (req->rangestringalloc == TRUE)
+    if (req->rangestringalloc)
       free(req->range);
 
     if(req->resume_from)
index 5975406fa14731c45b154de59062ceea9b326d57..e760e0c39a33c8e2938bc2c0f0e13113db81058e 100644 (file)
    of need. */
 #define HEADERSIZE 256
 
-#define CURLEASY_MAGIC_NUMBER 0xc0dedbad
+#define CURLEASY_MAGIC_NUMBER 0xc0dedbadU
 
 /* Just a convenience macro to get the larger value out of two given.
    We prefix with CURL to prevent name collisions. */
@@ -1354,7 +1354,7 @@ struct UserDefined {
 
   curl_proxytype proxytype; /* what kind of proxy that is in use */
 
-  int dns_cache_timeout; /* DNS cache timeout */
+  long dns_cache_timeout; /* DNS cache timeout */
   long buffer_size;      /* size of receive buffer to use */
 
   void *private_data; /* Private data */