fix some format string errors, and return value of read() ignored warnings
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 4 Nov 2008 19:16:07 +0000 (19:16 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 4 Nov 2008 19:16:07 +0000 (19:16 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8546 d7cf8633-e32d-0410-b094-e92efae38249

csprogs.c
fs.c
host_cmd.c
prvm_cmds.c
sv_user.c

index 203e107..8f15c55 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -44,7 +44,7 @@ void CL_VM_Error (const char *format, ...)    //[515]: hope it will be never execut
        Cvar_SetValueQuick(&csqc_progsize, -1);
 
 //     Host_AbortCurrentFrame();       //[515]: hmmm... if server says it needs csqc then client MUST disconnect
-       Host_Error(va("CL_VM_Error: %s", errorstring));
+       Host_Error("CL_VM_Error: %s", errorstring);
 }
 void CL_VM_UpdateDmgGlobals (int dmg_take, int dmg_save, vec3_t dmg_origin)
 {
diff --git a/fs.c b/fs.c
index 4d720f3..c83273e 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -472,7 +472,11 @@ int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd)
        // Load the central directory in memory
        central_dir = (unsigned char *)Mem_Alloc (tempmempool, eocd->cdir_size);
        lseek (pack->handle, eocd->cdir_offset, SEEK_SET);
-       read (pack->handle, central_dir, eocd->cdir_size);
+       if(read (pack->handle, central_dir, eocd->cdir_size) != eocd->cdir_size)
+       {
+               Mem_Free (central_dir);
+               return -1;
+       }
 
        // Extract the files properties
        // The parsing is done "by hand" because some fields have variable sizes and
@@ -808,7 +812,12 @@ pack_t *FS_LoadPackPAK (const char *packfile)
 #endif
        if (packhandle < 0)
                return NULL;
-       read (packhandle, (void *)&header, sizeof(header));
+       if(read (packhandle, (void *)&header, sizeof(header)) != sizeof(header))
+       {
+               Con_Printf ("%s is not a packfile\n", packfile);
+               close(packhandle);
+               return NULL;
+       }
        if (memcmp(header.id, "PACK", 4))
        {
                Con_Printf ("%s is not a packfile\n", packfile);
index ee974ac..c0a38fc 100644 (file)
@@ -2158,7 +2158,7 @@ void Host_SendCvar_f (void)
                if(svs.clients[i].active && svs.clients[i].netconnection)
                {
                        host_client = &svs.clients[i];
-                       Host_ClientCommands(va("sendcvar %s\n", cvarname));
+                       Host_ClientCommands("sendcvar %s\n", cvarname);
                }
        host_client = old;
 }
index 812860b..ccd5b0a 100644 (file)
@@ -23,7 +23,7 @@ void VM_Warning(const char *fmt, ...)
        dpvsnprintf(msg,sizeof(msg),fmt,argptr);
        va_end(argptr);
 
-       Con_Printf(msg);
+       Con_Print(msg);
 
        // TODO: either add a cvar/cmd to control the state dumping or replace some of the calls with Con_Printf [9/13/2006 Black]
        if(prvm_backtraceforwarnings.integer && recursive != realtime) // NOTE: this compares to the time, just in case if PRVM_PrintState causes a Host_Error and keeps recursive set
index 78ff1f9..882418c 100644 (file)
--- a/sv_user.c
+++ b/sv_user.c
@@ -860,7 +860,7 @@ clc_stringcmd_invalid:
                                                Mem_Free(temp);
                                                // calculated crc, send the file info to the client
                                                // (so that it can verify the data)
-                                               Host_ClientCommands(va("\ncl_downloadfinished %i %i %s\n", size, crc, host_client->download_name));
+                                               Host_ClientCommands("\ncl_downloadfinished %i %i %s\n", size, crc, host_client->download_name);
                                                Con_DPrintf("Download of %s by %s has finished\n", host_client->download_name, host_client->name);
                                                FS_Close(host_client->download_file);
                                                host_client->download_file = NULL;