diff --git a/include/QF/wadfile.h b/include/QF/wadfile.h index cd8b09cc4..8d37859a0 100644 --- a/include/QF/wadfile.h +++ b/include/QF/wadfile.h @@ -57,7 +57,7 @@ typedef struct qpic_s { int width, height; - byte data[4]; // variably sized + byte data[]; // variably sized } qpic_t; typedef struct wadinfo_s { diff --git a/include/netchan.h b/include/netchan.h index 0237bb122..cc756d984 100644 --- a/include/netchan.h +++ b/include/netchan.h @@ -156,14 +156,6 @@ void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport, int flags); qboolean Netchan_CanPacket (netchan_t *chan); qboolean Netchan_CanReliable (netchan_t *chan); -static inline void -Netchan_SendPacket (int length, const void *data, netadr_t to) -{ -#if 0 - if (net_packetlog->int_val) - Log_Outgoing_Packet(data, length, 1); -#endif - NET_SendPacket (length, data, to); -} +void Netchan_SendPacket (int length, const void *data, netadr_t to); #endif // _NET_H diff --git a/libs/net/net_chan.c b/libs/net/net_chan.c index 139ad4488..c77451bbd 100644 --- a/libs/net/net_chan.c +++ b/libs/net/net_chan.c @@ -428,3 +428,13 @@ Netchan_Process (netchan_t *chan) return true; } + +void +Netchan_SendPacket (int length, const void *data, netadr_t to) +{ +#if 0 + if (net_packetlog->int_val) + Log_Outgoing_Packet (data, length, 1); +#endif + NET_SendPacket (length, data, to); +} diff --git a/libs/net/nm/net_dgrm.c b/libs/net/nm/net_dgrm.c index 71fe067e1..8b9fc0d7c 100644 --- a/libs/net/nm/net_dgrm.c +++ b/libs/net/nm/net_dgrm.c @@ -60,33 +60,10 @@ static __attribute__ ((used)) const char rcsid[] = #ifdef BAN_TEST #if defined(_WIN32) #include -#elif defined (NeXT) -#include -#include #else -#define AF_INET 2 /* internet */ -struct in_addr { - union { - struct { - unsigned char s_b1, s_b2, s_b3, s_b4; - } S_un_b; - struct { - unsigned short s_w1, s_w2; - } S_un_w; - unsigned S_addr; - } S_un; -}; - -#define s_addr S_un.S_addr /* can be used for most tcp & ip code - */ -struct sockaddr_in { - short sin_family; - unsigned short sin_port; - struct in_addr sin_addr; - char sin_zero[8]; -}; -char *inet_ntoa (struct in_addr in); -unsigned inet_addr (const char *cp); +# include +# include +# include #endif #endif // BAN_TEST @@ -122,8 +99,8 @@ struct { #ifdef BAN_TEST -unsigned banAddr = 0x00000000; -unsigned banMask = 0xffffffff; +in_addr_t banAddr = 0x00000000; +in_addr_t banMask = 0xffffffff; static void NET_Ban_f (void) @@ -147,8 +124,11 @@ NET_Ban_f (void) switch (Cmd_Argc ()) { case 1: if (((struct in_addr *) &banAddr)->s_addr) { - strcpy (addrStr, inet_ntoa (*(struct in_addr *) &banAddr)); - strcpy (maskStr, inet_ntoa (*(struct in_addr *) &banMask)); + struct in_addr t; + t.s_addr = banAddr; + strcpy (addrStr, inet_ntoa (t)); + t.s_addr = banMask; + strcpy (maskStr, inet_ntoa (t)); print ("Banning %s [%s]\n", addrStr, maskStr); } else print ("Banning not active\n"); diff --git a/libs/net/nm/net_udp.c b/libs/net/nm/net_udp.c index 96bbcd1c0..b89e059e0 100644 --- a/libs/net/nm/net_udp.c +++ b/libs/net/nm/net_udp.c @@ -190,10 +190,14 @@ UDP_Init (void) get_address (net_controlsocket); - ((struct sockaddr_in *) &broadcastaddr)->sin_family = AF_INET; - ((struct sockaddr_in *) &broadcastaddr)->sin_addr.s_addr = - INADDR_BROADCAST; - ((struct sockaddr_in *) &broadcastaddr)->sin_port = htons (net_hostport); + { + struct sockaddr_in t; + memcpy (&t, &broadcastaddr, sizeof (t)); + t.sin_family = AF_INET; + t.sin_addr.s_addr = INADDR_BROADCAST; + t.sin_port = htons (net_hostport); + memcpy (&broadcastaddr, &t, sizeof (broadcastaddr)); + } UDP_GetSocketAddr (net_controlsocket, &addr); strcpy (my_tcpip_address, UDP_AddrToString (&addr)); diff --git a/libs/video/renderer/gl/gl_draw.c b/libs/video/renderer/gl/gl_draw.c index 6b7eb6bde..77dc927e0 100644 --- a/libs/video/renderer/gl/gl_draw.c +++ b/libs/video/renderer/gl/gl_draw.c @@ -167,7 +167,7 @@ Draw_PicFromWad (const char *name) pic = W_GetLumpName (name); targa = LoadImage (name); if (targa) { - p = malloc (sizeof (qpic_t)); + p = malloc (sizeof (qpic_t) + sizeof (glpic_t)); p->width = pic->width; p->height = pic->height; gl = (glpic_t *) p->data; @@ -733,8 +733,10 @@ Draw_ConsoleBackground (int lines, byte alpha) VISIBLE void Draw_TileClear (int x, int y, int w, int h) { + glpic_t *gl; qfglColor3ubv (color_0_8); - qfglBindTexture (GL_TEXTURE_2D, *(int *) draw_backtile->data); + gl = (glpic_t *) draw_backtile->data; + qfglBindTexture (GL_TEXTURE_2D, gl->texnum); qfglBegin (GL_QUADS); qfglTexCoord2f (x / 64.0, y / 64.0); qfglVertex2f (x, y); diff --git a/nq/source/sbar.c b/nq/source/sbar.c index b14d627af..cb64c8d06 100644 --- a/nq/source/sbar.c +++ b/nq/source/sbar.c @@ -272,7 +272,7 @@ Sbar_Changed (void) } -static inline void +static void draw_pic (view_t *view, int x, int y, qpic_t *pic) { Draw_Pic (view->xabs + x, view->yabs + y, pic); diff --git a/nq/source/sv_phys.c b/nq/source/sv_phys.c index 0a6070f58..5c76e89dd 100644 --- a/nq/source/sv_phys.c +++ b/nq/source/sv_phys.c @@ -95,6 +95,7 @@ SV_CheckVelocity (edict_t *ent) // bound velocity for (i = 0; i < 3; i++) { +#if 0 if (IS_NAN (SVvector (ent, velocity)[i])) { Sys_Printf ("Got a NaN velocity on %s\n", PR_GetString (&sv_pr_state, SVstring (ent, @@ -107,6 +108,7 @@ SV_CheckVelocity (edict_t *ent) classname))); SVvector (ent, origin)[i] = 0; } +#endif if (SVvector (ent, velocity)[i] > sv_maxvelocity->value) SVvector (ent, velocity)[i] = sv_maxvelocity->value; else if (SVvector (ent, velocity)[i] < -sv_maxvelocity->value) diff --git a/qw/source/sbar.c b/qw/source/sbar.c index 293d51bcb..5831bfc62 100644 --- a/qw/source/sbar.c +++ b/qw/source/sbar.c @@ -287,7 +287,7 @@ Sbar_Changed (void) sb_updates = 0; // update next frame } -static inline void +static void draw_pic (view_t *view, int x, int y, qpic_t *pic) { Draw_Pic (view->xabs + x, view->yabs + y, pic); diff --git a/qw/source/sv_main.c b/qw/source/sv_main.c index 56bb3847a..f2732ec18 100644 --- a/qw/source/sv_main.c +++ b/qw/source/sv_main.c @@ -1220,7 +1220,10 @@ SV_MaskIPCompare (byte *a, byte *b, int mask) #endif for (i = 0; i < intcount; i++) { - if ((((unsigned int *)a)[i] & ipmasks[mask > 32 ? 32 : mask]) != ((unsigned int *)b)[i]) + unsigned int x, y; + memcpy (&x, a + i * 4, 4); + memcpy (&y, b + i * 4, 4); + if ((x & ipmasks[mask > 32 ? 32 : mask]) != y) return false; if ((mask -= 32) < 0) mask = 0; diff --git a/qw/source/sv_phys.c b/qw/source/sv_phys.c index 80ce0d07b..51f72806a 100644 --- a/qw/source/sv_phys.c +++ b/qw/source/sv_phys.c @@ -96,9 +96,10 @@ void SV_CheckVelocity (edict_t *ent) { float wishspeed; - int i; +// int i; // bound velocity +#if 0 for (i = 0; i < 3; i++) { if (IS_NAN (SVvector (ent, velocity)[i])) { Sys_Printf ("Got a NaN velocity on %s\n", @@ -113,6 +114,7 @@ SV_CheckVelocity (edict_t *ent) SVvector (ent, origin)[i] = 0; } } +#endif wishspeed = VectorLength (SVvector (ent, velocity)); if (wishspeed > sv_maxvelocity->value) { VectorScale (SVvector (ent, velocity), sv_maxvelocity->value / diff --git a/tools/qfmodelgen/source/lbmlib.c b/tools/qfmodelgen/source/lbmlib.c index cf8b34b2b..18b69497e 100644 --- a/tools/qfmodelgen/source/lbmlib.c +++ b/tools/qfmodelgen/source/lbmlib.c @@ -33,10 +33,10 @@ #include "lbmlib.h" static int -LoadFile (const char *fname, void **buf) +LoadFile (const char *fname, byte **buf) { QFile *file; - char *src; + byte *src; int len; *buf = 0; @@ -345,7 +345,7 @@ LoadLBM (char *filename, byte **picture, byte **palette) mungecall = NULL; // load the LBM - LoadFile (filename, (void **) (char *)&LBMbuffer); + LoadFile (filename, &LBMbuffer); // parse the LBM header LBM_P = LBMbuffer;