get qf compiling with gcc 4.4

This commit is contained in:
Bill Currie 2009-12-19 10:54:23 +00:00 committed by Jeff Teunissen
parent 51932ee433
commit b14fcccd8f
12 changed files with 48 additions and 53 deletions

View file

@ -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 {

View file

@ -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

View file

@ -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);
}

View file

@ -60,33 +60,10 @@ static __attribute__ ((used)) const char rcsid[] =
#ifdef BAN_TEST
#if defined(_WIN32)
#include <windows.h>
#elif defined (NeXT)
#include <sys/socket.h>
#include <arpa/inet.h>
#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 <sys/socket.h>
# include <netinet/in.h>
# include <arpa/inet.h>
#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");

View file

@ -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));

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -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);

View file

@ -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;

View file

@ -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 /

View file

@ -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;