X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fcompat%2Fwindows%2Fwincompat.h;h=69de64d06e7f13ce733ad554d91a79b367543be4;hb=2a2f2cfc63df6d90a7731ceba113edf9be53bab6;hp=1ce3ac87db8fa41d2f469c13ab3ba6d0ebe96e1a;hpb=555fb0b9e9a6228e7cc3f743679d98237e22a6ea;p=catta diff --git a/src/compat/windows/wincompat.h b/src/compat/windows/wincompat.h index 1ce3ac8..69de64d 100644 --- a/src/compat/windows/wincompat.h +++ b/src/compat/windows/wincompat.h @@ -16,78 +16,6 @@ #include #include -// TODO: fix mingw32 x86 or drop support and use x86_x64 -// copied from x86_64-4.8.3-release-posix-seh-rt_v3-rev0 for mingw32 x86 4.8.1 -#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) - // from winsock2.h - #define POLLRDNORM 0x0100 - #define POLLRDBAND 0x0200 - #define POLLIN (POLLRDNORM | POLLRDBAND) - #define POLLPRI 0x0400 - - #define POLLWRNORM 0x0010 - #define POLLOUT (POLLWRNORM) - #define POLLWRBAND 0x0020 - - #define POLLERR 0x0001 - #define POLLHUP 0x0002 - #define POLLNVAL 0x0004 - - typedef struct pollfd { - SOCKET fd; - short events; - short revents; - } WSAPOLLFD, *PWSAPOLLFD, *LPWSAPOLLFD; - - // to fix redefenition of 'timespec' defined in pthread.h and parts/time.h used by simple-watch.c - #define HAVE_STRUCT_TIMESPEC - - // from ws2ipdef.h - #define IPV6_HOPOPTS 1 - #define IPV6_HDRINCL 2 - #define IPV6_UNICAST_HOPS 4 - #define IPV6_MULTICAST_IF 9 - #define IPV6_MULTICAST_HOPS 10 - #define IPV6_MULTICAST_LOOP 11 - #define IPV6_ADD_MEMBERSHIP 12 - #define IPV6_JOIN_GROUP IPV6_ADD_MEMBERSHIP - #define IPV6_DROP_MEMBERSHIP 13 - #define IPV6_LEAVE_GROUP IPV6_DROP_MEMBERSHIP - #define IPV6_DONTFRAG 14 - #define IPV6_PKTINFO 19 - #define IPV6_HOPLIMIT 21 - #define IPV6_PROTECTION_LEVEL 23 - #define IPV6_RECVIF 24 - #define IPV6_RECVDSTADDR 25 - #define IPV6_CHECKSUM 26 - #define IPV6_V6ONLY 27 - #define IPV6_IFLIST 28 - #define IPV6_ADD_IFLIST 29 - #define IPV6_DEL_IFLIST 30 - #define IPV6_UNICAST_IF 31 - #define IPV6_RTHDR 32 - #define IPV6_RECVRTHDR 38 - #define IPV6_TCLASS 39 - #define IPV6_RECVTCLASS 40 - - // from errno.h - #ifndef EADDRINUSE - #define EADDRINUSE 100 - #endif - - #ifndef EWOULDBLOCK - #define EWOULDBLOCK 140 - #endif - - // from mswsock.h - #define MSG_TRUNC 0x0100 - #define MSG_CTRUNC 0x0200 - - // from netioapi.h - //.... lots of dependencies x-( - // TODO: fix mingw32 x86 or drop support and use x86_x64 -#endif - // wrappers around WSAStartup/WSACleanup to avoid clutter void winsock_init(void); @@ -175,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);