diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-02-14 20:51:55 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-02-14 20:51:55 +0000 |
commit | 35f13ef51dbf99c3d45d04f572e9e88795df7ae6 (patch) | |
tree | 8213605775c5f749fdabe683fbdea9106a6c32c1 /toxcore/DHT.c | |
parent | 17a0b617f299c34563960bd4e9ed9a88e76ba92f (diff) |
Get rid of the only GNU extension we used.
Diffstat (limited to 'toxcore/DHT.c')
-rw-r--r-- | toxcore/DHT.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 28ff75c5..1b0302b3 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -406,7 +406,7 @@ int pack_ip_port(uint8_t *data, uint16_t length, const IP_Port *ip_port) | |||
406 | } | 406 | } |
407 | 407 | ||
408 | data[0] = net_family; | 408 | data[0] = net_family; |
409 | memcpy(data + 1, &ip_port->ip.ip4, SIZE_IP4); | 409 | memcpy(data + 1, &ip_port->ip.ip.v4, SIZE_IP4); |
410 | memcpy(data + 1 + SIZE_IP4, &ip_port->port, sizeof(uint16_t)); | 410 | memcpy(data + 1 + SIZE_IP4, &ip_port->port, sizeof(uint16_t)); |
411 | return size; | 411 | return size; |
412 | } else { | 412 | } else { |
@@ -417,7 +417,7 @@ int pack_ip_port(uint8_t *data, uint16_t length, const IP_Port *ip_port) | |||
417 | } | 417 | } |
418 | 418 | ||
419 | data[0] = net_family; | 419 | data[0] = net_family; |
420 | memcpy(data + 1, &ip_port->ip.ip6, SIZE_IP6); | 420 | memcpy(data + 1, &ip_port->ip.ip.v6, SIZE_IP6); |
421 | memcpy(data + 1 + SIZE_IP6, &ip_port->port, sizeof(uint16_t)); | 421 | memcpy(data + 1 + SIZE_IP6, &ip_port->port, sizeof(uint16_t)); |
422 | return size; | 422 | return size; |
423 | } | 423 | } |
@@ -491,7 +491,7 @@ int unpack_ip_port(IP_Port *ip_port, const uint8_t *data, uint16_t length, uint8 | |||
491 | } | 491 | } |
492 | 492 | ||
493 | ip_port->ip.family = host_family; | 493 | ip_port->ip.family = host_family; |
494 | memcpy(&ip_port->ip.ip4, data + 1, SIZE_IP4); | 494 | memcpy(&ip_port->ip.ip.v4, data + 1, SIZE_IP4); |
495 | memcpy(&ip_port->port, data + 1 + SIZE_IP4, sizeof(uint16_t)); | 495 | memcpy(&ip_port->port, data + 1 + SIZE_IP4, sizeof(uint16_t)); |
496 | return size; | 496 | return size; |
497 | } else { | 497 | } else { |
@@ -502,7 +502,7 @@ int unpack_ip_port(IP_Port *ip_port, const uint8_t *data, uint16_t length, uint8 | |||
502 | } | 502 | } |
503 | 503 | ||
504 | ip_port->ip.family = host_family; | 504 | ip_port->ip.family = host_family; |
505 | memcpy(&ip_port->ip.ip6, data + 1, SIZE_IP6); | 505 | memcpy(&ip_port->ip.ip.v6, data + 1, SIZE_IP6); |
506 | memcpy(&ip_port->port, data + 1 + SIZE_IP6, sizeof(uint16_t)); | 506 | memcpy(&ip_port->port, data + 1 + SIZE_IP6, sizeof(uint16_t)); |
507 | return size; | 507 | return size; |
508 | } | 508 | } |
@@ -1143,9 +1143,9 @@ uint32_t addto_lists(DHT *dht, IP_Port ip_port, const uint8_t *public_key) | |||
1143 | uint32_t used = 0; | 1143 | uint32_t used = 0; |
1144 | 1144 | ||
1145 | /* convert IPv4-in-IPv6 to IPv4 */ | 1145 | /* convert IPv4-in-IPv6 to IPv4 */ |
1146 | if ((ip_port.ip.family == TOX_AF_INET6) && IPV6_IPV4_IN_V6(ip_port.ip.ip6)) { | 1146 | if ((ip_port.ip.family == TOX_AF_INET6) && IPV6_IPV4_IN_V6(ip_port.ip.ip.v6)) { |
1147 | ip_port.ip.family = TOX_AF_INET; | 1147 | ip_port.ip.family = TOX_AF_INET; |
1148 | ip_port.ip.ip4.uint32 = ip_port.ip.ip6.uint32[3]; | 1148 | ip_port.ip.ip.v4.uint32 = ip_port.ip.ip.v6.uint32[3]; |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | /* NOTE: Current behavior if there are two clients with the same id is | 1151 | /* NOTE: Current behavior if there are two clients with the same id is |
@@ -1223,9 +1223,9 @@ static bool update_client_data(Client_data *array, size_t size, IP_Port ip_port, | |||
1223 | static void returnedip_ports(DHT *dht, IP_Port ip_port, const uint8_t *public_key, const uint8_t *nodepublic_key) | 1223 | static void returnedip_ports(DHT *dht, IP_Port ip_port, const uint8_t *public_key, const uint8_t *nodepublic_key) |
1224 | { | 1224 | { |
1225 | /* convert IPv4-in-IPv6 to IPv4 */ | 1225 | /* convert IPv4-in-IPv6 to IPv4 */ |
1226 | if ((ip_port.ip.family == TOX_AF_INET6) && IPV6_IPV4_IN_V6(ip_port.ip.ip6)) { | 1226 | if ((ip_port.ip.family == TOX_AF_INET6) && IPV6_IPV4_IN_V6(ip_port.ip.ip.v6)) { |
1227 | ip_port.ip.family = TOX_AF_INET; | 1227 | ip_port.ip.family = TOX_AF_INET; |
1228 | ip_port.ip.ip4.uint32 = ip_port.ip.ip6.uint32[3]; | 1228 | ip_port.ip.ip.v4.uint32 = ip_port.ip.ip.v6.uint32[3]; |
1229 | } | 1229 | } |
1230 | 1230 | ||
1231 | if (id_equal(public_key, dht->self_public_key)) { | 1231 | if (id_equal(public_key, dht->self_public_key)) { |