diff options
author | iphydf <iphydf@users.noreply.github.com> | 2020-05-05 22:28:59 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2020-05-05 22:56:35 +0100 |
commit | 48bd200acbf4b4d8f3fa241373477b3a21001d17 (patch) | |
tree | 732cd71532990452c9d7c07920265ed272f3e6c9 | |
parent | c1a2ea3309969608a5553c34fa4199b05f20abc2 (diff) |
refactor: Disallow multiple initialised declarators per decl.
We no longer allow:
```c
int a = 0, b = 0;
int a[3], b[3];
int a, *b;
```
But we do still allow (for now):
```c
int a, b;
```
-rw-r--r-- | other/bootstrap_daemon/docker/tox-bootstrapd.sha256 | 2 | ||||
-rw-r--r-- | toxcore/DHT.c | 3 | ||||
-rw-r--r-- | toxcore/LAN_discovery.c | 6 | ||||
-rw-r--r-- | toxcore/Messenger.c | 3 | ||||
-rw-r--r-- | toxcore/TCP_connection.c | 8 | ||||
-rw-r--r-- | toxcore/group.c | 16 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 15 | ||||
-rw-r--r-- | toxcore/onion_client.c | 29 | ||||
-rw-r--r-- | toxcore/tox.c | 3 |
9 files changed, 52 insertions, 33 deletions
diff --git a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 index 6ccdea6a..55bf67f6 100644 --- a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 +++ b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 | |||
@@ -1 +1 @@ | |||
6f719e76aedd7b386c40ef096412e0336dbc608e69112329932a2c7b60dd8652 /usr/local/bin/tox-bootstrapd | 20306177ad19b1b6ad84469331a06d1c5c01f7918a95517105545f76d3c90d82 /usr/local/bin/tox-bootstrapd | ||
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 7c9263cd..40f477fd 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -583,7 +583,8 @@ int pack_nodes(uint8_t *data, uint16_t length, const Node_format *nodes, uint16_ | |||
583 | int unpack_nodes(Node_format *nodes, uint16_t max_num_nodes, uint16_t *processed_data_len, const uint8_t *data, | 583 | int unpack_nodes(Node_format *nodes, uint16_t max_num_nodes, uint16_t *processed_data_len, const uint8_t *data, |
584 | uint16_t length, bool tcp_enabled) | 584 | uint16_t length, bool tcp_enabled) |
585 | { | 585 | { |
586 | uint32_t num = 0, len_processed = 0; | 586 | uint32_t num = 0; |
587 | uint32_t len_processed = 0; | ||
587 | 588 | ||
588 | while (num < max_num_nodes && len_processed < length) { | 589 | while (num < max_num_nodes && len_processed < length) { |
589 | const int ipp_size = unpack_ip_port(&nodes[num].ip_port, data + len_processed, length - len_processed, tcp_enabled); | 590 | const int ipp_size = unpack_ip_port(&nodes[num].ip_port, data + len_processed, length - len_processed, tcp_enabled); |
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c index c3d06014..e23550df 100644 --- a/toxcore/LAN_discovery.c +++ b/toxcore/LAN_discovery.c | |||
@@ -70,14 +70,16 @@ static void fetch_broadcast_info(uint16_t port) | |||
70 | IP_ADAPTER_INFO *pAdapter = pAdapterInfo; | 70 | IP_ADAPTER_INFO *pAdapter = pAdapterInfo; |
71 | 71 | ||
72 | while (pAdapter) { | 72 | while (pAdapter) { |
73 | IP gateway = {0}, subnet_mask = {0}; | 73 | IP gateway = {0}; |
74 | IP subnet_mask = {0}; | ||
74 | 75 | ||
75 | if (addr_parse_ip(pAdapter->IpAddressList.IpMask.String, &subnet_mask) | 76 | if (addr_parse_ip(pAdapter->IpAddressList.IpMask.String, &subnet_mask) |
76 | && addr_parse_ip(pAdapter->GatewayList.IpAddress.String, &gateway)) { | 77 | && addr_parse_ip(pAdapter->GatewayList.IpAddress.String, &gateway)) { |
77 | if (net_family_is_ipv4(gateway.family) && net_family_is_ipv4(subnet_mask.family)) { | 78 | if (net_family_is_ipv4(gateway.family) && net_family_is_ipv4(subnet_mask.family)) { |
78 | IP_Port *ip_port = &ip_ports[count]; | 79 | IP_Port *ip_port = &ip_ports[count]; |
79 | ip_port->ip.family = net_family_ipv4; | 80 | ip_port->ip.family = net_family_ipv4; |
80 | uint32_t gateway_ip = net_ntohl(gateway.ip.v4.uint32), subnet_ip = net_ntohl(subnet_mask.ip.v4.uint32); | 81 | uint32_t gateway_ip = net_ntohl(gateway.ip.v4.uint32); |
82 | uint32_t subnet_ip = net_ntohl(subnet_mask.ip.v4.uint32); | ||
81 | uint32_t broadcast_ip = gateway_ip + ~subnet_ip - 1; | 83 | uint32_t broadcast_ip = gateway_ip + ~subnet_ip - 1; |
82 | ip_port->ip.ip.v4.uint32 = net_htonl(broadcast_ip); | 84 | ip_port->ip.ip.v4.uint32 = net_htonl(broadcast_ip); |
83 | ip_port->port = port; | 85 | ip_port->port = port; |
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 32c89867..573cd64a 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -239,7 +239,8 @@ int32_t m_addfriend(Messenger *m, const uint8_t *address, const uint8_t *data, u | |||
239 | return FAERR_BADCHECKSUM; | 239 | return FAERR_BADCHECKSUM; |
240 | } | 240 | } |
241 | 241 | ||
242 | uint16_t check, checksum = address_checksum(address, FRIEND_ADDRESS_SIZE - sizeof(checksum)); | 242 | uint16_t check; |
243 | uint16_t checksum = address_checksum(address, FRIEND_ADDRESS_SIZE - sizeof(checksum)); | ||
243 | memcpy(&check, address + CRYPTO_PUBLIC_KEY_SIZE + sizeof(uint32_t), sizeof(check)); | 244 | memcpy(&check, address + CRYPTO_PUBLIC_KEY_SIZE + sizeof(uint32_t), sizeof(check)); |
244 | 245 | ||
245 | if (check != checksum) { | 246 | if (check != checksum) { |
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c index 4256f786..ac933cc3 100644 --- a/toxcore/TCP_connection.c +++ b/toxcore/TCP_connection.c | |||
@@ -692,9 +692,9 @@ static int rm_tcp_connection_from_conn(TCP_Connection_to *con_to, unsigned int t | |||
692 | */ | 692 | */ |
693 | static unsigned int online_tcp_connection_from_conn(TCP_Connection_to *con_to) | 693 | static unsigned int online_tcp_connection_from_conn(TCP_Connection_to *con_to) |
694 | { | 694 | { |
695 | unsigned int i, count = 0; | 695 | unsigned int count = 0; |
696 | 696 | ||
697 | for (i = 0; i < MAX_FRIEND_TCP_CONNECTIONS; ++i) { | 697 | for (unsigned int i = 0; i < MAX_FRIEND_TCP_CONNECTIONS; ++i) { |
698 | if (con_to->connections[i].tcp_connection) { | 698 | if (con_to->connections[i].tcp_connection) { |
699 | if (con_to->connections[i].status == TCP_CONNECTIONS_STATUS_ONLINE) { | 699 | if (con_to->connections[i].status == TCP_CONNECTIONS_STATUS_ONLINE) { |
700 | ++count; | 700 | ++count; |
@@ -1086,9 +1086,9 @@ static int tcp_relay_on_online(TCP_Connections *tcp_c, int tcp_connections_numbe | |||
1086 | return -1; | 1086 | return -1; |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | unsigned int i, sent = 0; | 1089 | unsigned int sent = 0; |
1090 | 1090 | ||
1091 | for (i = 0; i < tcp_c->connections_length; ++i) { | 1091 | for (unsigned int i = 0; i < tcp_c->connections_length; ++i) { |
1092 | TCP_Connection_to *con_to = get_connection(tcp_c, i); | 1092 | TCP_Connection_to *con_to = get_connection(tcp_c, i); |
1093 | 1093 | ||
1094 | if (con_to) { | 1094 | if (con_to) { |
diff --git a/toxcore/group.c b/toxcore/group.c index a946e7b8..02ca3cfe 100644 --- a/toxcore/group.c +++ b/toxcore/group.c | |||
@@ -242,7 +242,8 @@ static int get_peer_index(const Group_c *g, uint16_t peer_number) | |||
242 | 242 | ||
243 | static uint64_t calculate_comp_value(const uint8_t *pk1, const uint8_t *pk2) | 243 | static uint64_t calculate_comp_value(const uint8_t *pk1, const uint8_t *pk2) |
244 | { | 244 | { |
245 | uint64_t cmp1 = 0, cmp2 = 0; | 245 | uint64_t cmp1 = 0; |
246 | uint64_t cmp2 = 0; | ||
246 | 247 | ||
247 | for (size_t i = 0; i < sizeof(uint64_t); ++i) { | 248 | for (size_t i = 0; i < sizeof(uint64_t); ++i) { |
248 | cmp1 = (cmp1 << 8) + (uint64_t)pk1[i]; | 249 | cmp1 = (cmp1 << 8) + (uint64_t)pk1[i]; |
@@ -1979,7 +1980,8 @@ static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, con | |||
1979 | return; | 1980 | return; |
1980 | } | 1981 | } |
1981 | 1982 | ||
1982 | uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE], temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; | 1983 | uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE]; |
1984 | uint8_t temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; | ||
1983 | get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id); | 1985 | get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id); |
1984 | 1986 | ||
1985 | addpeer(g_c, groupnum, real_pk, temp_pk, peer_number, userdata, true, true); | 1987 | addpeer(g_c, groupnum, real_pk, temp_pk, peer_number, userdata, true, true); |
@@ -2097,7 +2099,8 @@ static int handle_packet_online(Group_Chats *g_c, int friendcon_id, const uint8_ | |||
2097 | send_packet_online(g_c->fr_c, friendcon_id, groupnumber, g->type, g->id); | 2099 | send_packet_online(g_c->fr_c, friendcon_id, groupnumber, g->type, g->id); |
2098 | 2100 | ||
2099 | if (g->connections[index].reasons & GROUPCHAT_CONNECTION_REASON_INTRODUCING) { | 2101 | if (g->connections[index].reasons & GROUPCHAT_CONNECTION_REASON_INTRODUCING) { |
2100 | uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE], temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; | 2102 | uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE]; |
2103 | uint8_t temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; | ||
2101 | get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id); | 2104 | get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id); |
2102 | 2105 | ||
2103 | const int peer_index = peer_in_group(g, real_pk); | 2106 | const int peer_index = peer_in_group(g, real_pk); |
@@ -2129,7 +2132,8 @@ static int handle_packet_rejoin(Group_Chats *g_c, int friendcon_id, const uint8_ | |||
2129 | return -1; | 2132 | return -1; |
2130 | } | 2133 | } |
2131 | 2134 | ||
2132 | uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE], temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; | 2135 | uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE]; |
2136 | uint8_t temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; | ||
2133 | get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id); | 2137 | get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id); |
2134 | 2138 | ||
2135 | uint16_t peer_number; | 2139 | uint16_t peer_number; |
@@ -2366,7 +2370,9 @@ static unsigned int send_lossy_all_connections(const Group_Chats *g_c, const Gro | |||
2366 | uint16_t length, | 2370 | uint16_t length, |
2367 | int receiver) | 2371 | int receiver) |
2368 | { | 2372 | { |
2369 | unsigned int sent = 0, num_connected_closest = 0, connected_closest[DESIRED_CLOSEST]; | 2373 | unsigned int sent = 0; |
2374 | unsigned int num_connected_closest = 0; | ||
2375 | unsigned int connected_closest[DESIRED_CLOSEST]; | ||
2370 | 2376 | ||
2371 | for (unsigned int i = 0; i < MAX_GROUP_CONNECTIONS; ++i) { | 2377 | for (unsigned int i = 0; i < MAX_GROUP_CONNECTIONS; ++i) { |
2372 | if (g->connections[i].type != GROUPCHAT_CONNECTION_ONLINE) { | 2378 | if (g->connections[i].type != GROUPCHAT_CONNECTION_ONLINE) { |
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index f57886a8..3ed46a99 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -617,7 +617,8 @@ static IP_Port return_ip_port_connection(Net_Crypto *c, int crypt_connection_id) | |||
617 | } | 617 | } |
618 | 618 | ||
619 | const uint64_t current_time = mono_time_get(c->mono_time); | 619 | const uint64_t current_time = mono_time_get(c->mono_time); |
620 | bool v6 = 0, v4 = 0; | 620 | bool v6 = 0; |
621 | bool v4 = 0; | ||
621 | 622 | ||
622 | if ((UDP_DIRECT_TIMEOUT + conn->direct_lastrecv_timev4) > current_time) { | 623 | if ((UDP_DIRECT_TIMEOUT + conn->direct_lastrecv_timev4) > current_time) { |
623 | v4 = 1; | 624 | v4 = 1; |
@@ -932,9 +933,9 @@ static int generate_request_packet(const Logger *log, uint8_t *data, uint16_t le | |||
932 | return cur_len; | 933 | return cur_len; |
933 | } | 934 | } |
934 | 935 | ||
935 | uint32_t i, n = 1; | 936 | uint32_t n = 1; |
936 | 937 | ||
937 | for (i = recv_array->buffer_start; i != recv_array->buffer_end; ++i) { | 938 | for (uint32_t i = recv_array->buffer_start; i != recv_array->buffer_end; ++i) { |
938 | uint32_t num = i % CRYPTO_PACKET_BUFFER_SIZE; | 939 | uint32_t num = i % CRYPTO_PACKET_BUFFER_SIZE; |
939 | 940 | ||
940 | if (!recv_array->buffer[num]) { | 941 | if (!recv_array->buffer[num]) { |
@@ -1290,9 +1291,10 @@ static int send_requested_packets(Net_Crypto *c, int crypt_connection_id, uint32 | |||
1290 | } | 1291 | } |
1291 | 1292 | ||
1292 | const uint64_t temp_time = current_time_monotonic(c->mono_time); | 1293 | const uint64_t temp_time = current_time_monotonic(c->mono_time); |
1293 | uint32_t i, num_sent = 0, array_size = num_packets_array(&conn->send_array); | 1294 | const uint32_t array_size = num_packets_array(&conn->send_array); |
1295 | uint32_t num_sent = 0; | ||
1294 | 1296 | ||
1295 | for (i = 0; i < array_size; ++i) { | 1297 | for (uint32_t i = 0; i < array_size; ++i) { |
1296 | Packet_Data *dt; | 1298 | Packet_Data *dt; |
1297 | const uint32_t packet_num = i + conn->send_array.buffer_start; | 1299 | const uint32_t packet_num = i + conn->send_array.buffer_start; |
1298 | const int ret = get_data_pointer(c->log, &conn->send_array, &dt, packet_num); | 1300 | const int ret = get_data_pointer(c->log, &conn->send_array, &dt, packet_num); |
@@ -2586,7 +2588,8 @@ static void send_crypto_packets(Net_Crypto *c) | |||
2586 | 2588 | ||
2587 | /* When switching from TCP to UDP, don't change the packet send rate for CONGESTION_EVENT_TIMEOUT ms. */ | 2589 | /* When switching from TCP to UDP, don't change the packet send rate for CONGESTION_EVENT_TIMEOUT ms. */ |
2588 | if (!(direct_connected && conn->last_tcp_sent + CONGESTION_EVENT_TIMEOUT > temp_time)) { | 2590 | if (!(direct_connected && conn->last_tcp_sent + CONGESTION_EVENT_TIMEOUT > temp_time)) { |
2589 | long signed int total_sent = 0, total_resent = 0; | 2591 | long signed int total_sent = 0; |
2592 | long signed int total_resent = 0; | ||
2590 | 2593 | ||
2591 | // TODO(irungentoo): use real delay | 2594 | // TODO(irungentoo): use real delay |
2592 | unsigned int delay = (unsigned int)((conn->rtt_time / PACKET_COUNTER_AVERAGE_INTERVAL) + 0.5); | 2595 | unsigned int delay = (unsigned int)((conn->rtt_time / PACKET_COUNTER_AVERAGE_INTERVAL) + 0.5); |
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index 60a80bc6..7494ea94 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -701,7 +701,8 @@ static int client_add_to_list(Onion_Client *onion_c, uint32_t num, const uint8_t | |||
701 | 701 | ||
702 | sort_onion_node_list(list_nodes, list_length, onion_c->mono_time, reference_id); | 702 | sort_onion_node_list(list_nodes, list_length, onion_c->mono_time, reference_id); |
703 | 703 | ||
704 | int index = -1, stored = 0; | 704 | int index = -1; |
705 | int stored = 0; | ||
705 | unsigned int i; | 706 | unsigned int i; |
706 | 707 | ||
707 | if (onion_node_timed_out(&list_nodes[0], onion_c->mono_time) | 708 | if (onion_node_timed_out(&list_nodes[0], onion_c->mono_time) |
@@ -1046,10 +1047,12 @@ int send_onion_data(Onion_Client *onion_c, int friend_num, const uint8_t *data, | |||
1046 | return -1; | 1047 | return -1; |
1047 | } | 1048 | } |
1048 | 1049 | ||
1049 | unsigned int i, good_nodes[MAX_ONION_CLIENTS], num_good = 0, num_nodes = 0; | 1050 | unsigned int good_nodes[MAX_ONION_CLIENTS]; |
1051 | unsigned int num_good = 0; | ||
1052 | unsigned int num_nodes = 0; | ||
1050 | Onion_Node *list_nodes = onion_c->friends_list[friend_num].clients_list; | 1053 | Onion_Node *list_nodes = onion_c->friends_list[friend_num].clients_list; |
1051 | 1054 | ||
1052 | for (i = 0; i < MAX_ONION_CLIENTS; ++i) { | 1055 | for (unsigned int i = 0; i < MAX_ONION_CLIENTS; ++i) { |
1053 | if (onion_node_timed_out(&list_nodes[i], onion_c->mono_time)) { | 1056 | if (onion_node_timed_out(&list_nodes[i], onion_c->mono_time)) { |
1054 | continue; | 1057 | continue; |
1055 | } | 1058 | } |
@@ -1081,7 +1084,7 @@ int send_onion_data(Onion_Client *onion_c, int friend_num, const uint8_t *data, | |||
1081 | 1084 | ||
1082 | unsigned int good = 0; | 1085 | unsigned int good = 0; |
1083 | 1086 | ||
1084 | for (i = 0; i < num_good; ++i) { | 1087 | for (unsigned int i = 0; i < num_good; ++i) { |
1085 | Onion_Path path; | 1088 | Onion_Path path; |
1086 | 1089 | ||
1087 | if (random_path(onion_c, &onion_c->onion_paths_friends, -1, &path) == -1) { | 1090 | if (random_path(onion_c, &onion_c->onion_paths_friends, -1, &path) == -1) { |
@@ -1210,7 +1213,8 @@ static int send_dhtpk_announce(Onion_Client *onion_c, uint16_t friend_num, uint8 | |||
1210 | } | 1213 | } |
1211 | } | 1214 | } |
1212 | 1215 | ||
1213 | int num1 = -1, num2 = -1; | 1216 | int num1 = -1; |
1217 | int num2 = -1; | ||
1214 | 1218 | ||
1215 | if (onion_dht_both != 1) { | 1219 | if (onion_dht_both != 1) { |
1216 | num1 = send_onion_data(onion_c, friend_num, data, DHTPK_DATA_MIN_LENGTH + nodes_len); | 1220 | num1 = send_onion_data(onion_c, friend_num, data, DHTPK_DATA_MIN_LENGTH + nodes_len); |
@@ -1289,9 +1293,9 @@ int onion_addfriend(Onion_Client *onion_c, const uint8_t *public_key) | |||
1289 | return num; | 1293 | return num; |
1290 | } | 1294 | } |
1291 | 1295 | ||
1292 | unsigned int i, index = -1; | 1296 | unsigned int index = -1; |
1293 | 1297 | ||
1294 | for (i = 0; i < onion_c->num_friends; ++i) { | 1298 | for (unsigned int i = 0; i < onion_c->num_friends; ++i) { |
1295 | if (onion_c->friends_list[i].status == 0) { | 1299 | if (onion_c->friends_list[i].status == 0) { |
1296 | index = i; | 1300 | index = i; |
1297 | break; | 1301 | break; |
@@ -1659,10 +1663,10 @@ void oniondata_registerhandler(Onion_Client *onion_c, uint8_t byte, oniondata_ha | |||
1659 | 1663 | ||
1660 | static void do_announce(Onion_Client *onion_c) | 1664 | static void do_announce(Onion_Client *onion_c) |
1661 | { | 1665 | { |
1662 | unsigned int i, count = 0; | 1666 | unsigned int count = 0; |
1663 | Onion_Node *list_nodes = onion_c->clients_announce_list; | 1667 | Onion_Node *list_nodes = onion_c->clients_announce_list; |
1664 | 1668 | ||
1665 | for (i = 0; i < MAX_ONION_CLIENTS_ANNOUNCE; ++i) { | 1669 | for (unsigned int i = 0; i < MAX_ONION_CLIENTS_ANNOUNCE; ++i) { |
1666 | if (onion_node_timed_out(&list_nodes[i], onion_c->mono_time)) { | 1670 | if (onion_node_timed_out(&list_nodes[i], onion_c->mono_time)) { |
1667 | continue; | 1671 | continue; |
1668 | } | 1672 | } |
@@ -1735,7 +1739,7 @@ static void do_announce(Onion_Client *onion_c) | |||
1735 | 1739 | ||
1736 | if (count <= random_u32() % MAX_ONION_CLIENTS_ANNOUNCE) { | 1740 | if (count <= random_u32() % MAX_ONION_CLIENTS_ANNOUNCE) { |
1737 | if (num_nodes != 0) { | 1741 | if (num_nodes != 0) { |
1738 | for (i = 0; i < (MAX_ONION_CLIENTS_ANNOUNCE / 2); ++i) { | 1742 | for (unsigned int i = 0; i < (MAX_ONION_CLIENTS_ANNOUNCE / 2); ++i) { |
1739 | const uint32_t num = random_u32() % num_nodes; | 1743 | const uint32_t num = random_u32() % num_nodes; |
1740 | client_send_announce_request(onion_c, 0, path_nodes[num].ip_port, path_nodes[num].public_key, nullptr, -1); | 1744 | client_send_announce_request(onion_c, 0, path_nodes[num].ip_port, path_nodes[num].public_key, nullptr, -1); |
1741 | } | 1745 | } |
@@ -1749,7 +1753,8 @@ static void do_announce(Onion_Client *onion_c) | |||
1749 | */ | 1753 | */ |
1750 | static int onion_isconnected(const Onion_Client *onion_c) | 1754 | static int onion_isconnected(const Onion_Client *onion_c) |
1751 | { | 1755 | { |
1752 | unsigned int i, num = 0, announced = 0; | 1756 | unsigned int num = 0; |
1757 | unsigned int announced = 0; | ||
1753 | 1758 | ||
1754 | if (mono_time_is_timeout(onion_c->mono_time, onion_c->last_packet_recv, ONION_OFFLINE_TIMEOUT)) { | 1759 | if (mono_time_is_timeout(onion_c->mono_time, onion_c->last_packet_recv, ONION_OFFLINE_TIMEOUT)) { |
1755 | return 0; | 1760 | return 0; |
@@ -1759,7 +1764,7 @@ static int onion_isconnected(const Onion_Client *onion_c) | |||
1759 | return 0; | 1764 | return 0; |
1760 | } | 1765 | } |
1761 | 1766 | ||
1762 | for (i = 0; i < MAX_ONION_CLIENTS_ANNOUNCE; ++i) { | 1767 | for (unsigned int i = 0; i < MAX_ONION_CLIENTS_ANNOUNCE; ++i) { |
1763 | if (!onion_node_timed_out(&onion_c->clients_announce_list[i], onion_c->mono_time)) { | 1768 | if (!onion_node_timed_out(&onion_c->clients_announce_list[i], onion_c->mono_time)) { |
1764 | ++num; | 1769 | ++num; |
1765 | 1770 | ||
diff --git a/toxcore/tox.c b/toxcore/tox.c index d2d3ed34..780d9136 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -400,7 +400,8 @@ Tox *tox_new(const struct Tox_Options *options, Tox_Err_New *error) | |||
400 | 400 | ||
401 | Messenger_Options m_options = {0}; | 401 | Messenger_Options m_options = {0}; |
402 | 402 | ||
403 | bool load_savedata_sk = false, load_savedata_tox = false; | 403 | bool load_savedata_sk = false; |
404 | bool load_savedata_tox = false; | ||
404 | 405 | ||
405 | struct Tox_Options *default_options = nullptr; | 406 | struct Tox_Options *default_options = nullptr; |
406 | 407 | ||