mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 09:35:32 -07:00
Use inet_pton instead of inet_aton
This exists on all platforms, no messy #ifdef needed.
This commit is contained in:
@@ -896,11 +896,7 @@ load_network(void)
|
||||
p = ini_section_get_string(cat, temp, "");
|
||||
if (p && *p) {
|
||||
struct in_addr addr;
|
||||
#ifdef _WIN32
|
||||
if (inet_aton(p, &addr)) {
|
||||
#else
|
||||
if (inet_pton(AF_INET, p, &addr)) {
|
||||
#endif
|
||||
uint8_t *bytes = (uint8_t *)&addr.s_addr;
|
||||
bytes[3] = 0;
|
||||
sprintf(nc->slirp_net, "%d.%d.%d.0", bytes[0], bytes[1], bytes[2]);
|
||||
|
||||
@@ -504,11 +504,7 @@ net_slirp_init(const netcard_t *card, const uint8_t *mac_addr, UNUSED(void *priv
|
||||
const char *slirp_net = net_cards_conf[card->card_num].slirp_net;
|
||||
if (slirp_net[0] != '\0') {
|
||||
struct in_addr addr;
|
||||
#ifdef _WIN32
|
||||
inet_pton(AF_INET, slirp_net, &addr);
|
||||
#else
|
||||
inet_aton(slirp_net, &addr);
|
||||
#endif
|
||||
net.s_addr = htonl(ntohl(addr.s_addr) & 0xffffff00);
|
||||
host.s_addr = htonl(ntohl(addr.s_addr) + 2);
|
||||
dhcp.s_addr = htonl(ntohl(addr.s_addr) + 15);
|
||||
|
||||
Reference in New Issue
Block a user