From 352177090f710fd155d22a79d11f621482c09640 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 10 Jun 2009 21:26:11 +0000 Subject: - Fabian Keil ran clang on the (lib)curl code, found a bunch of warnings and contributed a range of patches to fix them. --- lib/cookie.c | 2 +- lib/dict.c | 4 ++-- lib/http.c | 5 ++--- lib/http_chunks.c | 2 -- lib/sendf.c | 5 ++--- lib/ssluse.c | 2 -- lib/url.c | 1 - 7 files changed, 7 insertions(+), 14 deletions(-) (limited to 'lib') diff --git a/lib/cookie.c b/lib/cookie.c index 241f7ff3f..32ea705e4 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -405,7 +405,7 @@ Curl_cookie_add(struct SessionHandle *data, } ptr=semiptr+1; - while(ptr && *ptr && ISBLANK(*ptr)) + while(*ptr && ISBLANK(*ptr)) ptr++; semiptr=strchr(ptr, ';'); /* now, find the next semicolon */ diff --git a/lib/dict.c b/lib/dict.c index acf7ef689..223eddc0e 100644 --- a/lib/dict.c +++ b/lib/dict.c @@ -182,7 +182,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) *strategy++ = (char)0; nthdef = strchr(strategy, ':'); if(nthdef) { - *nthdef++ = (char)0; + *nthdef = (char)0; } } } @@ -238,7 +238,7 @@ static CURLcode dict_do(struct connectdata *conn, bool *done) *database++ = (char)0; nthdef = strchr(database, ':'); if(nthdef) { - *nthdef++ = (char)0; + *nthdef = (char)0; } } } diff --git a/lib/http.c b/lib/http.c index ccbec227f..8457b51f4 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1417,10 +1417,9 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, /* if timeout is requested, find out how much remaining time we have */ check = timeout - /* timeout time */ Curl_tvdiff(Curl_tvnow(), conn->now); /* spent time */ - if(check <=0 ) { + if(check <= 0) { failf(data, "Proxy CONNECT aborted due to timeout"); - error = SELECT_TIMEOUT; /* already too little time */ - break; + return CURLE_RECV_ERROR; } /* if we're in multi-mode and we would block, return instead for a retry */ diff --git a/lib/http_chunks.c b/lib/http_chunks.c index 13ef3cff6..ee35d6603 100644 --- a/lib/http_chunks.c +++ b/lib/http_chunks.c @@ -345,7 +345,6 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, conn->trailer[conn->trlPos]=0; if(conn->trlPos==2) { ch->state = CHUNK_STOP; - datap++; length--; /* @@ -400,7 +399,6 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn, case CHUNK_STOP: if(*datap == 0x0a) { - datap++; length--; /* Record the length of any data left in the end of the buffer diff --git a/lib/sendf.c b/lib/sendf.c index 0f8ccd33b..e80da04c7 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -133,12 +133,11 @@ static size_t convert_lineends(struct SessionHandle *data, *outPtr = *inPtr; } outPtr++; - inPtr++; } - if(outPtr < startPtr+size) { + if(outPtr < startPtr+size) /* tidy up by null terminating the now shorter data */ *outPtr = '\0'; - } + return(outPtr - startPtr); } return(size); diff --git a/lib/ssluse.c b/lib/ssluse.c index 90bdfc262..a570f7163 100644 --- a/lib/ssluse.c +++ b/lib/ssluse.c @@ -857,7 +857,6 @@ int Curl_ossl_shutdown(struct connectdata *conn, int sockindex) /* timeout */ failf(data, "SSL shutdown timeout"); done = 1; - break; } else { /* anything that gets here is fatally bad */ @@ -2272,7 +2271,6 @@ ossl_connect_common(struct connectdata *conn, return retcode; } - timeout_ms = 0; while(ssl_connect_2 == connssl->connecting_state || ssl_connect_2_reading == connssl->connecting_state || ssl_connect_2_writing == connssl->connecting_state) { diff --git a/lib/url.c b/lib/url.c index 0337ea867..1ef52e8ec 100644 --- a/lib/url.c +++ b/lib/url.c @@ -3489,7 +3489,6 @@ static bool check_noproxy(const char* name, const char* no_proxy) else namelen = strlen(name); - tok_start = 0; for (tok_start = 0; tok_start < no_proxy_len; tok_start = tok_end + 1) { while (tok_start < no_proxy_len && strchr(separator, no_proxy[tok_start]) != NULL) { -- cgit v1.2.3