mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-02-01 12:20:54 +00:00
revert back to using f* for file io. I hope this fixes the catapult, but I wouldn't be suprised if it doesn't.
This commit is contained in:
parent
02eaf75b18
commit
e98edd5f5f
15 changed files with 113 additions and 115 deletions
|
@ -69,7 +69,7 @@ void CL_StopPlayback (void)
|
|||
if (!cls.demoplayback)
|
||||
return;
|
||||
|
||||
Qclose (cls.demofile);
|
||||
fclose (cls.demofile);
|
||||
cls.demofile = NULL;
|
||||
cls.state = ca_disconnected;
|
||||
cls.demoplayback = 0;
|
||||
|
@ -99,10 +99,10 @@ void CL_WriteDemoCmd (usercmd_t *pcmd)
|
|||
//Con_Printf("write: %ld bytes, %4.4f\n", msg->cursize, realtime);
|
||||
|
||||
fl = LittleFloat((float)realtime);
|
||||
Qwrite (cls.demofile, &fl, sizeof(fl));
|
||||
fwrite (&fl, sizeof(fl), 1, cls.demofile);
|
||||
|
||||
c = dem_cmd;
|
||||
Qwrite (cls.demofile, &c, sizeof(c));
|
||||
fwrite (&c, sizeof(c), 1, cls.demofile);
|
||||
|
||||
// correct for byte order, bytes don't matter
|
||||
cmd = *pcmd;
|
||||
|
@ -113,15 +113,15 @@ void CL_WriteDemoCmd (usercmd_t *pcmd)
|
|||
cmd.sidemove = LittleShort(cmd.sidemove);
|
||||
cmd.upmove = LittleShort(cmd.upmove);
|
||||
|
||||
Qwrite(cls.demofile, &cmd, sizeof(cmd));
|
||||
fwrite(&cmd, sizeof(cmd), 1, cls.demofile);
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
fl = LittleFloat (cl.viewangles[i]);
|
||||
Qwrite (cls.demofile, &fl, 4);
|
||||
fwrite (&fl, 4, 1, cls.demofile);
|
||||
}
|
||||
|
||||
Qflush (cls.demofile);
|
||||
fflush (cls.demofile);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -143,16 +143,16 @@ void CL_WriteDemoMessage (sizebuf_t *msg)
|
|||
return;
|
||||
|
||||
fl = LittleFloat((float)realtime);
|
||||
Qwrite (cls.demofile, &fl, sizeof(fl));
|
||||
fwrite (&fl, sizeof(fl), 1, cls.demofile);
|
||||
|
||||
c = dem_read;
|
||||
Qwrite (cls.demofile, &c, sizeof(c));
|
||||
fwrite (&c, sizeof(c), 1, cls.demofile);
|
||||
|
||||
len = LittleLong (msg->cursize);
|
||||
Qwrite (cls.demofile, &len, 4);
|
||||
Qwrite (cls.demofile, msg->data, msg->cursize);
|
||||
fwrite (&len, 4, 1, cls.demofile);
|
||||
fwrite (msg->data, msg->cursize, 1, cls.demofile);
|
||||
|
||||
Qflush (cls.demofile);
|
||||
fflush (cls.demofile);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -171,7 +171,7 @@ qboolean CL_GetDemoMessage (void)
|
|||
usercmd_t *pcmd;
|
||||
|
||||
// read the time from the packet
|
||||
Qread(cls.demofile, &demotime, sizeof(demotime));
|
||||
fread(&demotime, sizeof(demotime), 1, cls.demofile);
|
||||
demotime = LittleFloat(demotime);
|
||||
|
||||
// decide if it is time to grab the next message
|
||||
|
@ -181,7 +181,7 @@ qboolean CL_GetDemoMessage (void)
|
|||
else if (demotime > cls.td_lastframe) {
|
||||
cls.td_lastframe = demotime;
|
||||
// rewind back to time
|
||||
Qseek(cls.demofile, Qtell(cls.demofile) - sizeof(demotime),
|
||||
fseek(cls.demofile, ftell(cls.demofile) - sizeof(demotime),
|
||||
SEEK_SET);
|
||||
return 0; // allready read this frame's message
|
||||
}
|
||||
|
@ -195,12 +195,12 @@ qboolean CL_GetDemoMessage (void)
|
|||
// too far back
|
||||
realtime = demotime - 1.0;
|
||||
// rewind back to time
|
||||
Qseek(cls.demofile, Qtell(cls.demofile) - sizeof(demotime),
|
||||
fseek(cls.demofile, ftell(cls.demofile) - sizeof(demotime),
|
||||
SEEK_SET);
|
||||
return 0;
|
||||
} else if (realtime < demotime) {
|
||||
// rewind back to time
|
||||
Qseek(cls.demofile, Qtell(cls.demofile) - sizeof(demotime),
|
||||
fseek(cls.demofile, ftell(cls.demofile) - sizeof(demotime),
|
||||
SEEK_SET);
|
||||
return 0; // don't need another message yet
|
||||
}
|
||||
|
@ -211,14 +211,14 @@ qboolean CL_GetDemoMessage (void)
|
|||
Host_Error ("CL_GetDemoMessage: cls.state != ca_active");
|
||||
|
||||
// get the msg type
|
||||
Qread (cls.demofile, &c, sizeof(c));
|
||||
fread (&c, sizeof(c), 1, cls.demofile);
|
||||
|
||||
switch (c) {
|
||||
case dem_cmd :
|
||||
// user sent input
|
||||
i = cls.netchan.outgoing_sequence & UPDATE_MASK;
|
||||
pcmd = &cl.frames[i].cmd;
|
||||
r = Qread (cls.demofile, pcmd, sizeof(*pcmd));
|
||||
r = fread (pcmd, sizeof(*pcmd), 1, cls.demofile);
|
||||
if (r != 1)
|
||||
{
|
||||
CL_StopPlayback ();
|
||||
|
@ -235,19 +235,19 @@ qboolean CL_GetDemoMessage (void)
|
|||
cls.netchan.outgoing_sequence++;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
r = Qread (cls.demofile, &f, 4);
|
||||
r = fread (&f, 4, 1, cls.demofile);
|
||||
cl.viewangles[i] = LittleFloat (f);
|
||||
}
|
||||
break;
|
||||
|
||||
case dem_read:
|
||||
// get the next message
|
||||
Qread (cls.demofile, &net_message.cursize, 4);
|
||||
fread (&net_message.cursize, 4, 1, cls.demofile);
|
||||
net_message.cursize = LittleLong (net_message.cursize);
|
||||
//Con_Printf("read: %ld bytes\n", net_message.cursize);
|
||||
if (net_message.cursize > MAX_MSGLEN)
|
||||
Sys_Error ("Demo message > MAX_MSGLEN");
|
||||
r = Qread (cls.demofile, net_message.data, net_message.cursize);
|
||||
r = fread (net_message.data, net_message.cursize, 1, cls.demofile);
|
||||
if (r != 1)
|
||||
{
|
||||
CL_StopPlayback ();
|
||||
|
@ -256,9 +256,9 @@ qboolean CL_GetDemoMessage (void)
|
|||
break;
|
||||
|
||||
case dem_set :
|
||||
Qread (cls.demofile, &i, 4);
|
||||
fread (&i, 4, 1, cls.demofile);
|
||||
cls.netchan.outgoing_sequence = LittleLong(i);
|
||||
Qread (cls.demofile, &i, 4);
|
||||
fread (&i, 4, 1, cls.demofile);
|
||||
cls.netchan.incoming_sequence = LittleLong(i);
|
||||
break;
|
||||
|
||||
|
@ -315,7 +315,7 @@ void CL_Stop_f (void)
|
|||
CL_WriteDemoMessage (&net_message);
|
||||
|
||||
// finish up
|
||||
Qclose (cls.demofile);
|
||||
fclose (cls.demofile);
|
||||
cls.demofile = NULL;
|
||||
cls.demorecording = false;
|
||||
Con_Printf ("Completed demo\n");
|
||||
|
@ -342,21 +342,21 @@ void CL_WriteRecordDemoMessage (sizebuf_t *msg, int seq)
|
|||
return;
|
||||
|
||||
fl = LittleFloat((float)realtime);
|
||||
Qwrite (cls.demofile, &fl, sizeof(fl));
|
||||
fwrite (&fl, sizeof(fl), 1, cls.demofile);
|
||||
|
||||
c = dem_read;
|
||||
Qwrite (cls.demofile, &c, sizeof(c));
|
||||
fwrite (&c, sizeof(c), 1, cls.demofile);
|
||||
|
||||
len = LittleLong (msg->cursize + 8);
|
||||
Qwrite (cls.demofile, &len, 4);
|
||||
fwrite (&len, 4, 1, cls.demofile);
|
||||
|
||||
i = LittleLong(seq);
|
||||
Qwrite (cls.demofile, &i, 4);
|
||||
Qwrite (cls.demofile, &i, 4);
|
||||
fwrite (&i, 4, 1, cls.demofile);
|
||||
fwrite (&i, 4, 1, cls.demofile);
|
||||
|
||||
Qwrite (cls.demofile, msg->data, msg->cursize);
|
||||
fwrite (msg->data, msg->cursize, 1, cls.demofile);
|
||||
|
||||
Qflush (cls.demofile);
|
||||
fflush (cls.demofile);
|
||||
}
|
||||
|
||||
|
||||
|
@ -372,17 +372,17 @@ void CL_WriteSetDemoMessage (void)
|
|||
return;
|
||||
|
||||
fl = LittleFloat((float)realtime);
|
||||
Qwrite (cls.demofile, &fl, sizeof(fl));
|
||||
fwrite (&fl, sizeof(fl), 1, cls.demofile);
|
||||
|
||||
c = dem_set;
|
||||
Qwrite (cls.demofile, &c, sizeof(c));
|
||||
fwrite (&c, sizeof(c), 1, cls.demofile);
|
||||
|
||||
len = LittleLong(cls.netchan.outgoing_sequence);
|
||||
Qwrite (cls.demofile, &len, 4);
|
||||
fwrite (&len, 4, 1, cls.demofile);
|
||||
len = LittleLong(cls.netchan.incoming_sequence);
|
||||
Qwrite (cls.demofile, &len, 4);
|
||||
fwrite (&len, 4, 1, cls.demofile);
|
||||
|
||||
Qflush (cls.demofile);
|
||||
fflush (cls.demofile);
|
||||
}
|
||||
|
||||
|
||||
|
@ -431,7 +431,7 @@ void CL_Record_f (void)
|
|||
//
|
||||
COM_DefaultExtension (name, ".qwd");
|
||||
|
||||
cls.demofile = Qopen (name, "wb");
|
||||
cls.demofile = fopen (name, "wb");
|
||||
if (!cls.demofile)
|
||||
{
|
||||
Con_Printf ("ERROR: couldn't open.\n");
|
||||
|
@ -717,7 +717,7 @@ void CL_ReRecord_f (void)
|
|||
//
|
||||
COM_DefaultExtension (name, ".qwd");
|
||||
|
||||
cls.demofile = Qopen (name, "wb");
|
||||
cls.demofile = fopen (name, "wb");
|
||||
if (!cls.demofile)
|
||||
{
|
||||
Con_Printf ("ERROR: couldn't open.\n");
|
||||
|
|
|
@ -548,7 +548,7 @@ void CL_Disconnect (void)
|
|||
Cam_Reset();
|
||||
|
||||
if (cls.download) {
|
||||
Qclose(cls.download);
|
||||
fclose(cls.download);
|
||||
cls.download = NULL;
|
||||
}
|
||||
|
||||
|
@ -1158,7 +1158,7 @@ void CL_Download_f (void)
|
|||
}
|
||||
|
||||
strncpy (cls.downloadtempname, cls.downloadname, sizeof(cls.downloadtempname));
|
||||
cls.download = Qopen (cls.downloadname, "wb");
|
||||
cls.download = fopen (cls.downloadname, "wb");
|
||||
cls.downloadtype = dl_single;
|
||||
|
||||
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
||||
|
@ -1207,9 +1207,9 @@ void CL_Init (void)
|
|||
CL_InitCam ();
|
||||
Pmove_Init ();
|
||||
|
||||
if ((servlist = Qopen(va("%s/servers.txt",fs_userpath->string),"r"))) {
|
||||
if ((servlist = fopen(va("%s/servers.txt",fs_userpath->string),"r"))) {
|
||||
slist = Server_List_LoadF(servlist,slist);
|
||||
Qclose(servlist);
|
||||
fclose(servlist);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1488,7 +1488,7 @@ void Host_WriteConfiguration (void)
|
|||
|
||||
if (host_initialized)
|
||||
{
|
||||
f = Qopen (va("%s/config.cfg",com_gamedir), "w");
|
||||
f = fopen (va("%s/config.cfg",com_gamedir), "w");
|
||||
if (!f)
|
||||
{
|
||||
Con_Printf ("Couldn't write config.cfg.\n");
|
||||
|
@ -1498,7 +1498,7 @@ void Host_WriteConfiguration (void)
|
|||
Key_WriteBindings (f);
|
||||
Cvar_WriteVariables (f);
|
||||
|
||||
Qclose (f);
|
||||
fclose (f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ qboolean CL_CheckOrDownloadFile (char *filename)
|
|||
COM_FOpenFile (filename, &f);
|
||||
if (f)
|
||||
{ // it exists, no need to download
|
||||
Qclose (f);
|
||||
fclose (f);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -378,7 +378,7 @@ void CL_ParseDownload (void)
|
|||
if (cls.download)
|
||||
{
|
||||
Con_Printf ("cls.download shouldn't have been set\n");
|
||||
Qclose (cls.download);
|
||||
fclose (cls.download);
|
||||
cls.download = NULL;
|
||||
}
|
||||
CL_RequestNextDownload ();
|
||||
|
@ -395,7 +395,7 @@ void CL_ParseDownload (void)
|
|||
|
||||
COM_CreatePath (name);
|
||||
|
||||
cls.download = Qopen (name, "wb");
|
||||
cls.download = fopen (name, "wb");
|
||||
if (!cls.download)
|
||||
{
|
||||
msg_readcount += size;
|
||||
|
@ -405,7 +405,7 @@ void CL_ParseDownload (void)
|
|||
}
|
||||
}
|
||||
|
||||
Qwrite (cls.download, net_message.data + msg_readcount, size);
|
||||
fwrite (net_message.data + msg_readcount, 1, size, cls.download);
|
||||
msg_readcount += size;
|
||||
|
||||
if (percent != 100)
|
||||
|
@ -434,7 +434,7 @@ void CL_ParseDownload (void)
|
|||
Con_Printf ("100%%\n");
|
||||
#endif
|
||||
|
||||
Qclose (cls.download);
|
||||
fclose (cls.download);
|
||||
|
||||
// rename the temp file to it's final name
|
||||
if (strcmp(cls.downloadtempname, cls.downloadname)) {
|
||||
|
@ -586,21 +586,21 @@ void CL_ParseServerData (void)
|
|||
if (cflag) {
|
||||
int cl_warncmd_val = cl_warncmd->value;
|
||||
snprintf(fn, sizeof(fn), "%s/%s", com_gamedir, "config.cfg");
|
||||
if ((f = Qopen(fn, "r")) != NULL) {
|
||||
Qclose(f);
|
||||
if ((f = fopen(fn, "r")) != NULL) {
|
||||
fclose(f);
|
||||
Cbuf_AddText ("cl_warncmd 0\n");
|
||||
Cbuf_AddText ("exec config.cfg\n");
|
||||
}
|
||||
snprintf(fn, sizeof(fn), "%s/%s", com_gamedir, "frontend.cfg");
|
||||
if ((f = Qopen(fn, "r")) != NULL) {
|
||||
Qclose(f);
|
||||
if ((f = fopen(fn, "r")) != NULL) {
|
||||
fclose(f);
|
||||
Cbuf_AddText ("cl_warncmd 0\n");
|
||||
Cbuf_AddText ("exec frontend.cfg\n");
|
||||
}
|
||||
if (cl_autoexec->value) {
|
||||
snprintf(fn, sizeof(fn), "%s/%s", com_gamedir, "autoexec.cfg");
|
||||
if ((f = Qopen(fn, "r")) != NULL) {
|
||||
Qclose(f);
|
||||
if ((f = fopen(fn, "r")) != NULL) {
|
||||
fclose(f);
|
||||
Cbuf_AddText ("cl_warncmd 0\n");
|
||||
Cbuf_AddText ("exec autoexec.cfg\n");
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ server_entry_t *Server_List_LoadF (FILE *f,server_entry_t *start) { // This coul
|
|||
i = 0;
|
||||
c = ' ';
|
||||
while (c != '\n' && c != EOF) {
|
||||
c = Qgetc(f);
|
||||
c = getc(f);
|
||||
if (i < 255) {
|
||||
line[i] = c;
|
||||
i++;
|
||||
|
@ -177,7 +177,7 @@ server_entry_t *Server_List_LoadF (FILE *f,server_entry_t *start) { // This coul
|
|||
|
||||
void Server_List_SaveF (FILE *f,server_entry_t *start) {
|
||||
do {
|
||||
Qprintf(f,"%s %s\n",start->server,start->desc);
|
||||
fprintf(f,"%s %s\n",start->server,start->desc);
|
||||
start = start->next;
|
||||
|
||||
} while (start);
|
||||
|
@ -186,9 +186,9 @@ server_entry_t *Server_List_LoadF (FILE *f,server_entry_t *start) { // This coul
|
|||
void Server_List_Shutdown (server_entry_t *start) {
|
||||
FILE *f;
|
||||
if (start) {
|
||||
if ((f = Qopen(va("%s/servers.txt",fs_userpath->string),"w"))) {
|
||||
if ((f = fopen(va("%s/servers.txt",fs_userpath->string),"w"))) {
|
||||
Server_List_SaveF(f,start);
|
||||
Qclose(f);
|
||||
fclose(f);
|
||||
}
|
||||
Server_List_Del_All (start);
|
||||
}
|
||||
|
|
|
@ -307,7 +307,7 @@ Cmd_Exec_File (char *path)
|
|||
char base[32];
|
||||
FILE *file;
|
||||
|
||||
if ((file = Qopen (path, "r")) != NULL) {
|
||||
if ((file = fopen (path, "r")) != NULL) {
|
||||
// extract the filename base name for hunk tag
|
||||
COM_FileBase (path, base);
|
||||
len = COM_filelength (file);
|
||||
|
@ -315,8 +315,8 @@ Cmd_Exec_File (char *path)
|
|||
f = (char *)Hunk_AllocName (len+1, base);
|
||||
if (f) {
|
||||
f[len] = 0;
|
||||
Qread (file, f, len);
|
||||
Qclose (file);
|
||||
fread (f, 1, len, file);
|
||||
fclose (file);
|
||||
Cbuf_InsertText (f);
|
||||
}
|
||||
Hunk_FreeToLowMark (mark);
|
||||
|
|
|
@ -70,8 +70,8 @@ void COM_CheckRegistered (void)
|
|||
|
||||
if (h) {
|
||||
static_registered = 1;
|
||||
Qread (h, check, sizeof(check));
|
||||
Qclose (h);
|
||||
fread (check, 1, sizeof(check), h);
|
||||
fclose (h);
|
||||
}
|
||||
|
||||
if (static_registered) {
|
||||
|
|
|
@ -275,7 +275,7 @@ void Cvar_WriteVariables (FILE *f)
|
|||
|
||||
for (var = cvar_vars ; var ; var = var->next)
|
||||
if (var->flags&CVAR_ARCHIVE)
|
||||
Qprintf (f, "%s \"%s\"\n", var->name, var->string);
|
||||
fprintf (f, "%s \"%s\"\n", var->name, var->string);
|
||||
}
|
||||
|
||||
void Cvar_Set_f(void)
|
||||
|
|
|
@ -673,7 +673,7 @@ void Key_WriteBindings (FILE *f)
|
|||
|
||||
for (i=0 ; i<256 ; i++)
|
||||
if (keybindings[i])
|
||||
Qprintf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
|
||||
fprintf (f, "bind %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1576,8 +1576,8 @@ void PF_logfrag (void)
|
|||
|
||||
SZ_Print (&svs.log[svs.logsequence&1], s);
|
||||
if (sv_fraglogfile) {
|
||||
Qprintf (sv_fraglogfile, s);
|
||||
Qflush (sv_fraglogfile);
|
||||
fprintf (sv_fraglogfile, s);
|
||||
fflush (sv_fraglogfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -191,10 +191,10 @@ COM_filelength (FILE *f)
|
|||
int pos;
|
||||
int end;
|
||||
|
||||
pos = Qtell (f);
|
||||
Qseek (f, 0, SEEK_END);
|
||||
end = Qtell (f);
|
||||
Qseek (f, pos, SEEK_SET);
|
||||
pos = ftell (f);
|
||||
fseek (f, 0, SEEK_END);
|
||||
end = ftell (f);
|
||||
fseek (f, pos, SEEK_SET);
|
||||
|
||||
return end;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ COM_FileOpenRead (char *path, FILE **hndl)
|
|||
{
|
||||
FILE *f;
|
||||
|
||||
f = Qopen(path, "rbz");
|
||||
f = fopen(path, "rbz");
|
||||
if (!f)
|
||||
{
|
||||
*hndl = NULL;
|
||||
|
@ -290,17 +290,17 @@ COM_WriteFile ( char *filename, void *data, int len )
|
|||
|
||||
snprintf(name, sizeof(name), "%s/%s", com_gamedir, filename);
|
||||
|
||||
f = Qopen (name, "wb");
|
||||
f = fopen (name, "wb");
|
||||
if (!f) {
|
||||
Sys_mkdir(com_gamedir);
|
||||
f = Qopen (name, "wb");
|
||||
f = fopen (name, "wb");
|
||||
if (!f)
|
||||
Sys_Error ("Error opening %s", filename);
|
||||
}
|
||||
|
||||
Sys_Printf ("COM_WriteFile: %s\n", name);
|
||||
Qwrite (f, data, len);
|
||||
Qclose (f);
|
||||
fwrite (data, 1, len, f);
|
||||
fclose (f);
|
||||
}
|
||||
|
||||
|
||||
|
@ -344,7 +344,7 @@ COM_CopyFile (char *netpath, char *cachepath)
|
|||
|
||||
remaining = COM_FileOpenRead (netpath, &in);
|
||||
COM_CreatePath (cachepath); // create directories up to the cache file
|
||||
out = Qopen(cachepath, "wb");
|
||||
out = fopen(cachepath, "wb");
|
||||
if (!out)
|
||||
Sys_Error ("Error opening %s", cachepath);
|
||||
|
||||
|
@ -354,13 +354,13 @@ COM_CopyFile (char *netpath, char *cachepath)
|
|||
count = remaining;
|
||||
else
|
||||
count = sizeof(buf);
|
||||
Qread (in, buf, count);
|
||||
Qwrite (out, buf, count);
|
||||
fread (buf, 1, count, in);
|
||||
fwrite (buf, 1, count, out);
|
||||
remaining -= count;
|
||||
}
|
||||
|
||||
Qclose (in);
|
||||
Qclose (out);
|
||||
fclose (in);
|
||||
fclose (out);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -393,7 +393,7 @@ COM_OpenRead (const char *path, int offs, int len)
|
|||
}
|
||||
lseek(fd,offs,SEEK_SET);
|
||||
com_filesize=len;
|
||||
return Qdopen(fd,"rbz");
|
||||
return fdopen(fd,"rbz");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -522,8 +522,8 @@ COM_LoadFile (char *path, int usehunk)
|
|||
if (!is_server) {
|
||||
Draw_BeginDisc();
|
||||
}
|
||||
Qread (h, buf, len);
|
||||
Qclose (h);
|
||||
fread (buf, 1, len, h);
|
||||
fclose (h);
|
||||
if (!is_server) {
|
||||
Draw_EndDisc();
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ COM_LoadPackFile (char *packfile)
|
|||
if (COM_FileOpenRead (packfile, &packhandle) == -1)
|
||||
return NULL;
|
||||
|
||||
Qread (packhandle, &header, sizeof(header));
|
||||
fread (&header, 1, sizeof(header), packhandle);
|
||||
if (header.id[0] != 'P' || header.id[1] != 'A'
|
||||
|| header.id[2] != 'C' || header.id[3] != 'K')
|
||||
Sys_Error ("%s is not a packfile", packfile);
|
||||
|
@ -599,8 +599,8 @@ COM_LoadPackFile (char *packfile)
|
|||
|
||||
newfiles = Z_Malloc (numpackfiles * sizeof(packfile_t));
|
||||
|
||||
Qseek (packhandle, header.dirofs, SEEK_SET);
|
||||
Qread (packhandle, info, header.dirlen);
|
||||
fseek (packhandle, header.dirofs, SEEK_SET);
|
||||
fread (info, 1, header.dirlen, packhandle);
|
||||
|
||||
|
||||
// parse the directory
|
||||
|
@ -812,7 +812,7 @@ COM_Gamedir (char *dir)
|
|||
{
|
||||
if (com_searchpaths->pack)
|
||||
{
|
||||
Qclose (com_searchpaths->pack->handle);
|
||||
fclose (com_searchpaths->pack->handle);
|
||||
Z_Free (com_searchpaths->pack->files);
|
||||
Z_Free (com_searchpaths->pack);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,6 @@ void R_ReadPointFile_f (void)
|
|||
int c;
|
||||
particle_t *p;
|
||||
char name[MAX_OSPATH];
|
||||
char buf[256];
|
||||
|
||||
// FIXME sprintf (name,"maps/%s.pts", sv.name);
|
||||
|
||||
|
@ -122,9 +121,7 @@ void R_ReadPointFile_f (void)
|
|||
c = 0;
|
||||
for ( ;; )
|
||||
{
|
||||
if (!Qgets(f,buf,sizeof(buf)))
|
||||
break;
|
||||
r = sscanf (buf,"%f %f %f\n", &org[0], &org[1], &org[2]);
|
||||
r = fscanf (f,"%f %f %f\n", &org[0], &org[1], &org[2]);
|
||||
if (r != 3)
|
||||
break;
|
||||
c++;
|
||||
|
@ -146,7 +143,7 @@ void R_ReadPointFile_f (void)
|
|||
VectorCopy (org, p->org);
|
||||
}
|
||||
|
||||
Qclose (f);
|
||||
fclose (f);
|
||||
Con_Printf ("%i points read\n", c);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,14 +127,14 @@ void SV_Logfile_f (void)
|
|||
if (sv_logfile)
|
||||
{
|
||||
Con_Printf ("File logging off.\n");
|
||||
Qclose (sv_logfile);
|
||||
fclose (sv_logfile);
|
||||
sv_logfile = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf (name, sizeof(name), "%s/qconsole.log", com_gamedir);
|
||||
Con_Printf ("Logging text to %s.\n", name);
|
||||
sv_logfile = Qopen (name, "w");
|
||||
sv_logfile = fopen (name, "w");
|
||||
if (!sv_logfile)
|
||||
Con_Printf ("failed.\n");
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ void SV_Fraglogfile_f (void)
|
|||
if (sv_fraglogfile)
|
||||
{
|
||||
Con_Printf ("Frag file logging off.\n");
|
||||
Qclose (sv_fraglogfile);
|
||||
fclose (sv_fraglogfile);
|
||||
sv_fraglogfile = NULL;
|
||||
return;
|
||||
}
|
||||
|
@ -162,15 +162,15 @@ void SV_Fraglogfile_f (void)
|
|||
for (i=0 ; i<1000 ; i++)
|
||||
{
|
||||
snprintf (name, sizeof(name), "%s/frag_%i.log", com_gamedir, i);
|
||||
sv_fraglogfile = Qopen (name, "r");
|
||||
sv_fraglogfile = fopen (name, "r");
|
||||
if (!sv_fraglogfile)
|
||||
{ // can't read it, so create this one
|
||||
sv_fraglogfile = Qopen (name, "w");
|
||||
sv_fraglogfile = fopen (name, "w");
|
||||
if (!sv_fraglogfile)
|
||||
i=1000; // give error
|
||||
break;
|
||||
}
|
||||
Qclose (sv_fraglogfile);
|
||||
fclose (sv_fraglogfile);
|
||||
}
|
||||
if (i==1000)
|
||||
{
|
||||
|
@ -354,7 +354,7 @@ void SV_Map_f (void)
|
|||
Cbuf_AddText (va("map %s", curlevel));
|
||||
return;
|
||||
}
|
||||
Qclose (f);
|
||||
fclose (f);
|
||||
|
||||
SV_BroadcastCommand ("changing\n");
|
||||
SV_SendMessagesToAll ();
|
||||
|
|
|
@ -188,12 +188,12 @@ void SV_Shutdown (void)
|
|||
Master_Shutdown ();
|
||||
if (sv_logfile)
|
||||
{
|
||||
Qclose (sv_logfile);
|
||||
fclose (sv_logfile);
|
||||
sv_logfile = NULL;
|
||||
}
|
||||
if (sv_fraglogfile)
|
||||
{
|
||||
Qclose (sv_fraglogfile);
|
||||
fclose (sv_fraglogfile);
|
||||
sv_logfile = NULL;
|
||||
}
|
||||
NET_Shutdown ();
|
||||
|
@ -298,12 +298,12 @@ void SV_DropClient (client_t *drop)
|
|||
|
||||
if (drop->download)
|
||||
{
|
||||
Qclose (drop->download);
|
||||
fclose (drop->download);
|
||||
drop->download = NULL;
|
||||
}
|
||||
if (drop->upload)
|
||||
{
|
||||
Qclose (drop->upload);
|
||||
fclose (drop->upload);
|
||||
drop->upload = NULL;
|
||||
}
|
||||
*drop->uploadfn = 0;
|
||||
|
@ -1119,7 +1119,7 @@ void SV_WriteIP_f (void)
|
|||
|
||||
Con_Printf ("Writing %s.\n", name);
|
||||
|
||||
f = Qopen (name, "wb");
|
||||
f = fopen (name, "wb");
|
||||
if (!f)
|
||||
{
|
||||
Con_Printf ("Couldn't open %s\n", name);
|
||||
|
@ -1129,10 +1129,10 @@ void SV_WriteIP_f (void)
|
|||
for (i=0 ; i<numipfilters ; i++)
|
||||
{
|
||||
*(unsigned *)b = ipfilters[i].compare;
|
||||
Qprintf (f, "addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
|
||||
fprintf (f, "addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
|
||||
}
|
||||
|
||||
Qclose (f);
|
||||
fclose (f);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -147,7 +147,7 @@ void Con_Printf (char *fmt, ...)
|
|||
|
||||
Sys_Printf ("%s", msg); // also echo to debugging console
|
||||
if (sv_logfile)
|
||||
Qprintf (sv_logfile, "%s", msg);
|
||||
fprintf (sv_logfile, "%s", msg);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -595,7 +595,7 @@ void SV_NextDownload_f (void)
|
|||
r = host_client->downloadsize - host_client->downloadcount;
|
||||
if (r > 768)
|
||||
r = 768;
|
||||
r = Qread (host_client->download, buffer, r);
|
||||
r = fread (buffer, 1, r, host_client->download);
|
||||
ClientReliableWrite_Begin (host_client, svc_download, 6+r);
|
||||
ClientReliableWrite_Short (host_client, r);
|
||||
|
||||
|
@ -610,7 +610,7 @@ void SV_NextDownload_f (void)
|
|||
if (host_client->downloadcount != host_client->downloadsize)
|
||||
return;
|
||||
|
||||
Qclose (host_client->download);
|
||||
fclose (host_client->download);
|
||||
host_client->download = NULL;
|
||||
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ void SV_NextUpload (void)
|
|||
|
||||
if (!host_client->upload)
|
||||
{
|
||||
host_client->upload = Qopen(host_client->uploadfn, "wb");
|
||||
host_client->upload = fopen(host_client->uploadfn, "wb");
|
||||
if (!host_client->upload) {
|
||||
Sys_Printf("Can't create %s\n", host_client->uploadfn);
|
||||
ClientReliableWrite_Begin (host_client, svc_stufftext, 8);
|
||||
|
@ -671,7 +671,7 @@ void SV_NextUpload (void)
|
|||
OutofBandPrintf(host_client->snap_from, "Server receiving %s from %d...\n", host_client->uploadfn, host_client->userid);
|
||||
}
|
||||
|
||||
Qwrite (host_client->upload, net_message.data + msg_readcount, size);
|
||||
fwrite (net_message.data + msg_readcount, 1, size, host_client->upload);
|
||||
msg_readcount += size;
|
||||
|
||||
Con_DPrintf ("UPLOAD: %d received\n", size);
|
||||
|
@ -680,7 +680,7 @@ Con_DPrintf ("UPLOAD: %d received\n", size);
|
|||
ClientReliableWrite_Begin (host_client, svc_stufftext, 8);
|
||||
ClientReliableWrite_String (host_client, "nextul\n");
|
||||
} else {
|
||||
Qclose (host_client->upload);
|
||||
fclose (host_client->upload);
|
||||
host_client->upload = NULL;
|
||||
|
||||
Sys_Printf("%s upload completed.\n", host_client->uploadfn);
|
||||
|
@ -760,7 +760,7 @@ void SV_BeginDownload_f(void)
|
|||
}
|
||||
|
||||
if (host_client->download) {
|
||||
Qclose (host_client->download);
|
||||
fclose (host_client->download);
|
||||
host_client->download = NULL;
|
||||
}
|
||||
|
||||
|
@ -772,6 +772,7 @@ void SV_BeginDownload_f(void)
|
|||
*p = tolower((int)*p);
|
||||
}
|
||||
|
||||
|
||||
host_client->downloadsize = COM_FOpenFile (name, &host_client->download);
|
||||
host_client->downloadcount = 0;
|
||||
|
||||
|
@ -781,7 +782,7 @@ void SV_BeginDownload_f(void)
|
|||
|| (strncmp(name, "maps/", 5) == 0 && file_from_pak))
|
||||
{
|
||||
if (host_client->download) {
|
||||
Qclose(host_client->download);
|
||||
fclose(host_client->download);
|
||||
host_client->download = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue