CDC1700: Fixing Coverity identified issues

This commit is contained in:
John Forecast 2017-03-15 14:53:51 -07:00 committed by Mark Pizzolato
parent 62879beb70
commit 8d8ecc1a5a
3 changed files with 849 additions and 855 deletions

View file

@ -657,6 +657,8 @@ static t_bool LoadDiskAddress(UNIT *uptr, struct cdio_unit *iou, uint16 state)
*/
static void StartCDDiskIO(UNIT *uptr, struct cdio_unit *iou, uint16 state)
{
uint16 sector;
CDdev.CWA = IOAreg;
CDdev.STATUS &= IO_ST_READY | IO_1733_ONCYL | IO_ST_PROT | IO_1733_SINGLE;
@ -666,29 +668,23 @@ static void StartCDDiskIO(UNIT *uptr, struct cdio_unit *iou, uint16 state)
if ((cd_dev.dctrl & DBG_DTRACE) != 0) {
const char *active = "None";
if (iou != NULL) {
if (iou->active != NULL) {
if (iou->active == iou->ondrive[0])
active = "0";
if (iou->active == iou->ondrive[1])
active = "1";
}
}
fprintf(DBGOUT,
"%sCD - Start I/O, drive: %s, disk: %s, cur: %04X, len: %04X, state: %s\r\n",
INTprefix, iou != NULL ? iou->name : "None", active,
CDdev.CWA, CDdev.BUFLEN, CDstateStr[state]);
if (iou != NULL) {
uint16 sector;
sector = (((2 * iou->cylinder) + iou->surface) * CD_NUMSC) + iou->sector;
fprintf(DBGOUT,
"%sCD - Disk Address: c:%u,s:%c,d:%c,s:%u (0x%04X), Log. Sector %u (0x%04X)\r\n",
INTprefix, iou->cylinder, '0' + iou->surface, '0' + iou->disk,
iou->sector, iou->sectorAddr, sector, sector);
}
}
CDdev.DCYLSTATUS &= ~iou->seekComplete;

View file

@ -225,7 +225,7 @@ static uint16 luabs(uint16 param, uint16 lu, uint16 a)
static uint16 spabs(uint16 param)
{
uint16 sa = M[param + 5];
uint16 l, sl = param + 5;
uint16 sl = param + 5;
/*
* If the D bit is set, the starting address must be absolute.
@ -326,7 +326,7 @@ static void motion(uint16 param, char *d)
}
} else {
sprintf(END(d), " Repeat = %s, %u times\r\n",
action[(commands & 0x7) >> 12], commands & 0xFFF);
action[(commands & 0x7000) >> 12], commands & 0xFFF);
}
}
@ -343,7 +343,7 @@ char *textRep(uint16 start, uint16 len)
text[0] = '\0';
for (i = 0; i < (2 * len); i++) {
for (i = 0; (i < (2 * len)) && (strlen(text) < MAXTEXT); i++) {
uint16 ch = M[start];
if ((i & 1) == 0)
@ -352,9 +352,6 @@ char *textRep(uint16 start, uint16 len)
ch &= 0x7F;
strcat(text, charRep[ch]);
if (strlen(text) > MAXTEXT)
break;
}
return text;
}
@ -618,12 +615,13 @@ void MSOS5request(uint16 param, uint16 depth)
strcpy(parameters, "Invalid directory scheduling code");
break;
}
break;
default:
request = "*Unknown*";
sprintf(parameters, "Request code: %d", (M[param] & 0x3E00) >> 9);
break;
}
done:
fprintf(DBGOUT, "%sMSOS5(%06u): [RQ: $%04X]%s%s %s\r\n",
INTprefix, seqno++, param, indent[depth & 0x7], request, parameters);
if (details[0] != '\0')