From e98edd5f5f2913079ea529680f080fda47df4409 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 23 May 2000 22:43:36 +0000 Subject: [PATCH] revert back to using f* for file io. I hope this fixes the catapult, but I wouldn't be suprised if it doesn't. --- source/cl_demo.c | 74 +++++++++++++++++++++++------------------------ source/cl_main.c | 12 ++++---- source/cl_parse.c | 22 +++++++------- source/cl_slist.c | 8 ++--- source/cmd.c | 6 ++-- source/com.c | 4 +-- source/cvar.c | 2 +- source/keys.c | 2 +- source/pr_cmds.c | 4 +-- source/quakefs.c | 42 +++++++++++++-------------- source/r_part.c | 7 ++--- source/sv_ccmds.c | 14 ++++----- source/sv_main.c | 14 ++++----- source/sv_send.c | 2 +- source/sv_user.c | 15 +++++----- 15 files changed, 113 insertions(+), 115 deletions(-) diff --git a/source/cl_demo.c b/source/cl_demo.c index 7dd67f4..b76b981 100644 --- a/source/cl_demo.c +++ b/source/cl_demo.c @@ -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"); diff --git a/source/cl_main.c b/source/cl_main.c index 8fa741c..2f72b1c 100644 --- a/source/cl_main.c +++ b/source/cl_main.c @@ -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); } } diff --git a/source/cl_parse.c b/source/cl_parse.c index 09870f6..36e7fde 100644 --- a/source/cl_parse.c +++ b/source/cl_parse.c @@ -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"); } diff --git a/source/cl_slist.c b/source/cl_slist.c index 1f732c0..8dfdc89 100644 --- a/source/cl_slist.c +++ b/source/cl_slist.c @@ -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); } diff --git a/source/cmd.c b/source/cmd.c index ef551af..95decd6 100644 --- a/source/cmd.c +++ b/source/cmd.c @@ -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); diff --git a/source/com.c b/source/com.c index f313c23..cade9ea 100644 --- a/source/com.c +++ b/source/com.c @@ -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) { diff --git a/source/cvar.c b/source/cvar.c index 1397924..13ebead 100644 --- a/source/cvar.c +++ b/source/cvar.c @@ -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) diff --git a/source/keys.c b/source/keys.c index 06b09ac..b9e1ddb 100644 --- a/source/keys.c +++ b/source/keys.c @@ -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]); } diff --git a/source/pr_cmds.c b/source/pr_cmds.c index 1ed31b1..ed0043f 100644 --- a/source/pr_cmds.c +++ b/source/pr_cmds.c @@ -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); } } diff --git a/source/quakefs.c b/source/quakefs.c index 571fcd1..7810509 100644 --- a/source/quakefs.c +++ b/source/quakefs.c @@ -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); } diff --git a/source/r_part.c b/source/r_part.c index ef30157..8eb2511 100644 --- a/source/r_part.c +++ b/source/r_part.c @@ -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); } diff --git a/source/sv_ccmds.c b/source/sv_ccmds.c index 5efce5c..fef8f46 100644 --- a/source/sv_ccmds.c +++ b/source/sv_ccmds.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 (); diff --git a/source/sv_main.c b/source/sv_main.c index d0e67b1..5df2697 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -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 ; idownloadsize - 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; }