1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-27 00:40:26 +00:00

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.
This commit is contained in:
llmII 2021-09-06 19:31:16 -05:00
parent 7217caacd1
commit ca5406c8e4
No known key found for this signature in database
GPG Key ID: E3AD2E259F58A9A0

View File

@ -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;