From 036bb51421126ed252e0c8aa1e9f139a22ff0482 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 21 Dec 2006 14:20:20 +0000 Subject: [PATCH] fix compiler warnings --- src/kex.c | 28 ++++++++++++++++++---------- src/mac.c | 2 ++ src/misc.c | 5 +++-- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/kex.c b/src/kex.c index 1879e3e..9b3fd48 100644 --- a/src/kex.c +++ b/src/kex.c @@ -235,18 +235,22 @@ static int libssh2_kex_method_diffie_hellman_groupGP_sha1_key_exchange(LIBSSH2_S SHA1_Init(&exchange_hash); if (session->local.banner) { - libssh2_htonu32(h_sig_comp, strlen(session->local.banner) - 2); - SHA1_Update(&exchange_hash, h_sig_comp, 4); - SHA1_Update(&exchange_hash, session->local.banner, strlen(session->local.banner) - 2); + libssh2_htonu32(h_sig_comp, + strlen((char *)session->local.banner) - 2); + SHA1_Update(&exchange_hash, h_sig_comp, 4); + SHA1_Update(&exchange_hash, (char *)session->local.banner, + strlen((char *)session->local.banner) - 2); } else { libssh2_htonu32(h_sig_comp, sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1); - SHA1_Update(&exchange_hash, h_sig_comp, 4); - SHA1_Update(&exchange_hash, LIBSSH2_SSH_DEFAULT_BANNER, sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1); + SHA1_Update(&exchange_hash, h_sig_comp, 4); + SHA1_Update(&exchange_hash, LIBSSH2_SSH_DEFAULT_BANNER, + sizeof(LIBSSH2_SSH_DEFAULT_BANNER) - 1); } - libssh2_htonu32(h_sig_comp, strlen(session->remote.banner)); - SHA1_Update(&exchange_hash, h_sig_comp, 4); - SHA1_Update(&exchange_hash, session->remote.banner, strlen(session->remote.banner)); + libssh2_htonu32(h_sig_comp, strlen((char *)session->remote.banner)); + SHA1_Update(&exchange_hash, h_sig_comp, 4); + SHA1_Update(&exchange_hash, session->remote.banner, + strlen((char *)session->remote.banner)); libssh2_htonu32(h_sig_comp, session->local.kexinit_len); SHA1_Update(&exchange_hash, h_sig_comp, 4); @@ -998,7 +1002,10 @@ static int libssh2_kex_agree_kex_hostkey(LIBSSH2_SESSION *session, unsigned char /* {{{ libssh2_kex_agree_crypt * Agree on a cipher algo */ -static int libssh2_kex_agree_crypt(LIBSSH2_SESSION *session, libssh2_endpoint_data *endpoint, unsigned char *crypt, unsigned long crypt_len) +static int libssh2_kex_agree_crypt(LIBSSH2_SESSION *session, + libssh2_endpoint_data *endpoint, + unsigned char *crypt, + unsigned long crypt_len) { LIBSSH2_CRYPT_METHOD **cryptp = libssh2_crypt_methods(); unsigned char *s; @@ -1011,7 +1018,8 @@ static int libssh2_kex_agree_crypt(LIBSSH2_SESSION *session, libssh2_endpoint_da int method_len = (p ? (p - s) : strlen(s)); if (libssh2_kex_agree_instr(crypt, crypt_len, s, method_len)) { - LIBSSH2_CRYPT_METHOD *method = (LIBSSH2_CRYPT_METHOD*)libssh2_get_method_by_name(s, method_len, (LIBSSH2_COMMON_METHOD**)cryptp); + LIBSSH2_CRYPT_METHOD *method = + (LIBSSH2_CRYPT_METHOD*)libssh2_get_method_by_name(s, method_len, (LIBSSH2_COMMON_METHOD**)cryptp); if (!method) { /* Invalid method -- Should never be reached */ diff --git a/src/mac.c b/src/mac.c index 90471e8..551d994 100644 --- a/src/mac.c +++ b/src/mac.c @@ -68,6 +68,7 @@ static int libssh2_mac_method_common_init(LIBSSH2_SESSION *session, unsigned cha { *abstract = key; *free_key = 0; + (void)session; return 0; } @@ -96,6 +97,7 @@ static int libssh2_mac_method_hmac_sha1_hash(LIBSSH2_SESSION *session, unsigned { HMAC_CTX ctx; unsigned char seqno_buf[4]; + (void)session; libssh2_htonu32(seqno_buf, seqno); diff --git a/src/misc.c b/src/misc.c index 040048c..12e4d00 100644 --- a/src/misc.c +++ b/src/misc.c @@ -133,12 +133,13 @@ LIBSSH2_API int libssh2_base64_decode(LIBSSH2_SESSION *session, char **data, uns short v; int i = 0, len = 0; - *data = d = LIBSSH2_ALLOC(session, (3 * src_len / 4) + 1); + *data = LIBSSH2_ALLOC(session, (3 * src_len / 4) + 1); + d = (unsigned char *)*data; if (!d) { return -1; } - for(s = src; ((char*)s) < (src + src_len); s++) { + for(s = (unsigned char *)src; ((char*)s) < (src + src_len); s++) { if ((v = libssh2_base64_reverse_table[*s]) < 0) continue; switch (i % 4) { case 0: