Fix more compile warnings

This commit is contained in:
Jasmine Iwanek
2023-08-14 18:59:02 -04:00
parent 1811115b65
commit 375f69ed61
10 changed files with 91 additions and 89 deletions

View File

@@ -100,9 +100,8 @@ typedef struct cpq_386_t {
static uint8_t
cpq_read_ram(uint32_t addr, void *priv)
{
cpq_ram_t *dev = (cpq_ram_t *) priv;
const cpq_ram_t *dev = (cpq_ram_t *) priv;
uint8_t ret = 0xff;
uint32_t old = addr;
addr = (addr - dev->virt_base) + dev->phys_base;
@@ -115,9 +114,8 @@ cpq_read_ram(uint32_t addr, void *priv)
static uint16_t
cpq_read_ramw(uint32_t addr, void *priv)
{
cpq_ram_t *dev = (cpq_ram_t *) priv;
const cpq_ram_t *dev = (cpq_ram_t *) priv;
uint16_t ret = 0xffff;
uint32_t old = addr;
addr = (addr - dev->virt_base) + dev->phys_base;
@@ -130,9 +128,8 @@ cpq_read_ramw(uint32_t addr, void *priv)
static uint32_t
cpq_read_raml(uint32_t addr, void *priv)
{
cpq_ram_t *dev = (cpq_ram_t *) priv;
const cpq_ram_t *dev = (cpq_ram_t *) priv;
uint32_t ret = 0xffffffff;
uint32_t old = addr;
addr = (addr - dev->virt_base) + dev->phys_base;
@@ -145,8 +142,7 @@ cpq_read_raml(uint32_t addr, void *priv)
static void
cpq_write_ram(uint32_t addr, uint8_t val, void *priv)
{
cpq_ram_t *dev = (cpq_ram_t *) priv;
uint32_t old = addr;
const cpq_ram_t *dev = (cpq_ram_t *) priv;
addr = (addr - dev->virt_base) + dev->phys_base;
@@ -157,8 +153,7 @@ cpq_write_ram(uint32_t addr, uint8_t val, void *priv)
static void
cpq_write_ramw(uint32_t addr, uint16_t val, void *priv)
{
cpq_ram_t *dev = (cpq_ram_t *) priv;
uint32_t old = addr;
const cpq_ram_t *dev = (cpq_ram_t *) priv;
addr = (addr - dev->virt_base) + dev->phys_base;
@@ -169,8 +164,7 @@ cpq_write_ramw(uint32_t addr, uint16_t val, void *priv)
static void
cpq_write_raml(uint32_t addr, uint32_t val, void *priv)
{
cpq_ram_t *dev = (cpq_ram_t *) priv;
uint32_t old = addr;
const cpq_ram_t *dev = (cpq_ram_t *) priv;
addr = (addr - dev->virt_base) + dev->phys_base;
@@ -181,7 +175,7 @@ cpq_write_raml(uint32_t addr, uint32_t val, void *priv)
static uint8_t
cpq_read_regs(uint32_t addr, void *priv)
{
cpq_386_t *dev = (cpq_386_t *) priv;
const cpq_386_t *dev = (cpq_386_t *) priv;
uint8_t ret = 0xff;
addr &= 0x00000fff;
@@ -195,6 +189,9 @@ cpq_read_regs(uint32_t addr, void *priv)
/* RAM Setup Port (Read/Write) */
ret = dev->regs[addr];
break;
default:
break;
}
return ret;
@@ -203,7 +200,6 @@ cpq_read_regs(uint32_t addr, void *priv)
static uint16_t
cpq_read_regsw(uint32_t addr, void *priv)
{
cpq_386_t *dev = (cpq_386_t *) priv;
uint16_t ret = 0xffff;
ret = cpq_read_regs(addr, priv);
@@ -215,7 +211,6 @@ cpq_read_regsw(uint32_t addr, void *priv)
static uint32_t
cpq_read_regsl(uint32_t addr, void *priv)
{
cpq_386_t *dev = (cpq_386_t *) priv;
uint32_t ret = 0xffffffff;
ret = cpq_read_regsw(addr, priv);
@@ -306,8 +301,6 @@ cpq_recalc_ram(cpq_386_t *dev)
uint8_t end;
uint8_t k;
uint32_t virt_base;
uint32_t virt_addr;
uint32_t phys_addr;
cpq_ram_t *cram;
for (uint16_t i = 0x10; i < sys_min_high; i++)
@@ -393,14 +386,15 @@ cpq_write_regs(uint32_t addr, uint8_t val, void *priv)
cpq_recalc_cache(dev);
}
break;
default:
break;
}
}
static void
cpq_write_regsw(uint32_t addr, uint16_t val, void *priv)
{
cpq_386_t *dev = (cpq_386_t *) priv;
cpq_write_regs(addr, val & 0xff, priv);
cpq_write_regs(addr + 1, (val >> 8) & 0xff, priv);
}
@@ -408,8 +402,6 @@ cpq_write_regsw(uint32_t addr, uint16_t val, void *priv)
static void
cpq_write_regsl(uint32_t addr, uint32_t val, void *priv)
{
cpq_386_t *dev = (cpq_386_t *) priv;
cpq_write_regsw(addr, val & 0xff, priv);
cpq_write_regsw(addr + 2, (val >> 16) & 0xff, priv);
}
@@ -439,8 +431,6 @@ compaq_ram_diags_parse(cpq_386_t *dev)
uint8_t val = dev->regs[0x00000001];
uint32_t accum = 0x00100000;
val;
for (uint8_t i = 0; i < 4; i++) {
dev->ram_bases[i] = accum;
@@ -451,6 +441,9 @@ compaq_ram_diags_parse(cpq_386_t *dev)
case RAM_DIAG_H_SYS_RAM_4MB:
dev->ram_sizes[i] = 0x00400000;
break;
default:
break;
}
if (i == 0)
dev->ram_sizes[i] -= 0x00100000;
@@ -476,8 +469,6 @@ compaq_recalc_base_ram(cpq_386_t *dev)
uint8_t low_end = 0x00;
uint8_t high_start = 0x00;
uint8_t high_end = 0x00;
uint32_t phys_addr = 0x00000000;
uint32_t virt_addr = 0x00000000;
cpq_ram_t *cram;
switch (base_mem) {
@@ -618,7 +609,7 @@ compaq_386_close(void *priv)
}
static void *
compaq_386_init(const device_t *info)
compaq_386_init(UNUSED(const device_t *info))
{
cpq_386_t *dev = (cpq_386_t *) calloc(1, sizeof(cpq_386_t));
@@ -706,6 +697,9 @@ compaq_386_init(const device_t *info)
dev->regs[0x00000001] = RAM_DIAG_H_SYS_RAM_4MB | RAM_DIAG_H_MOD_A_RAM_4MB |
RAM_DIAG_H_MOD_B_RAM_4MB | RAM_DIAG_H_MOD_C_RAM_4MB;
break;
default:
break;
}
} else
dev->regs[0x00000001] = RAM_DIAG_H_SYS_RAM_1MB | RAM_DIAG_H_MOD_A_RAM_NONE |

View File

@@ -1,6 +1,7 @@
#if defined __amd64__ || defined _M_X64
# include <stdint.h>
# include <inttypes.h>
# include <86box/86box.h>
# include "cpu.h"
# include <86box/mem.h>
@@ -125,7 +126,7 @@ host_x86_ADD64_REG_IMM(codeblock_t *block, int dst_reg, uint64_t imm_data)
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x48, 0x83, 0xc0 | RM_OP_ADD | (dst_reg & 7), imm_data & 0xff); /*ADD dst_reg, imm_data*/
} else
fatal("ADD64_REG_IMM !is_imm8 %016llx\n", imm_data);
fatal("ADD64_REG_IMM !is_imm8 %016" PRIu64 "\n", imm_data);
}
void
host_x86_ADD8_REG_REG(codeblock_t *block, int dst_reg, int src_reg)
@@ -1614,7 +1615,7 @@ host_x86_SUB64_REG_IMM(codeblock_t *block, int dst_reg, uint64_t imm_data)
codegen_alloc_bytes(block, 4);
codegen_addbyte4(block, 0x48, 0x83, 0xc0 | RM_OP_SUB | (dst_reg & 7), imm_data & 0xff); /*SUB dst_reg, imm_data*/
} else
fatal("SUB64_REG_IMM !is_imm8 %016llx\n", imm_data);
fatal("SUB64_REG_IMM !is_imm8 %016" PRIu64 "\n", imm_data);
}
void
host_x86_SUB8_REG_REG(codeblock_t *block, int dst_reg, int src_reg)

