Constification

This commit is contained in:
Jasmine Iwanek
2023-07-20 18:58:26 -04:00
parent db66543959
commit 998cfe5cc8
163 changed files with 1086 additions and 1071 deletions

View File

@@ -173,13 +173,13 @@ esdi_get_xfer_time(UNUSED(esdi_t *esdi), int size)
static int
get_sector(esdi_t *esdi, off64_t *addr)
{
drive_t *drive = &esdi->drives[esdi->drive_sel];
int heads = drive->cfg_hpc;
int sectors = drive->cfg_spt;
int c;
int h;
int s;
int sector;
const drive_t *drive = &esdi->drives[esdi->drive_sel];
int heads = drive->cfg_hpc;
int sectors = drive->cfg_spt;
int c;
int h;
int s;
int sector;
if (esdi->head > heads) {
esdi_at_log("esdi_get_sector: past end of configured heads\n");
@@ -882,8 +882,8 @@ wd1007vse1_init(UNUSED(const device_t *info))
static void
wd1007vse1_close(void *priv)
{
esdi_t *esdi = (esdi_t *) priv;
drive_t *drive;
esdi_t *esdi = (esdi_t *) priv;
const drive_t *drive;
for (uint8_t d = 0; d < 2; d++) {
drive = &esdi->drives[d];

View File

@@ -352,10 +352,10 @@ complete_command_status(esdi_t *dev)
static void
esdi_callback(void *priv)
{
esdi_t *dev = (esdi_t *) priv;
drive_t *drive;
int val;
double cmd_time = 0.0;
esdi_t *dev = (esdi_t *) priv;
const drive_t *drive;
int val;
double cmd_time = 0.0;
esdi_mca_set_callback(dev, 0);
@@ -1059,7 +1059,7 @@ esdi_writew(uint16_t port, uint16_t val, void *priv)
static uint8_t
esdi_mca_read(int port, void *priv)
{
esdi_t *dev = (esdi_t *) priv;
const esdi_t *dev = (esdi_t *) priv;
esdi_mca_log("ESDI: mcard(%04x)\n", port);
@@ -1132,7 +1132,7 @@ esdi_mca_write(int port, uint8_t val, void *priv)
static uint8_t
esdi_mca_feedb(void *priv)
{
esdi_t *dev = (esdi_t *) priv;
const esdi_t *dev = (esdi_t *) priv;
return (dev->pos_regs[2] & 1);
}
@@ -1210,8 +1210,8 @@ esdi_init(UNUSED(const device_t *info))
static void
esdi_close(void *priv)
{
esdi_t *dev = (esdi_t *) priv;
drive_t *drive;
esdi_t *dev = (esdi_t *) priv;
const drive_t *drive;
dev->drives[0].present = dev->drives[1].present = 0;

View File

@@ -597,13 +597,13 @@ ide_hd_identify(ide_t *ide)
static void
ide_identify(ide_t *ide)
{
int d;
int i;
int max_pio;
int max_sdma;
int max_mdma;
int max_udma;
ide_t *ide_other = ide_drives[ide->channel ^ 1];
int d;
int i;
int max_pio;
int max_sdma;
int max_mdma;
int max_udma;
const ide_t *ide_other = ide_drives[ide->channel ^ 1];
ide_log("IDE IDENTIFY or IDENTIFY PACKET DEVICE on board %i (channel %i)\n", ide->board, ide->channel);
@@ -1114,8 +1114,8 @@ ide_atapi_packet_read(ide_t *ide, int length)
{
scsi_common_t *dev = ide->sc;
uint16_t *bufferw;
uint32_t *bufferl;
const uint16_t *bufferw;
const uint32_t *bufferl;
uint32_t temp = 0;
@@ -1311,7 +1311,7 @@ ide_writew(uint16_t addr, uint16_t val, void *priv)
static void
ide_writel(uint16_t addr, uint32_t val, void *priv)
{
ide_board_t *dev = (ide_board_t *) priv;
const ide_board_t *dev = (ide_board_t *) priv;
ide_t *ide;
int ch;
@@ -1871,9 +1871,9 @@ ide_read_data(ide_t *ide, int length)
}
}
uint8_t *idebufferb = (uint8_t *) ide->buffer;
uint16_t *idebufferw = ide->buffer;
uint32_t *idebufferl = (uint32_t *) ide->buffer;
const uint8_t *idebufferb = (uint8_t *) ide->buffer;
const uint16_t *idebufferw = ide->buffer;
const uint32_t *idebufferl = (uint32_t *) ide->buffer;
if (ide->command == WIN_PACKETCMD) {
ide->pos = 0;
@@ -1953,7 +1953,7 @@ ide_status(ide_t *ide, ide_t *ide_other, int ch)
uint8_t
ide_readb(uint16_t addr, void *priv)
{
ide_board_t *dev = (ide_board_t *) priv;
const ide_board_t *dev = (ide_board_t *) priv;
int ch;
int absent = 0;
@@ -2083,7 +2083,7 @@ ide_read_alt_status(UNUSED(uint16_t addr), void *priv)
{
uint8_t temp = 0xff;
ide_board_t *dev = (ide_board_t *) priv;
const ide_board_t *dev = (ide_board_t *) priv;
ide_t *ide;
int ch;
@@ -2104,7 +2104,7 @@ ide_readw(uint16_t addr, void *priv)
{
uint16_t temp = 0xffff;
ide_board_t *dev = (ide_board_t *) priv;
const ide_board_t *dev = (ide_board_t *) priv;
ide_t *ide;
int ch;
@@ -2134,7 +2134,7 @@ ide_readl(uint16_t addr, void *priv)
uint16_t temp2;
uint32_t temp = 0xffffffff;
ide_board_t *dev = (ide_board_t *) priv;
const ide_board_t *dev = (ide_board_t *) priv;
ide_t *ide;
int ch;
@@ -2630,11 +2630,11 @@ id_not_found:
uint8_t
ide_read_ali_75(void)
{
ide_t *ide0;
ide_t *ide1;
int ch0;
int ch1;
uint8_t ret = 0x00;
const ide_t *ide0;
const ide_t *ide1;
int ch0;
int ch1;
uint8_t ret = 0x00;
ch0 = ide_boards[0]->cur_dev;
ch1 = ide_boards[1]->cur_dev;
@@ -2656,11 +2656,11 @@ ide_read_ali_75(void)
uint8_t
ide_read_ali_76(void)
{
ide_t *ide0;
ide_t *ide1;
int ch0;
int ch1;
uint8_t ret = 0x00;
const ide_t *ide0;
const ide_t *ide1;
int ch0;
int ch1;
uint8_t ret = 0x00;
ch0 = ide_boards[0]->cur_dev;
ch1 = ide_boards[1]->cur_dev;

View File

@@ -90,7 +90,7 @@ cmd646_set_irq(int channel, void *priv)
static int
cmd646_bus_master_dma(int channel, uint8_t *data, int transfer_length, int out, void *priv)
{
cmd646_t *dev = (cmd646_t *) priv;
const cmd646_t *dev = (cmd646_t *) priv;
return sff_bus_master_dma(channel, data, transfer_length, out, dev->bm[channel & 0x01]);
}

View File

@@ -93,8 +93,8 @@ opti611_cfg_writel(uint16_t addr, uint32_t val, void *priv)
static uint8_t
opti611_cfg_read(uint16_t addr, void *priv)
{
uint8_t ret = 0xff;
opti611_t *dev = (opti611_t *) priv;
uint8_t ret = 0xff;
const opti611_t *dev = (opti611_t *) priv;
addr &= 0x0007;

View File

@@ -222,7 +222,7 @@ sff_bus_master_writel(uint16_t port, uint32_t val, void *priv)
uint8_t
sff_bus_master_read(uint16_t port, void *priv)
{
sff8038i_t *dev = (sff8038i_t *) priv;
const sff8038i_t *dev = (sff8038i_t *) priv;
uint8_t ret = 0xff;
@@ -261,7 +261,7 @@ sff_bus_master_read(uint16_t port, void *priv)
static uint16_t
sff_bus_master_readw(uint16_t port, void *priv)
{
sff8038i_t *dev = (sff8038i_t *) priv;
const sff8038i_t *dev = (sff8038i_t *) priv;
uint16_t ret = 0xffff;
@@ -290,7 +290,7 @@ sff_bus_master_readw(uint16_t port, void *priv)
static uint32_t
sff_bus_master_readl(uint16_t port, void *priv)
{
sff8038i_t *dev = (sff8038i_t *) priv;
const sff8038i_t *dev = (sff8038i_t *) priv;
uint32_t ret = 0xffffffff;

View File

@@ -171,7 +171,7 @@ irq_update(mfm_t *mfm)
static int
get_sector(mfm_t *mfm, off64_t *addr)
{
drive_t *drive = &mfm->drives[mfm->drvsel];
const drive_t *drive = &mfm->drives[mfm->drvsel];
/* FIXME: See if this is even needed - if the code is present, IBM AT
diagnostics v2.07 will error with: ERROR 152 - SYSTEM BOARD. */
@@ -734,7 +734,7 @@ mfm_close(void *priv)
mfm_t *mfm = (mfm_t *) priv;
for (uint8_t d = 0; d < 2; d++) {
drive_t *drive = &mfm->drives[d];
const drive_t *drive = &mfm->drives[d];
hdd_image_close(drive->hdd_num);
}

View File

@@ -1381,10 +1381,10 @@ mem_write(uint32_t addr, uint8_t val, void *priv)
static uint8_t
mem_read(uint32_t addr, void *priv)
{
hdc_t *dev = (hdc_t *) priv;
uint32_t ptr;
uint32_t mask = 0;
uint8_t ret = 0xff;
const hdc_t *dev = (hdc_t *) priv;
uint32_t ptr;
uint32_t mask = 0;
uint8_t ret = 0xff;
/* Ignore accesses to anything below the configured address,
needed because of the emulator's 4k mapping granularity. */
@@ -1533,8 +1533,8 @@ loadhd(hdc_t *dev, int c, int d, UNUSED(const char *fn))
static void
set_switches(hdc_t *dev, hd_type_t *hdt, int num)
{
drive_t *drive;
int e;
const drive_t *drive;
int e;
dev->switches = 0x00;
@@ -1784,8 +1784,8 @@ st506_init(const device_t *info)
static void
st506_close(void *priv)
{
hdc_t *dev = (hdc_t *) priv;
drive_t *drive;
hdc_t *dev = (hdc_t *) priv;
const drive_t *drive;
for (uint8_t d = 0; d < MFM_NUM; d++) {
drive = &dev->drives[d];

View File

@@ -1104,8 +1104,8 @@ xta_init(const device_t *info)
static void
xta_close(void *priv)
{
hdc_t *dev = (hdc_t *) priv;
drive_t *drive;
hdc_t *dev = (hdc_t *) priv;
const drive_t *drive;
/* Remove the I/O handler. */
io_removehandler(dev->base, 4,

View File

@@ -160,7 +160,7 @@ hdd_seek_get_time(hard_disk_t *hdd, uint32_t dst_addr, uint8_t operation, uint8_
if (!hdd->speed_preset)
return HDD_OVERHEAD_TIME;
hdd_zone_t *zone = NULL;
const hdd_zone_t *zone = NULL;
if (hdd->num_zones <= 0) {
fatal("hdd_seek_get_time(): hdd->num_zones < 0)\n");
return 0.0;
@@ -486,7 +486,7 @@ hdd_preset_apply(int hdd_id)
if (hd->speed_preset >= hdd_preset_get_num())
hd->speed_preset = 0;
hdd_preset_t *preset = &hdd_speed_presets[hd->speed_preset];
const hdd_preset_t *preset = &hdd_speed_presets[hd->speed_preset];
hd->cache.num_segments = preset->rcache_num_seg;
hd->cache.segment_size = preset->rcache_seg_size;

View File

@@ -2055,7 +2055,7 @@ mo_do_identify(ide_t *ide, int ide_has_dma)
{
char model[40];
mo_t *mo = (mo_t *) ide->sc;
const mo_t *mo = (mo_t *) ide->sc;
memset(model, 0, 40);

View File

@@ -2288,7 +2288,7 @@ zip_250_identify(ide_t *ide, int ide_has_dma)
static void
zip_identify(ide_t *ide, int ide_has_dma)
{
zip_t *zip;
const zip_t *zip;
zip = (zip_t *) ide->sc;