From 1977d56caaff40ea9bbf6754b69bec9539a5a969 Mon Sep 17 00:00:00 2001 From: iphydf Date: Fri, 30 Sep 2016 15:15:50 +0100 Subject: [PATCH] Remove return after no-return situation (and other cleanups). Cleanups: - Fix header guards to not use reserved names. - Avoid name shadowing. - Removed an unused variable found by avoiding name shadowing. --- auto_tests/crypto_test.c | 10 ++++----- auto_tests/dht_test.c | 3 --- auto_tests/encryptsave_test.c | 6 +++--- auto_tests/tox_test.c | 16 ++++++-------- auto_tests/toxav_basic_test.c | 24 ++++++++++----------- other/DHT_bootstrap.c | 2 -- other/bootstrap_daemon/src/tox-bootstrapd.c | 2 -- testing/DHT_test.c | 2 -- testing/Messenger_test.c | 4 ++-- testing/irc_syncbot.c | 16 ++++++-------- testing/nTox.c | 1 - testing/tox_shell.c | 2 -- testing/tox_sync.c | 2 -- toxav/msi.c | 10 ++++----- toxcore/DHT.c | 6 +++--- toxcore/assoc.h | 6 +++--- toxcore/net_crypto.c | 4 +--- toxcore/network.c | 2 +- toxcore/ping.h | 6 +++--- toxcore/util.h | 6 +++--- toxdns/toxdns.c | 6 +++--- 21 files changed, 57 insertions(+), 79 deletions(-) diff --git a/auto_tests/crypto_test.c b/auto_tests/crypto_test.c index f39ee8d4..ce2101cc 100644 --- a/auto_tests/crypto_test.c +++ b/auto_tests/crypto_test.c @@ -37,7 +37,7 @@ static const unsigned char bobpk[32] = { 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f }; -static const unsigned char nonce[24] = { +static const unsigned char test_nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6, 0x82, 0x19, 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 @@ -96,12 +96,12 @@ START_TEST(test_known) ck_assert_msg(sizeof(test_c) == sizeof(c), "sanity check failed"); ck_assert_msg(sizeof(test_m) == sizeof(m), "sanity check failed"); - clen = encrypt_data(bobpk, alicesk, nonce, test_m, sizeof(test_m) / sizeof(unsigned char), c); + clen = encrypt_data(bobpk, alicesk, test_nonce, test_m, sizeof(test_m) / sizeof(unsigned char), c); ck_assert_msg(memcmp(test_c, c, sizeof(c)) == 0, "cyphertext doesn't match test vector"); ck_assert_msg(clen == sizeof(c) / sizeof(unsigned char), "wrong ciphertext length"); - mlen = decrypt_data(bobpk, alicesk, nonce, test_c, sizeof(test_c) / sizeof(unsigned char), m); + mlen = decrypt_data(bobpk, alicesk, test_nonce, test_c, sizeof(test_c) / sizeof(unsigned char), m); ck_assert_msg(memcmp(test_m, m, sizeof(m)) == 0, "decrypted text doesn't match test vector"); ck_assert_msg(mlen == sizeof(m) / sizeof(unsigned char), "wrong plaintext length"); @@ -122,12 +122,12 @@ START_TEST(test_fast_known) ck_assert_msg(sizeof(test_c) == sizeof(c), "sanity check failed"); ck_assert_msg(sizeof(test_m) == sizeof(m), "sanity check failed"); - clen = encrypt_data_symmetric(k, nonce, test_m, sizeof(test_m) / sizeof(unsigned char), c); + clen = encrypt_data_symmetric(k, test_nonce, test_m, sizeof(test_m) / sizeof(unsigned char), c); ck_assert_msg(memcmp(test_c, c, sizeof(c)) == 0, "cyphertext doesn't match test vector"); ck_assert_msg(clen == sizeof(c) / sizeof(unsigned char), "wrong ciphertext length"); - mlen = decrypt_data_symmetric(k, nonce, test_c, sizeof(test_c) / sizeof(unsigned char), m); + mlen = decrypt_data_symmetric(k, test_nonce, test_c, sizeof(test_c) / sizeof(unsigned char), m); ck_assert_msg(memcmp(test_m, m, sizeof(m)) == 0, "decrypted text doesn't match test vector"); ck_assert_msg(mlen == sizeof(m) / sizeof(unsigned char), "wrong plaintext length"); diff --git a/auto_tests/dht_test.c b/auto_tests/dht_test.c index 7b22e515..13db7e51 100644 --- a/auto_tests/dht_test.c +++ b/auto_tests/dht_test.c @@ -434,9 +434,6 @@ static void test_list_main(void) uint8_t cmp_list1[NUM_DHT][MAX_FRIEND_CLIENTS][crypto_box_PUBLICKEYBYTES + 1]; memset(cmp_list1, 0, sizeof(cmp_list1)); - IP ip; - ip_init(&ip, 1); - unsigned int i, j, k, l; for (i = 0; i < NUM_DHT; ++i) { diff --git a/auto_tests/encryptsave_test.c b/auto_tests/encryptsave_test.c index 5841f43f..2a2827da 100644 --- a/auto_tests/encryptsave_test.c +++ b/auto_tests/encryptsave_test.c @@ -19,7 +19,7 @@ #include "../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h" #endif -static unsigned char salt[32] = {0xB1, 0xC2, 0x09, 0xEE, 0x50, 0x6C, 0xF0, 0x20, 0xC4, 0xD6, 0xEB, 0xC0, 0x44, 0x51, 0x3B, 0x60, 0x4B, 0x39, 0x4A, 0xCF, 0x09, 0x53, 0x4F, 0xEA, 0x08, 0x41, 0xFA, 0xCA, 0x66, 0xD2, 0x68, 0x7F}; +static unsigned char test_salt[32] = {0xB1, 0xC2, 0x09, 0xEE, 0x50, 0x6C, 0xF0, 0x20, 0xC4, 0xD6, 0xEB, 0xC0, 0x44, 0x51, 0x3B, 0x60, 0x4B, 0x39, 0x4A, 0xCF, 0x09, 0x53, 0x4F, 0xEA, 0x08, 0x41, 0xFA, 0xCA, 0x66, 0xD2, 0x68, 0x7F}; static unsigned char known_key[crypto_box_BEFORENMBYTES] = {0x29, 0x36, 0x1c, 0x9e, 0x65, 0xbb, 0x46, 0x8b, 0xde, 0xa1, 0xac, 0xf, 0xd5, 0x11, 0x81, 0xc8, 0x29, 0x28, 0x17, 0x23, 0xa6, 0xc3, 0x6b, 0x77, 0x2e, 0xd7, 0xd3, 0x10, 0xeb, 0xd2, 0xf7, 0xc8}; static const char *pw = "hunter2"; static unsigned int pwlen = 7; @@ -46,7 +46,7 @@ START_TEST(test_known_kdf) crypto_box_BEFORENMBYTES, pw, pwlen, - salt, + test_salt, crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE * 8, crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE); ck_assert_msg(res != -1, "crypto function failed"); @@ -103,7 +103,7 @@ START_TEST(test_save_friend) uint8_t data2[size]; tox_get_savedata(tox3, data2); TOX_PASS_KEY key; - memcpy(key.salt, salt, 32); + memcpy(key.salt, test_salt, 32); memcpy(key.key, known_key2, crypto_box_BEFORENMBYTES); size2 = size + TOX_PASS_ENCRYPTION_EXTRA_LENGTH; uint8_t encdata2[size2]; diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 6ab03365..b934d7fe 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c @@ -155,12 +155,10 @@ static void tox_file_receive(Tox *tox, uint32_t friend_number, uint32_t file_num if (kind != TOX_FILE_KIND_DATA) { ck_abort_msg("Bad kind"); - return; } if (!(filename_length == sizeof("Gentoo.exe") && memcmp(filename, "Gentoo.exe", sizeof("Gentoo.exe")) == 0)) { ck_abort_msg("Bad filename"); - return; } uint8_t file_id[TOX_FILE_ID_LENGTH]; @@ -244,7 +242,6 @@ static void tox_file_chunk_request(Tox *tox, uint32_t friend_number, uint32_t fi if (sending_pos != position) { ck_abort_msg("Bad position %llu", position); - return; } if (length == 0) { @@ -293,7 +290,6 @@ static void write_file(Tox *tox, uint32_t friendnumber, uint32_t filenumber, uin if (size_recv != position) { ck_abort_msg("Bad position"); - return; } if (length == 0) { @@ -897,13 +893,13 @@ loop_top: tox_self_get_address(toxes[pairs[i].tox1], address); TOX_ERR_FRIEND_ADD test; - uint32_t num = tox_friend_add(toxes[pairs[i].tox2], address, (const uint8_t *)"Gentoo", 7, &test); + uint32_t friend_num = tox_friend_add(toxes[pairs[i].tox2], address, (const uint8_t *)"Gentoo", 7, &test); if (test == TOX_ERR_FRIEND_ADD_ALREADY_SENT) { goto loop_top; } - ck_assert_msg(num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test); + ck_assert_msg(friend_num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test); } for (i = 0; i < NUM_TOXES; ++i) { @@ -1010,13 +1006,13 @@ loop_top: tox_self_get_address(toxes[pairs[i].tox1], address); TOX_ERR_FRIEND_ADD test; - uint32_t num = tox_friend_add(toxes[pairs[i].tox2], address, (const uint8_t *)"Gentoo", 7, &test); + uint32_t friend_num = tox_friend_add(toxes[pairs[i].tox2], address, (const uint8_t *)"Gentoo", 7, &test); if (test == TOX_ERR_FRIEND_ADD_ALREADY_SENT) { goto loop_top; } - ck_assert_msg(num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test); + ck_assert_msg(friend_num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test); } while (1) { @@ -1109,13 +1105,13 @@ loop_top: tox_self_get_address(toxes[pairs[i].tox1], address); TOX_ERR_FRIEND_ADD test; - uint32_t num = tox_friend_add(toxes[pairs[i].tox2], address, (const uint8_t *)"Gentoo", 7, &test); + uint32_t friend_num = tox_friend_add(toxes[pairs[i].tox2], address, (const uint8_t *)"Gentoo", 7, &test); if (test == TOX_ERR_FRIEND_ADD_ALREADY_SENT) { goto loop_top; } - ck_assert_msg(num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test); + ck_assert_msg(friend_num != UINT32_MAX && test == TOX_ERR_FRIEND_ADD_OK, "Failed to add friend error code: %i", test); } uint16_t last_count = 0; diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index 1043c9be..860ad402 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_test.c @@ -226,11 +226,11 @@ START_TEST(test_AV_flows) memset(&AliceCC, 0, sizeof(CallControl)); \ memset(&BobCC, 0, sizeof(CallControl)); \ \ - TOXAV_ERR_CALL rc; \ - toxav_call(AliceAV, 0, A_BR, V_BR, &rc); \ + TOXAV_ERR_CALL call_err; \ + toxav_call(AliceAV, 0, A_BR, V_BR, &call_err); \ \ - if (rc != TOXAV_ERR_CALL_OK) { \ - printf("toxav_call failed: %d\n", rc); \ + if (call_err != TOXAV_ERR_CALL_OK) { \ + printf("toxav_call failed: %d\n", call_err); \ ck_assert(0); \ } \ \ @@ -241,11 +241,11 @@ START_TEST(test_AV_flows) while (BobCC.state != TOXAV_FRIEND_CALL_STATE_FINISHED) { \ \ if (BobCC.incoming) { \ - TOXAV_ERR_ANSWER rc; \ - toxav_answer(BobAV, 0, A_BR, V_BR, &rc); \ + TOXAV_ERR_ANSWER answer_err; \ + toxav_answer(BobAV, 0, A_BR, V_BR, &answer_err); \ \ - if (rc != TOXAV_ERR_ANSWER_OK) { \ - printf("toxav_answer failed: %d\n", rc); \ + if (answer_err != TOXAV_ERR_ANSWER_OK) { \ + printf("toxav_answer failed: %d\n", answer_err); \ ck_assert(0); \ } \ BobCC.incoming = false; \ @@ -254,11 +254,11 @@ START_TEST(test_AV_flows) \ if (time(NULL) - start_time >= 1) { \ \ - TOXAV_ERR_CALL_CONTROL rc; \ - toxav_call_control(AliceAV, 0, TOXAV_CALL_CONTROL_CANCEL, &rc); \ + TOXAV_ERR_CALL_CONTROL cc_err; \ + toxav_call_control(AliceAV, 0, TOXAV_CALL_CONTROL_CANCEL, &cc_err); \ \ - if (rc != TOXAV_ERR_CALL_CONTROL_OK) { \ - printf("toxav_call_control failed: %d\n", rc); \ + if (cc_err != TOXAV_ERR_CALL_CONTROL_OK) { \ + printf("toxav_call_control failed: %d\n", cc_err); \ ck_assert(0); \ } \ } \ diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index 2dc24b4e..8cb6a8d0 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c @@ -203,6 +203,4 @@ int main(int argc, char *argv[]) c_sleep(1); } - - return 0; } diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c index e846eeda..f2816ddf 100644 --- a/other/bootstrap_daemon/src/tox-bootstrapd.c +++ b/other/bootstrap_daemon/src/tox-bootstrapd.c @@ -339,6 +339,4 @@ int main(int argc, char *argv[]) SLEEP_MILLISECONDS(30); } - - return 1; } diff --git a/testing/DHT_test.c b/testing/DHT_test.c index c9223546..df029d41 100644 --- a/testing/DHT_test.c +++ b/testing/DHT_test.c @@ -259,6 +259,4 @@ int main(int argc, char *argv[]) print_friendlist(dht); c_sleep(300); } - - return 0; } diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index 3b7715a2..9f56c903 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c @@ -67,7 +67,7 @@ static void print_message(Messenger *m, uint32_t friendnumber, unsigned int type * networking_requesthandler and so cannot take a Messenger * */ static Messenger *m; -static void print_request(Messenger *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata) +static void print_request(Messenger *m2, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata) { printf("Friend request received from: \n"); printf("ClientID: "); @@ -91,7 +91,7 @@ static void print_request(Messenger *m, const uint8_t *public_key, const uint8_t //if the request contained the message of peace the person is obviously a friend so we add him. { printf("Friend request accepted.\n"); - m_addfriend_norequest(m, public_key); + m_addfriend_norequest(m2, public_key); } } diff --git a/testing/irc_syncbot.c b/testing/irc_syncbot.c index f72339a6..affc0296 100644 --- a/testing/irc_syncbot.c +++ b/testing/irc_syncbot.c @@ -47,9 +47,9 @@ static uint64_t get_monotime_sec(void) static int reconnect(void) { - int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + int new_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); - if (sock < 0) { + if (new_sock < 0) { printf("error socket\n"); return -1; } @@ -68,14 +68,14 @@ static int reconnect(void) addr4->sin_port = htons(port); - if (connect(sock, (struct sockaddr *)&addr, addrsize) != 0) { + if (connect(new_sock, (struct sockaddr *)&addr, addrsize) != 0) { printf("error connect\n"); return -1; } - send(sock, SERVER_CONNECT, sizeof(SERVER_CONNECT) - 1, MSG_NOSIGNAL); + send(new_sock, SERVER_CONNECT, sizeof(SERVER_CONNECT) - 1, MSG_NOSIGNAL); - return sock; + return new_sock; } #include "../toxcore/tox.h" @@ -256,9 +256,9 @@ static Tox *init_tox(int argc, char *argv[]) exit(1); } - uint16_t port = atoi(argv[argvoffset + 2]); + uint16_t bootstrap_port = atoi(argv[argvoffset + 2]); unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); - tox_bootstrap(tox, argv[argvoffset + 1], port, binary_string, 0); + tox_bootstrap(tox, argv[argvoffset + 1], bootstrap_port, binary_string, 0); free(binary_string); uint8_t *bin_id = hex_string_to_bin(temp_id); @@ -372,6 +372,4 @@ int main(int argc, char *argv[]) tox_iterate(tox, NULL); usleep(1000 * 50); } - - return 0; } diff --git a/testing/nTox.c b/testing/nTox.c index d620390d..3b24d903 100644 --- a/testing/nTox.c +++ b/testing/nTox.c @@ -1233,7 +1233,6 @@ static void file_print_control(Tox *tox, uint32_t friend_number, uint32_t file_n if (file_senders[i].file && file_senders[i].friendnum == friend_number && file_senders[i].filenumber == file_number) { fclose(file_senders[i].file); file_senders[i].file = 0; - char msg[512]; sprintf(msg, "[t] %u file transfer: %u cancelled", file_senders[i].friendnum, file_senders[i].filenumber); new_lines(msg); } diff --git a/testing/tox_shell.c b/testing/tox_shell.c index 7a6678ce..18aad9c7 100644 --- a/testing/tox_shell.c +++ b/testing/tox_shell.c @@ -159,6 +159,4 @@ int main(int argc, char *argv[]) tox_iterate(tox, master); c_sleep(1); } - - return 0; } diff --git a/testing/tox_sync.c b/testing/tox_sync.c index d90024b5..0c91abfd 100644 --- a/testing/tox_sync.c +++ b/testing/tox_sync.c @@ -333,6 +333,4 @@ int main(int argc, char *argv[]) tox_iterate(tox, NULL); c_sleep(1); } - - return 0; } diff --git a/toxav/msi.c b/toxav/msi.c index f1c40662..35686d2b 100644 --- a/toxav/msi.c +++ b/toxav/msi.c @@ -668,13 +668,13 @@ void handle_init(MSICall *call, const MSIMessage *msg) LOGGER_INFO(call->session->messenger->log, "Friend is recalling us"); - MSIMessage msg; - msg_init(&msg, requ_push); + MSIMessage out_msg; + msg_init(&out_msg, requ_push); - msg.capabilities.exists = true; - msg.capabilities.value = call->self_capabilities; + out_msg.capabilities.exists = true; + out_msg.capabilities.value = call->self_capabilities; - send_message(call->session->messenger, call->friend_number, &msg); + send_message(call->session->messenger, call->friend_number, &out_msg); /* If peer changed capabilities during re-call they will * be handled accordingly during the next step diff --git a/toxcore/DHT.c b/toxcore/DHT.c index ed03fac8..b3e68288 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c @@ -1686,10 +1686,10 @@ static void do_Close(DHT *dht) * so: reset all nodes to be BAD_NODE_TIMEOUT, but not * KILL_NODE_TIMEOUT, so we at least keep trying pings */ uint64_t badonly = unix_time() - BAD_NODE_TIMEOUT; - size_t i, a; + size_t j, a; - for (i = 0; i < LCLIENT_LIST; i++) { - Client_data *client = &dht->close_clientlist[i]; + for (j = 0; j < LCLIENT_LIST; j++) { + Client_data *client = &dht->close_clientlist[j]; IPPTsPng *assoc; for (a = 0, assoc = &client->assoc4; a < 2; a++, assoc = &client->assoc6) { diff --git a/toxcore/assoc.h b/toxcore/assoc.h index 811ccef4..1739d295 100644 --- a/toxcore/assoc.h +++ b/toxcore/assoc.h @@ -1,5 +1,5 @@ -#ifndef __ASSOC_H__ -#define __ASSOC_H__ +#ifndef ASSOC_H +#define ASSOC_H #include "DHT.h" #include "logger.h" @@ -105,4 +105,4 @@ void kill_Assoc(Assoc *assoc); void Assoc_status(Logger *log, const Assoc *assoc); -#endif /* !__ASSOC_H__ */ +#endif /* !ASSOC_H */ diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 16b3c6d2..13f73550 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -1552,8 +1552,6 @@ static int handle_packet_connection(Net_Crypto *c, int crypt_connection_id, cons return -1; } } - - return 0; } /* Set the size of the friend list to numfriends. @@ -2321,7 +2319,7 @@ static void send_crypto_packets(Net_Crypto *c) if (conn->status == CRYPTO_CONN_ESTABLISHED) { if (conn->packet_recv_rate > CRYPTO_PACKET_MIN_RATE) { - double request_packet_interval = (REQUEST_PACKETS_COMPARE_CONSTANT / (((double)num_packets_array( + double request_packet_interval = (REQUEST_PACKETS_COMPARE_CONSTANT / ((num_packets_array( &conn->recv_array) + 1.0) / (conn->packet_recv_rate + 1.0))); double request_packet_interval2 = ((CRYPTO_PACKET_MIN_RATE / conn->packet_recv_rate) * diff --git a/toxcore/network.c b/toxcore/network.c index 39e1fc98..386f8c16 100644 --- a/toxcore/network.c +++ b/toxcore/network.c @@ -21,7 +21,7 @@ * */ -#if (_WIN32_WINNT >= _WIN32_WINNT_WINXP) +#if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_WINXP #define _WIN32_WINNT 0x501 #endif diff --git a/toxcore/ping.h b/toxcore/ping.h index ed0caafa..4674c674 100644 --- a/toxcore/ping.h +++ b/toxcore/ping.h @@ -21,8 +21,8 @@ * You should have received a copy of the GNU General Public License * along with Tox. If not, see . */ -#ifndef __PING_H__ -#define __PING_H__ +#ifndef PING_H +#define PING_H #include "DHT.h" #include "network.h" @@ -49,4 +49,4 @@ void kill_ping(PING *ping); int send_ping_request(PING *ping, IP_Port ipp, const uint8_t *public_key); -#endif /* __PING_H__ */ +#endif /* PING_H */ diff --git a/toxcore/util.h b/toxcore/util.h index 20469b75..c435813b 100644 --- a/toxcore/util.h +++ b/toxcore/util.h @@ -22,8 +22,8 @@ * along with Tox. If not, see . */ -#ifndef __UTIL_H__ -#define __UTIL_H__ +#ifndef UTIL_H +#define UTIL_H #include #include @@ -58,4 +58,4 @@ int load_state(load_state_callback_func load_state_callback, void *outer, /* Returns -1 if failed or 0 if success */ int create_recursive_mutex(pthread_mutex_t *mutex); -#endif /* __UTIL_H__ */ +#endif /* UTIL_H */ diff --git a/toxdns/toxdns.c b/toxdns/toxdns.c index 6622d6a5..01380772 100644 --- a/toxdns/toxdns.c +++ b/toxdns/toxdns.c @@ -37,14 +37,14 @@ static const char base32[32] = { #define _encode(a, b, c) \ { \ -uint8_t i = 0; \ - while(i != c) { \ + uint8_t _i = 0; \ + while (_i != c) { \ *a++ = base32[((b[0] >> bits) | (b[1] << (8 - bits))) & 0x1F]; \ bits += 5; \ if(bits >= 8) { \ bits -= 8; \ b++; \ - i++; \ + _i++; \ } \ } \ }