]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - lhnet.c
renamed prvm_startupreuseedicttime to prvm_reuseedicts_startuptime
[xonotic/darkplaces.git] / lhnet.c
diff --git a/lhnet.c b/lhnet.c
index f51ea3a922b23595291615e0d469682339fe125f..7da46a74ecf2a799aa3ad99078cf8a0710308f81 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -6,7 +6,7 @@
 #define _WIN32_WINNT 0x0501
 #include <winsock2.h>
 #include <ws2tcpip.h>
-#include <wspiapi.h>
+//#include <wspiapi.h>
 #endif
 
 #ifndef STANDALONETEST
@@ -151,7 +151,10 @@ int LHNETADDRESS_Resolve(lhnetaddressnative_t *address, const char *name, int po
        if (err != 0 || addrinf == NULL)
                return 0;
        if (addrinf->ai_addr->sa_family != AF_INET6 && addrinf->ai_addr->sa_family != AF_INET)
+       {
+               freeaddrinfo (addrinf);
                return 0;
+       }
 
        // great it worked
        if (addrinf->ai_addr->sa_family == AF_INET6)
@@ -725,7 +728,7 @@ lhnetsocket_t *LHNET_OpenSocket_Connectionless(lhnetaddress_t *address)
                                                int ipv6_only = 1;
                                                if (address->addresstype != LHNETADDRESSTYPE_INET6
                                                        || setsockopt (lhnetsocket->inetsocket, IPPROTO_IPV6, IPV6_V6ONLY,
-                                                                                  (const void *)&ipv6_only, sizeof(ipv6_only)) == 0
+                                                                                  (const char *)&ipv6_only, sizeof(ipv6_only)) == 0
 #ifdef WIN32
                                                        // The Win32 API only supports IPV6_V6ONLY since Windows Vista, but fortunately
                                                        // the default value is what we want on Win32 anyway (IPV6_V6ONLY = true)
@@ -872,10 +875,10 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
        }
        else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET4)
        {
-               unsigned int inetaddresslength;
+               SOCKLEN_T inetaddresslength;
                address->addresstype = LHNETADDRESSTYPE_NONE;
                inetaddresslength = sizeof(address->addr.in);
-               value = recvfrom(lhnetsocket->inetsocket, content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);
+               value = recvfrom(lhnetsocket->inetsocket, (char *)content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);
                if (value > 0)
                {
                        address->addresstype = LHNETADDRESSTYPE_INET4;
@@ -898,10 +901,10 @@ int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength,
        }
        else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET6)
        {
-               unsigned int inetaddresslength;
+               SOCKLEN_T inetaddresslength;
                address->addresstype = LHNETADDRESSTYPE_NONE;
                inetaddresslength = sizeof(address->addr.in6);
-               value = recvfrom(lhnetsocket->inetsocket, content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);
+               value = recvfrom(lhnetsocket->inetsocket, (char *)content, maxcontentlength, 0, &address->addr.sock, &inetaddresslength);
                if (value > 0)
                {
                        address->addresstype = LHNETADDRESSTYPE_INET6;
@@ -954,7 +957,7 @@ int LHNET_Write(lhnetsocket_t *lhnetsocket, const void *content, int contentleng
        }
        else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET4)
        {
-               value = sendto(lhnetsocket->inetsocket, content, contentlength, 0, (struct sockaddr *)&address->addr.in, sizeof(struct sockaddr_in));
+               value = sendto(lhnetsocket->inetsocket, (char *)content, contentlength, 0, (struct sockaddr *)&address->addr.in, sizeof(struct sockaddr_in));
                if (value == -1)
                {
                        if (SOCKETERRNO == EWOULDBLOCK)
@@ -964,7 +967,7 @@ int LHNET_Write(lhnetsocket_t *lhnetsocket, const void *content, int contentleng
        }
        else if (lhnetsocket->address.addresstype == LHNETADDRESSTYPE_INET6)
        {
-               value = sendto(lhnetsocket->inetsocket, content, contentlength, 0, (struct sockaddr *)&address->addr.in6, sizeof(struct sockaddr_in6));
+               value = sendto(lhnetsocket->inetsocket, (char *)content, contentlength, 0, (struct sockaddr *)&address->addr.in6, sizeof(struct sockaddr_in6));
                if (value == -1)
                {
                        if (SOCKETERRNO == EWOULDBLOCK)