curl-library
Patches for a couple of clang warnings
Date: Sat, 6 Jun 2009 13:17:14 +0200
The attached patches fix a couple of clang warnings.
I think the first one fixes an actual, albeit minor, bug.
The other ones mainly fix dead stores and shouldn't result
in change of behaviour.
I left a couple of warnings untouched in places were I thought
keeping them would keep the code consistent. An example from
lib/sendf.c is:
131 else {
132 /* copy last byte */
133 *outPtr = *inPtr;
134 }
135 outPtr++;
136 inPtr++;
Value stored to 'inPtr' is never read
Other ones depend on ifdefs and fixing them didn't seem worth it.
For example in lib/version.c (I'm compiling without USE_ARES):
81 #ifdef HAVE_LIBZ1
82 len = snprintfcurl_msnprintf(ptr, left, " zlib/%s", zlibVersion());
83 left -= len;
84 ptr += len;
Value stored to 'ptr' is never read
85 #endif
86 #ifdef USE_ARES
87 /* this function is only present in c-ares, not in the original ares */
88 len = snprintfcurl_msnprintf(ptr, left, " c-ares/%s", ares_version(NULL((void *)0)));
89 left -= len;
90 ptr += len;
91 #endif
Finally there were a few cases were I wasn't sure what to do,
for example in lib/ftp.c
1829 rc = Curl_resolv(conn, conn->proxy.name, (int)conn->port, &addr);
1830 if(rc == CURLRESOLV_PENDING1)
1831 /* BLOCKING */
1832 rc = Curl_wait_for_resolv(conn, &addr);
Value stored to 'rc' is never read
One could either check rc, or use "(void)Curl_wait_for_resolv(conn, &addr);"
to keep the current behaviour without the dead store. That's a decision for
someone who knows the code, though.
Fabian
- text/x-patch attachment: 0001-In-Curl_proxyCONNECT-let-the-first-timeout-check-ret.patch
- text/x-patch attachment: 0002-Fix-white-space.patch
- text/x-patch attachment: 0003-Remove-dead-store.patch
- text/x-patch attachment: 0004-No-need-to-set-i-to-0-twice.patch
- text/x-patch attachment: 0005-Remove-strange-check-for-NULL.patch
- text/x-patch attachment: 0006-No-need-to-initialize-tok_start-twice.patch
- text/x-patch attachment: 0007-Why-increment-nthdef-if-we-won-t-read-from-it.patch
- text/x-patch attachment: 0008-Incrementing-datap-has-no-effect-here-it-isn-t-read-.patch
- text/x-patch attachment: 0009-No-need-to-set-timeout_ms-to-0-if-it-s-overwritten-r.patch
- text/x-patch attachment: 0010-Fix-dead-store.-Either-the-done-1-or-the-break-are-e.patch
- application/pgp-signature attachment: signature.asc