View File

@@ -64,8 +64,10 @@ static void
postcard_setui(void)
{
if (postcard_ports_num > 1) {
char ps[2][POSTCARDS_NUM][3] = { { 0 },
{ 0 } };
char ps[2][POSTCARDS_NUM][3] = { { { 0 },
{ 0 },
} };
for (uint8_t i = 0; i < POSTCARDS_NUM; i++) {
if (!postcard_written[i]) {
snprintf(ps[0][i], sizeof(ps[0][i]), "--");

View File

@@ -439,14 +439,12 @@ MVHDAPI int
mvhd_file_is_vhd(FILE* f)
{
uint8_t con_str[8];
size_t res;
if (f == NULL) {
return 0;
}
mvhd_fseeko64(f, -MVHD_FOOTER_SIZE, SEEK_END);
res = fread(con_str, sizeof con_str, 1, f);
if (mvhd_is_conectix_str(con_str)) {
return 1;
}

View File

@@ -1299,7 +1299,7 @@ lcdm_poll(amsvid_t *vid)
drawcursor = ((mda->ma == ca) && mda->con && mda->cursoron);
blink = ((mda->blink & 16) && (mda->ctrl & 0x20) && (attr & 0x80) && !drawcursor);
lcd_draw_char_80(vid, &((buffer32->line[mda->displine]))[x * 8], chr, attr, drawcursor, blink, mda->sc, 0, mda->ctrl);
lcd_draw_char_80(vid, &(buffer32->line[mda->displine])[x * 8], chr, attr, drawcursor, blink, mda->sc, 0, mda->ctrl);
mda->ma++;
}
}
@@ -2005,10 +2005,8 @@ const device_t vid_pc3086_device = {
};
static void
ms_write(uint16_t addr, UNUSED(uint8_t val), void *priv)
ms_write(uint16_t addr, UNUSED(uint8_t val), UNUSED(void *priv))
{
amstrad_t *ams = (amstrad_t *) priv;
if ((addr == 0x78) || (addr == 0x79))
mouse_clear_x();
else
@@ -2016,9 +2014,8 @@ ms_write(uint16_t addr, UNUSED(uint8_t val), void *priv)
}
static uint8_t
ms_read(uint16_t addr, void *priv)
ms_read(uint16_t addr, UNUSED(void *priv))
{
amstrad_t *ams = (amstrad_t *) priv;
uint8_t ret;
int delta = 0;

View File

@@ -68,7 +68,7 @@ void
ati68860_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga)
{
ati68860_ramdac_t *ramdac = (ati68860_ramdac_t *) priv;
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
switch (addr) {
case 0:
@@ -172,7 +172,7 @@ uint8_t
ati68860_ramdac_in(uint16_t addr, void *priv, svga_t *svga)
{
const ati68860_ramdac_t *ramdac = (ati68860_ramdac_t *) priv;
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
uint8_t temp = 0;
switch (addr) {

View File

@@ -26,6 +26,7 @@
#include <86box/video.h>
#include <86box/vid_svga.h>
#include <86box/vid_svga_render.h>
#include <86box/plat_unused.h>
typedef struct ati68875_ramdac_t {
uint8_t gen_cntl;
@@ -37,9 +38,9 @@ typedef struct ati68875_ramdac_t {
} ati68875_ramdac_t;
void
ati68875_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *p, svga_t *svga)
ati68875_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *priv, svga_t *svga)
{
ati68875_ramdac_t *ramdac = (ati68875_ramdac_t *) p;
ati68875_ramdac_t *ramdac = (ati68875_ramdac_t *) priv;
uint8_t rs = (addr & 0x03);
rs |= (!!rs2 << 2);
@@ -73,16 +74,18 @@ ati68875_ramdac_out(uint16_t addr, int rs2, int rs3, uint8_t val, void *p, svga_
case 0x0f: /* Reset State (RS value = 1111) */
ramdac->mux_cntl = 0x2d;
break;
default:
break;
}
return;
}
uint8_t
ati68875_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t *svga)
ati68875_ramdac_in(uint16_t addr, int rs2, int rs3, void *priv, svga_t *svga)
{
ati68875_ramdac_t *ramdac = (ati68875_ramdac_t *) p;
ibm8514_t *dev = &svga->dev8514;
const ati68875_ramdac_t *ramdac = (ati68875_ramdac_t *) priv;
uint8_t rs = (addr & 0x03);
uint8_t temp = 0;
@@ -116,15 +119,21 @@ ati68875_ramdac_in(uint16_t addr, int rs2, int rs3, void *p, svga_t *svga)
case 0x03:
temp = 0x75;
break;
default:
break;
}
break;
default:
break;
}
return temp;
}
static void *
ati68875_ramdac_init(const device_t *info)
ati68875_ramdac_init(UNUSED(const device_t *info))
{
ati68875_ramdac_t *ramdac = (ati68875_ramdac_t *) malloc(sizeof(ati68875_ramdac_t));
memset(ramdac, 0, sizeof(ati68875_ramdac_t));

View File

@@ -2639,7 +2639,7 @@ mach_recalctimings(svga_t *svga)
dev->pitch = dev->ext_pitch;
dev->rowoffset = dev->ext_crt_pitch;
if ((mach->accel.ext_ge_config & 0x800) || ((!(mach->accel.ext_ge_config & 0x8000) && !(mach->accel.ext_ge_config & 0x800)))) {
if ((mach->accel.ext_ge_config & 0x800) || (!(mach->accel.ext_ge_config & 0x8000) && !(mach->accel.ext_ge_config & 0x800))) {
if ((mach->accel.ext_ge_config & 0x30) == 0x20) {
if ((mach->accel.ext_ge_config & 0xc0) == 0x40)
dev->accel_bpp = 16;
@@ -2676,6 +2676,9 @@ mach_recalctimings(svga_t *svga)
else
svga->render8514 = ibm8514_render_RGBA8888;
break;
default:
break;
}
}
switch (mach->regs[0xb8] & 0xc0) {
@@ -2688,6 +2691,9 @@ mach_recalctimings(svga_t *svga)
case 0xc0:
svga->clock *= 4;
break;
default:
break;
}
} else {
dev->h_disp = (dev->hdisp + 1) << 3;
@@ -2773,6 +2779,9 @@ mach_recalctimings(svga_t *svga)
}
break;
default:
break;
}
}
}
@@ -4734,8 +4743,7 @@ static void
mach32_write(uint32_t addr, uint8_t val, void *priv)
{
svga_t *svga = (svga_t *) priv;
mach_t *mach = (mach_t *) svga->priv;
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
if (!dev->on) {
svga_write(addr, val, svga);
@@ -4750,8 +4758,7 @@ static void
mach32_writew(uint32_t addr, uint16_t val, void *priv)
{
svga_t *svga = (svga_t *) priv;
mach_t *mach = (mach_t *) svga->priv;
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
if (!dev->on) {
svga_writew(addr, val, svga);
@@ -4766,8 +4773,7 @@ static void
mach32_writel(uint32_t addr, uint32_t val, void *priv)
{
svga_t *svga = (svga_t *) priv;
mach_t *mach = (mach_t *) svga->priv;
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
if (!dev->on) {
svga_writel(addr, val, svga);
@@ -4784,7 +4790,7 @@ static uint8_t
mach32_read_linear(uint32_t addr, void *priv)
{
svga_t *svga = (svga_t *) priv;
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
uint32_t latch_addr = 0;
int readplane = svga->readplane;
uint8_t count;
@@ -4865,8 +4871,7 @@ static uint8_t
mach32_read(uint32_t addr, void *priv)
{
svga_t *svga = (svga_t *) priv;
mach_t *mach = (mach_t *) svga->priv;
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
uint8_t ret;
if (!dev->on) {
@@ -4883,8 +4888,7 @@ static uint16_t
mach32_readw(uint32_t addr, void *priv)
{
svga_t *svga = (svga_t *) priv;
mach_t *mach = (mach_t *) svga->priv;
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
uint16_t ret;
if (!dev->on) {
@@ -4901,8 +4905,7 @@ static uint32_t
mach32_readl(uint32_t addr, void *priv)
{
svga_t *svga = (svga_t *) priv;
mach_t *mach = (mach_t *) svga->priv;
ibm8514_t *dev = &svga->dev8514;
const ibm8514_t *dev = &svga->dev8514;
uint32_t ret;
if (!dev->on) {
@@ -5171,6 +5174,7 @@ mach32_hwcursor_draw(svga_t *svga, int displine)
dev->hwcursor_latch.addr += 16;
}
#if 0
static void
mach_io_remove(mach_t *mach)
{
@@ -5284,6 +5288,7 @@ mach_io_remove(mach_t *mach)
io_removehandler(0xfaee, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
io_removehandler(0xfeee, 0x0002, mach_accel_inb, mach_accel_inw, mach_accel_inl, mach_accel_outb, mach_accel_outw, mach_accel_outl, mach);
}
#endif
static void
mach_io_set(mach_t *mach)

View File

@@ -1357,8 +1357,6 @@ tgui_accel_command(int count, uint32_t cpu_dat, tgui_t *tgui)
uint32_t trans_col = (tgui->accel.flags & TGUI_TRANSREV) ? tgui->accel.fg_col : tgui->accel.bg_col;
uint16_t *vram_w = (uint16_t *) svga->vram;
uint32_t *vram_l = (uint32_t *) svga->vram;
uint8_t ger22lower = tgui->accel.ger22 & 0xff;
uint8_t ger22upper = (tgui->accel.ger22 >> 8) & 0xff;
if (tgui->accel.bpp == 0) {
trans_col &= 0xff;

View File

@@ -3079,7 +3079,6 @@ xga_init(const device_t *info)
xga_t *xga = &svga->xga;
FILE *f;
uint8_t *rom = NULL;
size_t res;
xga->ext_mem_addr = device_get_config_hex16("ext_mem_addr");
xga->instance_isa = device_get_config_int("instance");
@@ -3104,7 +3103,6 @@ xga_init(const device_t *info)
rom = malloc(xga->bios_rom.sz);
memset(rom, 0xff, xga->bios_rom.sz);
res = fread(rom, xga->bios_rom.sz, 1, f);
(void) fclose(f);
xga->bios_rom.rom = rom;