Fixed some MSVC warnings.

This commit is contained in:
Volker Ruppert 2024-08-04 14:45:52 +02:00
parent 6f42e05b6e
commit 96709fbcef
10 changed files with 28 additions and 28 deletions

View File

@ -2577,7 +2577,7 @@ void doFind()
// Try ascii for additional matches and selected lines
Select = TRUE; // this loop, only add selected lines to the display
by = strlen(tmpcb);
by = (int)strlen(tmpcb);
for(i = 0, L = 0; i < 4096; i += 16, L++)
{
if (by != 0 && FindHex((unsigned char *)DataDump + i,16,(unsigned char *)tmpcb,by))
@ -3590,7 +3590,7 @@ void ReadSettings()
DumpAlign = (1 << DumpWSIndex);
PrevDAD = 0;
} else if (!strcmp(param, "DockOrder")) {
DockOrder = strtoul(val, NULL, 16);
DockOrder = (short)strtoul(val, NULL, 16);
} else if ((len1 == 15) && !strncmp(param, "ListWidthPix[", 13) && (param[14] == ']')) {
if ((param[13] < '0') || (param[13] > '2')) {
fprintf(stderr, "bx_enh_dbg.ini: invalid index for option SeeReg[x]\n");

View File

@ -1573,7 +1573,7 @@ int bx_gui_c::bx_printf(const char *s)
}
console.cursor_addr = console.cursor_y * 160 + console.cursor_x * 2;
console_refresh(0);
return strlen(s);
return (int)strlen(s);
}
char* bx_gui_c::bx_gets(char *s, int size)

View File

