cURL / Mailing Lists / curl-library / Single Mail

curl-library

Patches for a couple of clang warnings

From: Fabian Keil <freebsd-listen_at_fabiankeil.de>
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

Received on 2009-06-06