From: everHannes Date: Sun, 16 Aug 2015 09:24:43 +0000 (+0200) Subject: fix gcc mingw compile (gcc 5.1 x86_64) X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=851f0397ec46b3e5969d1b4299dd151830699bb2;p=catta fix gcc mingw compile (gcc 5.1 x86_64) --- diff --git a/src/compat/windows/wincompat.c b/src/compat/windows/wincompat.c index d56e0a6..93a557e 100644 --- a/src/compat/windows/wincompat.c +++ b/src/compat/windows/wincompat.c @@ -237,11 +237,11 @@ int ioctl(int d, unsigned long request, int *p) int pipe(int pipefd[2]) { - int lsock = INVALID_SOCKET; + int lsock = (int)INVALID_SOCKET; struct sockaddr_in laddr; socklen_t laddrlen = sizeof(laddr); - pipefd[0] = pipefd[1] = INVALID_SOCKET; + pipefd[0] = pipefd[1] = (int)INVALID_SOCKET; // bind a listening socket to a TCP port on localhost laddr.sin_family = AF_INET; @@ -294,7 +294,8 @@ int uname(struct utsname *buf) strncpy(buf->version, "unknown", sizeof(buf->sysname)-1); // we don't need it // computer (node) name - if(GetComputerName(buf->nodename, sizeof(buf->nodename)-1) == 0) { + DWORD nodename_size = sizeof(buf->nodename)-1; + if(GetComputerName(buf->nodename, &nodename_size) == 0) { errno = EFAULT; return -1; } diff --git a/src/compat/windows/wincompat.h b/src/compat/windows/wincompat.h index ac151c9..6d6f414 100644 --- a/src/compat/windows/wincompat.h +++ b/src/compat/windows/wincompat.h @@ -103,10 +103,12 @@ 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 + #define _SSIZE_T + typedef signed int ssize_t; + #endif #endif ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);