diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 937e6196..78ea5b8c 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c @@ -675,7 +675,7 @@ IP_Port DHT_getfriendip(DHT *dht, uint8_t *client_id) { uint32_t i, j; uint64_t temp_time = unix_time(); - IP_Port empty = {{{0}}, 0}; + IP_Port empty = { .ip = {0}, .port = 0, .padding = 0 }; for (i = 0; i < dht->num_friends; ++i) { /* Equal */ diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c index 6046c09b..b8279604 100644 --- a/toxcore/Lossless_UDP.c +++ b/toxcore/Lossless_UDP.c @@ -302,7 +302,7 @@ IP_Port connection_ip(Lossless_UDP *ludp, int connection_id) if (connection_id >= 0 && connection_id < ludp->connections_length) return ludp->connections[connection_id].ip_port; - IP_Port zero = {{{0}}, 0}; + IP_Port zero = { .ip = {0}, .port = 0, .padding = 0 }; return zero; } diff --git a/toxcore/network.h b/toxcore/network.h index 0a0122be..685341ad 100644 --- a/toxcore/network.h +++ b/toxcore/network.h @@ -86,11 +86,14 @@ typedef union { uint32_t i; } IP; -typedef struct { - IP ip; - uint16_t port; - /* Not used for anything right now. */ - uint16_t padding; +typedef union { + struct { + IP ip; + uint16_t port; + /* Not used for anything right now. */ + uint16_t padding; + }; + uint8_t uint8[8]; } IP_Port; typedef struct {