mirror of
https://github.com/libssh2/libssh2.git
synced 2025-11-20 02:42:09 +03:00
windows: fix clang and WinCNG warnings
Fix these categories of warning: - in `wincng.c` disagreement in signed/unsigned char when passing around the passphrase string: `warning: pointer targets in passing argument [...] differ in signedness [-Wpointer-sign]` Fixed by using `const unsigned char *` in all static functions and applying/updating casts as necessary. - in each use of `libssh2_*_init()` macros where the result is not used: `warning: value computed is not used [-Wunused-value]` Fixed by using `(void)` casts. - `channel.c:1171:7: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]` Fixed by initializing this variable with `LIBSSH2_ERROR_CHANNEL_UNKNOWN`. While there I replaced a few 0 literals with `LIBSSH2_ERROR_NONE`. - in `sftp.c`, several of these two warnings: `warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized]` `warning: 'data_len' may be used uninitialized in this function [-Wmaybe-uninitialized]` Fixed by initializing these variables with NULL and 0 respectively. - Also removed the exec attribute from `wincng.h`. Notes: - There are many pre-existing checksrc issues. - The `sftp.c` and `channel.c` warnings may apply to other platforms as well. Closes #628
This commit is contained in:
12
src/kex.c
12
src/kex.c
@@ -78,7 +78,7 @@
|
||||
} \
|
||||
if(value) \
|
||||
while(len < (unsigned long)reqlen) { \
|
||||
libssh2_sha##digest_type##_init(&hash); \
|
||||
(void)libssh2_sha##digest_type##_init(&hash); \
|
||||
libssh2_sha##digest_type##_update(hash, \
|
||||
exchange_state->k_value, \
|
||||
exchange_state->k_value_len); \
|
||||
@@ -108,16 +108,16 @@
|
||||
static void _libssh2_sha_algo_ctx_init(int sha_algo, void *ctx)
|
||||
{
|
||||
if(sha_algo == 512) {
|
||||
libssh2_sha512_init((libssh2_sha512_ctx*)ctx);
|
||||
(void)libssh2_sha512_init((libssh2_sha512_ctx*)ctx);
|
||||
}
|
||||
else if(sha_algo == 384) {
|
||||
libssh2_sha384_init((libssh2_sha384_ctx*)ctx);
|
||||
(void)libssh2_sha384_init((libssh2_sha384_ctx*)ctx);
|
||||
}
|
||||
else if(sha_algo == 256) {
|
||||
libssh2_sha256_init((libssh2_sha256_ctx*)ctx);
|
||||
(void)libssh2_sha256_init((libssh2_sha256_ctx*)ctx);
|
||||
}
|
||||
else if(sha_algo == 1) {
|
||||
libssh2_sha1_init((libssh2_sha1_ctx*)ctx);
|
||||
(void)libssh2_sha1_init((libssh2_sha1_ctx*)ctx);
|
||||
}
|
||||
else {
|
||||
assert(0);
|
||||
@@ -1600,7 +1600,7 @@ kex_method_diffie_hellman_group_exchange_sha256_key_exchange
|
||||
{ \
|
||||
libssh2_sha##digest_type##_ctx ctx; \
|
||||
exchange_state->exchange_hash = (void *)&ctx; \
|
||||
libssh2_sha##digest_type##_init(&ctx); \
|
||||
(void)libssh2_sha##digest_type##_init(&ctx); \
|
||||
if(session->local.banner) { \
|
||||
_libssh2_htonu32(exchange_state->h_sig_comp, \
|
||||
strlen((char *) session->local.banner) - 2); \
|
||||
|
||||
Reference in New Issue
Block a user