[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libssh 0.8.4 MSVC Windows build issue


On Wednesday, 17 October 2018 14:59:26 CEST Wolf Wolfswinkel wrote:
> #include <BaseTsd.h>

Then the attached patch should be the correct patch. Thanks for your help 
addressing this issue!


	Andreas

-- 
Andreas Schneider                 asn@xxxxxxxxxxxxxx
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
From dcc43f4f7903e5a88ac64e6300376c63236be448 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@xxxxxxxxxxxxxx>
Date: Tue, 16 Oct 2018 15:44:12 +0200
Subject: [PATCH] priv: Add ssize_t if not available with MSVC

Fixes T113

Signed-off-by: Andreas Schneider <asn@xxxxxxxxxxxxxx>
---
 include/libssh/priv.h |  8 ++++++++
 include/libssh/sftp.h | 11 ++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 31abb106..e5ba96fe 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -29,6 +29,7 @@
 #ifndef _LIBSSH_PRIV_H
 #define _LIBSSH_PRIV_H
 
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -128,6 +129,13 @@ char *strndup(const char *s, size_t n);
 #   endif /* HAVE__VSNPRINTF */
 #  endif /* HAVE__VSNPRINTF_S */
 
+#  ifndef _SSIZE_T_DEFINED
+#   undef ssize_t
+#   include <BaseTsd.h>
+    typedef _W64 SSIZE_T ssize_t;
+#   define _SSIZE_T_DEFINED
+#  endif /* _SSIZE_T_DEFINED */
+
 # endif /* _MSC_VER */
 
 struct timeval;
diff --git a/include/libssh/sftp.h b/include/libssh/sftp.h
index b18bdc48..21512bce 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -53,9 +53,14 @@ extern "C" {
   typedef uint32_t gid_t;
 #endif /* gid_t */
 #ifdef _MSC_VER
-#ifndef ssize_t
-  typedef _W64 SSIZE_T ssize_t;
-#endif /* ssize_t */
+
+# ifndef _SSIZE_T_DEFINED
+#  undef ssize_t
+#  include <BaseTsd.h>
+   typedef _W64 SSIZE_T ssize_t;
+#  define _SSIZE_T_DEFINED
+# endif /* _SSIZE_T_DEFINED */
+
 #endif /* _MSC_VER */
 #endif /* _WIN32 */
 
-- 
2.19.1


Follow-Ups:
RE: libssh 0.8.4 MSVC Windows build issueWolf Wolfswinkel <wolf.wolfswinkel@xxxxxxxxxxxxx>
References:
libssh 0.8.4 MSVC Windows build issueWolf Wolfswinkel <wolf.wolfswinkel@xxxxxxxxxxxxx>
Re: libssh 0.8.4 MSVC Windows build issueAndreas Schneider <asn@xxxxxxxxxxxxxx>
RE: libssh 0.8.4 MSVC Windows build issueWolf Wolfswinkel <wolf.wolfswinkel@xxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org