1
0
mirror of https://github.com/simh/simh.git synced 2026-04-15 16:11:13 +00:00

sigma: Fix Coverity identified problems

CIS:   Properly clear sign
DP:   Fixed bug in selecting 3281 unit F
RTC: Fixed bugs in set, show_tps
This commit is contained in:
Bob Supnik
2017-03-14 04:46:42 -07:00
committed by Mark Pizzolato
parent 430541bda9
commit 0c03efb560
3 changed files with 235 additions and 173 deletions

View File

@@ -1,6 +1,6 @@
/* sigma_rtc.c: Sigma clocks
Copyright (c) 2007, Robert M. Supnik
Copyright (c) 2007-2017, Robert M. Supnik
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
@@ -25,6 +25,8 @@
rtc clocks
13-Mar-17 RMS Fixed bugs in set, show_tps (COVERITY)
The real-time clock includes an internal scheduler for events which need to
be driven at multiples of the clock frequency, such as console and multiplexor
polling. Other devices can "register" with the clock module to receive service
@@ -199,7 +201,8 @@ if ((r != SCPE_OK) || /* error? */
return SCPE_ARG;
for (i = 0; i < RTC_NUM_HZ; i++) { /* loop thru freqs */
if (newval == rtc_tab[i].hz) { /* found freq? */
rtc_tps[val] = i;
if (val < RTC_NUM_CNTRS) /* for clocks */
rtc_tps[val] = i; /* save val for reset */
rtc_indx[val] = i; /* save event vals */
rtc_cntr[val] = rtc_tab[i].cntr_reset;
rtc_xtra[val] = rtc_tab[i].xtra_reset;
@@ -217,7 +220,7 @@ uint32 idx;
if (val >= RTC_NUM_EVNTS)
return SCPE_IERR;
idx = rtc_tps[val]; /* ptr to clk defs */
idx = rtc_indx[val]; /* ptr to clk defs */
if (rtc_tab[idx].hz == 0)
fprintf (of, "off\n");
else fprintf (of, "%dHz\n", rtc_tab[idx].hz);