Merge pull request #673 from qeeg/master

Fix bugs pointed out by Coverity
This commit is contained in:
OBattler
2020-04-07 11:26:17 +02:00
committed by GitHub
3 changed files with 6 additions and 6 deletions

View File

@@ -1027,9 +1027,9 @@ fdc_write(uint16_t addr, uint8_t val, void *priv)
fdc->st0 |= 0x80; fdc->st0 |= 0x80;
drive_num = real_drive(fdc, fdc->drive); drive_num = real_drive(fdc, fdc->drive);
/* Three conditions under which the command should fail. */ /* Three conditions under which the command should fail. */
if (!fdd_get_flags(drive_num) || (drive_num >= FDD_NUM) || !motoron[drive_num] || fdd_track0(drive_num)) { if ((drive_num >= FDD_NUM) || !fdd_get_flags(drive_num) || !motoron[drive_num] || fdd_track0(drive_num)) {
fdc_log("Failed recalibrate\n"); fdc_log("Failed recalibrate\n");
if (!fdd_get_flags(drive_num) || (drive_num >= FDD_NUM) || !motoron[drive_num]) if ((drive_num >= FDD_NUM) || !fdd_get_flags(drive_num) || !motoron[drive_num])
fdc->st0 = 0x70 | (fdc->params[0] & 3); fdc->st0 = 0x70 | (fdc->params[0] & 3);
else else
fdc->st0 = 0x20 | (fdc->params[0] & 3); fdc->st0 = 0x20 | (fdc->params[0] & 3);

View File

@@ -43,8 +43,8 @@ typedef struct {
hwm_values_t* values; hwm_values_t* values;
uint8_t regs[256]; uint8_t regs[256];
uint8_t regs_bank1[6]; uint8_t regs_bank1[7];
uint8_t regs_bank2[6]; uint8_t regs_bank2[7];
uint8_t addr_register; uint8_t addr_register;
uint8_t data_register; uint8_t data_register;

View File

@@ -575,7 +575,7 @@ cgapal_rebuild(void)
video_6to8[cgapal[c].b]); video_6to8[cgapal[c].b]);
} }
if ((cga_palette > 1) && (cga_palette < 8)) { if ((cga_palette > 1) && (cga_palette < 7)) {
if (vid_cga_contrast != 0) { if (vid_cga_contrast != 0) {
for (c = 0; c < 16; c++) { for (c = 0; c < 16; c++) {
pal_lookup[c] = makecol(video_6to8[cgapal_mono[cga_palette - 2][c].r], pal_lookup[c] = makecol(video_6to8[cgapal_mono[cga_palette - 2][c].r],
@@ -609,7 +609,7 @@ cgapal_rebuild(void)
} }
} }
if (cga_palette == 8) if (cga_palette == 7)
pal_lookup[0x16] = makecol(video_6to8[42],video_6to8[42],video_6to8[0]); pal_lookup[0x16] = makecol(video_6to8[42],video_6to8[42],video_6to8[0]);
} }