r1294 - in trunk: . code/qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Apr 5 12:02:01 EDT 2008


Author: tma
Date: 2008-04-05 12:01:58 -0400 (Sat, 05 Apr 2008)
New Revision: 1294

Modified:
   trunk/Makefile
   trunk/code/qcommon/net_ip.c
Log:
* Fix to MinGW build following IPv6 changes


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2008-04-05 15:10:50 UTC (rev 1293)
+++ trunk/Makefile	2008-04-05 16:01:58 UTC (rev 1294)
@@ -381,6 +381,9 @@
   BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
     -DUSE_ICON
 
+  # Require Windows XP or later
+  BASE_CFLAGS += -DWINVER=0x501
+
   ifeq ($(USE_LOCAL_HEADERS),1)
     BASE_CFLAGS += -I$(SDLHDIR)/include
   endif
@@ -412,7 +415,7 @@
 
   BINEXT=.exe
 
-  LDFLAGS= -lwsock32 -lwinmm
+  LDFLAGS= -lws2_32 -lwinmm
   CLIENT_LDFLAGS = -mwindows -lgdi32 -lole32 -lopengl32
 
   ifeq ($(USE_CURL),1)

Modified: trunk/code/qcommon/net_ip.c
===================================================================
--- trunk/code/qcommon/net_ip.c	2008-04-05 15:10:50 UTC (rev 1293)
+++ trunk/code/qcommon/net_ip.c	2008-04-05 16:01:58 UTC (rev 1294)
@@ -24,12 +24,16 @@
 #include "../qcommon/qcommon.h"
 
 #ifdef _WIN32
-#include <Winsock2.h>
-#include <Ws2tcpip.h>
-#include <Wspiapi.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#if WINVER < 0x501
+#include <wspiapi.h>
+#else
+#include <ws2spi.h>
+#endif
 
 typedef int socklen_t;
-#define sa_family_t	ADDRESS_FAMILY
+typedef unsigned short sa_family_t;
 #define EAGAIN				WSAEWOULDBLOCK
 #define EADDRNOTAVAIL	WSAEADDRNOTAVAIL
 #define EAFNOSUPPORT	WSAEAFNOSUPPORT
@@ -524,7 +528,7 @@
 ==================
 */
 void Sys_SendPacket( int length, const void *data, netadr_t to ) {
-	int				ret;
+	int				ret = SOCKET_ERROR;
 	struct sockaddr_storage	addr;
 
 	if( to.type != NA_BROADCAST && to.type != NA_IP && to.type != NA_IP6 ) {
@@ -790,12 +794,14 @@
 		return INVALID_SOCKET;
 	}
 
+#ifdef IPV6_V6ONLY
 	// ipv4 addresses should not be allowed to connect via this socket.
 	if(setsockopt(newsocket, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &i, sizeof(i)) == SOCKET_ERROR)
 	{
 		// win32 systems don't seem to support this anyways.
 		Com_DPrintf("WARNING: NET_IP6Socket: setsockopt IPV6_V6ONLY: %s\n", NET_ErrorString());
 	}
+#endif
 
 	// make it broadcast capable
 	if( setsockopt( newsocket, SOL_SOCKET, SO_BROADCAST, (char *) &i, sizeof(i) ) == SOCKET_ERROR ) {




More information about the quake3-commits mailing list