]> git.meshlink.io Git - catta/blobdiff - src/compat/windows/wincompat.h
fix msvc _WIN64 ssize_t definition
[catta] / src / compat / windows / wincompat.h
index ac151c9ecf7bca078e185e41793db801234bd48f..69de64d06e7f13ce733ad554d91a79b367543be4 100644 (file)
@@ -103,10 +103,17 @@ static inline struct cmsghdr *CMSG_NXTHDR(struct msghdr *m, struct cmsghdr *c) {
 #undef CMSG_DATA
 #define CMSG_DATA(c) WSA_CMSG_DATA(c)
 
-// VS2012 and up has no ssize_t defined, before it was defined as unsigned int
-#ifndef _SSIZE_T
-#define _SSIZE_T
-typedef signed int        ssize_t;
+#ifdef _MSC_VER
+   // VS2012 and up has no ssize_t defined, before it was defined as unsigned int
+  #ifndef _SSIZE_T_DEFINED
+    #define _SSIZE_T_DEFINED
+    #undef ssize_t
+    #ifdef _WIN64
+      typedef signed __int64  ssize_t;
+    #else
+      typedef signed int      ssize_t;
+    #endif
+  #endif
 #endif
 
 ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);