diff --git a/src/channel.c b/src/channel.c index d9dc072..6e4bd43 100644 --- a/src/channel.c +++ b/src/channel.c @@ -1622,7 +1622,7 @@ libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel, int rc; if(!channel) - return LIBSSH2_ERROR_BAD_USE; + return (unsigned long)LIBSSH2_ERROR_BAD_USE; BLOCK_ADJUST(rc, channel->session, _libssh2_channel_receive_window_adjust(channel, adj, @@ -1669,7 +1669,7 @@ _libssh2_channel_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode) "Setting channel %lu/%lu handle_extended_data" " mode to %d", channel->local.id, channel->remote.id, ignore_mode); - channel->remote.extended_data_ignore_mode = ignore_mode; + channel->remote.extended_data_ignore_mode = (char)ignore_mode; channel->extData2_state = libssh2_NB_state_created; } diff --git a/src/keepalive.c b/src/keepalive.c index 260206a..fd749dd 100644 --- a/src/keepalive.c +++ b/src/keepalive.c @@ -75,7 +75,8 @@ libssh2_keepalive_send (LIBSSH2_SESSION *session, size_t len = sizeof (keepalive_data) - 1; int rc; - keepalive_data[len - 1] = session->keepalive_want_reply; + keepalive_data[len - 1] = + (unsigned char)session->keepalive_want_reply; rc = _libssh2_transport_send(session, keepalive_data, len, NULL, 0); /* Silently ignore PACKET_EAGAIN here: if the write buffer is @@ -90,8 +91,8 @@ libssh2_keepalive_send (LIBSSH2_SESSION *session, if (seconds_to_next) *seconds_to_next = session->keepalive_interval; } else if (seconds_to_next) { - *seconds_to_next = (int) session->keepalive_last_sent - + session->keepalive_interval - now; + *seconds_to_next = (int) (session->keepalive_last_sent - now) + + session->keepalive_interval; } return 0; diff --git a/src/misc.c b/src/misc.c index 725f192..283daea 100644 --- a/src/misc.c +++ b/src/misc.c @@ -266,15 +266,15 @@ libssh2_base64_decode(LIBSSH2_SESSION *session, char **data, continue; switch (i % 4) { case 0: - d[len] = v << 2; + d[len] = (unsigned char)(v << 2); break; case 1: d[len++] |= v >> 4; - d[len] = v << 4; + d[len] = (unsigned char)(v << 4); break; case 2: d[len++] |= v >> 2; - d[len] = v << 6; + d[len] = (unsigned char)(v << 6); break; case 3: d[len++] |= v; @@ -605,7 +605,7 @@ int __cdecl _libssh2_gettimeofday(struct timeval *tp, void *tzp) unsigned __int64 ns100; /*time since 1 Jan 1601 in 100ns units */ FILETIME ft; } _now; - + (void)tzp; if(tp) { GetSystemTimeAsFileTime (&_now.ft); diff --git a/src/packet.c b/src/packet.c index 74e77df..8143993 100644 --- a/src/packet.c +++ b/src/packet.c @@ -1157,8 +1157,7 @@ _libssh2_packet_burn(LIBSSH2_SESSION * session, { unsigned char *data; size_t data_len; - unsigned char all_packets[255]; - int i; + unsigned char i, all_packets[255]; int ret; if (*state == libssh2_NB_state_idle) { @@ -1193,7 +1192,8 @@ _libssh2_packet_burn(LIBSSH2_SESSION * session, /* Be lazy, let packet_ask pull it out of the brigade */ if (0 == - _libssh2_packet_ask(session, ret, &data, &data_len, 0, NULL, 0)) { + _libssh2_packet_ask(session, (unsigned char)ret, + &data, &data_len, 0, NULL, 0)) { /* Smoke 'em if you got 'em */ LIBSSH2_FREE(session, data); *state = libssh2_NB_state_idle; diff --git a/src/scp.c b/src/scp.c index 1ccd3be..89f302b 100644 --- a/src/scp.c +++ b/src/scp.c @@ -727,7 +727,7 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, struct stat * sb) sb->st_mtime = session->scpRecv_mtime; sb->st_atime = session->scpRecv_atime; sb->st_size = session->scpRecv_size; - sb->st_mode = session->scpRecv_mode; + sb->st_mode = (unsigned short)session->scpRecv_mode; } session->scpRecv_state = libssh2_NB_state_idle; diff --git a/src/sftp.c b/src/sftp.c index 6c9856f..b0cd445 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -1618,7 +1618,7 @@ static ssize_t sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, filename_len = real_filename_len; if (filename_len >= buffer_maxlen) { - filename_len = LIBSSH2_ERROR_BUFFER_TOO_SMALL; + filename_len = (size_t)LIBSSH2_ERROR_BUFFER_TOO_SMALL; goto end; } @@ -1633,7 +1633,7 @@ static ssize_t sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer, longentry_len = real_longentry_len; if (longentry_len >= longentry_maxlen) { - filename_len = LIBSSH2_ERROR_BUFFER_TOO_SMALL; + filename_len = (size_t)LIBSSH2_ERROR_BUFFER_TOO_SMALL; goto end; } diff --git a/src/transport.c b/src/transport.c index 3d61f8d..5b3d66d 100644 --- a/src/transport.c +++ b/src/transport.c @@ -829,7 +829,7 @@ int _libssh2_transport_send(LIBSSH2_SESSION *session, the MAC and the packet_length field itself */ _libssh2_htonu32(p->outbuf, packet_length - 4); /* store padding_length */ - p->outbuf[4] = padding_length; + p->outbuf[4] = (unsigned char)padding_length; /* fill the padding area with random junk */ _libssh2_random(p->outbuf + 5 + data_len, padding_length); diff --git a/src/userauth.c b/src/userauth.c index ae16ff7..4b9a929 100644 --- a/src/userauth.c +++ b/src/userauth.c @@ -216,7 +216,8 @@ userauth_password(LIBSSH2_SESSION *session, * chgpwdbool(1) + password_len(4) */ session->userauth_pswd_data_len = username_len + 40; - session->userauth_pswd_data0 = ~SSH_MSG_USERAUTH_PASSWD_CHANGEREQ; + session->userauth_pswd_data0 = + (unsigned char) ~SSH_MSG_USERAUTH_PASSWD_CHANGEREQ; /* TODO: remove this alloc with a fixed buffer in the session struct */ diff --git a/src/wincng.c b/src/wincng.c index e7a4c4d..4a8aa16 100644 --- a/src/wincng.c +++ b/src/wincng.c @@ -1278,7 +1278,8 @@ _libssh2_wincng_pub_priv_keyfile(LIBSSH2_SESSION *session, unsigned char *pbEncoded, **rpbDecoded; unsigned long cbEncoded, *rcbDecoded; unsigned char *key = NULL, *mth = NULL; - unsigned long keylen, mthlen, index, offset, length; + unsigned long keylen = 0, mthlen = 0; + unsigned long index, offset, length; int ret; ret = _libssh2_wincng_load_private(session, privatekey, passphrase,