[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 10:01:33 CEST Wolf Wolfswinkel wrote:
> The patch works. Thank you.
> 
> It does lead to a warning though:
> 
> libssh-0.8.4\include\libssh\sftp.h(57): warning C4142: 'ssize_t': benign
> redefinition of type [libssh-0.8.4\build_win32\src\ssh_shared.vcxproj]
> libssh-0.8.4\include\libssh\priv.h(136): note: see declaration of 'ssize_t'

The attached updated patch should address this. Could you please give feedback 
if it works correctly now?


Thanks,


	Andreas

-- 
Andreas Schneider                 asn@xxxxxxxxxxxxxx
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D
From 1dc49beaf77c104c4054efaeb019f99334ee5b7d 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 |  7 +++++++
 include/libssh/sftp.h | 10 +++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 31abb106..12d359da 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,12 @@ char *strndup(const char *s, size_t n);
 #   endif /* HAVE__VSNPRINTF */
 #  endif /* HAVE__VSNPRINTF_S */
 
+#  ifndef _SSIZE_T_DEFINED
+#   undef ssize_t
+    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..44db729c 100644
--- a/include/libssh/sftp.h
+++ b/include/libssh/sftp.h
@@ -53,9 +53,13 @@ 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
+   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