Addressed compiler warnings.
Added the initialization of several locals. In check_fields, validate that we have a valid index (idx) before using.
This commit is contained in:
@@ -3867,7 +3867,7 @@ boolean forcefields;
|
||||
int *topsz, *bottomsz;
|
||||
{
|
||||
int c, i, row, col, trackx, idx;
|
||||
boolean valid = TRUE, matchprev = FALSE, update_right, disregard;
|
||||
boolean valid = TRUE, matchprev = FALSE, update_right, disregard = FALSE;
|
||||
|
||||
if (!windowdata_init && !check_windowdata())
|
||||
return FALSE;
|
||||
@@ -3876,6 +3876,7 @@ int *topsz, *bottomsz;
|
||||
col = 1;
|
||||
trackx = 1;
|
||||
update_right = FALSE;
|
||||
idx = -1;
|
||||
for (i = 0; fieldorder[row][i] != BL_FLUSH; ++i) {
|
||||
idx = fieldorder[row][i];
|
||||
if (!status_activefields[idx])
|
||||
@@ -3941,10 +3942,12 @@ int *topsz, *bottomsz;
|
||||
tty_status[NOW][idx].redraw = TRUE;
|
||||
col += tty_status[NOW][idx].lth;
|
||||
}
|
||||
if (row && bottomsz)
|
||||
*bottomsz = col + tty_status[NOW][idx].lth;
|
||||
else if (topsz)
|
||||
*topsz = col + tty_status[NOW][idx].lth;
|
||||
if (idx != -1) {
|
||||
if (row && bottomsz)
|
||||
*bottomsz = col + tty_status[NOW][idx].lth;
|
||||
else if (topsz)
|
||||
*topsz = col + tty_status[NOW][idx].lth;
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
@@ -3960,7 +3963,7 @@ struct tty_status_fields *fld;
|
||||
const char *val;
|
||||
int x, y;
|
||||
{
|
||||
int i, n, ncols, lth;
|
||||
int i, n, ncols, lth = 0;
|
||||
struct WinDesc *cw = 0;
|
||||
const char *text = (char *)0;
|
||||
|
||||
@@ -4273,7 +4276,7 @@ render_status(VOID_ARGS)
|
||||
/* hitpointbar using hp percent calculation */
|
||||
int bar_pos, bar_len;
|
||||
char *bar2 = (char *)0;
|
||||
char bar[MAXCO], savedch;
|
||||
char bar[MAXCO], savedch = 0;
|
||||
boolean twoparts = FALSE;
|
||||
|
||||
bar_len = strlen(text);
|
||||
|
||||
Reference in New Issue
Block a user