From 009ca5c9ddd8f27d6397b605f1ff5c1d7c36c8a4 Mon Sep 17 00:00:00 2001 From: Andreas Schneider 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 Tested-by: Wolf Wolfswinkel --- 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 #include #include @@ -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 + 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 + typedef _W64 SSIZE_T ssize_t; +# define _SSIZE_T_DEFINED +# endif /* _SSIZE_T_DEFINED */ + #endif /* _MSC_VER */ #endif /* _WIN32 */