From 26b65e06b1da7a72682b222a2fb4b8099039fdbe Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 19 Mar 2009 12:54:58 +0000 Subject: [PATCH] pass in unsigned ints for u32 values and not longs --- src/libssh2_priv.h | 4 ++-- src/misc.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index 0898f25d..6c8785b5 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -1130,9 +1130,9 @@ _libssh2_debug(LIBSSH2_SESSION * session, int context, const char *format, ...) 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); -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); #ifdef WIN32 diff --git a/src/misc.c b/src/misc.c index c09a4b9b..445efcc9 100644 --- a/src/misc.c +++ b/src/misc.c @@ -112,7 +112,7 @@ _libssh2_send(int socket, const void *buffer, size_t length, int flags) /* libssh2_ntohu32 */ -unsigned long +unsigned int _libssh2_ntohu32(const unsigned char *buf) { return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; @@ -135,7 +135,7 @@ _libssh2_ntohu64(const unsigned char *buf) /* libssh2_htonu32 */ void -_libssh2_htonu32(unsigned char *buf, unsigned long value) +_libssh2_htonu32(unsigned char *buf, unsigned int value) { buf[0] = (value >> 24) & 0xFF; buf[1] = (value >> 16) & 0xFF; @@ -234,7 +234,8 @@ libssh2_base64_decode(LIBSSH2_SESSION * session, char **data, i++; } 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); return -1; }