diff options
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r-- | toxcore/Messenger.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 573cd64a..9984d7f0 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -1047,7 +1047,8 @@ int file_get_id(const Messenger *m, int32_t friendnumber, uint32_t filenumber, u | |||
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | uint32_t temp_filenum; | 1049 | uint32_t temp_filenum; |
1050 | uint8_t send_receive, file_number; | 1050 | uint8_t send_receive; |
1051 | uint8_t file_number; | ||
1051 | 1052 | ||
1052 | if (filenumber >= (1 << 16)) { | 1053 | if (filenumber >= (1 << 16)) { |
1053 | send_receive = 1; | 1054 | send_receive = 1; |
@@ -1209,7 +1210,8 @@ int file_control(const Messenger *m, int32_t friendnumber, uint32_t filenumber, | |||
1209 | } | 1210 | } |
1210 | 1211 | ||
1211 | uint32_t temp_filenum; | 1212 | uint32_t temp_filenum; |
1212 | uint8_t send_receive, file_number; | 1213 | uint8_t send_receive; |
1214 | uint8_t file_number; | ||
1213 | 1215 | ||
1214 | if (filenumber >= (1 << 16)) { | 1216 | if (filenumber >= (1 << 16)) { |
1215 | send_receive = 1; | 1217 | send_receive = 1; |
@@ -2568,9 +2570,9 @@ void do_messenger(Messenger *m, void *userdata) | |||
2568 | 2570 | ||
2569 | if (mono_time_get(m->mono_time) > m->lastdump + DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS) { | 2571 | if (mono_time_get(m->mono_time) > m->lastdump + DUMPING_CLIENTS_FRIENDS_EVERY_N_SECONDS) { |
2570 | m->lastdump = mono_time_get(m->mono_time); | 2572 | m->lastdump = mono_time_get(m->mono_time); |
2571 | uint32_t client, last_pinged; | 2573 | uint32_t last_pinged; |
2572 | 2574 | ||
2573 | for (client = 0; client < LCLIENT_LIST; ++client) { | 2575 | for (uint32_t client = 0; client < LCLIENT_LIST; ++client) { |
2574 | const Client_data *cptr = dht_get_close_client(m->dht, client); | 2576 | const Client_data *cptr = dht_get_close_client(m->dht, client); |
2575 | const IPPTsPng *const assocs[] = { &cptr->assoc4, &cptr->assoc6, nullptr }; | 2577 | const IPPTsPng *const assocs[] = { &cptr->assoc4, &cptr->assoc6, nullptr }; |
2576 | 2578 | ||
@@ -2595,14 +2597,12 @@ void do_messenger(Messenger *m, void *userdata) | |||
2595 | } | 2597 | } |
2596 | 2598 | ||
2597 | 2599 | ||
2598 | uint32_t friend_idx, dhtfriend; | ||
2599 | |||
2600 | /* dht contains additional "friends" (requests) */ | 2600 | /* dht contains additional "friends" (requests) */ |
2601 | uint32_t num_dhtfriends = dht_get_num_friends(m->dht); | 2601 | uint32_t num_dhtfriends = dht_get_num_friends(m->dht); |
2602 | VLA(int32_t, m2dht, num_dhtfriends); | 2602 | VLA(int32_t, m2dht, num_dhtfriends); |
2603 | VLA(int32_t, dht2m, num_dhtfriends); | 2603 | VLA(int32_t, dht2m, num_dhtfriends); |
2604 | 2604 | ||
2605 | for (friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { | 2605 | for (uint32_t friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { |
2606 | m2dht[friend_idx] = -1; | 2606 | m2dht[friend_idx] = -1; |
2607 | dht2m[friend_idx] = -1; | 2607 | dht2m[friend_idx] = -1; |
2608 | 2608 | ||
@@ -2610,7 +2610,7 @@ void do_messenger(Messenger *m, void *userdata) | |||
2610 | continue; | 2610 | continue; |
2611 | } | 2611 | } |
2612 | 2612 | ||
2613 | for (dhtfriend = 0; dhtfriend < dht_get_num_friends(m->dht); ++dhtfriend) { | 2613 | for (uint32_t dhtfriend = 0; dhtfriend < dht_get_num_friends(m->dht); ++dhtfriend) { |
2614 | if (id_equal(m->friendlist[friend_idx].real_pk, dht_get_friend_public_key(m->dht, dhtfriend))) { | 2614 | if (id_equal(m->friendlist[friend_idx].real_pk, dht_get_friend_public_key(m->dht, dhtfriend))) { |
2615 | m2dht[friend_idx] = dhtfriend; | 2615 | m2dht[friend_idx] = dhtfriend; |
2616 | break; | 2616 | break; |
@@ -2618,7 +2618,7 @@ void do_messenger(Messenger *m, void *userdata) | |||
2618 | } | 2618 | } |
2619 | } | 2619 | } |
2620 | 2620 | ||
2621 | for (friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { | 2621 | for (uint32_t friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { |
2622 | if (m2dht[friend_idx] >= 0) { | 2622 | if (m2dht[friend_idx] >= 0) { |
2623 | dht2m[m2dht[friend_idx]] = friend_idx; | 2623 | dht2m[m2dht[friend_idx]] = friend_idx; |
2624 | } | 2624 | } |
@@ -2631,7 +2631,7 @@ void do_messenger(Messenger *m, void *userdata) | |||
2631 | Friend *msgfptr; | 2631 | Friend *msgfptr; |
2632 | DHT_Friend *dhtfptr; | 2632 | DHT_Friend *dhtfptr; |
2633 | 2633 | ||
2634 | for (friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { | 2634 | for (uint32_t friend_idx = 0; friend_idx < num_dhtfriends; ++friend_idx) { |
2635 | if (dht2m[friend_idx] >= 0) { | 2635 | if (dht2m[friend_idx] >= 0) { |
2636 | msgfptr = &m->friendlist[dht2m[friend_idx]]; | 2636 | msgfptr = &m->friendlist[dht2m[friend_idx]]; |
2637 | } else { | 2637 | } else { |
@@ -2651,7 +2651,7 @@ void do_messenger(Messenger *m, void *userdata) | |||
2651 | id_to_string(dht_friend_public_key(dhtfptr), id_str, sizeof(id_str))); | 2651 | id_to_string(dht_friend_public_key(dhtfptr), id_str, sizeof(id_str))); |
2652 | } | 2652 | } |
2653 | 2653 | ||
2654 | for (client = 0; client < MAX_FRIEND_CLIENTS; ++client) { | 2654 | for (uint32_t client = 0; client < MAX_FRIEND_CLIENTS; ++client) { |
2655 | const Client_data *cptr = dht_friend_client(dhtfptr, client); | 2655 | const Client_data *cptr = dht_friend_client(dhtfptr, client); |
2656 | const IPPTsPng *const assocs[] = {&cptr->assoc4, &cptr->assoc6}; | 2656 | const IPPTsPng *const assocs[] = {&cptr->assoc4, &cptr->assoc6}; |
2657 | 2657 | ||