@ -1226,7 +1226,7 @@ bool bx_real_sim_c::restore_logopts()
do {
ret = fgets(line, sizeof(line)-1, fp);
line[sizeof(line) - 1] = '\0';
int len = strlen(line);
int len = (int)strlen(line);
if ((len>0) && (line[len-1] < ' '))
line[len-1] = '\0';
i = 0;
@ -1277,7 +1277,7 @@ static int bx_restore_getline(FILE *fp, char *line, int maxlen)
{
char *ret = fgets(line, maxlen - 1, fp);
line[maxlen - 1] = '\0';
int len = strlen(line);
int len = (int)strlen(line);
if ((len > 0) && (line[len - 1] < ' '))
line[len - 1] = '\0';
return (ret != NULL) ? len : 0;

View File

@ -205,7 +205,7 @@ int ask_int(const char *prompt, const char *help, Bit64s min, Bit64s max, Bit64s
bx_printf("Your choice must be an integer between " FMT_LL "d and " FMT_LL "d.\n\n", min, max);
continue;
}
illegal = (1 != sscanf(buffer, "%ld", &n));
illegal = (1 != sscanf(buffer, FMT_LL "d", &n));
if (illegal || n<min || n>max) {
bx_printf("Your choice (%s) was not an integer between " FMT_LL "d and " FMT_LL "d.\n\n",
clean, min, max);
@ -623,10 +623,10 @@ void bx_log_options(int individual)
if (ask_int(log_options_prompt1, "", -1, maxid-1, -1, &id) < 0)
return;
if (id < 0) return;
bx_printf("Editing log options for the device %s\n", SIM->get_prefix(id));
bx_printf("Editing log options for the device %s\n", SIM->get_prefix((int)id));
for (level=0; level<SIM->get_max_log_level(); level++) {
char prompt[1024];
int default_action = SIM->get_log_action(id, level);
int default_action = SIM->get_log_action((int)id, level);
sprintf(prompt, "Enter action for %s event: [%s] ", SIM->get_log_level_name(level), SIM->get_action_name(default_action));
// don't show the no change choice (choices=3)
if (ask_menu(prompt, "", log_level_n_choices_normal, log_level_choices, default_action, &action)<0)
@ -634,7 +634,7 @@ void bx_log_options(int individual)
// the exclude expression allows some choices not being available if they
// don't make any sense. For example, it would be stupid to ignore a panic.
if (!BX_LOG_OPTS_EXCLUDE(level, action)) {
SIM->set_log_action(id, level, action);
SIM->set_log_action((int)id, level, action);
} else {
bx_printf("Event type '%s' does not support log action '%s'.\n",
SIM->get_log_level_name(level), log_level_choices[action]);
@ -1068,7 +1068,7 @@ int text_ask(bx_param_c *param)
bx_list_c *list = (bx_list_c*)param;
bx_param_c *child;
const char *my_title = list->get_title();
int i, imax = strlen(my_title);
int i, imax = (int)strlen(my_title);
for (i=0; i<imax; i++) bx_printf("-");
bx_printf("\n%s\n", my_title);
for (i=0; i<imax; i++) bx_printf("-");

View File

@ -794,21 +794,21 @@ void bx_cmos_c::update_clock()
time_calendar = utctime(& BX_CMOS_THIS s.timeval);
// update seconds
BX_CMOS_THIS s.reg[REG_SEC] = bin_to_bcd(time_calendar->tm_sec, BX_CMOS_THIS s.rtc_mode_binary);
BX_CMOS_THIS s.reg[REG_SEC] = bin_to_bcd((Bit8u)time_calendar->tm_sec, BX_CMOS_THIS s.rtc_mode_binary);
// update minutes
BX_CMOS_THIS s.reg[REG_MIN] = bin_to_bcd(time_calendar->tm_min, BX_CMOS_THIS s.rtc_mode_binary);
BX_CMOS_THIS s.reg[REG_MIN] = bin_to_bcd((Bit8u)time_calendar->tm_min, BX_CMOS_THIS s.rtc_mode_binary);
// update hours
if (BX_CMOS_THIS s.rtc_mode_12hour) {
hour = time_calendar->tm_hour;
hour = (Bit8u)time_calendar->tm_hour;
val_bcd = (hour > 11) ? 0x80 : 0x00;
if (hour > 11) hour -= 12;
if (hour == 0) hour = 12;
val_bcd |= bin_to_bcd(hour, BX_CMOS_THIS s.rtc_mode_binary);
BX_CMOS_THIS s.reg[REG_HOUR] = val_bcd;
} else {
BX_CMOS_THIS s.reg[REG_HOUR] = bin_to_bcd(time_calendar->tm_hour, BX_CMOS_THIS s.rtc_mode_binary);
BX_CMOS_THIS s.reg[REG_HOUR] = bin_to_bcd((Bit8u)time_calendar->tm_hour, BX_CMOS_THIS s.rtc_mode_binary);
}
// update day of the week

View File

@ -427,7 +427,7 @@ void bx_vgacore_c::calculate_retrace_timing()
}
cwidth = ((BX_VGA_THIS s.sequencer.reg1 & 0x01) == 1) ? 8 : 9;
hfreq = (float)vclock / (crtcp.htotal * cwidth);
f_htotal_usec = 1000000.0 / hfreq;
f_htotal_usec = 1000000.0f / hfreq;
BX_VGA_THIS s.htotal_usec = (Bit32u)f_htotal_usec;
hbstart = BX_VGA_THIS s.CRTC.reg[2];
BX_VGA_THIS s.hbstart_usec = (Bit32u)((1000000.0 * hbstart * cwidth) / vclock);
@ -1731,7 +1731,7 @@ Bit8u bx_vgacore_c::mem_read(bx_phy_address addr)
offset = addr & 0x1FFFF;
}
} else {
offset = addr;
offset = (Bit32u)addr;
}
if (BX_VGA_THIS s.sequencer.chain_four) {
@ -1830,7 +1830,7 @@ void bx_vgacore_c::mem_write(bx_phy_address addr, Bit8u value)
offset = addr & 0x1FFFF;
}
} else {
offset = addr;
offset = (Bit32u)addr;
}
start_addr = BX_VGA_THIS s.CRTC.start_addr;
@ -2279,8 +2279,8 @@ void bx_vgacore_c::debug_dump(int argc, char **argv)
(unsigned) BX_VGA_THIS s.misc_output.horiz_sync_pol);
dbg_printf("s.misc_output.vert_sync_pol = %u ",
(unsigned) BX_VGA_THIS s.misc_output.vert_sync_pol);
switch ((BX_VGA_THIS s.misc_output.vert_sync_pol << 1) |
BX_VGA_THIS s.misc_output.horiz_sync_pol) {
switch (((int)BX_VGA_THIS s.misc_output.vert_sync_pol << 1) |
(int)BX_VGA_THIS s.misc_output.horiz_sync_pol) {
case 1: dbg_printf("(400 lines)\n"); break;
case 2: dbg_printf("(350 lines)\n"); break;
case 3: dbg_printf("(480 lines)\n"); break;

View File

@ -1180,7 +1180,7 @@ Bit32u bx_voodoo_1_2_c::get_retrace(bool hv)
Bit32u bx_voodoo_1_2_c::get_vtotal_usec(void)
{
return s.vdraw.vtotal_usec;
return (Bit32u)s.vdraw.vtotal_usec;
}
void bx_voodoo_1_2_c::output_enable(bool enabled)

View File

@ -143,7 +143,7 @@ static slirp_ssize_t send_packet(const void *buf, size_t len, void *opaque)
{
bx_slirp_pktmover_c *class_ptr = (bx_slirp_pktmover_c *)opaque;
return class_ptr->receive((void*)buf, len);
return class_ptr->receive((void*)buf, (unsigned)len);
}
static void guest_error(const char *msg, void *opaque)
@ -798,7 +798,7 @@ static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
p1 = strchr(p, sep);
if (!p1)
return -1;
len = p1 - p;
len = (int)(p1 - p);
p1++;
if (buf_size > 0) {
if (len > buf_size - 1)

View File

@ -2,7 +2,7 @@
// $Id: utctime.h
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001-2023 The Bochs Project
// Copyright (C) 2001-2024 The Bochs Project
//
// Portable gmtime()/timegm() clones by Michele Giacomone
//
@ -123,7 +123,7 @@ struct utctm *utctime_ext(const Bit64s *a,struct utctm *trgt)
tsec/=60;
bdt.tm_min=tsec%60; //Set the minutes value
tsec/=60;
bdt.tm_hour=tsec; //Set the hour value
bdt.tm_hour = (Bit16s)tsec; //Set the hour value
bdt.tm_wday=(etmp-6)%7;
if(bdt.tm_wday<0) bdt.tm_wday+=7; //Set the day of the week value
@ -144,13 +144,13 @@ struct utctm *utctime_ext(const Bit64s *a,struct utctm *trgt)
isleap=(isleap?1:0); //Find out if the year is leap
eyear-=1900;
bdt.tm_year=eyear; //Set the year value
bdt.tm_year = (Bit16s)eyear; //Set the year value
bdt.tm_yday=etmp; //Set the day of the year value
bdt.tm_yday = (Bit16s)etmp; //Set the day of the year value
bdt.tm_mon=0;
while(etmp>=monthlydays[isleap][bdt.tm_mon+1]) bdt.tm_mon++; //Set the month value
etmp-=monthlydays[isleap][bdt.tm_mon];
bdt.tm_mday=etmp+1; //Set the day of the month value
bdt.tm_mday = (Bit16s)(etmp + 1); //Set the day of the month value
if(eyear != bdt.tm_year) return NULL; //If the calculated year is too high fail

View File

@ -1331,7 +1331,7 @@ void bx_init_hardware()
if (memSize < hostMemSize) hostMemSize = memSize;
bx_param_num_c *bxp_memblock_size = SIM->get_param_num(BXPN_MEM_BLOCK_SIZE);
Bit32u memBlockSize = bxp_memblock_size->get64() * 1024;
Bit32u memBlockSize = (Bit32u)(bxp_memblock_size->get64() * 1024);
BX_MEM(0)->init_memory(memSize, hostMemSize, memBlockSize);