From 9eff92d943d00bce50f22c20f4b01cc420e95b2a Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Mon, 23 Oct 2023 02:28:09 -0400
Subject: [PATCH] Attempt to fix build on Windows and macOS.
---
src/SDL_net.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/SDL_net.c b/src/SDL_net.c
index ff00995..4bd9f5b 100644
--- a/src/SDL_net.c
+++ b/src/SDL_net.c
@@ -39,6 +39,7 @@ static int read(SOCKET s, char *buf, size_t count) {
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
+#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#include <string.h>
@@ -935,7 +936,7 @@ SDLNet_Server *SDLNet_CreateServer(SDLNet_Address *addr, Uint16 port)
}
int zero = 0;
- setsockopt(server->handle, SOL_IPV6, IPV6_V6ONLY, &zero, sizeof (zero)); // if this fails, oh well.
+ setsockopt(server->handle, SOL_IPV6, IPV6_V6ONLY, (const char *) &zero, sizeof (zero)); // if this fails, oh well.
int rc = bind(server->handle, addrwithport->ai_addr, addrwithport->ai_addrlen);
freeaddrinfo(addrwithport);
@@ -1288,7 +1289,7 @@ SDLNet_DatagramSocket *SDLNet_CreateDatagramSocket(SDLNet_Address *addr, Uint16
}
int zero = 0;
- setsockopt(sock->handle, SOL_IPV6, IPV6_V6ONLY, &zero, sizeof (zero)); // if this fails, oh well.
+ setsockopt(sock->handle, SOL_IPV6, IPV6_V6ONLY, (const char *) &zero, sizeof (zero)); // if this fails, oh well.
const int rc = bind(sock->handle, addrwithport->ai_addr, addrwithport->ai_addrlen);
freeaddrinfo(addrwithport);