From: cloudwalk Date: Sat, 27 Jun 2020 21:32:00 +0000 (+0000) Subject: Fix some warnings found by cppcheck X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d79de33fe1787fbf73bee091ef5f3499d7f06396;p=xonotic%2Fdarkplaces.git Fix some warnings found by cppcheck git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12746 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_parse.c b/cl_parse.c index 0ecfb693..2d8f04ab 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -270,8 +270,6 @@ static void CL_ParseStartSoundPacket(int largesoundindex) sound_num = MSG_ReadByte(&cl_message); } - channel = CHAN_NET2ENGINE(channel); - MSG_ReadVector(&cl_message, pos, cls.protocol); if (sound_num < 0 || sound_num >= MAX_SOUNDS) diff --git a/clvm_cmds.c b/clvm_cmds.c index dd8842df..ba1555d3 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -219,8 +219,6 @@ static void VM_CL_sound (prvm_prog_t *prog) else startposition = 0; - channel = CHAN_USER2ENGINE(channel); - if (!IS_CHAN(channel)) { VM_Warning(prog, "VM_CL_sound: channel must be in range 0-127\n"); diff --git a/csprogs.c b/csprogs.c index 07087c97..665d4887 100644 --- a/csprogs.c +++ b/csprogs.c @@ -562,12 +562,10 @@ void CL_VM_Parse_StuffCmd (const char *msg) // temporarily so that it can be set by the cvar command, // and then reprotect it afterwards int crcflags = csqc_progcrc.flags; - int sizeflags = csqc_progcrc.flags; csqc_progcrc.flags &= ~CVAR_READONLY; csqc_progsize.flags &= ~CVAR_READONLY; Cmd_ExecuteString(&cmd_client, msg, src_command, true); - csqc_progcrc.flags = crcflags; - csqc_progsize.flags = sizeflags; + csqc_progcrc.flags = csqc_progsize.flags = crcflags; return; } diff --git a/fs.c b/fs.c index a5130fbb..c15b8ba0 100644 --- a/fs.c +++ b/fs.c @@ -2891,7 +2891,7 @@ fs_offset_t FS_Read (qfile_t* file, void* buffer, size_t buffersize) { fs_offset_t count, done; - if (buffersize == 0) + if (buffersize == 0 || !buffer) return 0; // Get rid of the ungetc character