diff options
author | irungentoo <irungentoo@gmail.com> | 2013-09-14 12:57:41 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-09-14 12:57:41 -0400 |
commit | 46a99a87746fd071948bdbe47019e70f6d99e1c8 (patch) | |
tree | 6d27d0ddc67323d7bff4af6d8d1ece5cbd57e6ca | |
parent | 12d1c5199bd2feecd93424ff57f44fab4bbb02ad (diff) |
Fixed some warnings.
-rw-r--r-- | toxcore/DHT.c | 13 | ||||
-rw-r--r-- | toxcore/network.c | 10 |
2 files changed, 15 insertions, 8 deletions
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index df3b2f76..a2d0b5d8 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -195,9 +195,9 @@ static int friend_number(DHT *dht, uint8_t *client_id) | |||
195 | /* | 195 | /* |
196 | * helper for get_close_nodes(). argument list is a monster :D | 196 | * helper for get_close_nodes(). argument list is a monster :D |
197 | */ | 197 | */ |
198 | static int get_close_nodes_inner(DHT *dht, uint8_t *client_id, Node_format *nodes_list, | 198 | static void get_close_nodes_inner(DHT *dht, uint8_t *client_id, Node_format *nodes_list, |
199 | sa_family_t sa_family, Client_data *client_list, uint32_t client_list_length, | 199 | sa_family_t sa_family, Client_data *client_list, uint32_t client_list_length, |
200 | time_t timestamp, int *num_nodes_ptr) | 200 | time_t timestamp, int *num_nodes_ptr) |
201 | { | 201 | { |
202 | int num_nodes = 0; | 202 | int num_nodes = 0; |
203 | int i, tout, inlist, ipv46x, j, closest; | 203 | int i, tout, inlist, ipv46x, j, closest; |
@@ -974,9 +974,10 @@ void DHT_bootstrap(DHT *dht, IP_Port ip_port, uint8_t *public_key) | |||
974 | int DHT_bootstrap_from_address(DHT *dht, const char *address, uint8_t ipv6enabled, | 974 | int DHT_bootstrap_from_address(DHT *dht, const char *address, uint8_t ipv6enabled, |
975 | uint16_t port, uint8_t *public_key) | 975 | uint16_t port, uint8_t *public_key) |
976 | { | 976 | { |
977 | IP_Port ip_port_v64, ip_port_v4; | 977 | IP_Port ip_port_v64; |
978 | IP *ip_extra = NULL; | 978 | IP *ip_extra = NULL; |
979 | #ifdef TOX_ENABLE_IPV6 | 979 | #ifdef TOX_ENABLE_IPV6 |
980 | IP_Port ip_port_v4; | ||
980 | ip_init(&ip_port_v64.ip, ipv6enabled); | 981 | ip_init(&ip_port_v64.ip, ipv6enabled); |
981 | 982 | ||
982 | if (ipv6enabled) { | 983 | if (ipv6enabled) { |
@@ -1456,14 +1457,14 @@ void DHT_save(DHT *dht, uint8_t *data) | |||
1456 | int DHT_load(DHT *dht, uint8_t *data, uint32_t size) | 1457 | int DHT_load(DHT *dht, uint8_t *data, uint32_t size) |
1457 | { | 1458 | { |
1458 | if (size < sizeof(dht->close_clientlist)) { | 1459 | if (size < sizeof(dht->close_clientlist)) { |
1459 | fprintf(stderr, "DHT_load: Expected at least %u bytes, got %u.\n", sizeof(dht->close_clientlist), size); | 1460 | fprintf(stderr, "DHT_load: Expected at least %lu bytes, got %u.\n", sizeof(dht->close_clientlist), size); |
1460 | return -1; | 1461 | return -1; |
1461 | } | 1462 | } |
1462 | 1463 | ||
1463 | uint32_t friendlistsize = size - sizeof(dht->close_clientlist); | 1464 | uint32_t friendlistsize = size - sizeof(dht->close_clientlist); |
1464 | 1465 | ||
1465 | if (friendlistsize % sizeof(DHT_Friend) != 0) { | 1466 | if (friendlistsize % sizeof(DHT_Friend) != 0) { |
1466 | fprintf(stderr, "DHT_load: Expected a multiple of %u, got %u.\n", sizeof(DHT_Friend), friendlistsize); | 1467 | fprintf(stderr, "DHT_load: Expected a multiple of %lu, got %u.\n", sizeof(DHT_Friend), friendlistsize); |
1467 | return -1; | 1468 | return -1; |
1468 | } | 1469 | } |
1469 | 1470 | ||
diff --git a/toxcore/network.c b/toxcore/network.c index 5aa17cd0..a244b400 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -383,7 +383,10 @@ Networking_Core *new_networking(IP ip, uint16_t port) | |||
383 | if (ip.family == AF_INET6) | 383 | if (ip.family == AF_INET6) |
384 | { | 384 | { |
385 | char ipv6only = 0; | 385 | char ipv6only = 0; |
386 | int res = setsockopt(temp->sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&ipv6only, sizeof(ipv6only)); | 386 | #ifdef LOGGING |
387 | int res = | ||
388 | #endif | ||
389 | setsockopt(temp->sock, IPPROTO_IPV6, IPV6_V6ONLY, (char *)&ipv6only, sizeof(ipv6only)); | ||
387 | #ifdef LOGGING | 390 | #ifdef LOGGING |
388 | 391 | ||
389 | if (res < 0) { | 392 | if (res < 0) { |
@@ -403,7 +406,10 @@ Networking_Core *new_networking(IP ip, uint16_t port) | |||
403 | mreq.ipv6mr_multiaddr.s6_addr[ 1] = 0x02; | 406 | mreq.ipv6mr_multiaddr.s6_addr[ 1] = 0x02; |
404 | mreq.ipv6mr_multiaddr.s6_addr[15] = 0x01; | 407 | mreq.ipv6mr_multiaddr.s6_addr[15] = 0x01; |
405 | mreq.ipv6mr_interface = 0; | 408 | mreq.ipv6mr_interface = 0; |
406 | res = setsockopt(temp->sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)); | 409 | #ifdef LOGGING |
410 | res = | ||
411 | #endif | ||
412 | setsockopt(temp->sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)); | ||
407 | #ifdef LOGGING | 413 | #ifdef LOGGING |
408 | 414 | ||
409 | if (res < 0) { | 415 | if (res < 0) { |