1
0
mirror of https://github.com/simh/simh.git synced 2026-05-03 06:28:41 +00:00

SCP: Fixed "noise" bugs (COVERITY)

This commit is contained in:
Bob Supnik
2017-03-20 21:55:10 -07:00
committed by Mark Pizzolato
parent c6399f7e40
commit 5ca66f59fe
2 changed files with 13 additions and 7 deletions

15
scp.c
View File

@@ -1,6 +1,6 @@
/* scp.c: simulator control program /* scp.c: simulator control program
Copyright (c) 1993-2016, Robert M Supnik Copyright (c) 1993-2017, Robert M Supnik
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),
@@ -23,6 +23,7 @@
used in advertising or otherwise to promote the sale, use or other dealings used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from Robert M Supnik. in this Software without prior written authorization from Robert M Supnik.
10-Mar-17 MP Fixed "noise" bugs (COVERITY)
08-Mar-16 RMS Added shutdown flag for detach_all 08-Mar-16 RMS Added shutdown flag for detach_all
28-Mar-15 RMS Added sim_printf from GitHub master (Mark Pizzolato) 28-Mar-15 RMS Added sim_printf from GitHub master (Mark Pizzolato)
28-Dec-14 JDB [4.0] Moved sim_load and sim_emax declarations to scp.h 28-Dec-14 JDB [4.0] Moved sim_load and sim_emax declarations to scp.h
@@ -1785,15 +1786,19 @@ t_stat ssh_break (FILE *st, char *cptr, int32 flg)
{ {
char gbuf[CBUFSIZE], *tptr, *t1ptr, *aptr; char gbuf[CBUFSIZE], *tptr, *t1ptr, *aptr;
DEVICE *dptr = sim_dflt_dev; DEVICE *dptr = sim_dflt_dev;
UNIT *uptr = dptr->units; UNIT *uptr;
t_stat r; t_stat r;
t_addr lo, hi, max = uptr->capac - 1; t_addr lo, hi, max;
int32 cnt; int32 cnt;
if (sim_brk_types == 0) if (sim_brk_types == 0)
return SCPE_NOFNC; return SCPE_NOFNC;
if ((dptr == NULL) || (uptr == NULL)) if (dptr == NULL) /* sanity checks */
return SCPE_IERR; return SCPE_IERR;
uptr = dptr->units;
if (uptr == NULL)
return SCPE_IERR;
max = uptr->capac - 1;
if (aptr = strchr (cptr, ';')) { /* ;action? */ if (aptr = strchr (cptr, ';')) { /* ;action? */
if (flg != SSH_ST) /* only on SET */ if (flg != SSH_ST) /* only on SET */
return SCPE_ARG; return SCPE_ARG;
@@ -2172,7 +2177,7 @@ if (!(uptr->flags & UNIT_ATT)) /* attached? */
return SCPE_OK; return SCPE_OK;
if ((dptr = find_dev_from_unit (uptr)) == NULL) if ((dptr = find_dev_from_unit (uptr)) == NULL)
return SCPE_OK; return SCPE_OK;
if (uptr->flags & UNIT_BUF) { if ((uptr->flags & UNIT_BUF) && (uptr->filebuf)) { /* buffered? */
uint32 cap = (uptr->hwmark + dptr->aincr - 1) / dptr->aincr; uint32 cap = (uptr->hwmark + dptr->aincr - 1) / dptr->aincr;
if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) { if (uptr->hwmark && ((uptr->flags & UNIT_RO) == 0)) {
if (!sim_quiet) if (!sim_quiet)

View File

@@ -205,7 +205,8 @@ t_stat r;
if ((cptr == NULL) || (*cptr == 0)) if ((cptr == NULL) || (*cptr == 0))
return SCPE_2FARG; return SCPE_2FARG;
if (dptr->dradix == 16) rdx = 16; if (dptr->dradix == 16)
rdx = 16;
else rdx = 8; else rdx = 8;
val = (int32) get_uint (cptr, rdx, 0177, &r); val = (int32) get_uint (cptr, rdx, 0177, &r);
if ((r != SCPE_OK) || if ((r != SCPE_OK) ||
@@ -526,7 +527,7 @@ if (md != TTUF_MODE_8B) {
c |= ((~((nibble_even_parity >> ((c & 0xF) + 1)) ^ (nibble_even_parity >> (((c >> 4) & 0xF) + 1)))) & 0x80); c |= ((~((nibble_even_parity >> ((c & 0xF) + 1)) ^ (nibble_even_parity >> (((c >> 4) & 0xF) + 1)))) & 0x80);
break; break;
case TTUF_PAR_MARK: case TTUF_PAR_MARK:
c = c | 0x80; c = c | 0200;
break; break;
} }
} }