Subject: Compiler warnings with VC++ and 1.2.4

Compiler warnings with VC++ and 1.2.4

From: Neil Gierman <ngierman_at_roadrunn.com>
Date: Sat, 13 Feb 2010 20:16:37 -0600

I just grabbed the 1.2.4 source and compiled it. I am getting some compiler
warnings where I didn't use to. The patch below makes the warnings go away
(not sure about my scp changes).

Index: include/libssh2.h
===================================================================
--- include/libssh2.h (revision 16504)
+++ include/libssh2.h (working copy)
@@ -84,6 +84,13 @@
 typedef long long libssh2_int64_t;
 #endif
 
+#ifdef WIN32
+typedef SOCKET libssh2_socket_t;
+#else /* !WIN32 */
+typedef int libssh2_socket_t;
+#define INVALID_SOCKET -1
+#endif /* WIN32 */
+
 /* We use underscore instead of dash when appending DEV in dev versions
just
    to make the BANNER define (used by src/session.c) be a valid SSH
    banner. Release versions have no appended strings and may of course not
@@ -253,7 +260,7 @@
     unsigned char type; /* LIBSSH2_POLLFD_* below */
 
     union {
- int socket; /* File descriptors -- examined with system select()
call */
+ libssh2_socket_t socket; /* File descriptors -- examined with
system select() call */
         LIBSSH2_CHANNEL *channel; /* Examined by checking internal state */
         LIBSSH2_LISTENER *listener; /* Read polls only -- are inbound
                                        connections waiting to be accepted?
*/
Index: src/libssh2_priv.h
===================================================================
--- src/libssh2_priv.h (revision 16504)
+++ src/libssh2_priv.h (working copy)
@@ -886,7 +886,7 @@
     unsigned long scpRecv_command_len;
     unsigned char scpRecv_response[LIBSSH2_SCP_RESPONSE_BUFLEN];
     unsigned long scpRecv_response_len;
- long scpRecv_mode;
+ unsigned short scpRecv_mode;
 #if defined(HAVE_LONGLONG) && defined(HAVE_STRTOLL)
     /* we have the type and we can parse such numbers */
     long long scpRecv_size;
Index: src/scp.c
===================================================================
--- src/scp.c (revision 16504)
+++ src/scp.c (working copy)
@@ -686,7 +686,7 @@
                 *(p++) = '\0';
                 /* Make sure we don't get fooled by leftover values */
                 errno = 0;
- session->scpRecv_mode = strtol(s, &e, 8);
+ session->scpRecv_mode = (unsigned short)strtol(s, &e, 8);
                 if ((e && *e) || errno) {
                     libssh2_error(session, LIBSSH2_ERROR_SCP_PROTOCOL,
                                   "Invalid response from SCP server,
invalid mode",

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2010-02-14