From d1b5cf830bfe169745721b21245d2217d2c2453e Mon Sep 17 00:00:00 2001 From: Marcel Raad Date: Fri, 5 Apr 2019 19:57:29 +0200 Subject: build: fix Codacy/CppCheck warnings - remove unused variables - declare conditionally used variables conditionally - suppress unused variable warnings in the CMake tests - remove dead variable stores - consistently use WIN32 macro to detect Windows Closes https://github.com/curl/curl/pull/3739 --- lib/asyn-ares.c | 2 +- lib/if2ip.c | 7 +++++-- lib/md5.c | 2 +- lib/timeval.c | 2 ++ lib/version.c | 2 +- lib/vtls/gskit.c | 1 - 6 files changed, 10 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c index 5e6ba3dd8..fc107bc6b 100644 --- a/lib/asyn-ares.c +++ b/lib/asyn-ares.c @@ -68,7 +68,7 @@ #include "progress.h" # if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \ - (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) + (defined(WIN32) || defined(__SYMBIAN32__)) # define CARES_STATICLIB # endif # include diff --git a/lib/if2ip.c b/lib/if2ip.c index acbcff71e..6e27685a0 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -123,7 +123,9 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, char ipstr[64]; #ifdef ENABLE_IPV6 if(af == AF_INET6) { +#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID unsigned int scopeid = 0; +#endif unsigned int ifscope = Curl_ipv6_scope(iface->ifa_addr); if(ifscope != remote_scope) { @@ -149,9 +151,10 @@ if2ip_result_t Curl_if2ip(int af, unsigned int remote_scope, continue; } -#endif + if(scopeid) - msnprintf(scope, sizeof(scope), "%%%u", scopeid); + msnprintf(scope, sizeof(scope), "%%%u", scopeid); +#endif } else #endif diff --git a/lib/md5.c b/lib/md5.c index db4cc2656..e345065ea 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -124,7 +124,7 @@ static void MD5_Final(unsigned char digest[16], MD5_CTX *ctx) CC_MD5_Final(digest, ctx); } -#elif defined(_WIN32) && !defined(CURL_WINDOWS_APP) +#elif defined(WIN32) && !defined(CURL_WINDOWS_APP) #include #include "curl_memory.h" diff --git a/lib/timeval.c b/lib/timeval.c index ff8d8a69a..e2bd7fd14 100644 --- a/lib/timeval.c +++ b/lib/timeval.c @@ -66,7 +66,9 @@ struct curltime Curl_now(void) ** in any case the time starting point does not change once that the ** system has started up. */ +#ifdef HAVE_GETTIMEOFDAY struct timeval now; +#endif struct curltime cnow; struct timespec tsnow; diff --git a/lib/version.c b/lib/version.c index 9369ae8e3..4c885dc33 100644 --- a/lib/version.c +++ b/lib/version.c @@ -31,7 +31,7 @@ #ifdef USE_ARES # if defined(CURL_STATICLIB) && !defined(CARES_STATICLIB) && \ - (defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__)) + (defined(WIN32) || defined(__SYMBIAN32__)) # define CARES_STATICLIB # endif # include diff --git a/lib/vtls/gskit.c b/lib/vtls/gskit.c index c4afc8904..0498bf05f 100644 --- a/lib/vtls/gskit.c +++ b/lib/vtls/gskit.c @@ -1160,7 +1160,6 @@ static CURLcode gskit_connect_common(struct connectdata *conn, int sockindex, struct Curl_easy *data = conn->data; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; long timeout_ms; - Qso_OverlappedIO_t cstat; CURLcode result = CURLE_OK; *done = connssl->state == ssl_connection_complete; -- cgit v1.2.3