From 5e2c8dac61edb7eb28ec6ca8dbf0a12595aa064f Mon Sep 17 00:00:00 2001 From: Spoike Date: Tue, 21 Feb 2006 19:02:42 +0000 Subject: [PATCH] Fixed linux stuff git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1980 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- fteqtv/netchan.c | 10 ++++++---- fteqtv/qw.c | 10 ++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/fteqtv/netchan.c b/fteqtv/netchan.c index 136bd945..61fcea81 100644 --- a/fteqtv/netchan.c +++ b/fteqtv/netchan.c @@ -38,11 +38,13 @@ void NET_SendPacket(cluster_t *cluster, SOCKET sock, int length, char *data, net int Netchan_IsLocal (netadr_t 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 && - sadr->sin_addr.S_un.S_un_b.s_b2 == 0 && - sadr->sin_addr.S_un.S_un_b.s_b3 == 0 && - sadr->sin_addr.S_un.S_un_b.s_b4 == 1) + if (bytes[0] == 127 && + bytes[1] == 0 && + bytes[2] == 0 && + bytes[3] == 1) return true; return false; } diff --git a/fteqtv/qw.c b/fteqtv/qw.c index 6999ca80..9888c2f2 100644 --- a/fteqtv/qw.c +++ b/fteqtv/qw.c @@ -1078,7 +1078,12 @@ void QTV_Say(cluster_t *cluster, sv_t *qtv, viewer_t *v, char *message) } else if (!strcmp(v->expectcommand, "addserver")) { +#ifdef _WIN32 _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); 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")) { +#ifdef _WIN32 _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); if (!qtv) QW_PrintfToViewer(v, "Failed to play demo \"%s\"\n", message);