diff --git a/src/network/net_3c501.c b/src/network/net_3c501.c index b3a903c7b..5b9fc0cac 100644 --- a/src/network/net_3c501.c +++ b/src/network/net_3c501.c @@ -373,7 +373,7 @@ elnkR3HardReset(threec501_t *dev) static __inline int padr_match(threec501_t *dev, const uint8_t *buf) { - const struct ether_header *hdr = (struct ether_header *) buf; + const struct ether_header *hdr = (const struct ether_header *) buf; int result; /* Checks own + broadcast as well as own + multicast. */ @@ -389,7 +389,7 @@ static __inline int padr_bcast(threec501_t *dev, const uint8_t *buf) { static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - const struct ether_header *hdr = (struct ether_header *) buf; + const struct ether_header *hdr = (const struct ether_header *) buf; int result = (dev->RcvCmd.adr_match == EL_ADRM_BCAST) && !memcmp(hdr->ether_dhost, aBCAST, 6); return result; @@ -401,8 +401,8 @@ padr_bcast(threec501_t *dev, const uint8_t *buf) static __inline int padr_mcast(threec501_t *dev, const uint8_t *buf) { - struct ether_header *hdr = (struct ether_header *) buf; - int result = (dev->RcvCmd.adr_match == EL_ADRM_MCAST) && ETHER_IS_MULTICAST(hdr->ether_dhost); + const struct ether_header *hdr = (const struct ether_header *) buf; + int result = (dev->RcvCmd.adr_match == EL_ADRM_MCAST) && ETHER_IS_MULTICAST(hdr->ether_dhost); return result; } diff --git a/src/network/net_dp8390.c b/src/network/net_dp8390.c index 1e50ddd45..1c308e913 100644 --- a/src/network/net_dp8390.c +++ b/src/network/net_dp8390.c @@ -66,7 +66,7 @@ mcast_index(const void *dst) uint32_t crc = 0xffffffffL; int carry; uint8_t b; - const uint8_t *ep = (uint8_t *) dst; + const uint8_t *ep = (const uint8_t *) dst; for (int8_t i = 6; --i >= 0;) { b = *ep++; diff --git a/src/network/net_ne2000.c b/src/network/net_ne2000.c index 56f7facff..c7fba404f 100644 --- a/src/network/net_ne2000.c +++ b/src/network/net_ne2000.c @@ -812,7 +812,7 @@ static void nic_rom_init(nic_t *dev, char *s) { uint32_t temp; - FILE *f; + FILE *fp; if (s == NULL) return; @@ -820,10 +820,10 @@ nic_rom_init(nic_t *dev, char *s) if (dev->bios_addr == 0) return; - if ((f = rom_fopen(s, "rb")) != NULL) { - fseek(f, 0L, SEEK_END); - temp = ftell(f); - fclose(f); + if ((fp = rom_fopen(s, "rb")) != NULL) { + fseek(fp, 0L, SEEK_END); + temp = ftell(fp); + fclose(fp); dev->bios_size = 0x10000; if (temp <= 0x8000) dev->bios_size = 0x8000; diff --git a/src/network/net_pcnet.c b/src/network/net_pcnet.c index 7cbe10e31..ab761acf3 100644 --- a/src/network/net_pcnet.c +++ b/src/network/net_pcnet.c @@ -47,6 +47,7 @@ #include <86box/network.h> #include <86box/net_pcnet.h> #include <86box/bswap.h> +#include <86box/plat_fallthrough.h> #include <86box/plat_unused.h> /* PCI info. */ @@ -748,7 +749,7 @@ static const uint32_t crctab[256] = static __inline int padr_match(nic_t *dev, const uint8_t *buf, UNUSED(int size)) { - const struct ether_header *hdr = (struct ether_header *) buf; + const struct ether_header *hdr = (const struct ether_header *) buf; int result; uint8_t padr[6]; @@ -774,7 +775,7 @@ static __inline int padr_bcast(nic_t *dev, const uint8_t *buf, UNUSED(size_t size)) { static uint8_t aBCAST[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - const struct ether_header *hdr = (struct ether_header *) buf; + const struct ether_header *hdr = (const struct ether_header *) buf; int result = !CSR_DRCVBC(dev) && !memcmp(hdr->ether_dhost, aBCAST, 6); pcnet_log(3, "%s: padr_bcast result=%d\n", dev->name, result); @@ -785,7 +786,7 @@ padr_bcast(nic_t *dev, const uint8_t *buf, UNUSED(size_t size)) static int ladr_match(nic_t *dev, const uint8_t *buf, UNUSED(size_t size)) { - const struct ether_header *hdr = (struct ether_header *) buf; + const struct ether_header *hdr = (const struct ether_header *) buf; if ((hdr->ether_dhost[0] & 0x01) && ((uint64_t *) &dev->aCSR[8])[0] != 0LL) { int index; @@ -1998,7 +1999,7 @@ pcnet_bcr_writew(nic_t *dev, uint16_t rap, uint16_t val) break; } dev->aCSR[58] = val; - /* fall through */ + fallthrough; case BCR_LNKST: case BCR_LED1: case BCR_LED2: diff --git a/src/network/network.c b/src/network/network.c index eec85fcb0..4335c75f3 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -717,7 +717,7 @@ network_card_has_config(int card) } /* UI */ -char * +const char * network_card_get_internal_name(int card) { return device_get_internal_name(net_cards[card]); @@ -730,7 +730,7 @@ network_card_get_from_internal_name(char *s) int c = 0; while (net_cards[c] != NULL) { - if (!strcmp((char *) net_cards[c]->internal_name, s)) + if (!strcmp(net_cards[c]->internal_name, s)) return c; c++; }