Unverified Commit d1b5cf83 authored by Marcel Raad's avatar Marcel Raad
Browse files

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
parent bb0b1013
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -240,6 +240,7 @@ int main()
#ifndef inet_ntoa_r
  func_type func;
  func = (func_type)inet_ntoa_r;
  (void)func;
#endif
  return 0;
}
@@ -255,6 +256,7 @@ int main()
#ifndef inet_ntoa_r
  func_type func;
  func = (func_type)&inet_ntoa_r;
  (void)func;
#endif
  return 0;
}
@@ -582,7 +584,9 @@ int fun2(int arg1, int arg2) {
int
main() {
  int res3 = c99_vmacro3(1, 2, 3);
  (void)res3;
  int res2 = c99_vmacro2(1, 2);
  (void)res2;
  return 0;
}
#endif
+1 −1
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ typedef void CURLSH;

#ifdef CURL_STATICLIB
#  define CURL_EXTERN
#elif defined(WIN32) || defined(_WIN32) || defined(__SYMBIAN32__) || \
#elif defined(WIN32) || defined(__SYMBIAN32__) || \
     (__has_declspec_attribute(dllexport) && \
      __has_declspec_attribute(dllimport))
#  if defined(BUILDING_LIBCURL)
+1 −1
Original line number Diff line number Diff line
@@ -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 <ares.h>
+5 −2
Original line number Diff line number Diff line
@@ -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);
#endif
            }
            else
#endif
+1 −1
Original line number Diff line number Diff line
@@ -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 <wincrypt.h>
#include "curl_memory.h"
Loading