From d79de33fe1787fbf73bee091ef5f3499d7f06396 Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Sat, 27 Jun 2020 21:32:00 +0000 Subject: [PATCH] Fix some warnings found by cppcheck git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12746 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_parse.c | 2 -- clvm_cmds.c | 2 -- csprogs.c | 4 +--- fs.c | 2 +- 4 files changed, 2 insertions(+), 8 deletions(-) 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 -- 2.39.2