From f390c8e02d9929df83c459a849b9fd8d565dd805 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 27 Mar 2009 07:03:00 +0000 Subject: [PATCH] fix comments, moved to htonu64 function to sftp.c and made it static --- src/kex.c | 2 -- src/libssh2_priv.h | 1 - src/misc.c | 24 ++---------------------- src/session.c | 2 ++ src/sftp.c | 18 ++++++++++++++++++ 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/kex.c b/src/kex.c index a377e7a..caf01a5 100644 --- a/src/kex.c +++ b/src/kex.c @@ -1166,8 +1166,6 @@ static int kexinit(LIBSSH2_SESSION * session) return 0; } -/* }}} */ - /* kex_agree_instr * Kex specific variant of strstr() * Needle must be preceed by BOL or ',', and followed by ',' or EOL diff --git a/src/libssh2_priv.h b/src/libssh2_priv.h index b62e3c1..50e4c88 100644 --- a/src/libssh2_priv.h +++ b/src/libssh2_priv.h @@ -1137,7 +1137,6 @@ void _libssh2_session_shutdown(LIBSSH2_SESSION * session); unsigned int _libssh2_ntohu32(const unsigned char *buf); libssh2_uint64_t _libssh2_ntohu64(const unsigned char *buf); void _libssh2_htonu32(unsigned char *buf, unsigned int val); -void _libssh2_htonu64(unsigned char *buf, libssh2_uint64_t val); #ifdef WIN32 ssize_t _libssh2_recv(int socket, void *buffer, size_t length, int flags); diff --git a/src/misc.c b/src/misc.c index 4954a39..588ad16 100644 --- a/src/misc.c +++ b/src/misc.c @@ -115,7 +115,7 @@ _libssh2_ntohu32(const unsigned char *buf) } -/* libssh2_ntohu64 +/* _libssh2_ntohu64 */ libssh2_uint64_t _libssh2_ntohu64(const unsigned char *buf) @@ -128,7 +128,7 @@ _libssh2_ntohu64(const unsigned char *buf) return ((libssh2_uint64_t)msl <<32) | lsl; } -/* libssh2_htonu32 +/* _libssh2_htonu32 */ void _libssh2_htonu32(unsigned char *buf, unsigned int value) @@ -139,24 +139,6 @@ _libssh2_htonu32(unsigned char *buf, unsigned int value) buf[3] = value & 0xFF; } -/* libssh2_htonu64 - */ -void -_libssh2_htonu64(unsigned char *buf, libssh2_uint64_t value) -{ - unsigned long msl = ((libssh2_uint64_t)value >> 32); - - buf[0] = (msl >> 24) & 0xFF; - buf[1] = (msl >> 16) & 0xFF; - buf[2] = (msl >> 8) & 0xFF; - buf[3] = msl & 0xFF; - - buf[4] = (value >> 24) & 0xFF; - buf[5] = (value >> 16) & 0xFF; - buf[6] = (value >> 8) & 0xFF; - buf[7] = value & 0xFF; -} - /* Base64 Conversion */ static const char base64_table[] = @@ -240,8 +222,6 @@ libssh2_base64_decode(LIBSSH2_SESSION * session, char **data, return 0; } -/* }}} */ - #ifdef LIBSSH2DEBUG LIBSSH2_API int libssh2_trace(LIBSSH2_SESSION * session, int bitmask) diff --git a/src/session.c b/src/session.c index 8bd72bb..6b5fb16 100644 --- a/src/session.c +++ b/src/session.c @@ -51,6 +51,8 @@ #include #endif +#include "transport.h" + /* libssh2_default_alloc */ static diff --git a/src/sftp.c b/src/sftp.c index b7ec4a7..d1b7102 100644 --- a/src/sftp.c +++ b/src/sftp.c @@ -83,6 +83,24 @@ /* S_IFDIR */ #define LIBSSH2_SFTP_ATTR_PFILETYPE_DIR 0040000 +/* libssh2_htonu64 + */ +static void +_libssh2_htonu64(unsigned char *buf, libssh2_uint64_t value) +{ + unsigned long msl = ((libssh2_uint64_t)value >> 32); + + buf[0] = (msl >> 24) & 0xFF; + buf[1] = (msl >> 16) & 0xFF; + buf[2] = (msl >> 8) & 0xFF; + buf[3] = msl & 0xFF; + + buf[4] = (value >> 24) & 0xFF; + buf[5] = (value >> 16) & 0xFF; + buf[6] = (value >> 8) & 0xFF; + buf[7] = value & 0xFF; +} + /* * sftp_packet_add *