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. --- CHANGES | 4 ++++ RELEASE-NOTES | 1 + 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 - src/main.c | 2 -- 10 files changed, 12 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index aec53194c..b65b41721 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,10 @@ Changelog +Daniel Stenberg (10 Jun 2009) +- Fabian Keil ran clang on the (lib)curl code, found a bunch of warnings and + contributed a range of patches to fix them. + Yang Tse (9 Jun 2009) - Daniel Steinberg pointed out that Curl_FormInit() in formdata.c was not initializing the fread callback pointer and this triggered a compiler diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2061683da..c4e9c2cb2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -37,5 +37,6 @@ advice from friends like these: Yang Tse, Daniel Fandrich, Kamil Dudka, Caolan McNamara, Frank McGeough, Andre Guibert de Bruet, Mike Crowe, Claes Jakobsson, John E. Malmberg, Aaron Oneal, Igor Novoseltsev, Eric Wong, Bill Hoffman, Daniel Steinberg, + Fabian Keil Thanks! (and sorry if I forgot to mention someone) 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) { diff --git a/src/main.c b/src/main.c index 46cdb4eb2..663b7e32b 100644 --- a/src/main.c +++ b/src/main.c @@ -2702,7 +2702,6 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */ break; case 'Q': /* QUOTE command to send to FTP server */ - err = PARAM_OK; switch(nextarg[0]) { case '-': /* prefixed with a dash makes it a POST TRANSFER one */ @@ -3382,7 +3381,6 @@ static int myprogress (void *clientp, percent = frac * 100.0f; barwidth = bar->width - 7; num = (int) (((double)barwidth) * frac); - i = 0; for ( i = 0; i < num; i++ ) { line[i] = '#'; } -- cgit v1.2.3