From 48bd200acbf4b4d8f3fa241373477b3a21001d17 Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 5 May 2020 22:28:59 +0100 Subject: 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; ``` --- toxcore/group.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'toxcore/group.c') 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) static uint64_t calculate_comp_value(const uint8_t *pk1, const uint8_t *pk2) { - uint64_t cmp1 = 0, cmp2 = 0; + uint64_t cmp1 = 0; + uint64_t cmp2 = 0; for (size_t i = 0; i < sizeof(uint64_t); ++i) { cmp1 = (cmp1 << 8) + (uint64_t)pk1[i]; @@ -1979,7 +1980,8 @@ static void handle_friend_invite_packet(Messenger *m, uint32_t friendnumber, con return; } - uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE], temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; + uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE]; + uint8_t temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id); 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_ send_packet_online(g_c->fr_c, friendcon_id, groupnumber, g->type, g->id); if (g->connections[index].reasons & GROUPCHAT_CONNECTION_REASON_INTRODUCING) { - uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE], temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; + uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE]; + uint8_t temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id); 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_ return -1; } - uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE], temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; + uint8_t real_pk[CRYPTO_PUBLIC_KEY_SIZE]; + uint8_t temp_pk[CRYPTO_PUBLIC_KEY_SIZE]; get_friendcon_public_keys(real_pk, temp_pk, g_c->fr_c, friendcon_id); uint16_t peer_number; @@ -2366,7 +2370,9 @@ static unsigned int send_lossy_all_connections(const Group_Chats *g_c, const Gro uint16_t length, int receiver) { - unsigned int sent = 0, num_connected_closest = 0, connected_closest[DESIRED_CLOSEST]; + unsigned int sent = 0; + unsigned int num_connected_closest = 0; + unsigned int connected_closest[DESIRED_CLOSEST]; for (unsigned int i = 0; i < MAX_GROUP_CONNECTIONS; ++i) { if (g->connections[i].type != GROUPCHAT_CONNECTION_ONLINE) { -- cgit v1.2.3