From 00cdcc2df71e2538f2ee9e43041868833cacead4 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Thu, 18 Apr 2019 19:09:13 +0200 Subject: [PATCH] global: fix Windows warnings --- src/agent.c | 4 ++-- src/bcrypt_pbkdf.c | 2 +- src/channel.c | 2 +- src/userauth.c | 4 ++-- src/userauth.h | 4 ++-- src/wincng.c | 9 ++++----- src/wincng.h | 4 ++-- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/agent.c b/src/agent.c index 07400fb80e..faff04204e 100644 --- a/src/agent.c +++ b/src/agent.c @@ -290,7 +290,7 @@ agent_transact_pageant(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx) HANDLE filemap; unsigned char *p; unsigned char *p2; - int id; + LRESULT id; COPYDATASTRUCT cds; if(!transctx || 4 + transctx->request_len > PAGEANT_MAX_MSGLEN) @@ -322,7 +322,7 @@ agent_transact_pageant(LIBSSH2_AGENT *agent, agent_transaction_ctx_t transctx) transctx->request_len); cds.dwData = PAGEANT_COPYDATA_ID; - cds.cbData = 1 + strlen(mapname); + cds.cbData = (DWORD)(1 + strlen(mapname)); cds.lpData = mapname; id = SendMessage(hwnd, WM_COPYDATA, (WPARAM) NULL, (LPARAM) &cds); diff --git a/src/bcrypt_pbkdf.c b/src/bcrypt_pbkdf.c index f9a9758014..eaa1d2c56a 100644 --- a/src/bcrypt_pbkdf.c +++ b/src/bcrypt_pbkdf.c @@ -65,7 +65,7 @@ bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out) uint32_t cdata[BCRYPT_BLOCKS]; int i; uint16_t j; - size_t shalen = SHA512_DIGEST_LENGTH; + uint16_t shalen = SHA512_DIGEST_LENGTH; /* key expansion */ Blowfish_initstate(&state); diff --git a/src/channel.c b/src/channel.c index 6e1d0a7bef..985b23cf32 100644 --- a/src/channel.c +++ b/src/channel.c @@ -470,7 +470,7 @@ channel_forward_listen(LIBSSH2_SESSION * session, const char *host, host = "0.0.0.0"; if(session->fwdLstn_state == libssh2_NB_state_idle) { - session->fwdLstn_host_len = strlen(host); + session->fwdLstn_host_len = (uint32_t)strlen(host); /* 14 = packet_type(1) + request_len(4) + want_replay(1) + host_len(4) + port(4) */ session->fwdLstn_packet_len = diff --git a/src/userauth.c b/src/userauth.c index 949dc1c660..0c2bef0f30 100644 --- a/src/userauth.c +++ b/src/userauth.c @@ -1080,9 +1080,9 @@ libssh2_userauth_hostbased_fromfile_ex(LIBSSH2_SESSION *session, int _libssh2_userauth_publickey(LIBSSH2_SESSION *session, const char *username, - unsigned int username_len, + size_t username_len, const unsigned char *pubkeydata, - unsigned long pubkeydata_len, + size_t pubkeydata_len, LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC ((*sign_callback)), void *abstract) diff --git a/src/userauth.h b/src/userauth.h index a7b0a9846e..a1a2c36d9b 100644 --- a/src/userauth.h +++ b/src/userauth.h @@ -41,9 +41,9 @@ int _libssh2_userauth_publickey(LIBSSH2_SESSION *session, const char *username, - unsigned int username_len, + size_t username_len, const unsigned char *pubkeydata, - unsigned long pubkeydata_len, + size_t pubkeydata_len, LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC ((*sign_callback)), void *abstract); diff --git a/src/wincng.c b/src/wincng.c index c078ab2b1a..3d53b8453c 100755 --- a/src/wincng.c +++ b/src/wincng.c @@ -561,7 +561,7 @@ _libssh2_wincng_load_pem(LIBSSH2_SESSION *session, } ret = _libssh2_pem_parse(session, headerbegin, headerend, - passphrase, + (unsigned char *)passphrase, fp, data, datalen); fclose(fp); @@ -1879,7 +1879,7 @@ _libssh2_wincng_bignum_new(void) } static int -_libssh2_wincng_bignum_resize(_libssh2_bn *bn, unsigned long length) +_libssh2_wincng_bignum_resize(_libssh2_bn *bn, size_t length) { unsigned char *bignum; @@ -1909,7 +1909,7 @@ static int _libssh2_wincng_bignum_rand(_libssh2_bn *rnd, int bits, int top, int bottom) { unsigned char *bignum; - unsigned long length; + size_t length; if(!rnd) return -1; @@ -2071,8 +2071,7 @@ _libssh2_wincng_bignum_bits(const _libssh2_bn *bn) } _libssh2_bn * -_libssh2_wincng_bignum_new_from_bin(unsigned long len, - const void *bin) +_libssh2_wincng_bignum_new_from_bin(size_t len, const void *bin) { _libssh2_bn *bn = _libssh2_bn_new(); unsigned char *bignum; diff --git a/src/wincng.h b/src/wincng.h index 5d6a19ead7..5df07610db 100755 --- a/src/wincng.h +++ b/src/wincng.h @@ -364,7 +364,7 @@ struct _libssh2_wincng_bignum { */ _libssh2_bn *_libssh2_wincng_bignum_new(void); -_libssh2_bn *_libssh2_wincng_bignum_new_from_bin(unsigned long len, +_libssh2_bn *_libssh2_wincng_bignum_new_from_bin(size_t len, const void *val); #define _libssh2_bn_new() \ @@ -553,7 +553,7 @@ _libssh2_wincng_bignum_set_word(_libssh2_bn *bn, unsigned long word); unsigned long _libssh2_wincng_bignum_bits(const _libssh2_bn *bn); void -_libssh2_wincng_bignum_from_bin(_libssh2_bn *bn, unsigned long len, +_libssh2_wincng_bignum_from_bin(_libssh2_bn *bn, size_t len, const unsigned char *bin); void _libssh2_wincng_bignum_to_bin(const _libssh2_bn *bn, unsigned char *bin);