I7094: Compiler warning cleanup

- Initialize local state variables to 0.  Likely non functional changes due
  to lack of depth in static analysis scan.  Coverity detects real problems
  like this.
- Avoid potential out of array indexing due to theoretical array
  reference via signed char index.  Likely non functional change.
This commit is contained in:
Mark Pizzolato 2020-10-19 12:28:59 -07:00
parent 1e46a14ba7
commit 9e2925534b
3 changed files with 4 additions and 4 deletions

View file

@ -231,7 +231,7 @@ switch (cdr_sta) { /* case on state */
if (uptr->flags & UNIT_CBN) /* column binary? */
colbin = (((uint32) cdr_cbuf[2 * col]) << 6) |
((uint32) cdr_cbuf[(2 * col) + 1]); /* 2 chars -> col bin */
else colbin = bcd_to_colbin[cdr_cbuf[col]]; /* cvt to col binary */
else colbin = bcd_to_colbin[cdr_cbuf[col] & 077]; /* cvt to col binary */
dat = bit_masks[35 - (col % 36)]; /* mask for column */
for (row = 0; row < 12; row++) { /* rows 9..0, 11, 12 */
bufw = (row * 2) + (col / 36); /* index to buffer */
@ -440,7 +440,7 @@ for (col = 0; col < 72; col++) { /* process 72 columns */
}
else { /* text */
bcd = colbin_to_bcd (colbin); /* column bin -> BCD */
cdp_cbuf[col] = pch[bcd]; /* -> ASCII */
cdp_cbuf[col] = pch[bcd & 077]; /* -> ASCII */
}
}
for (i = ((2 * CD_CHRLNT) + 1); (i > 0) &&

View file

@ -619,7 +619,7 @@ const uint8 op_flags[1024] = {
t_stat sim_instr (void)
{
t_stat reason = SCPE_OK;
t_uint64 IR, SR, t, t1, t2, sr1;
t_uint64 IR, SR, t, t1, t2, sr1 = 0;
uint32 op, fl, tag, tagi, addr, ea;
uint32 ch, dec, xr, xec_cnt, trp;
uint32 i, j, sc, s1, s2, spill;

View file

@ -323,7 +323,7 @@ for (col = 0; col < 72; col++) { /* proc 72 columns */
colbin |= col_masks[row];
}
bcd = colbin_to_bcd (colbin); /* column bin -> BCD */
lpt_cbuf[col] = pch[bcd]; /* -> ASCII */
lpt_cbuf[col] = pch[bcd & 077]; /* -> ASCII */
}
for (i = LPT_CHRLNT; (i > 0) &&
(lpt_cbuf[i - 1] == ' '); --i) ; /* trim spaces */