Fixed linux stuff

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1980 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-02-21 19:02:42 +00:00
parent f3a67176f4
commit 5e2c8dac61
2 changed files with 16 additions and 4 deletions

View file

@ -38,11 +38,13 @@ void NET_SendPacket(cluster_t *cluster, SOCKET sock, int length, char *data, net
int Netchan_IsLocal (netadr_t adr) int Netchan_IsLocal (netadr_t adr)
{ {
struct sockaddr_in *sadr = (struct sockaddr_in *)adr; struct sockaddr_in *sadr = (struct sockaddr_in *)adr;
unsigned char *bytes;
bytes = (char *)&sadr->sin_addr;
if (sadr->sin_addr.S_un.S_un_b.s_b1 == 127 && if (bytes[0] == 127 &&
sadr->sin_addr.S_un.S_un_b.s_b2 == 0 && bytes[1] == 0 &&
sadr->sin_addr.S_un.S_un_b.s_b3 == 0 && bytes[2] == 0 &&
sadr->sin_addr.S_un.S_un_b.s_b4 == 1) bytes[3] == 1)
return true; return true;
return false; return false;
} }

View file

@ -1078,7 +1078,12 @@ void QTV_Say(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *message)
} }
else if (!strcmp(v->expectcommand, "addserver")) else if (!strcmp(v->expectcommand, "addserver"))
{ {
#ifdef _WIN32
_snprintf(buf, sizeof(buf), "tcp:%s", message); _snprintf(buf, sizeof(buf), "tcp:%s", message);
buf[suzeof(buf)-1] = '\0';
#else
snprintf(buf, sizeof(buf), "tcp:%s", message);
#endif
qtv = QTV_NewServerConnection(cluster, buf, false); qtv = QTV_NewServerConnection(cluster, buf, false);
if (qtv) if (qtv)
{ {
@ -1105,7 +1110,12 @@ void QTV_Say(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *message)
} }
else if (!strcmp(v->expectcommand, "adddemo")) else if (!strcmp(v->expectcommand, "adddemo"))
{ {
#ifdef _WIN32
_snprintf(buf, sizeof(buf), "file:%s", message); _snprintf(buf, sizeof(buf), "file:%s", message);
buf[sizeof(buf)-1] = '\0';
#else
snprintf(buf, sizeof(buf), "file:%s", message);
#endif
qtv = QTV_NewServerConnection(cluster, buf, false); qtv = QTV_NewServerConnection(cluster, buf, false);
if (!qtv) if (!qtv)
QW_PrintfToViewer(v, "Failed to play demo \"%s\"\n", message); QW_PrintfToViewer(v, "Failed to play demo \"%s\"\n", message);