From ca5406c8e4dfaff2f1b39a8d0a0bbbad7a96ab6c Mon Sep 17 00:00:00 2001 From: llmII Date: Mon, 6 Sep 2021 19:31:16 -0500 Subject: [PATCH] More windows fixes MSVC's output via appveyor is a little lacking in indication of all issues so I'm hitting them as I can find them. --- src/core/net.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/net.c b/src/core/net.c index 7ad7da6a..f7d8f043 100644 --- a/src/core/net.c +++ b/src/core/net.c @@ -574,7 +574,11 @@ JANET_CORE_FN(cfun_net_listen, #define SO_MAX(a, b) (((a) > (b))? (a) : (b)) #define SA_PORT_NONE (&(in_port_t){ 0 }) #define SO_MIN(a, b) (((a) < (b))? (a) : (b)) +#ifndef JANET_WINDOWS #define SA_ADDRSTRLEN SO_MAX(INET6_ADDRSTRLEN, (sizeof ((struct sockaddr_un *)0)->sun_path) + 1) +#else +#define SA_ADDRSTRLEN (INET6_ADDRSTRLEN + 1) +#endif #define sa_ntoa(sa) sa_ntoa_((char [SA_ADDRSTRLEN]){ 0 }, SA_ADDRSTRLEN, (sa)) #define sa_family(...) sa_family(__VA_ARGS__) #define sa_port(...) sa_port(__VA_ARGS__) @@ -730,6 +734,7 @@ static Janet janet_so_getname(const struct sockaddr_storage *ss, socklen_t slen) hn = (uint8_t *)sa_ntoa(ss); hp = ntohs(*sa_port((void *)ss, SA_PORT_NONE, NULL)); break; +#ifndef JANET_WINDOWS case AF_UNIX: /* support nameless sockets, linux-ism */ if (slen > offsetof(struct sockaddr_un, sun_path)) { @@ -751,6 +756,7 @@ static Janet janet_so_getname(const struct sockaddr_storage *ss, socklen_t slen) plen = 1; } break; +#endif default: hn = (uint8_t *)""; plen = 0;