1
0
Fork 0
forked from fte/fteqw

sockaddr_qstorage should make no assumptions about where the sa_family member is. Thanks to bigfoot for pointing this out.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@862 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2005-01-29 02:26:42 +00:00
parent 72a13752b6
commit ae500c07ef
7 changed files with 14 additions and 14 deletions

View file

@ -946,7 +946,7 @@ void CL_ParseCustomTEnt(void)
clcustomtents_t *t;
int type = MSG_ReadByte();
if (type == 255)
if (type == 255) //255 is register
{
type = MSG_ReadByte();
if (type == 255)

View file

@ -234,7 +234,7 @@ void NET_SendPollPacket(int len, void *data, netadr_t to)
NetadrToSockadr (&to, &addr);
#ifdef USEIPX
if (addr.sa_family == AF_IPX)
if (((struct sockaddr*)&addr)->sa_family == AF_IPX)
{
lastpollsockIPX++;
if (lastpollsockIPX>=POLLIPXSOCKETS)

View file

@ -828,7 +828,7 @@ void R_DefaultTrail (model_t *model)
else if (model->flags & EF_TRACER3)
model->particletrail = AllocateParticleType("t_tracer3");
else if (model->flags & EF_BLOODSHOT)
else if (model->flags & EF_BLOODSHOT) //these are the hexen2 ones.
model->particletrail = AllocateParticleType("t_bloodshot");
else if (model->flags & EF_FIREBALL)
model->particletrail = AllocateParticleType("t_fireball");

View file

@ -40,8 +40,8 @@ typedef struct
struct sockaddr_qstorage
{
short sa_family;
unsigned char sa_pad[6];
short dontusesa_family;
unsigned char dontusesa_pad[6];
#if defined(_MSC_VER) || defined(MINGW)
__int64 sa_align;
#else

View file

@ -192,7 +192,7 @@ void NetadrToSockadr (netadr_t *a, struct sockaddr_qstorage *s)
void SockadrToNetadr (struct sockaddr_qstorage *s, netadr_t *a)
{
switch (s->sa_family)
switch (((struct sockaddr*)s)->sa_family)
{
case AF_INET:
a->type = NA_IP;
@ -453,7 +453,7 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr)
{
return false;
}
sadr->sa_family = 0;
((struct sockaddr*)sadr)->sa_family = 0;
for (pos = addrinfo; pos; pos = pos->ai_next)
{
switch(pos->ai_family)
@ -470,7 +470,7 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr)
}
dblbreak:
pfreeaddrinfo (addrinfo);
if (!sadr->sa_family)
if (!((struct sockaddr*)sadr)->sa_family)
return false;
}
else

View file

@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define NET_GAMENAME_QW "QUAKEWORLD"
// This is enables a simple IP banning mechanism
#define BAN_TEST
//#define BAN_TEST
#ifdef BAN_TEST
#if defined(_WIN32)
@ -1005,7 +1005,7 @@ static qsocket_t *_Datagram_CheckNewConnections (void)
#ifdef BAN_TEST
// check for a ban
if (clientaddr.sa_family == AF_INET)
if (((struct sockaddr_in*)clientaddr).sa_family == AF_INET)
{
unsigned long testAddr;
testAddr = ((struct sockaddr_in *)&clientaddr)->sin_addr.s_addr;

View file

@ -554,7 +554,7 @@ static int PartialIPAddress (char *in, struct sockaddr_qstorage *hostaddr)
else
port = net_hostport;
hostaddr->sa_family = AF_INET;
((struct sockaddr_in *)hostaddr)->sin_family = AF_INET;
((struct sockaddr_in *)hostaddr)->sin_port = htons((short)port);
((struct sockaddr_in *)hostaddr)->sin_addr.s_addr = (myAddr & htonl(mask)) | htonl(addr);
@ -672,7 +672,7 @@ int WINS_StringToAddr (char *string, struct sockaddr_qstorage *addr)
sscanf(string, "%d.%d.%d.%d:%d", &ha1, &ha2, &ha3, &ha4, &hp);
ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;
addr->sa_family = AF_INET;
((struct sockaddr_in *)addr)->sin_family = AF_INET;
((struct sockaddr_in *)addr)->sin_addr.s_addr = htonl(ipaddr);
((struct sockaddr_in *)addr)->sin_port = htons((unsigned short)hp);
return 0;
@ -724,7 +724,7 @@ int WINS_GetAddrFromName(char *name, struct sockaddr_qstorage *addr)
if (!hostentry)
return -1;
addr->sa_family = AF_INET;
((struct sockaddr_in *)addr)->sin_family = AF_INET;
((struct sockaddr_in *)addr)->sin_port = htons((unsigned short)net_hostport);
((struct sockaddr_in *)addr)->sin_addr.s_addr = *(int *)hostentry->h_addr_list[0];
@ -735,7 +735,7 @@ int WINS_GetAddrFromName(char *name, struct sockaddr_qstorage *addr)
int WINS_AddrCompare (struct sockaddr_qstorage *addr1, struct sockaddr_qstorage *addr2)
{
if (addr1->sa_family != addr2->sa_family)
if (((struct sockaddr_in *)addr1)->sin_family != ((struct sockaddr_in *)addr2)->sin_family)
return -1;
if (((struct sockaddr_in *)addr1)->sin_addr.s_addr != ((struct sockaddr_in *)addr2)->sin_addr.s_addr)