More compile warning fixes

This commit is contained in:
Jasmine Iwanek
2022-11-06 15:55:16 -05:00
parent f88fbd6fd2
commit 6ea143e107
9 changed files with 20 additions and 17 deletions

View File

@@ -892,10 +892,9 @@ pc_init_modules(void)
}
if (!video_card_available(gfxcard_2)) {
char temp[1024] = { 0 };
char tempc[1024] = { 0 };
char tempc[512] = { 0 };
device_get_name(video_card_getdevice(gfxcard_2), 0, tempc);
snprintf(temp, sizeof(temp), "Video card #2 \"%s\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card.", tempc);
swprintf(temp, sizeof(temp), (wchar_t *) "Video card #2 \"%hs\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card.", tempc);
ui_msgbox_header(MBX_INFO, (wchar_t *) IDS_2128, temp);
gfxcard_2 = 0;
}

View File

@@ -13,8 +13,12 @@
* Copyright 2022 RichardG.
*/
// clang-format off
#ifndef _LARGEFILE_SOURCE
#define _LARGEFILE_SOURCE
#endif
#ifndef _LARGEFILE64_SOURCE
#define _LARGEFILE64_SOURCE
#endif
#define __STDC_FORMAT_MACROS
#include <ctype.h>
#include <inttypes.h>

View File

@@ -713,7 +713,7 @@ load_network(void)
ini_section_t cat = ini_find_section(config, "Network");
char *p;
char temp[512];
int c = 0, min = 0;
uint16_t c = 0, min = 0;
/* Handle legacy configuration which supported only one NIC */
p = ini_section_get_string(cat, "net_card", NULL);

View File

@@ -48,7 +48,7 @@ extern void ini_section_set_double(ini_section_t section, char *name, double
extern void ini_section_set_hex16(ini_section_t section, char *name, int val);
extern void ini_section_set_hex20(ini_section_t section, char *name, int val);
extern void ini_section_set_mac(ini_section_t section, char *name, int val);
extern void ini_section_set_string(ini_section_t section, char *name, char *val);
extern void ini_section_set_string(ini_section_t section, const char *name, const char *val);
extern void ini_section_set_wstring(ini_section_t section, char *name, wchar_t *val);
#define ini_delete_var(ini, head, name) ini_section_delete_var(ini_find_section(ini, head), name)

View File

@@ -89,14 +89,14 @@ enum {
};
typedef struct {
int device_num;
uint16_t device_num;
int net_type;
char host_dev_name[128];
uint32_t link_state;
} netcard_conf_t;
extern netcard_conf_t net_cards_conf[NET_CARD_MAX];
extern int net_card_current;
extern uint16_t net_card_current;
typedef int (*NETRXCB)(void *, uint8_t *, int);
typedef int (*NETSETLINKSTATE)(void *, uint32_t link_state);
@@ -135,7 +135,7 @@ struct _netcard_t {
mutex_t *tx_mutex;
mutex_t *rx_mutex;
pc_timer_t timer;
int card_num;
uint16_t card_num;
double byte_period;
uint32_t led_timer;
uint32_t led_state;

View File

@@ -141,7 +141,7 @@ ini_rename_section(ini_section_t section, char *name)
}
static entry_t *
find_entry(section_t *section, char *name)
find_entry(section_t *section, const char *name)
{
entry_t *ent;
@@ -222,7 +222,7 @@ ini_find_or_create_section(ini_t ini, char *name)
}
static entry_t *
create_entry(section_t *section, char *name)
create_entry(section_t *section, const char *name)
{
entry_t *ne = malloc(sizeof(entry_t));
@@ -750,7 +750,7 @@ ini_section_set_mac(ini_section_t self, char *name, int val)
}
void
ini_section_set_string(ini_section_t self, char *name, char *val)
ini_section_set_string(ini_section_t self, const char *name, const char *val)
{
section_t *section = (section_t *) self;
entry_t *ent;

View File

@@ -26,7 +26,6 @@
#include <stdlib.h>
#include <inttypes.h>
#include <wchar.h>
#include <slirp/libslirp.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
#include <86box/device.h>
@@ -38,6 +37,10 @@
#include <86box/ini.h>
#include <86box/config.h>
#include <86box/video.h>
# define _SSIZE_T_DEFINED
#include <slirp/libslirp.h>
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
@@ -414,7 +417,7 @@ net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, void *priv)
/* Set up port forwarding. */
int udp, external, internal, i = 0;
char category[32];
snprintf(category, sizeof(category), "SLiRP Port Forwarding #%i", card->card_num + 1);
snprintf(category, sizeof(category), "SLiRP Port Forwarding #%d", card->card_num + 1);
char key[20];
while (1) {
sprintf(key, "%d_protocol", i);

View File

@@ -118,7 +118,7 @@ static const device_t *net_cards[] = {
};
netcard_conf_t net_cards_conf[NET_CARD_MAX];
int net_card_current = 0;
uint16_t net_card_current = 0;
/* Global variables. */
int network_ndev;

View File

@@ -2663,7 +2663,6 @@ static void
svga_t *svga = svga_get_pri();
xga_t *xga = &svga->xga;
FILE *f;
uint32_t temp;
uint32_t initial_bios_addr = device_get_config_hex20("init_bios_addr");
uint8_t *rom = NULL;
@@ -2683,13 +2682,11 @@ static void
f = rom_fopen(xga->type ? XGA2_BIOS_PATH : XGA_BIOS_PATH, "rb");
(void) fseek(f, 0L, SEEK_END);
temp = ftell(f);
(void) fseek(f, 0L, SEEK_SET);
rom = malloc(xga->bios_rom.sz);
memset(rom, 0xff, xga->bios_rom.sz);
(void) !fread(rom, xga->bios_rom.sz, 1, f);
temp -= xga->bios_rom.sz;
(void) fclose(f);
xga->bios_rom.rom = rom;