On Tuesday, 16 October 2018 15:14:31 CEST Wolf Wolfswinkel wrote:
> Hi,
>
> I am trying to upgrade from libssh 0.7.5 to 0.8.4.
>
> The 0.7.5 build used to work fine with VS2017, but with 0.8.4 it fails
> because 'ssize_t' is undefined (in connector.c). Does anyone recognize
> this?
>
> I ran cmake as
>
> cmake -G "Visual Studio 15 2017 Win64" -DWITH_ZLIB=OFF -DWITH_SERVER=OFF
> -DWITH_EXAMPLES=OFF
>
> Thanks,
>
> Wolf Wolfswinkel
Does the attached patch work for you?
Andreas
--
Andreas Schneider [email protected]
GPG-ID: 8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D>From 90c83864c852d5dc2c8f81ba29995abe01caa371 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <[email protected]>
Date: Tue, 16 Oct 2018 15:44:12 +0200
Subject: [PATCH] priv: Add ssize_t if not available with MSVC
Signed-off-by: Andreas Schneider <[email protected]>
---
include/libssh/priv.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 31abb106..8fc79259 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,14 @@ char *strndup(const char *s, size_t n);
# endif /* HAVE__VSNPRINTF */
# endif /* HAVE__VSNPRINTF_S */
+# ifndef _SSIZE_T_DEFINED
+# ifdef _WIN64
+ typedef unsigned __int64 ssize_t;
+# else
+ typedef _W64 unsigned int ssize_t;
+# endif
+# define _SSIZE_T_DEFINED
+# endif
# endif /* _MSC_VER */
struct timeval;
--
2.19.1