Merge pull request #3896 from jriwanek-forks/warnfix

Warning fixes
This commit is contained in:
Miran Grča
2023-12-18 03:00:01 +01:00
committed by GitHub
6 changed files with 21 additions and 23 deletions

View File

@@ -489,12 +489,10 @@ static void
ali5229_ide_irq_handler(ali1543_t *dev) ali5229_ide_irq_handler(ali1543_t *dev)
{ {
int ctl = 0; int ctl = 0;
int ch = 0;
int bit = 0; int bit = 0;
if (dev->ide_conf[0x52] & 0x10) { if (dev->ide_conf[0x52] & 0x10) {
ctl ^= 1; ctl ^= 1;
ch ^= 1;
bit ^= 5; bit ^= 5;
} }

View File

@@ -1104,13 +1104,13 @@ load_floppy_and_cdrom_drives(void)
p = ini_section_get_string(cat, temp, NULL); p = ini_section_get_string(cat, temp, NULL);
if (p) { if (p) {
if (path_abs(p)) { if (path_abs(p)) {
if (strlen(p) > 255) if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 255 " fatal("load_floppy_and_cdrom_drives(): strlen(p) > 2047 "
"(fdd_image_history[%i][%i])\n", c, i); "(fdd_image_history[%i][%i])\n", c, i);
else else
snprintf(fdd_image_history[c][i], 255, "%s", p); snprintf(fdd_image_history[c][i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
} else } else
snprintf(fdd_image_history[c][i], 255, "%s%s%s", usr_path, snprintf(fdd_image_history[c][i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), p); path_get_slash(usr_path), p);
path_normalize(fdd_image_history[c][i]); path_normalize(fdd_image_history[c][i]);
} }
@@ -1220,13 +1220,13 @@ load_floppy_and_cdrom_drives(void)
p = ini_section_get_string(cat, temp, NULL); p = ini_section_get_string(cat, temp, NULL);
if (p) { if (p) {
if (path_abs(p)) { if (path_abs(p)) {
if (strlen(p) > 511) if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("load_floppy_and_cdrom_drives(): strlen(p) > 511 " fatal("load_floppy_and_cdrom_drives(): strlen(p) > 2047 "
"(cdrom[%i].image_history[%i])\n", c, i); "(cdrom[%i].image_history[%i])\n", c, i);
else else
snprintf(cdrom[c].image_history[i], 511, "%s", p); snprintf(cdrom[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
} else } else
snprintf(cdrom[c].image_history[i], 511, "%s%s%s", usr_path, snprintf(cdrom[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), p); path_get_slash(usr_path), p);
path_normalize(cdrom[c].image_history[i]); path_normalize(cdrom[c].image_history[i]);
} }
@@ -1353,13 +1353,13 @@ load_other_removable_devices(void)
p = ini_section_get_string(cat, temp, NULL); p = ini_section_get_string(cat, temp, NULL);
if (p) { if (p) {
if (path_abs(p)) { if (path_abs(p)) {
if (strlen(p) > 511) if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("load_other_removable_devices(): strlen(p) > 511 " fatal("load_other_removable_devices(): strlen(p) > 2047 "
"(zip_drives[%i].image_history[%i])\n", c, i); "(zip_drives[%i].image_history[%i])\n", c, i);
else else
snprintf(zip_drives[c].image_history[i], 511, "%s", p); snprintf(zip_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
} else } else
snprintf(zip_drives[c].image_history[i], 511, "%s%s%s", usr_path, snprintf(zip_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), p); path_get_slash(usr_path), p);
path_normalize(zip_drives[c].image_history[i]); path_normalize(zip_drives[c].image_history[i]);
} }
@@ -1469,13 +1469,13 @@ load_other_removable_devices(void)
p = ini_section_get_string(cat, temp, NULL); p = ini_section_get_string(cat, temp, NULL);
if (p) { if (p) {
if (path_abs(p)) { if (path_abs(p)) {
if (strlen(p) > 511) if (strlen(p) > (MAX_IMAGE_PATH_LEN - 1))
fatal("load_other_removable_devices(): strlen(p) > 511 " fatal("load_other_removable_devices(): strlen(p) > 2047 "
"(mo_drives[%i].image_history[%i])\n", c, i); "(mo_drives[%i].image_history[%i])\n", c, i);
else else
snprintf(mo_drives[c].image_history[i], 511, "%s", p); snprintf(mo_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s", p);
} else } else
snprintf(mo_drives[c].image_history[i], 511, "%s%s%s", usr_path, snprintf(mo_drives[c].image_history[i], (MAX_IMAGE_PATH_LEN - 1), "%s%s%s", usr_path,
path_get_slash(usr_path), p); path_get_slash(usr_path), p);
path_normalize(mo_drives[c].image_history[i]); path_normalize(mo_drives[c].image_history[i]);
} }

View File

@@ -33,7 +33,7 @@
/* Recently used images */ /* Recently used images */
#define MAX_PREV_IMAGES 4 #define MAX_PREV_IMAGES 4
#define MAX_IMAGE_PATH_LEN 256 #define MAX_IMAGE_PATH_LEN 2048
/* Default language 0xFFFF = from system, 0x409 = en-US */ /* Default language 0xFFFF = from system, 0x409 = en-US */
#define DEFAULT_LANGUAGE 0x0409 #define DEFAULT_LANGUAGE 0x0409

View File

@@ -3312,7 +3312,7 @@ nic_init(const device_t *info)
fp = nvr_fopen(eeprom_filename, "rb"); fp = nvr_fopen(eeprom_filename, "rb");
if (fp) { if (fp) {
fread(s->eeprom.contents, 2, 64, fp); (void) !fread(s->eeprom.contents, 2, 64, fp);
fclose(fp); fclose(fp);
fp = NULL; fp = NULL;
} else { } else {

View File

@@ -88,7 +88,7 @@ RendererCommon::onResize(int width, int height)
if (video_fullscreen_scale == FULLSCR_SCALE_INT43) { if (video_fullscreen_scale == FULLSCR_SCALE_INT43) {
gh = gw / r43; gh = gw / r43;
gw = gw; // gw = gw;
gsr = r43; gsr = r43;
} }

View File

@@ -830,7 +830,7 @@ plat_init_rom_paths(void)
rom_add_path("/usr/share/86Box/roms/"); rom_add_path("/usr/share/86Box/roms/");
} }
#else #else
char default_rom_path[1024] = { '\0 ' }; char default_rom_path[1024] = { '\0' };
getDefaultROMPath(default_rom_path); getDefaultROMPath(default_rom_path);
rom_add_path(default_rom_path); rom_add_path(default_rom_path);
#endif #endif
@@ -918,7 +918,7 @@ monitor_thread(void *param)
line = f_readline("(86Box) "); line = f_readline("(86Box) ");
else { else {
printf("(86Box) "); printf("(86Box) ");
!getline(&line, &n, stdin); (void) !getline(&line, &n, stdin);
} }
if (line) { if (line) {
int cmdargc = 0; int cmdargc = 0;