]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
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 203e107056862d9f5c0d712431874f543a85d34d..8f15c553c8ca7daef8baa88cf034b9f6cd159191 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 4d720f3615dea689480a0257c48782de2a0c1b4a..c83273e4e746a02ed80326333bbbe4f15a5668b6 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 ee974ac607e302c71c4ff19eb8208a44c98a40a8..c0a38fca9f3799a96fe68a1d1424979764ff29f3 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 812860baacf5eb7c7d90f22cf409afe97918259a..ccd5b0a02eaa4a16ebab1e1d1af61deaf0ead895 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 78ff1f9fdb5af10e3f28fd112407302fcf6431e7..882418c6706c8c676ce0bbdcf72c49bb32b99092 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;