pass in unsigned ints for u32 values and not longs

This commit is contained in:
Daniel Stenberg 2009-03-19 12:54:58 +00:00
parent 468272d648
commit 26b65e06b1
2 changed files with 6 additions and 5 deletions

View File

@ -1130,9 +1130,9 @@ _libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...)
void _libssh2_session_shutdown(LIBSSH2_SESSION * session); void _libssh2_session_shutdown(LIBSSH2_SESSION * session);
unsigned long _libssh2_ntohu32(const unsigned char *buf); unsigned int _libssh2_ntohu32(const unsigned char *buf);
libssh2_uint64_t _libssh2_ntohu64(const unsigned char *buf); libssh2_uint64_t _libssh2_ntohu64(const unsigned char *buf);
void _libssh2_htonu32(unsigned char *buf, unsigned long val); void _libssh2_htonu32(unsigned char *buf, unsigned int val);
void _libssh2_htonu64(unsigned char *buf, libssh2_uint64_t val); void _libssh2_htonu64(unsigned char *buf, libssh2_uint64_t val);
#ifdef WIN32 #ifdef WIN32

View File

@ -112,7 +112,7 @@ _libssh2_send(int socket, const void *buffer, size_t length, int flags)
/* libssh2_ntohu32 /* libssh2_ntohu32
*/ */
unsigned long unsigned int
_libssh2_ntohu32(const unsigned char *buf) _libssh2_ntohu32(const unsigned char *buf)
{ {
return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
@ -135,7 +135,7 @@ _libssh2_ntohu64(const unsigned char *buf)
/* libssh2_htonu32 /* libssh2_htonu32
*/ */
void void
_libssh2_htonu32(unsigned char *buf, unsigned long value) _libssh2_htonu32(unsigned char *buf, unsigned int value)
{ {
buf[0] = (value >> 24) & 0xFF; buf[0] = (value >> 24) & 0xFF;
buf[1] = (value >> 16) & 0xFF; buf[1] = (value >> 16) & 0xFF;
@ -234,7 +234,8 @@ libssh2_base64_decode(LIBSSH2_SESSION * session, char **data,
i++; i++;
} }
if ((i % 4) == 1) { if ((i % 4) == 1) {
/* Invalid -- We have a byte which belongs exclusively to a partial octet */ /* Invalid -- We have a byte which belongs exclusively to a partial
octet */
LIBSSH2_FREE(session, *data); LIBSSH2_FREE(session, *data);
return -1; return -1;
} }