summaryrefslogtreecommitdiff
path: root/toxcore/net_crypto.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-08-27 12:52:34 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-08-27 12:54:46 +0000
commit0075374f2bb3bb72ef1112471f1aacf12b6b6658 (patch)
treeadd97dd9763a59685c3c36003c5962905cf6d751 /toxcore/net_crypto.c
parent25a477a7e429f108cb690d0c24701272ec30195f (diff)
Make `ip_is_lan` return bool instead of 0/-1.
This inverts the truthiness of the return value. Previously, 0 meant `true` and -1 meant `false`. Now, `true` (1) means `true` and `false` (0) means `false`.
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r--toxcore/net_crypto.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c
index 8213ce47..76cd27e7 100644
--- a/toxcore/net_crypto.c
+++ b/toxcore/net_crypto.c
@@ -584,7 +584,7 @@ static int add_ip_port_connection(Net_Crypto *c, int crypt_connection_id, IP_Por
584 } 584 }
585 585
586 if (net_family_is_ipv4(ip_port.ip.family)) { 586 if (net_family_is_ipv4(ip_port.ip.family)) {
587 if (!ipport_equal(&ip_port, &conn->ip_portv4) && ip_is_lan(conn->ip_portv4.ip) != 0) { 587 if (!ipport_equal(&ip_port, &conn->ip_portv4) && !ip_is_lan(conn->ip_portv4.ip)) {
588 if (!bs_list_add(&c->ip_port_list, (uint8_t *)&ip_port, crypt_connection_id)) { 588 if (!bs_list_add(&c->ip_port_list, (uint8_t *)&ip_port, crypt_connection_id)) {
589 return -1; 589 return -1;
590 } 590 }
@@ -634,7 +634,7 @@ static IP_Port return_ip_port_connection(Net_Crypto *c, int crypt_connection_id)
634 v6 = 1; 634 v6 = 1;
635 } 635 }
636 636
637 if (v4 && ip_is_lan(conn->ip_portv4.ip) == 0) { 637 if (v4 && ip_is_lan(conn->ip_portv4.ip)) {
638 return conn->ip_portv4; 638 return conn->ip_portv4;
639 } 639 }
640 640