summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcel Raad <Marcel.Raad@teamviewer.com>2019-04-05 19:57:29 +0200
committerMarcel Raad <Marcel.Raad@teamviewer.com>2019-04-11 21:08:44 +0200
commitd1b5cf830bfe169745721b21245d2217d2c2453e (patch)
tree3f230490e3ba67789b84f94aebac29370b81092f /src
parentbb0b10135caf58f82ee9e9d38f400880a7e5c9cc (diff)
downloadcurl-d1b5cf830bfe169745721b21245d2217d2c2453e.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/tool_cb_prg.c2
-rw-r--r--src/tool_cb_wrt.c2
-rw-r--r--src/tool_doswin.c1
-rw-r--r--src/tool_main.c4
-rw-r--r--src/tool_metalink.c4
5 files changed, 6 insertions, 7 deletions
diff --git a/src/tool_cb_prg.c b/src/tool_cb_prg.c
index 0539e9895..e2ee54225 100644
--- a/src/tool_cb_prg.c
+++ b/src/tool_cb_prg.c
@@ -221,7 +221,7 @@ void progressbarinit(struct ProgressData *bar,
struct winsize ts;
if(!ioctl(STDIN_FILENO, TIOCGWINSZ, &ts))
cols = ts.ws_col;
-#elif defined(_WIN32)
+#elif defined(WIN32)
{
HANDLE stderr_hnd = GetStdHandle(STD_ERROR_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO console_info;
diff --git a/src/tool_cb_wrt.c b/src/tool_cb_wrt.c
index f403ab34c..2f699f326 100644
--- a/src/tool_cb_wrt.c
+++ b/src/tool_cb_wrt.c
@@ -159,7 +159,7 @@ size_t tool_write_cb(char *buffer, size_t sz, size_t nmemb, void *userdata)
}
}
-#ifdef _WIN32
+#ifdef WIN32
fhnd = _get_osfhandle(fileno(outs->stream));
if(isatty(fileno(outs->stream)) &&
GetConsoleScreenBufferInfo((HANDLE)fhnd, &console_info)) {
diff --git a/src/tool_doswin.c b/src/tool_doswin.c
index 8b5bdadaf..779a3cb8f 100644
--- a/src/tool_doswin.c
+++ b/src/tool_doswin.c
@@ -599,7 +599,6 @@ SANITIZEcode rename_if_reserved_dos_device_name(char **const sanitized,
}
memmove(base + 1, base, blen + 1);
base[0] = '_';
- ++blen;
}
}
#endif
diff --git a/src/tool_main.c b/src/tool_main.c
index 5679f361e..7d1e62b79 100644
--- a/src/tool_main.c
+++ b/src/tool_main.c
@@ -237,7 +237,7 @@ static void main_free(struct GlobalConfig *config)
config->last = NULL;
}
-#ifdef _WIN32
+#ifdef WIN32
/* TerminalSettings for Windows */
static struct TerminalSettings {
HANDLE hStdOut;
@@ -275,7 +275,7 @@ static void configure_terminal(void)
static void restore_terminal(void)
{
-#ifdef _WIN32
+#ifdef WIN32
/* Restore Console output mode and codepage to whatever they were
* when Curl started */
SetConsoleMode(TerminalSettings.hStdOut, TerminalSettings.dwOutputMode);
diff --git a/src/tool_metalink.c b/src/tool_metalink.c
index 4c4261472..28aa71707 100644
--- a/src/tool_metalink.c
+++ b/src/tool_metalink.c
@@ -73,7 +73,7 @@
and later. If you're building for an older cat, well, sorry. */
# define COMMON_DIGEST_FOR_OPENSSL
# include <CommonCrypto/CommonDigest.h>
-#elif defined(_WIN32)
+#elif defined(WIN32)
/* For Windows: If no other crypto library is provided, we fallback
to the hash functions provided within the Microsoft Windows CryptoAPI */
# include <wincrypt.h>
@@ -380,7 +380,7 @@ static void SHA256_Final(unsigned char digest[32], SHA256_CTX *ctx)
sha256_finish(ctx, digest);
}
-#elif defined(_WIN32)
+#elif defined(WIN32)
static void win32_crypto_final(struct win32_crypto_hash *ctx,
unsigned char *digest,