fix more clang complaints

Fix some more of the complaints from clang's static analyzer.  The one
in options.c (manipulating warnings symbols) appears to be an actual bug.
All the rest are either because the analysis isn't quite sophicated
enough or outright bogus.

Two of them appear to be because a static routine is attempting to guard
against callers in the same file failing to pass in required output
pointers.  Stripping away the check for missing pointer should convince
the analyzer that those output parameters always receive a value.  We'll
see once the analysis is eventually re-run....
This commit is contained in:
PatR
2015-11-21 00:25:50 -08:00
parent 63dc6b3a31
commit 2e4e1adea3
5 changed files with 32 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1447234076 2015/11/11 09:27:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.240 $ */
/* NetHack 3.6 options.c $NHDT-Date: 1448094341 2015/11/21 08:25:41 $ $NHDT-Branch: master $:$NHDT-Revision: 1.241 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1015,20 +1015,19 @@ warning_opts(opts, optype)
register char *opts;
const char *optype;
{
uchar translate[MAXPCHARS + 1];
uchar translate[WARNCOUNT];
int length, i;
if (!(opts = string_for_env_opt(optype, opts, FALSE)))
return;
escapes(opts, opts);
length = strlen(opts);
if (length > WARNCOUNT)
length = WARNCOUNT;
length = (int) strlen(opts);
/* match the form obtained from PC configuration files */
for (i = 0; i < length; i++)
translate[i] = (((i < WARNCOUNT) && opts[i]) ? (uchar) opts[i]
: def_warnsyms[i].sym);
for (i = 0; i < WARNCOUNT; i++)
translate[i] = (i >= length) ? 0
: opts[i] ? (uchar) opts[i]
: def_warnsyms[i].sym;
assign_warnings(translate);
}