1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-01-13 15:27:04 +00:00

SIMCARD: fixed Coverity issues.

This commit is contained in:
Richard Cornwell 2017-03-19 12:04:22 -04:00
parent c76ad0296d
commit 21ebaeb8b8
2 changed files with 14 additions and 7 deletions

16
scp.c
View File

@ -3544,7 +3544,7 @@ else {
result = test_search (&val, &sim_stabr); /* test condition */
}
else { /* Handle memory case */
if (!get_asearch (gbuf, sim_dfdev->dradix, &sim_staba) || /* parse condition */
if (!get_asearch (gbuf, sim_dfdev ? sim_dfdev->dradix : sim_dflt_dev->dradix, &sim_staba) || /* parse condition */
(sim_staba.boolop == -1)) /* relational op reqd */
return SCPE_MISVAL;
reason = get_aval (addr, sim_dfdev, sim_dfunit);/* get data */
@ -6141,10 +6141,14 @@ t_bool suppress_warning = ((sim_switches & SWMASK ('Q')) != 0);
t_bool warned = FALSE;
sim_switches &= ~(SWMASK ('F') | SWMASK ('D') | SWMASK ('Q')); /* remove digested switches */
#define READ_S(xx) if (read_line ((xx), sizeof(xx), rfile) == NULL) \
return SCPE_IOERR;
#define READ_I(xx) if (sim_fread (&xx, sizeof (xx), 1, rfile) == 0) \
return SCPE_IOERR;
#define READ_S(xx) if (read_line ((xx), sizeof(xx), rfile) == NULL) { \
r = SCPE_IOERR; \
goto Cleanup_Return; \
}
#define READ_I(xx) if (sim_fread (&xx, sizeof (xx), 1, rfile) == 0) { \
r = SCPE_IOERR; \
goto Cleanup_Return; \
}
fstat (fileno (rfile), &rstat);
READ_S (buf); /* [V2.5+] read version */
@ -6431,6 +6435,8 @@ for (j=0, r = SCPE_OK; j<attcnt; j++) {
free (attnames[j]);
}
Cleanup_Return:
for (j=0; j < attcnt; j++)
free (attnames[j]);
free (attnames);
free (attunits);
free (attswitches);

View File

@ -581,6 +581,7 @@ sim_read_card(UNIT * uptr)
mode = uptr->flags & UNIT_CARD_MODE;
switch(mode) {
default:
case MODE_TEXT:
sim_debug(DEBUG_CARD, dptr, "text: [");
/* Check for special codes */
@ -656,7 +657,7 @@ sim_read_card(UNIT * uptr)
if ((uptr->flags & MODE_LOWER) == 0)
c = toupper(c);
switch(uptr->flags & MODE_CHAR) {
case 0:
default:
case MODE_026:
temp = ascii_to_hol_026[(int)c];
break;
@ -895,7 +896,7 @@ sim_punch_card(UNIT * uptr, UNIT *stkuptr)
case MODE_OCTAL:
sim_debug(DEBUG_CARD, dptr, "octal: [");
out[outp++] = '~';
for (i = 80; i > 0; i--) {
for (i = 79; i >= 0; i--) {
if (data->image[i] != 0)
break;
}