summaryrefslogtreecommitdiff
path: root/toxcore/group.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/group.c')
-rw-r--r--toxcore/group.c16
1 files changed, 11 insertions, 5 deletions
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
243static uint64_t calculate_comp_value(const uint8_t *pk1, const uint8_t *pk2) 243static 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) {