ref: b8e4e7db10724ef2fd64ccc21dad5e4a2f3fb811
parent: 4a40fbd789b5308e3904cb73b164f3f8f270c4d0
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Oct 14 14:32:50 EDT 2024
fix a few scan-build reports
--- a/fs.c
+++ b/fs.c
@@ -725,7 +725,7 @@
if(bf == nil)
return -1;
r = -1;
- if(s = frdline(bf), s == nil)
+ if((s = frdline(bf)) == nil)
goto exit;
n = strtol(s, nil, 10);
if(n != Nsavver){
@@ -732,8 +732,8 @@
werrstr("invalid version %d", n);
goto exit;
}
- frdline(bf);
- r = loadparms(bf, f);
+ if(frdline(bf) != nil)
+ r = loadparms(bf, f);
exit:
fclose(bf);
return r;
--- a/net_main.c
+++ b/net_main.c
@@ -437,6 +437,8 @@
bool state1 [MAX_SCOREBOARD];
bool state2 [MAX_SCOREBOARD];
+ memset(state1, 0, sizeof(state1));
+ memset(state2, 0, sizeof(state2));
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
{
if (!host_client->netconnection)
@@ -451,8 +453,6 @@
continue;
}
count++;
- state1[i] = false;
- state2[i] = false;
}
else
{
--- a/snd_openal.c
+++ b/snd_openal.c
@@ -692,7 +692,10 @@
if(var == &s_al_dev && Cmd_Argc() == 1){
Con_Printf("%-2d: default (%s)\n", 0, def ? def : "<invalid>");
for(i = 1, s = all; s != nil && *s; i++){
- Con_Printf("%-2d: %s%s\n", i, s, strcmp(s, def) == 0 ? " (default)" : "");
+ Con_Printf(
+ "%-2d: %s%s\n",
+ i, s, (def != nil && strcmp(s, def) == 0) ? " (default)" : ""
+ );
s += strlen(s)+1;
}
return;