From f05d47ddd6d706dcda05504da8c90a111d53f67b Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 1 Jul 2004 07:43:20 +0000 Subject: [PATCH] variable type cleanup to fix picky compiler warnings --- lib/ftp.c | 5 ++--- lib/url.c | 31 +++++++++++++++---------------- lib/urldata.h | 2 +- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/ftp.c b/lib/ftp.c index 694ff91b4..7cd586482 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -2662,9 +2662,8 @@ CURLcode ftp_regular_transfer(struct connectdata *conn) /* we skip empty path components, like "x//y" since the FTP command CWD requires a parameter and a non-existant parameter a) doesn't work on many servers and b) has no effect on the others. */ - ftp->dirs[ftp->dirdepth] = curl_unescape(cur_pos - absolute_dir, - slash_pos - cur_pos + - absolute_dir); + int len = (int)(slash_pos - cur_pos + absolute_dir); + ftp->dirs[ftp->dirdepth] = curl_unescape(cur_pos - absolute_dir, len); if (!ftp->dirs[ftp->dirdepth]) { /* run out of memory ... */ failf(data, "no memory"); diff --git a/lib/url.c b/lib/url.c index 3fbc7b3e6..1ed05f021 100644 --- a/lib/url.c +++ b/lib/url.c @@ -151,12 +151,12 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by #include "memdebug.h" /* Local static prototypes */ -static int ConnectionKillOne(struct SessionHandle *data); +static long ConnectionKillOne(struct SessionHandle *data); static bool ConnectionExists(struct SessionHandle *data, struct connectdata *needle, struct connectdata **usethis); -static unsigned int ConnectionStore(struct SessionHandle *data, - struct connectdata *conn); +static long ConnectionStore(struct SessionHandle *data, + struct connectdata *conn); static bool safe_strequal(char* str1, char* str2); #ifndef USE_ARES @@ -411,17 +411,16 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) { long newconnects= va_arg(param, long); struct connectdata **newptr; + long i; if(newconnects < data->state.numconnects) { /* Since this number is *decreased* from the existing number, we must close the possibly open connections that live on the indexes that are being removed! */ - int i; for(i=newconnects; i< data->state.numconnects; i++) Curl_disconnect(data->state.connects[i]); } if(newconnects) { - int i; newptr= (struct connectdata **) realloc(data->state.connects, sizeof(struct connectdata *) * newconnects); @@ -577,7 +576,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) * This is the value to compare with the remote document with the * method set with CURLOPT_TIMECONDITION */ - data->set.timevalue = va_arg(param, long); + data->set.timevalue = (time_t)va_arg(param, long); break; case CURLOPT_SSLVERSION: /* @@ -1633,14 +1632,14 @@ ConnectionExists(struct SessionHandle *data, * should take the previously set policy into account when deciding which * of the connections to kill. */ -static int +static long ConnectionKillOne(struct SessionHandle *data) { long i; struct connectdata *conn; - int highscore=-1; - int connindex=-1; - int score; + long highscore=-1; + long connindex=-1; + long score; struct timeval now; now = Curl_tvnow(); @@ -1697,7 +1696,7 @@ ConnectionKillOne(struct SessionHandle *data) * The given connection should be unique. That must've been checked prior to * this call. */ -static unsigned int +static long ConnectionStore(struct SessionHandle *data, struct connectdata *conn) { @@ -1787,8 +1786,8 @@ static int handleSock5Proxy(const char *proxy_name, /* Needs user name and password */ int userlen, pwlen, len; - userlen = strlen(proxy_name); - pwlen = proxy_password?strlen(proxy_password):0; + userlen = (int)strlen(proxy_name); + pwlen = proxy_password?(int)strlen(proxy_password):0; /* username/password request looks like * +----+------+----------+------+----------+ @@ -2108,7 +2107,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, CURLcode result=CURLE_OK; struct connectdata *conn; struct connectdata *conn_temp; - int urllen; + size_t urllen; struct Curl_dns_entry *hostaddr; #ifdef HAVE_ALARM unsigned int prev_alarm=0; @@ -2407,7 +2406,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, nope=no_proxy?strtok_r(no_proxy, ", ", &no_proxy_tok_buf):NULL; while(nope) { - unsigned int namelen; + size_t namelen; char *endptr = strchr(conn->host.name, ':'); if(endptr) namelen=endptr-conn->host.name; @@ -3290,7 +3289,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, failf(data, "Previous alarm fired off!"); } else - alarm(alarm_set); + alarm((unsigned int)alarm_set); } else alarm(0); /* just shut it off */ diff --git a/lib/urldata.h b/lib/urldata.h index 517dc0f3d..d44e839b0 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -876,7 +876,7 @@ struct UserDefined { struct curl_slist *http200aliases; /* linked list of aliases for http200 */ - int ip_version; + long ip_version; curl_off_t max_filesize; /* Maximum file size to download */