ref: cd8c8d416b4245458460cfe8e3c00bcb69c3c45b
parent: 0f42d9aeb91c01f8932e7130f3345111485f2202
author: Konstantinn Bonnet <qu7uux@gmail.com>
date: Sun Feb 15 19:13:05 EST 2015
*printf -> *print, NULL -> nil (where not stdio) %i -> %d, %u -> %ud some compilation warnings quenched fixes some introduced bugs, but mostly just ocd. someone punch me already.
--- a/README
+++ b/README
@@ -83,6 +83,7 @@
- sys_9.c: proper P9 use (bad programming?)
- rewrite everything to use plan9 style? (ocd)
- proper %r use for *_Printf and Sys_Error
+ - g '/\* FIXME'
legal
--- a/cd_9.c
+++ b/cd_9.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
qboolean cdValid = false;
@@ -64,7 +65,7 @@
track = remap[track];
if(track < 1 || track > maxTrack){
- Con_DPrintf("CDAudio: Bad track number %u.\n", track);
+ Con_DPrintf("CDAudio: Bad track number %ud.\n", track);
return;
}
@@ -83,7 +84,7 @@
return;
}
if(entry.cdte_ctrl == CDROM_DATA_TRACK){
- Con_Printf("CDAudio: track %i is not audio\n", track);
+ Con_Printf("CDAudio: track %d is not audio\n", track);
return;
}
@@ -178,7 +179,7 @@
if(ret <= 0){
for(n = 1; n < 100; n++)
if(remap[n] != n)
- Con_Printf(" %u -> %u\n", n, remap[n]);
+ Con_Printf(" %ud -> %ud\n", n, remap[n]);
return;
}
for(n = 1; n <= ret; n++)
@@ -224,11 +225,11 @@
return;
}
if(Q_strcasecmp(command, "info") == 0){
- Con_Printf("%u tracks\n", maxTrack);
+ Con_Printf("%ud tracks\n", maxTrack);
if(playing)
- Con_Printf("Currently %s track %u\n", playLooping ? "looping" : "playing", playTrack);
+ Con_Printf("Currently %s track %ud\n", playLooping ? "looping" : "playing", playTrack);
else if(wasPlaying)
- Con_Printf("Paused %s track %u\n", playLooping ? "looping" : "playing", playTrack);
+ Con_Printf("Paused %s track %ud\n", playLooping ? "looping" : "playing", playTrack);
Con_Printf("Volume is %f\n", cdvolume);
return;
}
--- a/chase.c
+++ b/chase.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
cvar_t chase_back = {"chase_back", "100"};
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
void CL_FinishTimeDemo (void);
@@ -100,7 +101,7 @@
VectorCopy (cl.mviewangles[0], cl.mviewangles[1]);
for (i=0 ; i<3 ; i++)
{
- r = fread (&f, 4, 1, cls.demofile);
+ fread (&f, 4, 1, cls.demofile);
cl.mviewangles[0][i] = LittleFloat (f);
}
@@ -207,7 +208,7 @@
if (c == 4)
{
track = atoi(Cmd_Argv(3));
- Con_Printf ("Forcing CD track to %i\n", cls.forcetrack);
+ Con_Printf ("Forcing CD track to %d\n", cls.forcetrack);
}
else
track = -1;
@@ -234,7 +235,7 @@
}
cls.forcetrack = track;
- fprintf (cls.demofile, "%i\n", cls.forcetrack);
+ fprintf (cls.demofile, "%d\n", cls.forcetrack);
cls.demorecording = true;
}
@@ -316,7 +317,7 @@
time = realtime - cls.td_starttime;
if (!time)
time = 1;
- Con_Printf ("%i frames %5.1f seconds %5.1f fps\n", frames, time, frames/time);
+ Con_Printf ("%d frames %5.1f seconds %5.1f fps\n", frames, time, frames/time);
}
/*
--- a/cl_input.c
+++ b/cl_input.c
@@ -5,6 +5,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
/*
--- a/cl_main.c
+++ b/cl_main.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
// we need to declare some mouse variables here, because the menu system
@@ -68,7 +69,7 @@
cl.free_efrags = cl_efrags;
for (i=0 ; i<MAX_EFRAGS-1 ; i++)
cl.free_efrags[i].entnext = &cl.free_efrags[i+1];
- cl.free_efrags[i].entnext = NULL;
+ cl.free_efrags[i].entnext = nil;
}
/*
@@ -159,7 +160,7 @@
{
char str[8192];
-Con_DPrintf ("CL_SignonReply: %i\n", cls.signon);
+Con_DPrintf ("CL_SignonReply: %d\n", cls.signon);
switch (cls.signon)
{
@@ -173,10 +174,10 @@
MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
MSG_WriteByte (&cls.message, clc_stringcmd);
- MSG_WriteString (&cls.message, va("color %i %i\n", ((int)cl_color.value)>>4, ((int)cl_color.value)&15));
+ MSG_WriteString (&cls.message, va("color %d %d\n", ((int)cl_color.value)>>4, ((int)cl_color.value)&15));
MSG_WriteByte (&cls.message, clc_stringcmd);
- sprintf (str, "spawn %s", cls.spawnparms);
+ sprint (str, "spawn %s", cls.spawnparms);
MSG_WriteString (&cls.message, str);
break;
@@ -219,7 +220,7 @@
}
}
- sprintf (str,"playdemo %s\n", cls.demos[cls.demonum]);
+ sprint (str,"playdemo %s\n", cls.demos[cls.demonum]);
Cbuf_InsertText (str);
cls.demonum++;
}
@@ -236,13 +237,13 @@
for (i=0,ent=cl_entities ; i<cl.num_entities ; i++,ent++)
{
- Con_Printf ("%3i:",i);
+ Con_Printf ("%3d:",i);
if (!ent->model)
{
Con_Printf ("EMPTY\n");
continue;
}
- Con_Printf ("%s:%2i (%5.1f,%5.1f,%5.1f) [%5.1f %5.1f %5.1f]\n"
+ Con_Printf ("%s:%2d (%5.1f,%5.1f,%5.1f) [%5.1f %5.1f %5.1f]\n"
,ent->model->name,ent->frame, ent->origin[0], ent->origin[1], ent->origin[2], ent->angles[0], ent->angles[1], ent->angles[2]);
}
}
@@ -255,7 +256,7 @@
Debugging tool, just flashes the screen
===============
*/
-void SetPal (int i)
+void SetPal (int /*i*/)
{
/*
static int old;
@@ -473,7 +474,7 @@
// if the object wasn't included in the last packet, remove it
if (ent->msgtime != cl.mtime[0])
{
- ent->model = NULL;
+ ent->model = nil;
continue;
}
--- a/cl_parse.c
+++ b/cl_parse.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
char *svc_strings[] =
@@ -64,7 +65,7 @@
if (num >= cl.num_entities)
{
if (num >= MAX_EDICTS)
- Host_Error ("CL_EntityNum: %i is an invalid number",num);
+ Host_Error ("CL_EntityNum: %d is an invalid number",num);
while (cl.num_entities<=num)
{
cl_entities[cl.num_entities].colormap = vid.colormap;
@@ -110,7 +111,7 @@
channel &= 7;
if (ent > MAX_EDICTS)
- Host_Error ("CL_ParseStartSoundPacket: ent = %i", ent);
+ Host_Error ("CL_ParseStartSoundPacket: ent = %d", ent);
for (i=0 ; i<3 ; i++)
pos[i] = MSG_ReadCoord ();
@@ -202,7 +203,7 @@
i = MSG_ReadLong ();
if (i != PROTOCOL_VERSION)
{
- Con_Printf ("Server returned version %i, not %i", i, PROTOCOL_VERSION);
+ Con_Printf ("Server returned version %d, not %d", i, PROTOCOL_VERSION);
return;
}
@@ -210,7 +211,7 @@
cl.maxclients = MSG_ReadByte ();
if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD)
{
- Con_Printf("Bad maxclients (%u) from server\n", cl.maxclients);
+ Con_Printf("Bad maxclients (%ud) from server\n", cl.maxclients);
return;
}
cl.scores = Hunk_AllocName (cl.maxclients*sizeof(*cl.scores), "scores");
@@ -271,7 +272,7 @@
for (i=1 ; i<nummodels ; i++)
{
cl.model_precache[i] = Mod_ForName (model_precache[i], false);
- if (cl.model_precache[i] == NULL)
+ if (cl.model_precache[i] == nil)
{
Con_Printf("Model %s not found\n", model_precache[i]);
return;
@@ -671,7 +672,7 @@
}
-#define SHOWNET(x) if(cl_shownet.value==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x);
+#define SHOWNET(x) if(cl_shownet.value==2)Con_Printf ("%3d:%s\n", msg_readcount-1, x);
/*
=====================
@@ -687,7 +688,7 @@
// if recording demos, copy the message out
//
if (cl_shownet.value == 1)
- Con_Printf ("%i ",net_message.cursize);
+ Con_Printf ("%d ",net_message.cursize);
else if (cl_shownet.value == 2)
Con_Printf ("------------------\n");
@@ -744,7 +745,7 @@
case svc_version:
i = MSG_ReadLong ();
if (i != PROTOCOL_VERSION)
- Host_Error ("CL_ParseServerMessage: Server is protocol %i instead of %i\n", i, PROTOCOL_VERSION);
+ Host_Error ("CL_ParseServerMessage: Server is protocol %d instead of %d\n", i, PROTOCOL_VERSION);
break;
case svc_disconnect:
@@ -852,7 +853,7 @@
case svc_signonnum:
i = MSG_ReadByte ();
if (i <= cls.signon)
- Host_Error ("Received signon %i when at %i", i, cls.signon);
+ Host_Error ("Received signon %d when at %d", i, cls.signon);
cls.signon = i;
CL_SignonReply ();
break;
@@ -868,7 +869,7 @@
case svc_updatestat:
i = MSG_ReadByte ();
if (i < 0 || i >= MAX_CL_STATS)
- Sys_Error ("svc_updatestat: %i is invalid", i);
+ Sys_Error ("svc_updatestat: %d is invalid", i);
cl.stats[i] = MSG_ReadLong ();;
break;
--- a/cl_tent.c
+++ b/cl_tent.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
int num_temp_entities;
@@ -244,9 +245,9 @@
entity_t *ent;
if (cl_numvisedicts == MAX_VISEDICTS)
- return NULL;
+ return nil;
if (num_temp_entities == MAX_TEMP_ENTITIES)
- return NULL;
+ return nil;
ent = &cl_temp_entities[num_temp_entities];
memset (ent, 0, sizeof(*ent));
num_temp_entities++;
--- a/cmd.c
+++ b/cmd.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
void Cmd_ForwardToServer (void);
@@ -93,7 +94,7 @@
*/
void Cbuf_InsertText (char *text)
{
- char *temp;
+ char *temp = nil;
int templen;
// copy off any commands still remaining in the exec buffer
@@ -104,8 +105,6 @@
Q_memcpy (temp, cmd_text.data, templen);
SZ_Clear (&cmd_text);
}
- else
- temp = NULL; // shut up compiler
// add the entire text of the file
Cbuf_AddText (text);
@@ -396,7 +395,7 @@
static int cmd_argc;
static char *cmd_argv[MAX_ARGS];
static char *cmd_null_string = "";
-static char *cmd_args = NULL;
+static char *cmd_args = nil;
cmd_source_t cmd_source;
@@ -470,7 +469,7 @@
Z_Free (cmd_argv[i]);
cmd_argc = 0;
- cmd_args = NULL;
+ cmd_args = nil;
while (1)
{
@@ -576,7 +575,7 @@
len = Q_strlen(partial);
if (!len)
- return NULL;
+ return nil;
// check functions
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
@@ -583,7 +582,7 @@
if (!Q_strncmp (partial,cmd->name, len))
return cmd->name;
- return NULL;
+ return nil;
}
/*
@@ -677,8 +676,8 @@
{
int i;
- if (!parm)
- Sys_Error ("Cmd_CheckParm: NULL");
+ if (parm == nil)
+ Sys_Error ("Cmd_CheckParm: nil");
for (i = 1; i < Cmd_Argc (); i++)
if (! Q_strcasecmp (parm, Cmd_Argv (i)))
--- a/common.c
+++ b/common.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#define NUM_SAFE_ARGVS 7
@@ -714,7 +715,7 @@
void SZ_Free (sizebuf_t *buf)
{
// Z_Free (buf->data);
-// buf->data = NULL;
+// buf->data = nil;
// buf->maxsize = 0;
buf->cursize = 0;
}
@@ -734,7 +735,7 @@
Sys_Error ("SZ_GetSpace: overflow without allowoverflow set");
if (length > buf->maxsize)
- Sys_Error ("SZ_GetSpace: %i is > full buffer size", length);
+ Sys_Error ("SZ_GetSpace: %d is > full buffer size", length);
buf->overflowed = true;
Con_Printf ("SZ_GetSpace: overflow");
@@ -889,8 +890,8 @@
len = 0;
com_token[0] = 0;
- if (!data)
- return NULL;
+ if (data == nil)
+ return nil;
// skip whitespace
skipwhite:
@@ -897,7 +898,7 @@
while ( (c = *data) <= ' ')
{
if (c == 0)
- return NULL; // end of file;
+ return nil; // end of file;
data++;
}
@@ -1142,7 +1143,7 @@
static char string[1024];
va_start (argptr, format);
- vsprintf (string, format,argptr);
+ vseprint (string,string+sizeof(string),format,argptr);
va_end (argptr);
return string;
@@ -1234,7 +1235,7 @@
{
if (s->pack)
{
- Con_Printf ("%s (%i files)\n", s->pack->filename, s->pack->numfiles);
+ Con_Printf ("%s (%d files)\n", s->pack->filename, s->pack->numfiles);
}
else
Con_Printf ("%s\n", s->filename);
@@ -1253,7 +1254,7 @@
int handle;
char name[MAX_OSPATH];
- sprintf (name, "%s/%s", com_gamedir, filename);
+ sprint (name, "%s/%s", com_gamedir, filename);
handle = Sys_FileOpenWrite (name);
if (handle == -1)
@@ -1392,7 +1393,7 @@
continue;
}
- sprintf (netpath, "%s/%s",search->filename, filename);
+ sprint (netpath, "%s/%s",search->filename, filename);
findtime = Sys_FileTime (netpath);
if (findtime == -1)
@@ -1403,7 +1404,7 @@
strcpy (cachepath, netpath);
else
{
- sprintf (cachepath,"%s%s", com_cachedir, netpath);
+ sprint (cachepath,"%s%s", com_cachedir, netpath);
cachetime = Sys_FileTime (cachepath);
@@ -1461,7 +1462,7 @@
*/
int COM_FOpenFile (char *filename, FILE **file)
{
- return COM_FindFile (filename, NULL, file);
+ return COM_FindFile (filename, nil, file);
}
/*
@@ -1501,12 +1502,12 @@
char base[32];
int len;
- buf = NULL; // quiet compiler warning
+ buf = nil; // quiet compiler warning
// look for it in the filesystem or pack files
len = COM_OpenFile (path, &h);
if (h == -1)
- return NULL;
+ return nil;
// extract the filename base name for hunk tag
COM_FileBase (path, base);
@@ -1594,7 +1595,7 @@
if (Sys_FileOpenRead (packfile, &packhandle) == -1)
{
// Con_Printf ("Couldn't open %s\n", packfile);
- return NULL;
+ return nil;
}
Sys_FileRead (packhandle, (void *)&header, sizeof(header));
if (header.id[0] != 'P' || header.id[1] != 'A'
@@ -1606,7 +1607,7 @@
numpackfiles = header.dirlen / sizeof(dpackfile_t);
if (numpackfiles > MAX_FILES_IN_PACK)
- Sys_Error ("%s has %i files", packfile, numpackfiles);
+ Sys_Error ("%s has %d files", packfile, numpackfiles);
if (numpackfiles != PAK0_COUNT)
com_modified = true; // not the original file
@@ -1637,7 +1638,7 @@
pack->numfiles = numpackfiles;
pack->files = newfiles;
- Con_Printf ("Added packfile %s (%i files)\n", packfile, numpackfiles);
+ Con_Printf ("Added packfile %s (%d files)\n", packfile, numpackfiles);
return pack;
}
@@ -1672,7 +1673,7 @@
//
for (i=0 ; ; i++)
{
- sprintf (pakfile, "%s/pak%i.pak", dir, i);
+ sprint (pakfile, "%s/pak%d.pak", dir, i);
pak = COM_LoadPackFile (pakfile);
if (!pak)
break;
@@ -1764,7 +1765,7 @@
if (i)
{
com_modified = true;
- com_searchpaths = NULL;
+ com_searchpaths = nil;
while (++i < com_argc)
{
if (!com_argv[i] || com_argv[i][0] == '+' || com_argv[i][0] == '-')
--- a/console.c
+++ b/console.c
@@ -1,7 +1,6 @@
-//#include <unistd.h>
-//#include <fcntl.h>
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
int con_linewidth;
@@ -197,7 +196,7 @@
{
if (strlen (com_gamedir) < (MAXGAMEDIRLEN - strlen (t2)))
{
- sprintf (temp, "%s%s", com_gamedir, t2);
+ sprint (temp, "%s%s", com_gamedir, t2);
remove (temp);
}
}
@@ -333,7 +332,7 @@
int fd;
va_start(argptr, fmt);
- vsprintf(data, fmt, argptr);
+ vseprint(data, data+sizeof(data), fmt, argptr);
va_end(argptr);
/*fd = open(file, OWRITE | O_WRONLY | O_CREAT | O_APPEND, 0666);*/
fd = open(file, OWRITE);
@@ -358,7 +357,7 @@
static qboolean inupdate;
va_start (argptr,fmt);
- vsprintf (msg,fmt,argptr);
+ vseprint (msg,msg+sizeof(msg),fmt,argptr);
va_end (argptr);
// also echo to debugging console
@@ -407,7 +406,7 @@
return; // don't confuse non-developers with techie stuff...
va_start (argptr,fmt);
- vsprintf (msg,fmt,argptr);
+ vseprint (msg,msg+sizeof(msg),fmt,argptr);
va_end (argptr);
Con_Printf ("%s", msg);
@@ -428,7 +427,7 @@
int temp;
va_start (argptr,fmt);
- vsprintf (msg,fmt,argptr);
+ vseprint (msg,msg+sizeof(msg),fmt,argptr);
va_end (argptr);
temp = scr_disabled_for_loading;
--- a/crc.c
+++ b/crc.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "crc.h"
--- a/cvar.c
+++ b/cvar.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
cvar_t *cvar_vars;
@@ -119,7 +120,7 @@
{
char val[32];
- sprintf (val, "%f",value);
+ sprint (val, "%f",value);
Cvar_Set (var_name, val);
}
--- a/d_edge.c
+++ b/d_edge.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "d_local.h"
--- a/d_fill.c
+++ b/d_fill.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
--- a/d_init.c
+++ b/d_init.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "d_local.h"
--- a/d_modech.c
+++ b/d_modech.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "d_local.h"
--- a/d_part.c
+++ b/d_part.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "d_local.h"
--- a/d_polyse.c
+++ b/d_polyse.c
@@ -3,6 +3,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
@@ -43,18 +44,18 @@
edgetable *pedgetable;
edgetable edgetables[12] = {
- {0, 1, r_p0, r_p2, NULL, 2, r_p0, r_p1, r_p2 },
- {0, 2, r_p1, r_p0, r_p2, 1, r_p1, r_p2, NULL},
- {1, 1, r_p0, r_p2, NULL, 1, r_p1, r_p2, NULL},
- {0, 1, r_p1, r_p0, NULL, 2, r_p1, r_p2, r_p0 },
- {0, 2, r_p0, r_p2, r_p1, 1, r_p0, r_p1, NULL},
- {0, 1, r_p2, r_p1, NULL, 1, r_p2, r_p0, NULL},
- {0, 1, r_p2, r_p1, NULL, 2, r_p2, r_p0, r_p1 },
- {0, 2, r_p2, r_p1, r_p0, 1, r_p2, r_p0, NULL},
- {0, 1, r_p1, r_p0, NULL, 1, r_p1, r_p2, NULL},
- {1, 1, r_p2, r_p1, NULL, 1, r_p0, r_p1, NULL},
- {1, 1, r_p1, r_p0, NULL, 1, r_p2, r_p0, NULL},
- {0, 1, r_p0, r_p2, NULL, 1, r_p0, r_p1, NULL},
+ {0, 1, r_p0, r_p2, nil, 2, r_p0, r_p1, r_p2 },
+ {0, 2, r_p1, r_p0, r_p2, 1, r_p1, r_p2, nil},
+ {1, 1, r_p0, r_p2, nil, 1, r_p1, r_p2, nil},
+ {0, 1, r_p1, r_p0, nil, 2, r_p1, r_p2, r_p0 },
+ {0, 2, r_p0, r_p2, r_p1, 1, r_p0, r_p1, nil},
+ {0, 1, r_p2, r_p1, nil, 1, r_p2, r_p0, nil},
+ {0, 1, r_p2, r_p1, nil, 2, r_p2, r_p0, r_p1 },
+ {0, 2, r_p2, r_p1, r_p0, 1, r_p2, r_p0, nil},
+ {0, 1, r_p1, r_p0, nil, 1, r_p1, r_p2, nil},
+ {1, 1, r_p2, r_p1, nil, 1, r_p0, r_p1, nil},
+ {1, 1, r_p1, r_p0, nil, 1, r_p2, r_p0, nil},
+ {0, 1, r_p0, r_p2, nil, 1, r_p0, r_p1, nil},
};
// FIXME: some of these can become statics
--- a/d_scan.c
+++ b/d_scan.c
@@ -4,6 +4,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
@@ -222,7 +223,7 @@
} while (count > 0);
- } while ((pspan = pspan->pnext) != NULL);
+ } while ((pspan = pspan->pnext) != nil);
}
@@ -356,7 +357,7 @@
} while (count > 0);
- } while ((pspan = pspan->pnext) != NULL);
+ } while ((pspan = pspan->pnext) != nil);
}
@@ -415,5 +416,5 @@
if (count & 1)
*pdest = (short)(izi >> 16);
- } while ((pspan = pspan->pnext) != NULL);
+ } while ((pspan = pspan->pnext) != nil);
}
--- a/d_sky.c
+++ b/d_sky.c
@@ -1,7 +1,6 @@
-// d_sky.c
-
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
@@ -116,6 +115,6 @@
} while (count > 0);
- } while ((pspan = pspan->pnext) != NULL);
+ } while ((pspan = pspan->pnext) != nil);
}
--- a/d_sprite.c
+++ b/d_sprite.c
@@ -3,6 +3,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "d_local.h"
@@ -144,7 +145,7 @@
btemp = *(pbase + (s >> 16) + (t >> 16) * cachewidth);
if (btemp != 255)
{
- if (*pz <= (izi >> 16))
+ if (*pz <= (izi >> 16)) /* FIXME: segfault: assumed 32bit ptr? */
{
*pz = izi >> 16;
*pdest = btemp;
--- a/d_surf.c
+++ b/d_surf.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "d_local.h"
#include "r_local.h"
@@ -67,14 +68,14 @@
{
if (!msg_suppress_1)
- Con_Printf ("%ik surface cache\n", size/1024);
+ Con_Printf ("%dk surface cache\n", size/1024);
sc_size = size - GUARDSIZE;
sc_base = (surfcache_t *)buffer;
sc_rover = sc_base;
- sc_base->next = NULL;
- sc_base->owner = NULL;
+ sc_base->next = nil;
+ sc_base->owner = nil;
sc_base->size = sc_size;
D_ClearCacheGuard ();
@@ -96,12 +97,12 @@
for (c = sc_base ; c ; c = c->next)
{
if (c->owner)
- *c->owner = NULL;
+ *c->owner = nil;
}
sc_rover = sc_base;
- sc_base->next = NULL;
- sc_base->owner = NULL;
+ sc_base->next = nil;
+ sc_base->owner = nil;
sc_base->size = sc_size;
}
@@ -124,7 +125,7 @@
size = (uintptr)&((surfcache_t *)0)->data[size];
size = (size + 3) & ~3;
if (size > sc_size)
- Sys_Error ("D_SCAlloc: %i > cache size",size);
+ Sys_Error ("D_SCAlloc: %d > cache size",size);
// if there is not size bytes after the rover, reset to the start
wrapped_this_time = false;
@@ -141,7 +142,7 @@
// colect and free surfcache_t blocks until the rover block is large enough
new = sc_rover;
if (sc_rover->owner)
- *sc_rover->owner = NULL;
+ *sc_rover->owner = nil;
while (new->size < size)
{
@@ -150,7 +151,7 @@
if (!sc_rover)
Sys_Error ("D_SCAlloc: hit the end of memory");
if (sc_rover->owner)
- *sc_rover->owner = NULL;
+ *sc_rover->owner = nil;
new->size += sc_rover->size;
new->next = sc_rover->next;
@@ -163,7 +164,7 @@
sc_rover->size = new->size - size;
sc_rover->next = new->next;
sc_rover->width = 0;
- sc_rover->owner = NULL;
+ sc_rover->owner = nil;
new->next = sc_rover;
new->size = size;
}
@@ -175,7 +176,7 @@
if (width > 0)
new->height = (size - sizeof(*new) + sizeof(new->data)) / width;
- new->owner = NULL; // should be set properly after return
+ new->owner = nil; // should be set properly after return
if (d_roverwrapped)
{
@@ -205,7 +206,7 @@
{
if (test == sc_rover)
Sys_Printf ("ROVER:\n");
- printf ("%p : %i bytes %i width\n",test, test->size, test->width);
+ print ("%p : %d bytes %ud width\n",test, test->size, test->width);
}
}
--- a/d_vars.c
+++ b/d_vars.c
@@ -2,7 +2,8 @@
#include <u.h>
#include <libc.h>
-#include "quakedef.h"
+#include <stdio.h>
+#include "quakedef.h"
// all global and static refresh variables are collected in a contiguous block
// to avoid cache conflicts.
--- a/d_zpoint.c
+++ b/d_zpoint.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "d_local.h"
--- a/draw.c
+++ b/draw.c
@@ -3,6 +3,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
typedef struct {
@@ -126,9 +127,9 @@
#ifdef PARANOID
if (y > vid.height - 8 || x < 0 || x > vid.width - 8)
- Sys_Error ("Con_DrawCharacter: (%i, %i)", x, y);
+ Sys_Error ("Con_DrawCharacter: (%d, %d)", x, y);
if (num < 0 || num > 255)
- Sys_Error ("Con_DrawCharacter: char %i", num);
+ Sys_Error ("Con_DrawCharacter: char %d", num);
#endif
row = num>>4;
--- a/host.c
+++ b/host.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -72,7 +73,7 @@
char string[1024];
va_start (argptr,message);
- vsprintf (string,message,argptr);
+ vseprint (string,string+sizeof(string),message,argptr);
va_end (argptr);
Con_DPrintf ("Host_EndGame: %s\n",string);
@@ -110,7 +111,7 @@
SCR_EndLoadingPlaque (); // reenable screen updates
va_start (argptr,error);
- vsprintf (string,error,argptr);
+ vseprint (string,string+sizeof(string),error,argptr);
va_end (argptr);
Con_Printf ("Host_Error: %s\n",string);
@@ -259,7 +260,7 @@
char string[1024];
va_start (argptr,fmt);
- vsprintf (string, fmt,argptr);
+ vseprint (string,string+sizeof(string),fmt,argptr);
va_end (argptr);
MSG_WriteByte (&host_client->message, svc_print);
@@ -280,7 +281,7 @@
int i;
va_start (argptr,fmt);
- vsprintf (string, fmt,argptr);
+ vseprint (string,string+sizeof(string),fmt,argptr);
va_end (argptr);
for (i=0 ; i<svs.maxclients ; i++)
@@ -304,7 +305,7 @@
char string[1024];
va_start (argptr,fmt);
- vsprintf (string, fmt,argptr);
+ vseprint (string,string+sizeof(string),fmt,argptr);
va_end (argptr);
MSG_WriteByte (&host_client->message, svc_stufftext);
@@ -349,7 +350,7 @@
// break the net connection
NET_Close (host_client->netconnection);
- host_client->netconnection = NULL;
+ host_client->netconnection = nil;
// free the client (the body stays around)
host_client->active = false;
@@ -431,7 +432,7 @@
MSG_WriteByte(&buf, svc_disconnect);
count = NET_SendToAll(&buf, 5);
if (count)
- Con_Printf("Host_ShutdownServer: NET_SendToAll failed for %u clients\n", count);
+ Con_Printf("Host_ShutdownServer: NET_SendToAll failed for %ud clients\n", count);
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
if (host_client->active)
@@ -649,7 +650,7 @@
time3 = Sys_FloatTime ();
pass2 = (time2 - time1)*1000;
pass3 = (time3 - time2)*1000;
- Con_Printf ("%3i tot %3i server %3i gfx %3i snd\n",
+ Con_Printf ("%3d tot %3d server %3d gfx %3d snd\n",
pass1+pass2+pass3, pass1, pass2, pass3);
}
@@ -689,7 +690,7 @@
c++;
}
- Con_Printf ("serverprofile: %2i clients %2i msec\n", c, m);
+ Con_Printf ("serverprofile: %2d clients %2d msec\n", c, m);
}
//============================================================================
@@ -849,7 +850,7 @@
if (isdown)
{
- printf ("recursive shutdown\n");
+ print ("recursive shutdown\n");
return;
}
isdown = true;
--- a/host_cmd.c
+++ b/host_cmd.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
extern cvar_t pausable;
@@ -63,7 +64,7 @@
if (ipxAvailable)
print ("ipx: %s\n", my_ipx_address);
print ("map: %s\n", sv.name);
- print ("players: %i active (%i max)\n\n", net_activeconnections, svs.maxclients);
+ print ("players: %d active (%d max)\n\n", net_activeconnections, svs.maxclients);
for (j=0, client = svs.clients ; j<svs.maxclients ; j++, client++)
{
if (!client->active)
@@ -79,7 +80,7 @@
}
else
hours = 0;
- print ("#%-2u %-16.16s %3i %2i:%02i:%02i\n", j+1, client->name, (int)client->edict->v.frags, hours, minutes, seconds);
+ print ("#%-2ud %-16.16s %3d %2d:%02d:%02d\n", j+1, client->name, (int)client->edict->v.frags, hours, minutes, seconds);
print (" %s\n", client->netconnection->address);
}
}
@@ -213,7 +214,7 @@
for (j=0 ; j<NUM_PING_TIMES ; j++)
total+=client->ping_times[j];
total /= NUM_PING_TIMES;
- SV_ClientPrintf ("%4i %s\n", (int)(total*1000), client->name);
+ SV_ClientPrintf ("%4d %s\n", (int)(total*1000), client->name);
}
}
@@ -388,7 +389,7 @@
for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
text[i] = ' ';
memcpy (text, cl.levelname, strlen(cl.levelname));
- sprintf (kills,"kills:%3i/%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
+ sprint (kills,"kills:%3d/%3d", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
memcpy (text+22, kills, strlen(kills));
// convert space to _ to make stdio happy
for (i=0 ; i<SAVEGAME_COMMENT_LENGTH ; i++)
@@ -452,7 +453,7 @@
}
}
- sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
+ sprint (name, "%s/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (name, ".sav");
Con_Printf ("Saving game to %s...\n", name);
@@ -463,7 +464,7 @@
return;
}
- fprintf (f, "%i\n", SAVEGAME_VERSION);
+ fprintf (f, "%d\n", SAVEGAME_VERSION);
Host_SavegameComment (comment);
fprintf (f, "%s\n", comment);
for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
@@ -523,7 +524,7 @@
cls.demonum = -1; // stop demo loop in case this fails
- sprintf (name, "%s/%s", com_gamedir, Cmd_Argv(1));
+ sprint (name, "%s/%s", com_gamedir, Cmd_Argv(1));
COM_DefaultExtension (name, ".sav");
// we can't call SCR_BeginLoadingPlaque, because too much stack space has
@@ -538,11 +539,11 @@
return;
}
- fscanf (f, "%i\n", &version);
+ fscanf (f, "%d\n", &version);
if (version != SAVEGAME_VERSION)
{
fclose (f);
- Con_Printf ("Savegame is version %i, not %i\n", version, SAVEGAME_VERSION);
+ Con_Printf ("Savegame is version %d, not %d\n", version, SAVEGAME_VERSION);
return;
}
fscanf (f, "%s\n", str);
@@ -780,9 +781,9 @@
// turn on color set 1
if (!fromServer)
- sprintf (text, "%c%s: ", 1, save->name);
+ sprint (text, "%c%s: ", 1, save->name);
else
- sprintf (text, "%c<%s> ", 1, hostname.string);
+ sprint (text, "%c<%s> ", 1, hostname.string);
j = sizeof(text) - 2 - Q_strlen(text); // -2 for /n and null terminator
if (Q_strlen(p) > j)
@@ -882,7 +883,7 @@
if (Cmd_Argc() == 1)
{
- Con_Printf ("\"color\" is \"%i %i\"\n", ((int)cl_color.value) >> 4, ((int)cl_color.value) & 0x0f);
+ Con_Printf ("\"color\" is \"%d %d\"\n", ((int)cl_color.value) >> 4, ((int)cl_color.value) & 0x0f);
Con_Printf ("color <0-13> [0-13]\n");
return;
}
@@ -1162,7 +1163,7 @@
void Host_Kick_f (void)
{
char *who;
- char *message = NULL;
+ char *message = nil;
client_t *save;
int i;
qboolean byNumber = false;
@@ -1417,7 +1418,7 @@
return e;
}
Con_Printf ("No viewthing on map\n");
- return NULL;
+ return nil;
}
/*
@@ -1479,7 +1480,7 @@
return;
pframedesc = &hdr->frames[frame];
- Con_Printf ("frame %i: %s\n", frame, pframedesc->name);
+ Con_Printf ("frame %d: %s\n", frame, pframedesc->name);
}
/*
@@ -1555,10 +1556,10 @@
c = Cmd_Argc() - 1;
if (c > MAX_DEMOS)
{
- Con_Printf ("Max %i demos in demoloop\n", MAX_DEMOS);
+ Con_Printf ("Max %d demos in demoloop\n", MAX_DEMOS);
c = MAX_DEMOS;
}
- Con_Printf ("%i demo(s) in loop\n", c);
+ Con_Printf ("%d demo(s) in loop\n", c);
for (i=1 ; i<c+1 ; i++)
strncpy (cls.demos[i-1], Cmd_Argv(i), sizeof(cls.demos[0])-1);
--- a/in_9.c
+++ b/in_9.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include <draw.h>
#include <thread.h>
#include <mouse.h>
--- a/keys.c
+++ b/keys.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
/*
@@ -120,7 +121,7 @@
{"SEMICOLON", ';'}, // because a raw semicolon seperates commands
- {NULL,0}
+ {nil,0}
};
/*
@@ -386,7 +387,7 @@
if (keybindings[keynum])
{
Z_Free (keybindings[keynum]);
- keybindings[keynum] = NULL;
+ keybindings[keynum] = nil;
}
// allocate memory for new binding
@@ -649,7 +650,7 @@
kb = keybindings[key];
if (kb && kb[0] == '+')
{
- sprintf (cmd, "-%s %i\n", kb+1, key);
+ sprint (cmd, "-%s %d\n", kb+1, key);
Cbuf_AddText (cmd);
}
if (keyshift[key] != key)
@@ -657,7 +658,7 @@
kb = keybindings[keyshift[key]];
if (kb && kb[0] == '+')
{
- sprintf (cmd, "-%s %i\n", kb+1, key);
+ sprint (cmd, "-%s %d\n", kb+1, key);
Cbuf_AddText (cmd);
}
}
@@ -685,7 +686,7 @@
{
if (kb[0] == '+')
{ // button commands add keynum as a parm
- sprintf (cmd, "%s %i\n", kb, key);
+ sprint (cmd, "%s %d\n", kb, key);
Cbuf_AddText (cmd);
}
else
--- a/mathlib.c
+++ b/mathlib.c
@@ -2,7 +2,7 @@
#include <u.h>
#include <libc.h>
-//#include <math.h>
+#include <stdio.h>
#include "quakedef.h"
void Sys_Error (char *error, ...);
--- a/menu.c
+++ b/menu.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
void (*vid_menudrawfn)(void);
@@ -279,7 +280,7 @@
f = (int)(host_time * 10)%6;
- M_DrawTransPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
+ M_DrawTransPic (54, 32 + m_main_cursor * 20,Draw_CachePic( va("gfx/menudot%d.lmp", f+1 ) ) );
}
@@ -362,7 +363,7 @@
f = (int)(host_time * 10)%6;
- M_DrawTransPic (54, 32 + m_singleplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
+ M_DrawTransPic (54, 32 + m_singleplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%d.lmp", f+1 ) ) );
}
@@ -433,7 +434,7 @@
{
strcpy (m_filenames[i], "--- UNUSED SLOT ---");
loadable[i] = false;
- sprintf (name, "%s/s%i.sav", com_gamedir, i);
+ sprint (name, "%s/s%d.sav", com_gamedir, i);
f = fopen (name, "r");
if (!f)
continue;
@@ -526,7 +527,7 @@
SCR_BeginLoadingPlaque ();
// issue the load command
- Cbuf_AddText (va ("load s%i\n", load_cursor) );
+ Cbuf_AddText (va ("load s%d\n", load_cursor) );
return;
case K_UPARROW:
@@ -559,7 +560,7 @@
case K_ENTER:
m_state = m_none;
key_dest = key_game;
- Cbuf_AddText (va("save s%i\n", load_cursor));
+ Cbuf_AddText (va("save s%d\n", load_cursor));
return;
case K_UPARROW:
@@ -607,7 +608,7 @@
f = (int)(host_time * 10)%6;
- M_DrawTransPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
+ M_DrawTransPic (54, 32 + m_multiplayer_cursor * 20,Draw_CachePic( va("gfx/menudot%d.lmp", f+1 ) ) );
if (serialAvailable || ipxAvailable || tcpipAvailable)
return;
@@ -778,7 +779,7 @@
if (Q_strcmp(hostname.string, setup_hostname) != 0)
Cvar_Set("hostname", setup_hostname);
if (setup_top != setup_oldtop || setup_bottom != setup_oldbottom)
- Cbuf_AddText( va ("color %i %i\n", setup_top, setup_bottom) );
+ Cbuf_AddText( va ("color %d %d\n", setup_top, setup_bottom) );
m_entersound = true;
M_Menu_MultiPlayer_f ();
break;
@@ -934,7 +935,7 @@
M_Print (f, 166, net_helpMessage[m_net_cursor*4+3]);
f = (int)(host_time * 10)%6;
- M_DrawTransPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%i.lmp", f+1 ) ) );
+ M_DrawTransPic (54, 32 + m_net_cursor * 20,Draw_CachePic( va("gfx/menudot%d.lmp", f+1 ) ) );
}
@@ -1375,7 +1376,7 @@
S_LocalSound ("misc/menu1.wav");
if (k != '`')
{
- sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
+ sprint (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]);
Cbuf_InsertText (cmd);
}
@@ -1462,7 +1463,7 @@
void M_Help_Draw (void)
{
- M_DrawPic (0, 0, Draw_CachePic ( va("gfx/help%i.lmp", help_page)) );
+ M_DrawPic (0, 0, Draw_CachePic ( va("gfx/help%d.lmp", help_page)) );
}
@@ -1686,15 +1687,15 @@
M_Print (basex, serialConfig_cursor_table[0], "Port");
M_DrawTextBox (160, 40, 4, 1);
- M_Print (168, serialConfig_cursor_table[0], va("COM%u", serialConfig_comport));
+ M_Print (168, serialConfig_cursor_table[0], va("COM%ud", serialConfig_comport));
M_Print (basex, serialConfig_cursor_table[1], "IRQ");
M_DrawTextBox (160, serialConfig_cursor_table[1]-8, 1, 1);
- M_Print (168, serialConfig_cursor_table[1], va("%u", serialConfig_irq));
+ M_Print (168, serialConfig_cursor_table[1], va("%ud", serialConfig_irq));
M_Print (basex, serialConfig_cursor_table[2], "Baud");
M_DrawTextBox (160, serialConfig_cursor_table[2]-8, 5, 1);
- M_Print (168, serialConfig_cursor_table[2], va("%u", serialConfig_baudrate[serialConfig_baud]));
+ M_Print (168, serialConfig_cursor_table[2], va("%ud", serialConfig_baudrate[serialConfig_baud]));
if (SerialConfig)
{
@@ -2090,7 +2091,7 @@
if (StartingGame && lanConfig_cursor == 2)
lanConfig_cursor = 1;
lanConfig_port = DEFAULTnet_hostport;
- sprintf(lanConfig_portname, "%u", lanConfig_port);
+ sprint(lanConfig_portname, "%ud", (uint)lanConfig_port); /* FIXME */
m_return_onerror = false;
m_return_reason[0] = 0;
@@ -2261,7 +2262,7 @@
l = Q_atoi(lanConfig_portname);
if (l < 65535)
lanConfig_port = l;
- sprintf(lanConfig_portname, "%u", lanConfig_port);
+ sprint(lanConfig_portname, "%ud", (uint)lanConfig_port); /* FIXME */
}
//=============================================================================
@@ -2446,7 +2447,7 @@
M_Print (160, 40, "begin game");
M_Print (0, 56, " Max players");
- M_Print (160, 56, va("%i", maxplayers) );
+ M_Print (160, 56, va("%d", maxplayers) );
M_Print (0, 64, " Game Type");
if (coop.value)
@@ -2498,13 +2499,13 @@
if (fraglimit.value == 0)
M_Print (160, 88, "none");
else
- M_Print (160, 88, va("%i frags", (int)fraglimit.value));
+ M_Print (160, 88, va("%d frags", (int)fraglimit.value));
M_Print (0, 96, " Time Limit");
if (timelimit.value == 0)
M_Print (160, 96, "none");
else
- M_Print (160, 96, va("%i minutes", (int)timelimit.value));
+ M_Print (160, 96, va("%d minutes", (int)timelimit.value));
M_Print (0, 112, " Episode");
//MED 01/06/97 added hipnotic episodes
@@ -2703,7 +2704,7 @@
if (sv.active)
Cbuf_AddText ("disconnect\n");
Cbuf_AddText ("listen 0\n"); // so host_netport will be re-examined
- Cbuf_AddText ( va ("maxplayers %u\n", maxplayers) );
+ Cbuf_AddText ( va ("maxplayers %ud\n", maxplayers) );
SCR_BeginLoadingPlaque ();
if (hipnotic)
@@ -2828,9 +2829,9 @@
for (n = 0; n < hostCacheCount; n++)
{
if (hostcache[n].maxusers)
- sprintf(string, "%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
+ sprint(string, "%-15.15s %-15.15s %2ud/%2ud\n", hostcache[n].name, hostcache[n].map, (uint)hostcache[n].users, (uint)hostcache[n].maxusers); /* FIXME */
else
- sprintf(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
+ sprint(string, "%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
M_Print (16, 32 + 8*n, string);
}
M_DrawCharacter (0, 32 + slist_cursor*8, 12+((int)(realtime*4)&1));
--- a/model.c
+++ b/model.c
@@ -5,6 +5,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -154,7 +155,7 @@
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++) {
mod->needload = NL_UNREFERENCED;
//FIX FOR CACHE_ALLOC ERRORS:
- if (mod->type == mod_sprite) mod->cache.data = NULL;
+ if (mod->type == mod_sprite) mod->cache.data = nil;
}
}
@@ -168,10 +169,10 @@
{
int i;
model_t *mod;
- model_t *avail = NULL;
+ model_t *avail = nil;
if (!name[0])
- Sys_Error ("Mod_ForName: NULL name");
+ Sys_Error ("Mod_ForName: nil name");
//
// search the currently loaded models
@@ -265,7 +266,7 @@
{
if (crash)
Sys_Error ("Mod_NumForName: %s not found", mod->name);
- return NULL;
+ return nil;
}
//
@@ -344,7 +345,7 @@
if (!l->filelen)
{
- loadmodel->textures = NULL;
+ loadmodel->textures = nil;
return;
}
m = (dmiptexlump_t *)(mod_base + l->fileofs);
@@ -454,7 +455,7 @@
{
tx2 = anims[j];
if (!tx2)
- Sys_Error ("Missing frame %i of %s",j, tx->name);
+ Sys_Error ("Missing frame %d of %s",j, tx->name);
tx2->anim_total = max * ANIM_CYCLE;
tx2->anim_min = j * ANIM_CYCLE;
tx2->anim_max = (j+1) * ANIM_CYCLE;
@@ -466,7 +467,7 @@
{
tx2 = altanims[j];
if (!tx2)
- Sys_Error ("Missing frame %i of %s",j, tx->name);
+ Sys_Error ("Missing frame %d of %s",j, tx->name);
tx2->anim_total = altmax * ANIM_CYCLE;
tx2->anim_min = j * ANIM_CYCLE;
tx2->anim_max = (j+1) * ANIM_CYCLE;
@@ -486,7 +487,7 @@
{
if (!l->filelen)
{
- loadmodel->lightdata = NULL;
+ loadmodel->lightdata = nil;
return;
}
loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname);
@@ -503,7 +504,7 @@
{
if (!l->filelen)
{
- loadmodel->visdata = NULL;
+ loadmodel->visdata = nil;
return;
}
loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname);
@@ -520,7 +521,7 @@
{
if (!l->filelen)
{
- loadmodel->entities = NULL;
+ loadmodel->entities = nil;
return;
}
loadmodel->entities = Hunk_AllocName ( l->filelen, loadname);
@@ -783,7 +784,7 @@
out->styles[i] = in->styles[i];
i = LittleLong(in->lightofs);
if (i == -1)
- out->samples = NULL;
+ out->samples = nil;
else
out->samples = loadmodel->lightdata + i;
@@ -867,7 +868,7 @@
}
}
- Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs
+ Mod_SetParent (loadmodel->nodes, nil); // sets nodes and leafs
}
/*
@@ -907,10 +908,10 @@
p = LittleLong(in->visofs);
if (p == -1)
- out->compressed_vis = NULL;
+ out->compressed_vis = nil;
else
out->compressed_vis = loadmodel->visdata + p;
- out->efrags = NULL;
+ out->efrags = nil;
for (j=0 ; j<4 ; j++)
out->ambient_sound_level[j] = in->ambient_level[j];
@@ -1133,7 +1134,7 @@
i = LittleLong (header->version);
if (i != BSPVERSION)
- Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%i should be %i)", mod->name, i, BSPVERSION);
+ Sys_Error ("Mod_LoadBrushModel: %s has wrong version number (%d should be %d)", mod->name, i, BSPVERSION);
// swap all the lumps
mod_base = (byte *)header;
@@ -1191,7 +1192,7 @@
{ // duplicate the basic information
char name[10];
- sprintf (name, "*%i", i+1);
+ sprint (name, "*%d", i+1);
loadmodel = Mod_FindName (name);
*loadmodel = *mod;
strcpy (loadmodel->name, name);
@@ -1442,7 +1443,7 @@
version = LittleLong (pinmodel->version);
if (version != ALIAS_VERSION)
- Sys_Error ("%s has wrong version number (%i should be %i)",
+ Sys_Error ("%s has wrong version number (%d should be %d)",
mod->name, version, ALIAS_VERSION);
//
@@ -1771,7 +1772,7 @@
version = LittleLong (pin->version);
if (version != SPRITE_VERSION)
Sys_Error ("%s has wrong version number "
- "(%i should be %i)", mod->name, version, SPRITE_VERSION);
+ "(%d should be %d)", mod->name, version, SPRITE_VERSION);
numframes = LittleLong (pin->numframes);
--- a/net_bsd.c
+++ b/net_bsd.c
@@ -1,7 +1,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
-
#include "net_loop.h"
#include "net_dgrm.h"
--- a/net_dgrm.c
+++ b/net_dgrm.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
// This is enables a simple IP banning mechanism
//#define BAN_TEST /* FIXME */
@@ -67,7 +68,7 @@
int n;
for (n = 0; n < 16; n++)
- sprintf (buf + n * 2, "%02x", *p++);
+ sprint (buf + n * 2, "%02x", *p++);
return buf;
}
#endif
@@ -144,7 +145,7 @@
Sys_Error("Datagram_SendMessage: zero length message\n");
if (data->cursize > NET_MAXMESSAGE)
- Sys_Error("Datagram_SendMessage: message too big %u\n", data->cursize);
+ Sys_Error("Datagram_SendMessage: message too big %ud\n", data->cursize);
if (sock->canSend == false)
Sys_Error("SendMessage: called with canSend == false\n");
@@ -270,7 +271,7 @@
Sys_Error("Datagram_SendUnreliableMessage: zero length message\n");
if (data->cursize > MAX_DATAGRAM)
- Sys_Error("Datagram_SendUnreliableMessage: message too big %u\n", data->cursize);
+ Sys_Error("Datagram_SendUnreliableMessage: message too big %ud\n", data->cursize);
#endif
packetLen = NET_HEADERSIZE + data->cursize;
@@ -354,7 +355,7 @@
{
count = sequence - sock->unreliableReceiveSequence;
droppedDatagrams += count;
- Con_DPrintf("Dropped %u datagram(s)\n", count);
+ Con_DPrintf("Dropped %ud datagram(s)\n", count);
}
sock->unreliableReceiveSequence = sequence + 1;
@@ -440,9 +441,9 @@
void PrintStats(qsocket_t *s)
{
- Con_Printf("canSend = %4u \n", s->canSend);
- Con_Printf("sendSeq = %4u ", s->sendSequence);
- Con_Printf("recvSeq = %4u \n", s->receiveSequence);
+ Con_Printf("canSend = %4ud \n", s->canSend);
+ Con_Printf("sendSeq = %4ud ", s->sendSequence);
+ Con_Printf("recvSeq = %4ud \n", s->receiveSequence);
Con_Printf("\n");
}
@@ -452,16 +453,16 @@
if (Cmd_Argc () == 1)
{
- Con_Printf("unreliable messages sent = %i\n", unreliableMessagesSent);
- Con_Printf("unreliable messages recv = %i\n", unreliableMessagesReceived);
- Con_Printf("reliable messages sent = %i\n", messagesSent);
- Con_Printf("reliable messages received = %i\n", messagesReceived);
- Con_Printf("packetsSent = %i\n", packetsSent);
- Con_Printf("packetsReSent = %i\n", packetsReSent);
- Con_Printf("packetsReceived = %i\n", packetsReceived);
- Con_Printf("receivedDuplicateCount = %i\n", receivedDuplicateCount);
- Con_Printf("shortPacketCount = %i\n", shortPacketCount);
- Con_Printf("droppedDatagrams = %i\n", droppedDatagrams);
+ Con_Printf("unreliable messages sent = %d\n", unreliableMessagesSent);
+ Con_Printf("unreliable messages recv = %d\n", unreliableMessagesReceived);
+ Con_Printf("reliable messages sent = %d\n", messagesSent);
+ Con_Printf("reliable messages received = %d\n", messagesReceived);
+ Con_Printf("packetsSent = %d\n", packetsSent);
+ Con_Printf("packetsReSent = %d\n", packetsReSent);
+ Con_Printf("packetsReceived = %d\n", packetsReceived);
+ Con_Printf("receivedDuplicateCount = %d\n", receivedDuplicateCount);
+ Con_Printf("shortPacketCount = %d\n", shortPacketCount);
+ Con_Printf("droppedDatagrams = %d\n", droppedDatagrams);
}
else if (Q_strcmp(Cmd_Argv(1), "*") == 0)
{
@@ -475,11 +476,11 @@
for (s = net_activeSockets; s; s = s->next)
if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0)
break;
- if (s == NULL)
+ if (s == nil)
for (s = net_freeSockets; s; s = s->next)
if (Q_strcasecmp(Cmd_Argv(1), s->address) == 0)
break;
- if (s == NULL)
+ if (s == nil)
return;
PrintStats(s);
}
@@ -492,7 +493,7 @@
static int testSocket;
static void Test_Poll(void *);
-PollProcedure testPollProcedure = {NULL, 0.0, Test_Poll};
+PollProcedure testPollProcedure = {nil, 0.0, Test_Poll};
static void Test_Poll(void *)
{
@@ -536,7 +537,7 @@
connectTime = MSG_ReadLong();
Q_strcpy(address, MSG_ReadString());
- Con_Printf("%s\n frags:%3i colors:%u %u time:%u\n %s\n", name, frags, colors >> 4, colors & 0x0f, connectTime / 60, address);
+ Con_Printf("%s\n frags:%3d colors:%ud %ud time:%ud\n %s\n", name, frags, colors >> 4, colors & 0x0f, connectTime / 60, address);
}
testPollCount--;
@@ -620,7 +621,7 @@
static int test2Socket;
static void Test2_Poll(void *);
-PollProcedure test2PollProcedure = {NULL, 0.0, Test2_Poll};
+PollProcedure test2PollProcedure = {nil, 0.0, Test2_Poll};
static void Test2_Poll(void *)
{
@@ -817,13 +818,13 @@
acceptsock = dfunc.CheckNewConnections();
if (acceptsock == -1)
- return NULL;
+ return nil;
SZ_Clear(&net_message);
len = dfunc.Read (acceptsock, net_message.data, net_message.maxsize, &clientaddr);
if (len < sizeof(int))
- return NULL;
+ return nil;
net_message.cursize = len;
MSG_BeginReading ();
@@ -830,17 +831,17 @@
control = BigLong(*((int *)net_message.data));
MSG_ReadLong();
if (control == -1)
- return NULL;
+ return nil;
if ((control & (~NETFLAG_LENGTH_MASK)) != NETFLAG_CTL)
- return NULL;
+ return nil;
if ((control & NETFLAG_LENGTH_MASK) != len)
- return NULL;
+ return nil;
command = MSG_ReadByte();
if (command == CCREQ_SERVER_INFO)
{
if (Q_strcmp(MSG_ReadString(), "QUAKE") != 0)
- return NULL;
+ return nil;
SZ_Clear(&net_message);
// save space for the header, filled in later
@@ -856,7 +857,7 @@
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message);
- return NULL;
+ return nil;
}
if (command == CCREQ_PLAYER_INFO)
@@ -878,7 +879,7 @@
}
}
if (clientNumber == svs.maxclients)
- return NULL;
+ return nil;
SZ_Clear(&net_message);
// save space for the header, filled in later
@@ -894,7 +895,7 @@
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message);
- return NULL;
+ return nil;
}
if (command == CCREQ_RULE_INFO)
@@ -908,7 +909,7 @@
{
var = Cvar_FindVar (prevCvarName);
if (!var)
- return NULL;
+ return nil;
var = var->next;
}
else
@@ -937,14 +938,14 @@
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message);
- return NULL;
+ return nil;
}
if (command != CCREQ_CONNECT)
- return NULL;
+ return nil;
if (Q_strcmp(MSG_ReadString(), "QUAKE") != 0)
- return NULL;
+ return nil;
if (MSG_ReadByte() != NET_PROTOCOL_VERSION)
{
@@ -956,7 +957,7 @@
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message);
- return NULL;
+ return nil;
}
#ifdef BAN_TEST
@@ -975,7 +976,7 @@
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message);
- return NULL;
+ return nil;
}
}
#endif
@@ -1001,18 +1002,18 @@
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message);
- return NULL;
+ return nil;
}
// it's somebody coming back in from a crash/disconnect
// so close the old qsocket and let their retry get them back in
NET_Close(s);
- return NULL;
+ return nil;
}
}
// allocate a QSocket
sock = NET_NewQSocket ();
- if (sock == NULL)
+ if (sock == nil)
{
// no room; try to let him know
SZ_Clear(&net_message);
@@ -1023,7 +1024,7 @@
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
dfunc.Write (acceptsock, net_message.data, net_message.cursize, &clientaddr);
SZ_Clear(&net_message);
- return NULL;
+ return nil;
}
// allocate a network socket
@@ -1031,7 +1032,7 @@
if (newsock == -1)
{
NET_FreeQSocket(sock);
- return NULL;
+ return nil;
}
// connect to the client
@@ -1039,7 +1040,7 @@
{
dfunc.CloseSocket(newsock);
NET_FreeQSocket(sock);
- return NULL;
+ return nil;
}
// everything is allocated, just fill in the details
@@ -1065,11 +1066,11 @@
qsocket_t *Datagram_CheckNewConnections (void)
{
- qsocket_t *ret = NULL;
+ qsocket_t *ret = nil;
for (net_landriverlevel = 0; net_landriverlevel < net_numlandrivers; net_landriverlevel++)
if (net_landrivers[net_landriverlevel].initialized)
- if ((ret = _Datagram_CheckNewConnections ()) != NULL)
+ if ((ret = _Datagram_CheckNewConnections ()) != nil)
break;
return ret;
}
@@ -1192,7 +1193,7 @@
struct qsockaddr readaddr;
qsocket_t *sock;
int newsock;
- int ret;
+ int ret = 0;
int reps;
double start_time;
int control;
@@ -1200,14 +1201,14 @@
// see if we can resolve the host name
if (dfunc.GetAddrFromName(host, &sendaddr) == -1)
- return NULL;
+ return nil;
newsock = dfunc.OpenSocket (0);
if (newsock == -1)
- return NULL;
+ return nil;
sock = NET_NewQSocket ();
- if (sock == NULL)
+ if (sock == nil)
goto ErrorReturn2;
sock->socket = newsock;
sock->landriver = net_landriverlevel;
@@ -1350,16 +1351,16 @@
m_state = m_return_state;
m_return_onerror = false;
}
- return NULL;
+ return nil;
}
qsocket_t *Datagram_Connect (char *host)
{
- qsocket_t *ret = NULL;
+ qsocket_t *ret = nil;
for (net_landriverlevel = 0; net_landriverlevel < net_numlandrivers; net_landriverlevel++)
if (net_landrivers[net_landriverlevel].initialized)
- if ((ret = _Datagram_Connect (host)) != NULL)
+ if ((ret = _Datagram_Connect (host)) != nil)
break;
return ret;
}
--- a/net_loop.c
+++ b/net_loop.c
@@ -1,11 +1,12 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "net_loop.h"
qboolean localconnectpending = false;
-qsocket_t *loop_client = NULL;
-qsocket_t *loop_server = NULL;
+qsocket_t *loop_client = nil;
+qsocket_t *loop_server = nil;
int Loop_Init (void)
{
@@ -46,16 +47,16 @@
qsocket_t *Loop_Connect (char *host)
{
if (Q_strcmp(host,"local") != 0)
- return NULL;
+ return nil;
localconnectpending = true;
if (!loop_client)
{
- if ((loop_client = NET_NewQSocket ()) == NULL)
+ if ((loop_client = NET_NewQSocket ()) == nil)
{
Con_Printf("Loop_Connect: no qsocket available\n");
- return NULL;
+ return nil;
}
Q_strcpy (loop_client->address, "localhost");
}
@@ -65,10 +66,10 @@
if (!loop_server)
{
- if ((loop_server = NET_NewQSocket ()) == NULL)
+ if ((loop_server = NET_NewQSocket ()) == nil)
{
Con_Printf("Loop_Connect: no qsocket available\n");
- return NULL;
+ return nil;
}
Q_strcpy (loop_server->address, "LOCAL");
}
@@ -86,7 +87,7 @@
qsocket_t *Loop_CheckNewConnections (void)
{
if (!localconnectpending)
- return NULL;
+ return nil;
localconnectpending = false;
loop_server->sendMessageLength = 0;
@@ -215,12 +216,12 @@
void Loop_Close (qsocket_t *sock)
{
if (sock->driverdata)
- ((qsocket_t *)sock->driverdata)->driverdata = NULL;
+ ((qsocket_t *)sock->driverdata)->driverdata = nil;
sock->receiveMessageLength = 0;
sock->sendMessageLength = 0;
sock->canSend = true;
if (sock == loop_client)
- loop_client = NULL;
+ loop_client = nil;
else
- loop_server = NULL;
+ loop_server = nil;
}
--- a/net_main.c
+++ b/net_main.c
@@ -1,10 +1,11 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "net_vcr.h"
-qsocket_t *net_activeSockets = NULL;
-qsocket_t *net_freeSockets = NULL;
+qsocket_t *net_activeSockets = nil;
+qsocket_t *net_freeSockets = nil;
int net_numsockets = 0;
qboolean serialAvailable = false;
@@ -32,8 +33,8 @@
static void Slist_Send(void *);
static void Slist_Poll(void *);
-PollProcedure slistSendProcedure = {NULL, 0.0, Slist_Send};
-PollProcedure slistPollProcedure = {NULL, 0.0, Slist_Poll};
+PollProcedure slistSendProcedure = {nil, 0.0, Slist_Send};
+PollProcedure slistPollProcedure = {nil, 0.0, Slist_Poll};
sizebuf_t net_message;
@@ -92,11 +93,11 @@
{
qsocket_t *sock;
- if (net_freeSockets == NULL)
- return NULL;
+ if (net_freeSockets == nil)
+ return nil;
if (net_activeconnections >= svs.maxclients)
- return NULL;
+ return nil;
// get one from free list
sock = net_freeSockets;
@@ -111,7 +112,7 @@
Q_strcpy (sock->address,"UNSET ADDRESS");
sock->driver = net_driverlevel;
sock->socket = 0;
- sock->driverdata = NULL;
+ sock->driverdata = nil;
sock->canSend = true;
sock->sendNext = false;
sock->lastMessageTime = net_time;
@@ -157,7 +158,7 @@
{
if (Cmd_Argc () != 2)
{
- Con_Printf ("\"listen\" is \"%u\"\n", listening ? 1 : 0);
+ Con_Printf ("\"listen\" is \"%ud\"\n", listening ? 1 : 0);
return;
}
@@ -178,7 +179,7 @@
if (Cmd_Argc () != 2)
{
- Con_Printf ("\"maxplayers\" is \"%u\"\n", svs.maxclients);
+ Con_Printf ("\"maxplayers\" is \"%ud\"\n", svs.maxclients);
return;
}
@@ -194,7 +195,7 @@
if (n > svs.maxclientslimit)
{
n = svs.maxclientslimit;
- Con_Printf ("\"maxplayers\" set to \"%u\"\n", n);
+ Con_Printf ("\"maxplayers\" set to \"%ud\"\n", n);
}
if ((n == 1) && listening)
@@ -217,7 +218,7 @@
if (Cmd_Argc () != 2)
{
- Con_Printf ("\"port\" is \"%u\"\n", net_hostport);
+ Con_Printf ("\"port\" is \"%ud\"\n", net_hostport);
return;
}
@@ -255,7 +256,7 @@
for (n = slistLastShown; n < hostCacheCount; n++)
{
if (hostcache[n].maxusers)
- Con_Printf("%-15.15s %-15.15s %2u/%2u\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
+ Con_Printf("%-15.15s %-15.15s %2ud/%2ud\n", hostcache[n].name, hostcache[n].map, hostcache[n].users, hostcache[n].maxusers);
else
Con_Printf("%-15.15s %-15.15s\n", hostcache[n].name, hostcache[n].map);
}
@@ -355,7 +356,7 @@
SetNetTime();
if (host && *host == 0)
- host = NULL;
+ host = nil;
if (host)
{
@@ -384,10 +385,10 @@
while(slistInProgress)
NET_Poll();
- if (host == NULL)
+ if (host == nil)
{
if (hostCacheCount != 1)
- return NULL;
+ return nil;
host = hostcache[0].cname;
Con_Printf("Connecting to...\n%s @ %s\n\n", hostcache[0].name, host);
}
@@ -418,7 +419,7 @@
PrintSlistTrailer();
}
- return NULL;
+ return nil;
}
@@ -470,7 +471,7 @@
Sys_FileWrite (vcrFile, &vcrConnect, sizeof(vcrConnect));
}
- return NULL;
+ return nil;
}
/*
@@ -905,7 +906,7 @@
}
-static PollProcedure *pollProcedureList = NULL;
+static PollProcedure *pollProcedureList = nil;
void NET_Poll(void)
{
@@ -943,7 +944,7 @@
PollProcedure *pp, *prev;
proc->nextTime = Sys_FloatTime() + timeOffset;
- for (pp = pollProcedureList, prev = NULL; pp; pp = pp->next)
+ for (pp = pollProcedureList, prev = nil; pp; pp = pp->next)
{
if (pp->nextTime >= proc->nextTime)
break;
@@ -950,7 +951,7 @@
prev = pp;
}
- if (prev == NULL)
+ if (prev == nil)
{
proc->next = pollProcedureList;
pollProcedureList = proc;
--- a/net_udp.c
+++ b/net_udp.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
/* FIXME FIXME FIXME */
--- a/net_vcr.c
+++ b/net_vcr.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "net_vcr.h"
@@ -121,7 +122,7 @@
qsocket_t *VCR_Connect (char *) /*host*/
{
- return NULL;
+ return nil;
}
@@ -135,7 +136,7 @@
if (!next.session)
{
VCR_ReadNext ();
- return NULL;
+ return nil;
}
sock = NET_NewQSocket ();
--- a/nonintel.c
+++ b/nonintel.c
@@ -4,6 +4,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#define RETURN_EDICT(e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e))
@@ -552,13 +553,13 @@
attenuation = G_FLOAT(OFS_PARM4);
if (volume < 0 || volume > 255)
- Sys_Error ("SV_StartSound: volume = %i", volume);
+ Sys_Error ("SV_StartSound: volume = %d", volume);
if (attenuation < 0 || attenuation > 4)
Sys_Error ("SV_StartSound: attenuation = %f", attenuation);
if (channel < 0 || channel > 7)
- Sys_Error ("SV_StartSound: channel = %i", channel);
+ Sys_Error ("SV_StartSound: channel = %d", channel);
SV_StartSound (entity, channel, sample, volume, attenuation);
}
@@ -880,9 +881,9 @@
v = G_FLOAT(OFS_PARM0);
if (v == (int)v)
- sprintf (pr_string_temp, "%d",(int)v);
+ sprint (pr_string_temp, "%d",(int)v);
else
- sprintf (pr_string_temp, "%5.1f",v);
+ sprint (pr_string_temp, "%5.1f",v);
G_INT(OFS_RETURN) = pr_string_temp - pr_strings;
}
@@ -895,7 +896,7 @@
void PF_vtos (void)
{
- sprintf (pr_string_temp, "'%5.1f %5.1f %5.1f'", G_VECTOR(OFS_PARM0)[0], G_VECTOR(OFS_PARM0)[1], G_VECTOR(OFS_PARM0)[2]);
+ sprint (pr_string_temp, "'%5.1f %5.1f %5.1f'", G_VECTOR(OFS_PARM0)[0], G_VECTOR(OFS_PARM0)[1], G_VECTOR(OFS_PARM0)[2]);
G_INT(OFS_RETURN) = pr_string_temp - pr_strings;
}
@@ -1254,7 +1255,7 @@
// try all possible entities
VectorCopy (dir, bestdir);
bestdist = sv_aim.value;
- bestent = NULL;
+ bestent = nil;
check = NEXT_EDICT(sv.edicts);
for (i=1 ; i<sv.num_edicts ; i++, check = NEXT_EDICT(check) )
@@ -1383,7 +1384,7 @@
break;
}
- return NULL;
+ return nil;
}
void PF_WriteByte (void)
--- a/pr_edict.c
+++ b/pr_edict.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
dprograms_t *progs;
@@ -41,7 +42,7 @@
char field[MAX_FIELD_LEN];
} gefv_cache;
-static gefv_cache gefvCache[GEFV_CACHESIZE] = {{NULL, ""}, {NULL, ""}};
+static gefv_cache gefvCache[GEFV_CACHESIZE] = {{nil, ""}, {nil, ""}};
/* amd64: kludge for assumed 32bit pointer arithmetic */
char *PR_Str (int ofs)
@@ -55,7 +56,7 @@
=================
ED_ClearEdict
-Sets everything to NULL
+Sets everything to nil
=================
*/
void ED_ClearEdict (edict_t *e)
@@ -147,7 +148,7 @@
if (def->ofs == ofs)
return def;
}
- return NULL;
+ return nil;
}
/*
@@ -166,7 +167,7 @@
if (def->ofs == ofs)
return def;
}
- return NULL;
+ return nil;
}
/*
@@ -185,7 +186,7 @@
if (!strcmp(PR_Str(def->s_name),name) )
return def;
}
- return NULL;
+ return nil;
}
@@ -205,7 +206,7 @@
if (!strcmp(PR_Str(def->s_name),name) )
return def;
}
- return NULL;
+ return nil;
}
@@ -225,7 +226,7 @@
if (!strcmp(PR_Str(func->s_name),name) )
return func;
}
- return NULL;
+ return nil;
}
@@ -279,33 +280,33 @@
switch (type)
{
case ev_string:
- sprintf (line, "%s", PR_Str(val->string));
+ sprint (line, "%s", PR_Str(val->string));
break;
case ev_entity:
- sprintf (line, "entity %i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)) );
+ sprint (line, "entity %d", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)) );
break;
case ev_function:
f = pr_functions + val->function;
- sprintf (line, "%s()", PR_Str(f->s_name));
+ sprint (line, "%s()", PR_Str(f->s_name));
break;
case ev_field:
def = ED_FieldAtOfs ( val->_int );
- sprintf (line, ".%s", PR_Str(def->s_name));
+ sprint (line, ".%s", PR_Str(def->s_name));
break;
case ev_void:
- sprintf (line, "void");
+ sprint (line, "void");
break;
case ev_float:
- sprintf (line, "%5.1f", val->_float);
+ sprint (line, "%5.1f", val->_float);
break;
case ev_vector:
- sprintf (line, "'%5.1f %5.1f %5.1f'", val->vector[0], val->vector[1], val->vector[2]);
+ sprint (line, "'%5.1f %5.1f %5.1f'", val->vector[0], val->vector[1], val->vector[2]);
break;
case ev_pointer:
- sprintf (line, "pointer");
+ sprint (line, "pointer");
break;
default:
- sprintf (line, "bad type %i", type);
+ sprint (line, "bad type %d", type);
break;
}
@@ -331,30 +332,30 @@
switch (type)
{
case ev_string:
- sprintf (line, "%s", PR_Str(val->string));
+ sprint (line, "%s", PR_Str(val->string));
break;
case ev_entity:
- sprintf (line, "%i", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
+ sprint (line, "%d", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
break;
case ev_function:
f = pr_functions + val->function;
- sprintf (line, "%s", PR_Str(f->s_name));
+ sprint (line, "%s", PR_Str(f->s_name));
break;
case ev_field:
def = ED_FieldAtOfs ( val->_int );
- sprintf (line, "%s", PR_Str(def->s_name));
+ sprint (line, "%s", PR_Str(def->s_name));
break;
case ev_void:
- sprintf (line, "void");
+ sprint (line, "void");
break;
case ev_float:
- sprintf (line, "%f", val->_float);
+ sprint (line, "%f", val->_float);
break;
case ev_vector:
- sprintf (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
+ sprint (line, "%f %f %f", val->vector[0], val->vector[1], val->vector[2]);
break;
default:
- sprintf (line, "bad type %i", type);
+ sprint (line, "bad type %d", type);
break;
}
@@ -380,11 +381,11 @@
val = (void *)&pr_globals[ofs];
def = ED_GlobalAtOfs(ofs);
if (!def)
- sprintf (line,"%i(???)", ofs);
+ sprint (line,"%d(???)", ofs); /* FIXME */
else
{
s = PR_ValueString (def->type, val);
- sprintf (line,"%i(%s)%s", ofs, PR_Str(def->s_name), s);
+ sprint (line,"%d(%s)%s", ofs, PR_Str(def->s_name), s);
}
i = strlen(line);
@@ -403,9 +404,9 @@
def = ED_GlobalAtOfs(ofs);
if (!def)
- sprintf (line,"%i(???)", ofs);
+ sprint (line,"%d(???)", ofs); /* FIXME */
else
- sprintf (line,"%i(%s)", ofs, PR_Str(def->s_name));
+ sprint (line,"%d(%s)", ofs, PR_Str(def->s_name));
i = strlen(line);
for ( ; i<20 ; i++)
@@ -438,7 +439,7 @@
return;
}
- Con_Printf("\nEDICT %i:\n", NUM_FOR_EDICT(ed));
+ Con_Printf("\nEDICT %d:\n", NUM_FOR_EDICT(ed));
for (i=1 ; i<progs->numfielddefs ; i++)
{
d = &pr_fielddefs[i];
@@ -529,7 +530,7 @@
{
int i;
- Con_Printf ("%i entities\n", sv.num_edicts);
+ Con_Printf ("%d entities\n", sv.num_edicts);
for (i=0 ; i<sv.num_edicts ; i++)
ED_PrintNum (i);
}
@@ -582,11 +583,11 @@
step++;
}
- Con_Printf ("num_edicts:%3i\n", sv.num_edicts);
- Con_Printf ("active :%3i\n", active);
- Con_Printf ("view :%3i\n", models);
- Con_Printf ("touch :%3i\n", solid);
- Con_Printf ("step :%3i\n", step);
+ Con_Printf ("num_edicts:%3d\n", sv.num_edicts);
+ Con_Printf ("active :%3d\n", active);
+ Con_Printf ("view :%3d\n", models);
+ Con_Printf ("touch :%3d\n", solid);
+ Con_Printf ("step :%3d\n", step);
}
@@ -864,7 +865,7 @@
{
char temp[32];
strcpy (temp, com_token);
-sprintf (com_token, "0 %s 0", temp);
+sprint (com_token, "0 %s 0", temp);
}
if (!ED_ParseEpair ((void *)&ent->v, key, com_token))
@@ -899,7 +900,7 @@
int inhibit;
dfunction_t *func;
- ent = NULL;
+ ent = nil;
inhibit = 0;
pr_global_struct->time = sv.time;
@@ -964,7 +965,7 @@
PR_ExecuteProgram (func - pr_functions);
}
- Con_DPrintf ("%i entities inhibited\n", inhibit);
+ Con_DPrintf ("%d entities inhibited\n", inhibit);
}
@@ -996,7 +997,7 @@
((int *)progs)[i] = LittleLong ( ((int *)progs)[i] );
if (progs->version != PROG_VERSION)
- Sys_Error ("progs.dat has wrong version number (%i should be %i)", progs->version, PROG_VERSION);
+ Sys_Error ("progs.dat has wrong version number (%d should be %d)", progs->version, PROG_VERSION);
if (progs->crc != PROGHEADER_CRC)
Sys_Error ("progs.dat system vars have been modified, progdefs.h is out of date");
@@ -1080,7 +1081,7 @@
edict_t *EDICT_NUM(int n)
{
if (n < 0 || n >= sv.max_edicts)
- Sys_Error ("EDICT_NUM: bad number %i", n);
+ Sys_Error ("EDICT_NUM: bad number %d", n);
return (edict_t *)((byte *)sv.edicts+ (n)*pr_edict_size);
}
--- a/pr_exec.c
+++ b/pr_exec.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
@@ -142,10 +143,10 @@
}
if (s->op == OP_IF || s->op == OP_IFNOT)
- Con_Printf ("%sbranch %i",PR_GlobalString(s->a),s->b);
+ Con_Printf ("%sbranch %d",PR_GlobalString(s->a),s->b);
else if (s->op == OP_GOTO)
{
- Con_Printf ("branch %i",s->a);
+ Con_Printf ("branch %d",s->a);
}
else if ( (unsigned)(s->op - OP_STORE_F) < 6)
{
@@ -212,7 +213,7 @@
do
{
max = 0;
- best = NULL;
+ best = nil;
for (i=0 ; i<progs->numfunctions ; i++)
{
f = &pr_functions[i];
@@ -225,7 +226,7 @@
if (best)
{
if (num < 10)
- Con_Printf ("%7i %s\n", best->profile, PR_Str(best->s_name));
+ Con_Printf ("%7d %s\n", best->profile, PR_Str(best->s_name));
num++;
best->profile = 0;
}
@@ -246,7 +247,7 @@
char string[1024];
va_start (argptr,error);
- vsprintf (string,error,argptr);
+ vseprint (string,string+sizeof(string),error,argptr);
va_end (argptr);
PR_PrintStatement (pr_statements + pr_xstatement);
@@ -639,7 +640,7 @@
break;
default:
- PR_RunError ("Bad opcode %i", st->op);
+ PR_RunError ("Bad opcode %d", st->op);
}
}
--- a/quakedef.h
+++ b/quakedef.h
@@ -5,8 +5,6 @@
//#define PARANOID // speed sapping error checking
#define GAMENAME "id1" // directory to look in by default
-#include <stdio.h> /* FIXME */
-
#define VID_LockBuffer()
#define VID_UnlockBuffer()
--- a/r_aclip.c
+++ b/r_aclip.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
--- a/r_alias.c
+++ b/r_alias.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h" // FIXME: shouldn't be needed (is needed for patch
--- a/r_bsp.c
+++ b/r_bsp.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -145,7 +146,7 @@
mvertex_t *pvert, *plastvert, *ptvert;
mnode_t *pn;
- psideedges[0] = psideedges[1] = NULL;
+ psideedges[0] = psideedges[1] = nil;
makeclippededge = false;
@@ -370,7 +371,7 @@
pbedge[j].pnext = &pbedge[j+1];
}
- pbedge[j-1].pnext = NULL; // mark end of edges
+ pbedge[j-1].pnext = nil; // mark end of edges
R_RecursiveClipBPoly (pbedge, currententity->topnode, psurf);
}
--- a/r_draw.c
+++ b/r_draw.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h" // FIXME: shouldn't need to include this
@@ -323,7 +324,7 @@
R_ClipEdge (&clipvert, pv1, clip->next);
return;
}
- } while ((clip = clip->next) != NULL);
+ } while ((clip = clip->next) != nil);
}
// add the edge
@@ -386,7 +387,7 @@
c_faceclip++;
// set up clip planes
- pclip = NULL;
+ pclip = nil;
for (i=3, mask = 0x08 ; i>=0 ; i--, mask >>= 1)
{
@@ -533,7 +534,7 @@
surface_p->spanstate = 0;
surface_p->entity = currententity;
surface_p->key = r_currentkey++;
- surface_p->spans = NULL;
+ surface_p->spans = nil;
pplane = fa->plane;
// FIXME: cache this?
@@ -587,7 +588,7 @@
r_pedge = &tedge;
// set up clip planes
- pclip = NULL;
+ pclip = nil;
for (i=3, mask = 0x08 ; i>=0 ; i--, mask >>= 1)
{
@@ -648,7 +649,7 @@
surface_p->spanstate = 0;
surface_p->entity = currententity;
surface_p->key = r_currentbkey;
- surface_p->spans = NULL;
+ surface_p->spans = nil;
pplane = psurf->plane;
// FIXME: cache this?
@@ -692,7 +693,7 @@
s_axis = t_axis = 0; // keep compiler happy
// set up clip planes
- pclip = NULL;
+ pclip = nil;
for (i=3, mask = 0x08 ; i>=0 ; i--, mask >>= 1)
{
--- a/r_edge.c
+++ b/r_edge.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -113,7 +114,7 @@
surface_p = &surfaces[2]; // background is surface 1,
// surface 0 is a dummy
- surfaces[1].spans = NULL; // no background spans yet
+ surfaces[1].spans = nil; // no background spans yet
surfaces[1].flags = SURF_DRAWBACKGROUND;
// put the background behind everything in the world
@@ -133,7 +134,7 @@
// FIXME: set with memset
for (v=r_refdef.vrect.y ; v<r_refdef.vrectbottom ; v++)
{
- newedges[v] = removeedges[v] = NULL;
+ newedges[v] = removeedges[v] = nil;
}
}
@@ -176,7 +177,7 @@
edgestoadd->prev = edgelist->prev;
edgelist->prev->next = edgestoadd;
edgelist->prev = edgestoadd;
- } while ((edgestoadd = next_edge) != NULL);
+ } while ((edgestoadd = next_edge) != nil);
}
@@ -192,7 +193,7 @@
{
pedge->next->prev = pedge->prev;
pedge->prev->next = pedge->next;
- } while ((pedge = pedge->nextremove) != NULL);
+ } while ((pedge = pedge->nextremove) != nil);
}
@@ -642,7 +643,7 @@
edge_head.u = r_refdef.vrect.x << 20;
edge_head_u_shift20 = edge_head.u >> 20;
edge_head.u_step = 0;
- edge_head.prev = NULL;
+ edge_head.prev = nil;
edge_head.next = &edge_tail;
edge_head.surfs[0] = 0;
edge_head.surfs[1] = 1;
@@ -703,7 +704,7 @@
// clear the surface span pointers
for (s = &surfaces[1] ; s<surface_p ; s++)
- s->spans = NULL;
+ s->spans = nil;
span_p = basespan_p;
}
--- a/r_efrag.c
+++ b/r_efrag.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -61,7 +62,7 @@
cl.free_efrags = old;
}
- ent->efrag = NULL;
+ ent->efrag = nil;
}
/*
@@ -104,7 +105,7 @@
// add the entity link
*lastlink = ef;
lastlink = &ef->entnext;
- ef->entnext = NULL;
+ ef->entnext = nil;
// set the leaf links
ef->leaf = leaf;
@@ -194,7 +195,7 @@
r_addent = ent;
lastlink = &ent->efrag;
- r_pefragtopnode = NULL;
+ r_pefragtopnode = nil;
entmodel = ent->model;
@@ -224,7 +225,7 @@
efrag_t *pefrag;
- while ((pefrag = *ppefrag) != NULL)
+ while ((pefrag = *ppefrag) != nil)
{
pent = pefrag->entity;
clmodel = pent->model;
--- a/r_light.c
+++ b/r_light.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
--- a/r_main.c
+++ b/r_main.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -225,9 +226,9 @@
// clear out efrags in case the level hasn't been reloaded
// FIXME: is this one short?
for (i=0 ; i<cl.worldmodel->numleafs ; i++)
- cl.worldmodel->leafs[i].efrags = NULL;
+ cl.worldmodel->leafs[i].efrags = nil;
- r_viewleaf = NULL;
+ r_viewleaf = nil;
R_ClearParticles ();
r_cnumsurfs = r_maxsurfs.value;
@@ -261,7 +262,7 @@
if (r_numallocatededges <= NUMSTACKEDGES)
{
- auxedges = NULL;
+ auxedges = nil;
}
else
{
@@ -768,7 +769,7 @@
}
else
{
- r_pefragtopnode = NULL;
+ r_pefragtopnode = nil;
for (j=0 ; j<3 ; j++)
{
@@ -796,7 +797,7 @@
R_DrawSubmodelPolygons (clmodel, clipflags);
}
- currententity->topnode = NULL;
+ currententity->topnode = nil;
}
}
--- a/r_misc.c
+++ b/r_misc.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -35,7 +36,7 @@
vr.x = vr.y = 0;
vr.width = vid.width;
vr.height = vid.height;
- vr.pnext = NULL;
+ vr.pnext = nil;
VID_Update (&vr);
}
@@ -71,7 +72,7 @@
vr.y = r_refdef.vrect.y;
vr.width = r_refdef.vrect.width;
vr.height = r_refdef.vrect.height;
- vr.pnext = NULL;
+ vr.pnext = nil;
VID_Update (&vr);
}
stop = Sys_FloatTime ();
@@ -181,7 +182,7 @@
ms = 1000* (r_time2 - r_time1);
- Con_Printf ("%5.1f ms %3i/%3i/%3i poly %3i surf\n",
+ Con_Printf ("%5.1f ms %3d/%3d/%3d poly %3d surf\n",
ms, c_faceclip, r_polycount, r_drawnpolycount, c_surf);
c_surf = 0;
}
@@ -206,7 +207,7 @@
dv_time = (dv_time2 - dv_time1) * 1000;
ms = (r_time2 - r_time1) * 1000;
- Con_Printf ("%3i %4.1fp %3iw %4.1fb %3is %4.1fe %4.1fv\n",
+ Con_Printf ("%3d %4.1fp %3dw %4.1fb %3ds %4.1fe %4.1fv\n",
(int)ms, dp_time, (int)rw_time, db_time, (int)se_time, de_time,
dv_time);
}
@@ -219,7 +220,7 @@
*/
void R_PrintAliasStats (void)
{
- Con_Printf ("%3i polygon model drawn\n", r_amodels_drawn);
+ Con_Printf ("%3d polygon model drawn\n", r_amodels_drawn);
}
--- a/r_part.c
+++ b/r_part.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -120,11 +121,11 @@
int i;
free_particles = &particles[0];
- active_particles = NULL;
+ active_particles = nil;
for (i=0 ;i<r_numparticles ; i++)
particles[i].next = &particles[i+1];
- particles[r_numparticles-1].next = NULL;
+ particles[r_numparticles-1].next = nil;
}
@@ -137,7 +138,7 @@
particle_t *p;
char name[MAX_OSPATH];
- sprintf (name,"maps/%s.pts", sv.name);
+ sprint (name,"maps/%s.pts", sv.name);
COM_FOpenFile (name, &f);
if (!f)
@@ -173,7 +174,7 @@
}
fclose (f);
- Con_Printf ("%i points read\n", c);
+ Con_Printf ("%d points read\n", c);
}
/*
--- a/r_sky.c
+++ b/r_sky.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
#include "d_local.h"
--- a/r_sprite.c
+++ b/r_sprite.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
--- a/r_surf.c
+++ b/r_surf.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
--- a/r_vars.c
+++ b/r_vars.c
@@ -2,7 +2,8 @@
#include <u.h>
#include <libc.h>
-#include "quakedef.h"
+#include <stdio.h>
+#include "quakedef.h"
// all global and static refresh variables are collected in a contiguous block
// to avoid cache conflicts.
--- a/sbar.c
+++ b/sbar.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
@@ -97,8 +98,8 @@
for (i=0 ; i<10 ; i++)
{
- sb_nums[0][i] = Draw_PicFromWad (va("num_%i",i));
- sb_nums[1][i] = Draw_PicFromWad (va("anum_%i",i));
+ sb_nums[0][i] = Draw_PicFromWad (va("num_%d",i));
+ sb_nums[1][i] = Draw_PicFromWad (va("anum_%d",i));
}
sb_nums[0][10] = Draw_PicFromWad ("num_minus");
@@ -125,13 +126,13 @@
for (i=0 ; i<5 ; i++)
{
- sb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_shotgun",i+1));
- sb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_sshotgun",i+1));
- sb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_nailgun",i+1));
- sb_weapons[2+i][3] = Draw_PicFromWad (va("inva%i_snailgun",i+1));
- sb_weapons[2+i][4] = Draw_PicFromWad (va("inva%i_rlaunch",i+1));
- sb_weapons[2+i][5] = Draw_PicFromWad (va("inva%i_srlaunch",i+1));
- sb_weapons[2+i][6] = Draw_PicFromWad (va("inva%i_lightng",i+1));
+ sb_weapons[2+i][0] = Draw_PicFromWad (va("inva%d_shotgun",i+1));
+ sb_weapons[2+i][1] = Draw_PicFromWad (va("inva%d_sshotgun",i+1));
+ sb_weapons[2+i][2] = Draw_PicFromWad (va("inva%d_nailgun",i+1));
+ sb_weapons[2+i][3] = Draw_PicFromWad (va("inva%d_snailgun",i+1));
+ sb_weapons[2+i][4] = Draw_PicFromWad (va("inva%d_rlaunch",i+1));
+ sb_weapons[2+i][5] = Draw_PicFromWad (va("inva%d_srlaunch",i+1));
+ sb_weapons[2+i][6] = Draw_PicFromWad (va("inva%d_lightng",i+1));
}
sb_ammo[0] = Draw_PicFromWad ("sb_shells");
@@ -195,11 +196,11 @@
for (i=0 ; i<5 ; i++)
{
- hsb_weapons[2+i][0] = Draw_PicFromWad (va("inva%i_laser",i+1));
- hsb_weapons[2+i][1] = Draw_PicFromWad (va("inva%i_mjolnir",i+1));
- hsb_weapons[2+i][2] = Draw_PicFromWad (va("inva%i_gren_prox",i+1));
- hsb_weapons[2+i][3] = Draw_PicFromWad (va("inva%i_prox_gren",i+1));
- hsb_weapons[2+i][4] = Draw_PicFromWad (va("inva%i_prox",i+1));
+ hsb_weapons[2+i][0] = Draw_PicFromWad (va("inva%d_laser",i+1));
+ hsb_weapons[2+i][1] = Draw_PicFromWad (va("inva%d_mjolnir",i+1));
+ hsb_weapons[2+i][2] = Draw_PicFromWad (va("inva%d_gren_prox",i+1));
+ hsb_weapons[2+i][3] = Draw_PicFromWad (va("inva%d_prox_gren",i+1));
+ hsb_weapons[2+i][4] = Draw_PicFromWad (va("inva%d_prox",i+1));
}
hsb_items[0] = Draw_PicFromWad ("sb_wsuit");
@@ -421,7 +422,7 @@
{
k = fragsort[i];
s = &cl.scores[k];
- sprintf (&scoreboardtext[i][1], "%3i %s", s->frags, s->name);
+ sprint (&scoreboardtext[i][1], "%3d %s", s->frags, s->name);
top = s->colors & 0xf0;
bottom = (s->colors & 15) <<4;
@@ -443,10 +444,10 @@
int minutes, seconds, tens, units;
int l;
- sprintf (str,"Monsters:%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
+ sprint (str,"Monsters:%3d /%3d", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]);
Sbar_DrawString (8, 4, str);
- sprintf (str,"Secrets :%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
+ sprint (str,"Secrets :%3d /%3d", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
Sbar_DrawString (8, 12, str);
// time
@@ -454,7 +455,7 @@
seconds = cl.time - 60*minutes;
tens = seconds / 10;
units = seconds - 10*tens;
- sprintf (str,"Time :%3i:%i%i", minutes, tens, units);
+ sprint (str,"Time :%3d:%d%d", minutes, tens, units);
Sbar_DrawString (184, 4, str);
// draw level name
@@ -644,7 +645,7 @@
// ammo counts
for (i=0 ; i<4 ; i++)
{
- sprintf (num, "%3i",cl.stats[STAT_SHELLS+i] );
+ sprint (num, "%3d",cl.stats[STAT_SHELLS+i] );
if (num[0] != ' ')
Sbar_DrawCharacter ( (6*i+1)*8 - 2, -24, 18 + num[0] - '0');
if (num[1] != ' ')
@@ -785,7 +786,7 @@
// draw number
f = s->frags;
- sprintf (num, "%3i",f);
+ sprint (num, "%3d",f);
Sbar_DrawCharacter ( (x+1)*8 , -24, num[0]);
Sbar_DrawCharacter ( (x+2)*8 , -24, num[1]);
@@ -842,7 +843,7 @@
// draw number
f = s->frags;
- sprintf (num, "%3i",f);
+ sprint (num, "%3d",f);
if (top==8)
{
@@ -1107,7 +1108,7 @@
// draw number
f = s->frags;
- sprintf (num, "%3i",f);
+ sprint (num, "%3d",f);
Draw_Character ( x+8 , y, num[0]);
Draw_Character ( x+16 , y, num[1]);
@@ -1128,7 +1129,7 @@
tens = n/10;
units = n%10;
- sprintf (num, "%3i:%i%i", minutes, tens, units);
+ sprint (num, "%3d:%d%d", minutes, tens, units);
Draw_String ( x+48 , y, num);
}
@@ -1205,7 +1206,7 @@
// draw number
f = s->frags;
- sprintf (num, "%3i",f);
+ sprint (num, "%3d",f);
Draw_Character ( x+8 , y, num[0]);
Draw_Character ( x+16 , y, num[1]);
@@ -1228,7 +1229,7 @@
tens = n/10;
units = n%10;
- sprintf (num, "%3i:%i%i", minutes, tens, units);
+ sprint (num, "%3d:%d%d", minutes, tens, units);
Draw_String ( x+48 , y, num);
}
--- a/screen.c
+++ b/screen.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -535,7 +536,7 @@
byte *pack;
pcx = Hunk_TempAlloc (width*height*2+1000);
- if (pcx == NULL)
+ if (pcx == nil)
{
Con_Printf("SCR_ScreenShot_f: not enough memory\n");
return;
@@ -608,7 +609,7 @@
{
pcxname[5] = i/10 + '0';
pcxname[6] = i%10 + '0';
- sprintf (checkname, "%s/%s", com_gamedir, pcxname);
+ sprint (checkname, "%s/%s", com_gamedir, pcxname);
if (Sys_FileTime(checkname) == -1)
break; // file doesn't exist
}
@@ -862,7 +863,7 @@
Sbar_Changed ();
}
- pconupdate = NULL;
+ pconupdate = nil;
SCR_SetUpToDrawConsole ();
--- a/snd_9.c
+++ b/snd_9.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
int audio_fd;
@@ -85,5 +86,5 @@
Sys_Warn("SNDDMA_Submit:write");
SNDDMA_Shutdown();
}
- n += wpos;
+ wpos += n;
}
--- a/snd_dma.c
+++ b/snd_dma.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
void S_Play(void);
@@ -205,7 +206,7 @@
}
if(shm != nil)
- Con_Printf ("Sound sampling rate: %i\n", shm->speed);
+ Con_Printf ("Sound sampling rate: %d\n", shm->speed);
// provides a tick sound until washed clean
@@ -255,7 +256,7 @@
int i;
sfx_t *sfx;
- if (!name)
+ if (name == nil)
Sys_Error ("S_FindName: NULL\n");
if (Q_strlen(name) >= MAX_QPATH)
@@ -308,7 +309,7 @@
sfx_t *sfx;
if (!sound_started || nosound.value)
- return NULL;
+ return nil;
sfx = S_FindName (name);
@@ -358,10 +359,10 @@
}
if (first_to_die == -1)
- return NULL;
+ return nil;
if (channels[first_to_die].sfx)
- channels[first_to_die].sfx = NULL;
+ channels[first_to_die].sfx = nil;
return &channels[first_to_die];
}
@@ -462,7 +463,7 @@
sc = S_LoadSound (sfx);
if (!sc)
{
- target_chan->sfx = NULL;
+ target_chan->sfx = nil;
return; // couldn't load the sound's data
}
@@ -500,7 +501,7 @@
&& channels[i].entchannel == entchannel)
{
channels[i].end = 0;
- channels[i].sfx = NULL;
+ channels[i].sfx = nil;
return;
}
}
@@ -517,7 +518,7 @@
for (i=0 ; i<MAX_CHANNELS ; i++)
if (channels[i].sfx)
- channels[i].sfx = NULL;
+ channels[i].sfx = nil;
Q_memset(channels, 0, MAX_CHANNELS * sizeof(channel_t));
@@ -613,7 +614,7 @@
if (!l || !ambient_level.value)
{
for (ambient_channel = 0 ; ambient_channel< NUM_AMBIENTS ; ambient_channel++)
- channels[ambient_channel].sfx = NULL;
+ channels[ambient_channel].sfx = nil;
return;
}
@@ -670,7 +671,7 @@
// update general area ambient sound sources
S_UpdateAmbientSounds ();
- combine = NULL;
+ combine = nil;
// update spatialization for static and dynamic sounds
ch = channels+NUM_AMBIENTS;
@@ -703,7 +704,7 @@
if (j == total_channels)
{
- combine = NULL;
+ combine = nil;
}
else
{
@@ -730,11 +731,11 @@
for (i=0 ; i<total_channels; i++, ch++)
if (ch->sfx && (ch->leftvol || ch->rightvol) )
{
- //Con_Printf ("%3i %3i %s\n", ch->leftvol, ch->rightvol, ch->sfx->name);
+ //Con_Printf ("%3d %3d %s\n", ch->leftvol, ch->rightvol, ch->sfx->name);
total++;
}
- Con_Printf ("----(%i)----\n", total);
+ Con_Printf ("----(%d)----\n", total);
}
// mix some sound
@@ -883,9 +884,9 @@
Con_Printf ("L");
else
Con_Printf (" ");
- Con_Printf("(%2db) %6i : %s\n",sc->width*8, size, sfx->name);
+ Con_Printf("(%2db) %6d : %s\n",sc->width*8, size, sfx->name);
}
- Con_Printf ("Total resident: %i\n", total);
+ Con_Printf ("Total resident: %d\n", total);
}
--- a/snd_mem.c
+++ b/snd_mem.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
int cache_full_cycle;
@@ -104,7 +105,7 @@
if (!data)
{
Con_Printf ("Couldn't load %s\n", namebuffer);
- return NULL;
+ return nil;
}
info = GetWavinfo (s->name, data, com_filesize);
@@ -111,7 +112,7 @@
if (info.channels != 1)
{
Con_Printf ("%s is a stereo sample\n",s->name);
- return NULL;
+ return nil;
}
stepscale = (float)info.rate / shm->speed;
@@ -121,7 +122,7 @@
sc = Cache_Alloc ( &s->cache, len + sizeof(sfxcache_t), s->name);
if (!sc)
- return NULL;
+ return nil;
sc->length = info.samples;
sc->loopstart = info.loopstart;
@@ -182,7 +183,7 @@
if (data_p >= iff_end)
{ // didn't find the chunk
- data_p = NULL;
+ data_p = nil;
return;
}
@@ -190,11 +191,11 @@
iff_chunk_len = GetLittleLong();
if (iff_chunk_len < 0)
{
- data_p = NULL;
+ data_p = nil;
return;
}
// if (iff_chunk_len > 1024*1024)
-// Sys_Error ("FindNextChunk: %i length is past the 1 meg sanity limit", iff_chunk_len);
+// Sys_Error ("FindNextChunk: %d length is past the 1 meg sanity limit", iff_chunk_len);
data_p -= 8;
last_chunk = data_p + 8 + ( (iff_chunk_len + 1) & ~1 );
if (!Q_strncmp((char *)data_p, name, 4))
@@ -293,7 +294,7 @@
data_p += 24;
i = GetLittleLong (); // samples in loop
info.samples = info.loopstart + i;
-// Con_Printf("looped length: %i\n", i);
+// Con_Printf("looped length: %d\n", i);
}
}
}
--- a/snd_mix.c
+++ b/snd_mix.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#define DWORD u32int
@@ -202,7 +203,7 @@
}
else
{ // channel just stopped
- ch->sfx = NULL;
+ ch->sfx = nil;
break;
}
}
--- a/sv_main.c
+++ b/sv_main.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
server_t sv;
@@ -42,7 +43,7 @@
Cvar_RegisterVariable (&sv_nostep);
for (i=0 ; i<MAX_MODELS ; i++)
- sprintf (localmodels[i], "*%i", i);
+ sprint (localmodels[i], "*%d", i);
}
/*
@@ -107,13 +108,13 @@
int ent;
if (volume < 0 || volume > 255)
- Sys_Error ("SV_StartSound: volume = %i", volume);
+ Sys_Error ("SV_StartSound: volume = %d", volume);
if (attenuation < 0 || attenuation > 4)
Sys_Error ("SV_StartSound: attenuation = %f", attenuation);
if (channel < 0 || channel > 7)
- Sys_Error ("SV_StartSound: channel = %i", channel);
+ Sys_Error ("SV_StartSound: channel = %d", channel);
if (sv.datagram.cursize > MAX_DATAGRAM-16)
return;
@@ -175,7 +176,7 @@
char message[2048];
MSG_WriteByte (&client->message, svc_print);
- sprintf (message, "%c\nVERSION %4.2f SERVER (%i CRC)", 2, VERSION, pr_crc);
+ sprint (message, "%c\nVERSION %4.2f SERVER (%ud CRC)", 2, VERSION, pr_crc);
MSG_WriteString (&client->message,message);
MSG_WriteByte (&client->message, svc_serverinfo);
@@ -187,7 +188,7 @@
else
MSG_WriteByte (&client->message, GAME_COOP);
- sprintf (message, PR_Str(sv.edicts->v.message));
+ sprint (message, PR_Str(sv.edicts->v.message));
MSG_WriteString (&client->message,message);
@@ -1086,7 +1087,7 @@
sv.time = 1.0;
strcpy (sv.name, server);
- sprintf (sv.modelname,"maps/%s.bsp", server);
+ sprint (sv.modelname,"maps/%s.bsp", server);
sv.worldmodel = Mod_ForName (sv.modelname, false);
if (!sv.worldmodel)
{
--- a/sv_move.c
+++ b/sv_move.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#define STEPSIZE 18
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
/*
@@ -196,7 +197,7 @@
1 = floor
2 = wall / step
4 = dead stop
-If steptrace is not NULL, the trace of any vertical wall hit will be stored
+If steptrace is not nil, the trace of any vertical wall hit will be stored
============
*/
#define MAX_CLIP_PLANES 5
@@ -312,7 +313,7 @@
{ // go along the crease
if (numplanes != 2)
{
-// Con_Printf ("clip velocity, numplanes == %i\n",numplanes);
+// Con_Printf ("clip velocity, numplanes == %d\n",numplanes);
VectorCopy (vec3_origin, ent->v.velocity);
return 7;
}
@@ -896,7 +897,7 @@
case MOVETYPE_FLY:
if (!SV_RunThink (ent))
return;
- SV_FlyMove (ent, host_frametime, NULL);
+ SV_FlyMove (ent, host_frametime, nil);
break;
case MOVETYPE_NOCLIP:
@@ -906,7 +907,7 @@
break;
default:
- Sys_Error ("SV_Physics_client: bad movetype %i", (int)ent->v.movetype);
+ Sys_Error ("SV_Physics_client: bad movetype %d", (int)ent->v.movetype);
}
//
@@ -1093,7 +1094,7 @@
SV_AddGravity (ent);
SV_CheckVelocity (ent);
- SV_FlyMove (ent, host_frametime, NULL);
+ SV_FlyMove (ent, host_frametime, nil);
SV_LinkEdict (ent, true);
if ( (int)ent->v.flags & FL_ONGROUND ) // just hit ground
@@ -1160,7 +1161,7 @@
|| ent->v.movetype == MOVETYPE_FLYMISSILE)
SV_Physics_Toss (ent);
else
- Sys_Error ("SV_Physics: bad movetype %i", (int)ent->v.movetype);
+ Sys_Error ("SV_Physics: bad movetype %d", (int)ent->v.movetype);
}
if (pr_global_struct->force_retouch)
--- a/sv_user.c
+++ b/sv_user.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
edict_t *sv_player;
--- a/sys_9.c
+++ b/sys_9.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
qboolean isDedicated;
--- a/vid_9.c
+++ b/vid_9.c
@@ -1,6 +1,7 @@
#include <u.h>
#include <libc.h>
#include <draw.h>
+#include <stdio.h>
#include "quakedef.h"
#include "d_local.h"
--- a/view.c
+++ b/view.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#include "r_local.h"
@@ -688,7 +689,7 @@
VectorCopy (ent->origin, r_refdef.vieworg);
VectorCopy (ent->angles, r_refdef.viewangles);
- view->model = NULL;
+ view->model = nil;
// allways idle in intermission
old = v_idlescale.value;
--- a/wad.c
+++ b/wad.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
int wad_numlumps;
@@ -100,7 +101,7 @@
}
Sys_Error ("W_GetLumpinfo: %s not found", name);
- return NULL;
+ return nil;
}
void *W_GetLumpName (char *name)
@@ -117,7 +118,7 @@
lumpinfo_t *lump;
if (num < 0 || num > wad_numlumps)
- Sys_Error ("W_GetLumpNum: bad number: %i", num);
+ Sys_Error ("W_GetLumpNum: bad number: %d", num);
lump = wad_lumps + num;
--- a/world.c
+++ b/world.c
@@ -2,6 +2,7 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
/*
@@ -197,7 +198,7 @@
if (depth == AREA_DEPTH)
{
anode->axis = -1;
- anode->children[0] = anode->children[1] = NULL;
+ anode->children[0] = anode->children[1] = nil;
return anode;
}
@@ -248,7 +249,7 @@
if (!ent->area.prev)
return; // not linked in anywhere
RemoveLink (&ent->area);
- ent->area.prev = ent->area.next = NULL;
+ ent->area.prev = ent->area.next = nil;
}
@@ -508,7 +509,7 @@
if (trace.startsolid)
return sv.edicts;
- return NULL;
+ return nil;
}
--- a/zone.c
+++ b/zone.c
@@ -1,5 +1,6 @@
#include <u.h>
#include <libc.h>
+#include <stdio.h>
#include "quakedef.h"
#define DYNAMIC_SIZE 0xc000
@@ -127,7 +128,7 @@
Z_CheckHeap (); // DEBUG
buf = Z_TagMalloc (size, 1);
if (!buf)
- Sys_Error ("Z_Malloc: failed on allocation of %i bytes",size);
+ Sys_Error ("Z_Malloc: failed on allocation of %d bytes",size);
Q_memset (buf, 0, size);
return buf;
@@ -155,7 +156,7 @@
do
{
if (rover == start) // scaned all the way around the list
- return NULL;
+ return nil;
if (rover->tag)
base = rover = rover->next;
else
@@ -201,11 +202,11 @@
{
memblock_t *block;
- Con_Printf ("zone size: %i location: %p\n",mainzone->size,mainzone);
+ Con_Printf ("zone size: %d location: %p\n",mainzone->size,mainzone);
for (block = zone->blocklist.next ; ; block = block->next)
{
- Con_Printf ("block:%p size:%7i tag:%3i\n",
+ Con_Printf ("block:%p size:%7d tag:%3d\n",
block, block->size, block->tag);
if (block->next == &zone->blocklist)
@@ -310,7 +311,7 @@
starthigh = (hunk_t *)(hunk_base + hunk_size - hunk_high_used);
endhigh = (hunk_t *)(hunk_base + hunk_size);
- Con_Printf (" :%8i total hunk size\n", hunk_size);
+ Con_Printf (" :%8d total hunk size\n", hunk_size);
Con_Printf ("-------------------------\n");
while (1)
@@ -321,7 +322,7 @@
if ( h == endlow )
{
Con_Printf ("-------------------------\n");
- Con_Printf (" :%8i REMAINING\n", hunk_size - hunk_low_used - hunk_high_used);
+ Con_Printf (" :%8d REMAINING\n", hunk_size - hunk_low_used - hunk_high_used);
Con_Printf ("-------------------------\n");
h = starthigh;
}
@@ -350,7 +351,7 @@
//
memcpy (name, h->name, 8);
if (all)
- Con_Printf ("%8p :%8i %8s\n",h, h->size, name);
+ Con_Printf ("%8p :%8d %8s\n",h, h->size, name);
//
// print the total
@@ -359,7 +360,7 @@
strncmp (h->name, next->name, 8) )
{
if (!all)
- Con_Printf (" :%8i %8s (TOTAL)\n",sum, name);
+ Con_Printf (" :%8d %8s (TOTAL)\n",sum, name);
count = 0;
sum = 0;
}
@@ -368,7 +369,7 @@
}
Con_Printf ("-------------------------\n");
- Con_Printf ("%8i total blocks\n", totalblocks);
+ Con_Printf ("%8d total blocks\n", totalblocks);
}
@@ -386,12 +387,12 @@
#endif
if (size < 0)
- Sys_Error ("Hunk_Alloc: bad size: %i", size);
+ Sys_Error ("Hunk_Alloc: bad size: %d", size);
size = sizeof(hunk_t) + ((size+15)&~15);
if (hunk_size - hunk_low_used - hunk_high_used < size)
- Sys_Error ("Hunk_Alloc: failed on %i bytes",size);
+ Sys_Error ("Hunk_Alloc: failed on %d bytes",size);
h = (hunk_t *)(hunk_base + hunk_low_used);
hunk_low_used += size;
@@ -425,7 +426,7 @@
void Hunk_FreeToLowMark (int mark)
{
if (mark < 0 || mark > hunk_low_used)
- Sys_Error ("Hunk_FreeToLowMark: bad mark %i", mark);
+ Sys_Error ("Hunk_FreeToLowMark: bad mark %d", mark);
memset (hunk_base + mark, 0, hunk_low_used - mark);
hunk_low_used = mark;
}
@@ -449,7 +450,7 @@
Hunk_FreeToHighMark (hunk_tempmark);
}
if (mark < 0 || mark > hunk_high_used)
- Sys_Error ("Hunk_FreeToHighMark: bad mark %i", mark);
+ Sys_Error ("Hunk_FreeToHighMark: bad mark %d", mark);
memset (hunk_base + hunk_size - hunk_high_used, 0, hunk_high_used - mark);
hunk_high_used = mark;
}
@@ -465,7 +466,7 @@
hunk_t *h;
if (size < 0)
- Sys_Error ("Hunk_HighAllocName: bad size: %i", size);
+ Sys_Error ("Hunk_HighAllocName: bad size: %d", size);
if (hunk_tempactive)
{
@@ -481,8 +482,8 @@
if (hunk_size - hunk_low_used - hunk_high_used < size)
{
- Con_Printf ("Hunk_HighAlloc: failed on %i bytes\n",size);
- return NULL;
+ Con_Printf ("Hunk_HighAlloc: failed on %d bytes\n",size);
+ return nil;
}
hunk_high_used += size;
@@ -610,7 +611,7 @@
{
cache_system_t *c, *prev;
- prev = NULL;
+ prev = nil;
while (1)
{
c = cache_head.prev;
@@ -636,7 +637,7 @@
cs->lru_next->lru_prev = cs->lru_prev;
cs->lru_prev->lru_next = cs->lru_next;
- cs->lru_prev = cs->lru_next = NULL;
+ cs->lru_prev = cs->lru_next = nil;
}
void Cache_MakeLRU (cache_system_t *cs)
@@ -667,7 +668,7 @@
if (!nobottom && cache_head.prev == &cache_head)
{
if (hunk_size - hunk_high_used - hunk_low_used < size)
- Sys_Error ("Cache_TryAlloc: %i is greater then free hunk", size);
+ Sys_Error ("Cache_TryAlloc: %d is greater then free hunk", size);
new = (cache_system_t *) (hunk_base + hunk_low_used);
memset (new, 0, sizeof(*new));
@@ -727,7 +728,7 @@
return new;
}
- return NULL; // couldn't allocate
+ return nil; // couldn't allocate
}
/*
@@ -756,7 +757,7 @@
for (cd = cache_head.next ; cd != &cache_head ; cd = cd->next)
{
- Con_Printf ("%8i : %s\n", cd->size, cd->name);
+ Con_Printf ("%8d : %s\n", cd->size, cd->name);
}
}
@@ -813,9 +814,9 @@
cs->prev->next = cs->next;
cs->next->prev = cs->prev;
- cs->next = cs->prev = NULL;
+ cs->next = cs->prev = nil;
- c->data = NULL;
+ c->data = nil;
Cache_UnlinkLRU (cs);
}
@@ -832,7 +833,7 @@
cache_system_t *cs;
if (!c->data)
- return NULL;
+ return nil;
cs = ((cache_system_t *)c->data) - 1;
@@ -857,7 +858,7 @@
Sys_Error ("Cache_Alloc: allready allocated");
if (size <= 0)
- Sys_Error ("Cache_Alloc: size %i", size);
+ Sys_Error ("Cache_Alloc: size %d", size);
size = (size + sizeof(cache_system_t) + 15) & ~15;