silence multiple data conversion warnings

This commit is contained in:
Marc Hoersken 2014-12-15 12:23:43 +01:00
parent 637c90959b
commit 8f799f98d9
9 changed files with 21 additions and 18 deletions

View File

@ -1622,7 +1622,7 @@ libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel,
int rc; int rc;
if(!channel) if(!channel)
return LIBSSH2_ERROR_BAD_USE; return (unsigned long)LIBSSH2_ERROR_BAD_USE;
BLOCK_ADJUST(rc, channel->session, BLOCK_ADJUST(rc, channel->session,
_libssh2_channel_receive_window_adjust(channel, adj, _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" "Setting channel %lu/%lu handle_extended_data"
" mode to %d", " mode to %d",
channel->local.id, channel->remote.id, ignore_mode); 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; channel->extData2_state = libssh2_NB_state_created;
} }

View File

@ -75,7 +75,8 @@ libssh2_keepalive_send (LIBSSH2_SESSION *session,
size_t len = sizeof (keepalive_data) - 1; size_t len = sizeof (keepalive_data) - 1;
int rc; 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); rc = _libssh2_transport_send(session, keepalive_data, len, NULL, 0);
/* Silently ignore PACKET_EAGAIN here: if the write buffer is /* Silently ignore PACKET_EAGAIN here: if the write buffer is
@ -90,8 +91,8 @@ libssh2_keepalive_send (LIBSSH2_SESSION *session,
if (seconds_to_next) if (seconds_to_next)
*seconds_to_next = session->keepalive_interval; *seconds_to_next = session->keepalive_interval;
} else if (seconds_to_next) { } else if (seconds_to_next) {
*seconds_to_next = (int) session->keepalive_last_sent *seconds_to_next = (int) (session->keepalive_last_sent - now)
+ session->keepalive_interval - now; + session->keepalive_interval;
} }
return 0; return 0;

View File

@ -266,15 +266,15 @@ libssh2_base64_decode(LIBSSH2_SESSION *session, char **data,
continue; continue;
switch (i % 4) { switch (i % 4) {
case 0: case 0:
d[len] = v << 2; d[len] = (unsigned char)(v << 2);
break; break;
case 1: case 1:
d[len++] |= v >> 4; d[len++] |= v >> 4;
d[len] = v << 4; d[len] = (unsigned char)(v << 4);
break; break;
case 2: case 2:
d[len++] |= v >> 2; d[len++] |= v >> 2;
d[len] = v << 6; d[len] = (unsigned char)(v << 6);
break; break;
case 3: case 3:
d[len++] |= v; 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 */ unsigned __int64 ns100; /*time since 1 Jan 1601 in 100ns units */
FILETIME ft; FILETIME ft;
} _now; } _now;
(void)tzp;
if(tp) if(tp)
{ {
GetSystemTimeAsFileTime (&_now.ft); GetSystemTimeAsFileTime (&_now.ft);

View File

@ -1157,8 +1157,7 @@ _libssh2_packet_burn(LIBSSH2_SESSION * session,
{ {
unsigned char *data; unsigned char *data;
size_t data_len; size_t data_len;
unsigned char all_packets[255]; unsigned char i, all_packets[255];
int i;
int ret; int ret;
if (*state == libssh2_NB_state_idle) { 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 */ /* Be lazy, let packet_ask pull it out of the brigade */
if (0 == 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 */ /* Smoke 'em if you got 'em */
LIBSSH2_FREE(session, data); LIBSSH2_FREE(session, data);
*state = libssh2_NB_state_idle; *state = libssh2_NB_state_idle;

View File

@ -727,7 +727,7 @@ scp_recv(LIBSSH2_SESSION * session, const char *path, struct stat * sb)
sb->st_mtime = session->scpRecv_mtime; sb->st_mtime = session->scpRecv_mtime;
sb->st_atime = session->scpRecv_atime; sb->st_atime = session->scpRecv_atime;
sb->st_size = session->scpRecv_size; 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; session->scpRecv_state = libssh2_NB_state_idle;

View File

@ -1618,7 +1618,7 @@ static ssize_t sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer,
filename_len = real_filename_len; filename_len = real_filename_len;
if (filename_len >= buffer_maxlen) { if (filename_len >= buffer_maxlen) {
filename_len = LIBSSH2_ERROR_BUFFER_TOO_SMALL; filename_len = (size_t)LIBSSH2_ERROR_BUFFER_TOO_SMALL;
goto end; goto end;
} }
@ -1633,7 +1633,7 @@ static ssize_t sftp_readdir(LIBSSH2_SFTP_HANDLE *handle, char *buffer,
longentry_len = real_longentry_len; longentry_len = real_longentry_len;
if (longentry_len >= longentry_maxlen) { if (longentry_len >= longentry_maxlen) {
filename_len = LIBSSH2_ERROR_BUFFER_TOO_SMALL; filename_len = (size_t)LIBSSH2_ERROR_BUFFER_TOO_SMALL;
goto end; goto end;
} }

View File

@ -829,7 +829,7 @@ int _libssh2_transport_send(LIBSSH2_SESSION *session,
the MAC and the packet_length field itself */ the MAC and the packet_length field itself */
_libssh2_htonu32(p->outbuf, packet_length - 4); _libssh2_htonu32(p->outbuf, packet_length - 4);
/* store padding_length */ /* store padding_length */
p->outbuf[4] = padding_length; p->outbuf[4] = (unsigned char)padding_length;
/* fill the padding area with random junk */ /* fill the padding area with random junk */
_libssh2_random(p->outbuf + 5 + data_len, padding_length); _libssh2_random(p->outbuf + 5 + data_len, padding_length);

View File

@ -216,7 +216,8 @@ userauth_password(LIBSSH2_SESSION *session,
* chgpwdbool(1) + password_len(4) */ * chgpwdbool(1) + password_len(4) */
session->userauth_pswd_data_len = username_len + 40; 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 /* TODO: remove this alloc with a fixed buffer in the session
struct */ struct */

View File

@ -1278,7 +1278,8 @@ _libssh2_wincng_pub_priv_keyfile(LIBSSH2_SESSION *session,
unsigned char *pbEncoded, **rpbDecoded; unsigned char *pbEncoded, **rpbDecoded;
unsigned long cbEncoded, *rcbDecoded; unsigned long cbEncoded, *rcbDecoded;
unsigned char *key = NULL, *mth = NULL; 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; int ret;
ret = _libssh2_wincng_load_private(session, privatekey, passphrase, ret = _libssh2_wincng_load_private(session, privatekey, passphrase,