diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-08-18 00:37:45 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-08-18 17:10:15 +0100 |
commit | 6935643f9aca68c135161a4e3bf046cbd075000c (patch) | |
tree | c5ce6174304d16444021761b2f7a5d70fe9b8f1c /auto_tests | |
parent | 390fcb6c27b757b02c0e61776f920f32fcc77dcf (diff) |
Fix some compiler warnings.
Diffstat (limited to 'auto_tests')
-rw-r--r-- | auto_tests/TCP_test.c | 8 | ||||
-rw-r--r-- | auto_tests/assoc_test.c | 1 | ||||
-rw-r--r-- | auto_tests/dht_test.c | 17 | ||||
-rw-r--r-- | auto_tests/encryptsave_test.c | 23 | ||||
-rw-r--r-- | auto_tests/onion_test.c | 4 | ||||
-rw-r--r-- | auto_tests/tox_test.c | 26 |
6 files changed, 33 insertions, 46 deletions
diff --git a/auto_tests/TCP_test.c b/auto_tests/TCP_test.c index 04c5dfe2..b08a04bc 100644 --- a/auto_tests/TCP_test.c +++ b/auto_tests/TCP_test.c | |||
@@ -91,7 +91,7 @@ START_TEST(test_basic) | |||
91 | uint8_t r_req[2 + 1 + crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES]; | 91 | uint8_t r_req[2 + 1 + crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES]; |
92 | uint16_t size = 1 + crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES; | 92 | uint16_t size = 1 + crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES; |
93 | size = htons(size); | 93 | size = htons(size); |
94 | ret = encrypt_data_symmetric(f_shared_key, f_nonce, r_req_p, 1 + crypto_box_PUBLICKEYBYTES, r_req + 2); | 94 | encrypt_data_symmetric(f_shared_key, f_nonce, r_req_p, 1 + crypto_box_PUBLICKEYBYTES, r_req + 2); |
95 | increment_nonce(f_nonce); | 95 | increment_nonce(f_nonce); |
96 | memcpy(r_req, &size, 2); | 96 | memcpy(r_req, &size, 2); |
97 | uint32_t i; | 97 | uint32_t i; |
@@ -587,7 +587,7 @@ START_TEST(test_tcp_connection) | |||
587 | do_tcp_connections(tc_1, NULL); | 587 | do_tcp_connections(tc_1, NULL); |
588 | do_tcp_connections(tc_2, NULL); | 588 | do_tcp_connections(tc_2, NULL); |
589 | 589 | ||
590 | int ret = send_packet_tcp_connection(tc_1, 0, "Gentoo", 6); | 590 | int ret = send_packet_tcp_connection(tc_1, 0, (const uint8_t *)"Gentoo", 6); |
591 | ck_assert_msg(ret == 0, "could not send packet."); | 591 | ck_assert_msg(ret == 0, "could not send packet."); |
592 | set_packet_tcp_connection_callback(tc_2, &tcp_data_callback, (void *) 120397); | 592 | set_packet_tcp_connection_callback(tc_2, &tcp_data_callback, (void *) 120397); |
593 | 593 | ||
@@ -608,7 +608,7 @@ START_TEST(test_tcp_connection) | |||
608 | do_tcp_connections(tc_1, NULL); | 608 | do_tcp_connections(tc_1, NULL); |
609 | do_tcp_connections(tc_2, NULL); | 609 | do_tcp_connections(tc_2, NULL); |
610 | 610 | ||
611 | ck_assert_msg(send_packet_tcp_connection(tc_1, 0, "Gentoo", 6) == -1, "could send packet."); | 611 | ck_assert_msg(send_packet_tcp_connection(tc_1, 0, (const uint8_t *)"Gentoo", 6) == -1, "could send packet."); |
612 | ck_assert_msg(kill_tcp_connection_to(tc_2, 0) == 0, "could not kill connection to\n"); | 612 | ck_assert_msg(kill_tcp_connection_to(tc_2, 0) == 0, "could not kill connection to\n"); |
613 | 613 | ||
614 | kill_TCP_server(tcp_s); | 614 | kill_TCP_server(tcp_s); |
@@ -684,7 +684,7 @@ START_TEST(test_tcp_connection2) | |||
684 | do_tcp_connections(tc_1, NULL); | 684 | do_tcp_connections(tc_1, NULL); |
685 | do_tcp_connections(tc_2, NULL); | 685 | do_tcp_connections(tc_2, NULL); |
686 | 686 | ||
687 | int ret = send_packet_tcp_connection(tc_1, 0, "Gentoo", 6); | 687 | int ret = send_packet_tcp_connection(tc_1, 0, (const uint8_t *)"Gentoo", 6); |
688 | ck_assert_msg(ret == 0, "could not send packet."); | 688 | ck_assert_msg(ret == 0, "could not send packet."); |
689 | set_oob_packet_tcp_connection_callback(tc_2, &tcp_oobdata_callback, tc_2); | 689 | set_oob_packet_tcp_connection_callback(tc_2, &tcp_oobdata_callback, tc_2); |
690 | set_packet_tcp_connection_callback(tc_1, &tcp_data_callback, (void *) 120397); | 690 | set_packet_tcp_connection_callback(tc_1, &tcp_data_callback, (void *) 120397); |
diff --git a/auto_tests/assoc_test.c b/auto_tests/assoc_test.c index 165724e9..47ac23dc 100644 --- a/auto_tests/assoc_test.c +++ b/auto_tests/assoc_test.c | |||
@@ -79,7 +79,6 @@ START_TEST(test_fillup) | |||
79 | IPPTs ippts_send; | 79 | IPPTs ippts_send; |
80 | IP_Port ipp_recv; | 80 | IP_Port ipp_recv; |
81 | }; | 81 | }; |
82 | unsigned int fail = 0; | ||
83 | struct entry entries[128]; | 82 | struct entry entries[128]; |
84 | struct entry closest[8]; | 83 | struct entry closest[8]; |
85 | 84 | ||
diff --git a/auto_tests/dht_test.c b/auto_tests/dht_test.c index ebe4f368..6d3f11ac 100644 --- a/auto_tests/dht_test.c +++ b/auto_tests/dht_test.c | |||
@@ -284,7 +284,9 @@ void test_addto_lists_good(DHT *dht, | |||
284 | ck_assert_msg(client_in_list(list, length, public_key) == -1, "Good client id is in the list"); | 284 | ck_assert_msg(client_in_list(list, length, public_key) == -1, "Good client id is in the list"); |
285 | } | 285 | } |
286 | 286 | ||
287 | void test_addto_lists(IP ip) | 287 | // These tests currently fail. |
288 | #if 0 | ||
289 | static void test_addto_lists(IP ip) | ||
288 | { | 290 | { |
289 | Networking_Core *net = new_networking(ip, TOX_PORT_DEFAULT); | 291 | Networking_Core *net = new_networking(ip, TOX_PORT_DEFAULT); |
290 | ck_assert_msg(net != 0, "Failed to create Networking_Core"); | 292 | ck_assert_msg(net != 0, "Failed to create Networking_Core"); |
@@ -353,7 +355,6 @@ START_TEST(test_addto_lists_ipv4) | |||
353 | IP ip; | 355 | IP ip; |
354 | ip_init(&ip, 0); | 356 | ip_init(&ip, 0); |
355 | test_addto_lists(ip); | 357 | test_addto_lists(ip); |
356 | |||
357 | } | 358 | } |
358 | END_TEST | 359 | END_TEST |
359 | 360 | ||
@@ -362,9 +363,9 @@ START_TEST(test_addto_lists_ipv6) | |||
362 | IP ip; | 363 | IP ip; |
363 | ip_init(&ip, 1); | 364 | ip_init(&ip, 1); |
364 | test_addto_lists(ip); | 365 | test_addto_lists(ip); |
365 | |||
366 | } | 366 | } |
367 | END_TEST | 367 | END_TEST |
368 | #endif | ||
368 | 369 | ||
369 | #define DHT_DEFAULT_PORT (TOX_PORT_DEFAULT + 20) | 370 | #define DHT_DEFAULT_PORT (TOX_PORT_DEFAULT + 20) |
370 | 371 | ||
@@ -575,10 +576,6 @@ START_TEST(test_DHT_test) | |||
575 | uint16_t tox2; | 576 | uint16_t tox2; |
576 | } pairs[NUM_DHT_FRIENDS]; | 577 | } pairs[NUM_DHT_FRIENDS]; |
577 | 578 | ||
578 | uint8_t address[TOX_ADDRESS_SIZE]; | ||
579 | |||
580 | unsigned int num_f = 0; | ||
581 | |||
582 | for (i = 0; i < NUM_DHT_FRIENDS; ++i) { | 579 | for (i = 0; i < NUM_DHT_FRIENDS; ++i) { |
583 | loop_top: | 580 | loop_top: |
584 | pairs[i].tox1 = rand() % NUM_DHT; | 581 | pairs[i].tox1 = rand() % NUM_DHT; |
@@ -637,8 +634,10 @@ Suite *dht_suite(void) | |||
637 | { | 634 | { |
638 | Suite *s = suite_create("DHT"); | 635 | Suite *s = suite_create("DHT"); |
639 | 636 | ||
640 | //DEFTESTCASE(addto_lists_ipv4); | 637 | #if 0 |
641 | //DEFTESTCASE(addto_lists_ipv6); | 638 | DEFTESTCASE(addto_lists_ipv4); |
639 | DEFTESTCASE(addto_lists_ipv6); | ||
640 | #endif | ||
642 | DEFTESTCASE_SLOW(list, 20); | 641 | DEFTESTCASE_SLOW(list, 20); |
643 | DEFTESTCASE_SLOW(DHT_test, 50); | 642 | DEFTESTCASE_SLOW(DHT_test, 50); |
644 | return s; | 643 | return s; |
diff --git a/auto_tests/encryptsave_test.c b/auto_tests/encryptsave_test.c index c970b756..a2a95758 100644 --- a/auto_tests/encryptsave_test.c +++ b/auto_tests/encryptsave_test.c | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | 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}; | 22 | 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}; |
23 | 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}; | 23 | 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}; |
24 | char *pw = "hunter2"; | 24 | const char *pw = "hunter2"; |
25 | unsigned int pwlen = 7; | 25 | unsigned int pwlen = 7; |
26 | 26 | ||
27 | unsigned char known_key2[crypto_box_BEFORENMBYTES] = {0x7a, 0xfa, 0x95, 0x45, 0x36, 0x8a, 0xa2, 0x5c, 0x40, 0xfd, 0xc0, 0xe2, 0x35, 0x8, 0x7, 0x88, 0xfa, 0xf9, 0x37, 0x86, 0xeb, 0xff, 0x50, 0x4f, 0x3, 0xe2, 0xf6, 0xd9, 0xef, 0x9, 0x17, 0x1}; | 27 | unsigned char known_key2[crypto_box_BEFORENMBYTES] = {0x7a, 0xfa, 0x95, 0x45, 0x36, 0x8a, 0xa2, 0x5c, 0x40, 0xfd, 0xc0, 0xe2, 0x35, 0x8, 0x7, 0x88, 0xfa, 0xf9, 0x37, 0x86, 0xeb, 0xff, 0x50, 0x4f, 0x3, 0xe2, 0xf6, 0xd9, 0xef, 0x9, 0x17, 0x1}; |
@@ -71,7 +71,7 @@ START_TEST(test_save_friend) | |||
71 | size_t size2 = size + TOX_PASS_ENCRYPTION_EXTRA_LENGTH; | 71 | size_t size2 = size + TOX_PASS_ENCRYPTION_EXTRA_LENGTH; |
72 | uint8_t enc_data[size2]; | 72 | uint8_t enc_data[size2]; |
73 | TOX_ERR_ENCRYPTION error1; | 73 | TOX_ERR_ENCRYPTION error1; |
74 | bool ret = tox_pass_encrypt(data, size, "correcthorsebatterystaple", 25, enc_data, &error1); | 74 | bool ret = tox_pass_encrypt(data, size, (const uint8_t *)"correcthorsebatterystaple", 25, enc_data, &error1); |
75 | ck_assert_msg(ret, "failed to encrypted save: %u", error1); | 75 | ck_assert_msg(ret, "failed to encrypted save: %u", error1); |
76 | ck_assert_msg(tox_is_data_encrypted(enc_data), "magic number missing"); | 76 | ck_assert_msg(tox_is_data_encrypted(enc_data), "magic number missing"); |
77 | 77 | ||
@@ -85,9 +85,10 @@ START_TEST(test_save_friend) | |||
85 | Tox *tox3 = tox_new(&options, &err2); | 85 | Tox *tox3 = tox_new(&options, &err2); |
86 | ck_assert_msg(err2 == TOX_ERR_NEW_LOAD_ENCRYPTED, "wrong error! %u. should fail with %u", err2, | 86 | ck_assert_msg(err2 == TOX_ERR_NEW_LOAD_ENCRYPTED, "wrong error! %u. should fail with %u", err2, |
87 | TOX_ERR_NEW_LOAD_ENCRYPTED); | 87 | TOX_ERR_NEW_LOAD_ENCRYPTED); |
88 | ck_assert_msg(tox3 == NULL, "tox_new with error should return NULL"); | ||
88 | uint8_t dec_data[size]; | 89 | uint8_t dec_data[size]; |
89 | TOX_ERR_DECRYPTION err3; | 90 | TOX_ERR_DECRYPTION err3; |
90 | ret = tox_pass_decrypt(enc_data, size2, "correcthorsebatterystaple", 25, dec_data, &err3); | 91 | ret = tox_pass_decrypt(enc_data, size2, (const uint8_t *)"correcthorsebatterystaple", 25, dec_data, &err3); |
91 | ck_assert_msg(ret, "failed to decrypt save: %u", err3); | 92 | ck_assert_msg(ret, "failed to decrypt save: %u", err3); |
92 | options.savedata_data = dec_data; | 93 | options.savedata_data = dec_data; |
93 | options.savedata_length = size; | 94 | options.savedata_length = size; |
@@ -111,7 +112,7 @@ START_TEST(test_save_friend) | |||
111 | ck_assert_msg(tox_is_data_encrypted(encdata2), "magic number the second missing"); | 112 | ck_assert_msg(tox_is_data_encrypted(encdata2), "magic number the second missing"); |
112 | 113 | ||
113 | uint8_t out1[size], out2[size]; | 114 | uint8_t out1[size], out2[size]; |
114 | ret = tox_pass_decrypt(encdata2, size2, pw, pwlen, out1, &err3); | 115 | ret = tox_pass_decrypt(encdata2, size2, (const uint8_t *)pw, pwlen, out1, &err3); |
115 | ck_assert_msg(ret, "failed to pw decrypt %u", err3); | 116 | ck_assert_msg(ret, "failed to pw decrypt %u", err3); |
116 | ret = tox_pass_key_decrypt(encdata2, size2, &key, out2, &err3); | 117 | ret = tox_pass_key_decrypt(encdata2, size2, &key, out2, &err3); |
117 | ck_assert_msg(ret, "failed to key decrypt %u", err3); | 118 | ck_assert_msg(ret, "failed to key decrypt %u", err3); |
@@ -141,16 +142,16 @@ START_TEST(test_keys) | |||
141 | TOX_ERR_DECRYPTION decerr; | 142 | TOX_ERR_DECRYPTION decerr; |
142 | TOX_ERR_KEY_DERIVATION keyerr; | 143 | TOX_ERR_KEY_DERIVATION keyerr; |
143 | TOX_PASS_KEY key; | 144 | TOX_PASS_KEY key; |
144 | bool ret = tox_derive_key_from_pass("123qweasdzxc", 12, &key, &keyerr); | 145 | bool ret = tox_derive_key_from_pass((const uint8_t *)"123qweasdzxc", 12, &key, &keyerr); |
145 | ck_assert_msg(ret, "generic failure 1: %u", keyerr); | 146 | ck_assert_msg(ret, "generic failure 1: %u", keyerr); |
146 | uint8_t *string = "No Patrick, mayonnaise is not an instrument."; // 44 | 147 | const uint8_t *string = (const uint8_t *)"No Patrick, mayonnaise is not an instrument."; // 44 |
147 | 148 | ||
148 | uint8_t encrypted[44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH]; | 149 | uint8_t encrypted[44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH]; |
149 | ret = tox_pass_key_encrypt(string, 44, &key, encrypted, &encerr); | 150 | ret = tox_pass_key_encrypt(string, 44, &key, encrypted, &encerr); |
150 | ck_assert_msg(ret, "generic failure 2: %u", encerr); | 151 | ck_assert_msg(ret, "generic failure 2: %u", encerr); |
151 | 152 | ||
152 | uint8_t encrypted2[44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH]; | 153 | uint8_t encrypted2[44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH]; |
153 | ret = tox_pass_encrypt(string, 44, "123qweasdzxc", 12, encrypted2, &encerr); | 154 | ret = tox_pass_encrypt(string, 44, (const uint8_t *)"123qweasdzxc", 12, encrypted2, &encerr); |
154 | ck_assert_msg(ret, "generic failure 3: %u", encerr); | 155 | ck_assert_msg(ret, "generic failure 3: %u", encerr); |
155 | 156 | ||
156 | uint8_t out1[44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH]; | 157 | uint8_t out1[44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH]; |
@@ -160,7 +161,8 @@ START_TEST(test_keys) | |||
160 | ck_assert_msg(ret, "generic failure 4: %u", decerr); | 161 | ck_assert_msg(ret, "generic failure 4: %u", decerr); |
161 | ck_assert_msg(memcmp(out1, string, 44) == 0, "decryption 1 failed"); | 162 | ck_assert_msg(memcmp(out1, string, 44) == 0, "decryption 1 failed"); |
162 | 163 | ||
163 | ret = tox_pass_decrypt(encrypted2, 44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH, "123qweasdzxc", 12, out2, &decerr); | 164 | ret = tox_pass_decrypt(encrypted2, 44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH, (const uint8_t *)"123qweasdzxc", 12, out2, |
165 | &decerr); | ||
164 | ck_assert_msg(ret, "generic failure 5: %u", decerr); | 166 | ck_assert_msg(ret, "generic failure 5: %u", decerr); |
165 | ck_assert_msg(memcmp(out2, string, 44) == 0, "decryption 2 failed"); | 167 | ck_assert_msg(memcmp(out2, string, 44) == 0, "decryption 2 failed"); |
166 | 168 | ||
@@ -169,14 +171,15 @@ START_TEST(test_keys) | |||
169 | ck_assert_msg(decerr != TOX_ERR_DECRYPTION_FAILED, "Bad error code %u", decerr); | 171 | ck_assert_msg(decerr != TOX_ERR_DECRYPTION_FAILED, "Bad error code %u", decerr); |
170 | 172 | ||
171 | // test that pass_decrypt can decrypt things from pass_key_encrypt | 173 | // test that pass_decrypt can decrypt things from pass_key_encrypt |
172 | ret = tox_pass_decrypt(encrypted, 44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH, "123qweasdzxc", 12, out1, &decerr); | 174 | ret = tox_pass_decrypt(encrypted, 44 + TOX_PASS_ENCRYPTION_EXTRA_LENGTH, (const uint8_t *)"123qweasdzxc", 12, out1, |
175 | &decerr); | ||
173 | ck_assert_msg(ret, "generic failure 6: %u", decerr); | 176 | ck_assert_msg(ret, "generic failure 6: %u", decerr); |
174 | ck_assert_msg(memcmp(out1, string, 44) == 0, "decryption 3 failed"); | 177 | ck_assert_msg(memcmp(out1, string, 44) == 0, "decryption 3 failed"); |
175 | 178 | ||
176 | uint8_t salt[TOX_PASS_SALT_LENGTH]; | 179 | uint8_t salt[TOX_PASS_SALT_LENGTH]; |
177 | ck_assert_msg(tox_get_salt(encrypted, salt), "couldn't get salt"); | 180 | ck_assert_msg(tox_get_salt(encrypted, salt), "couldn't get salt"); |
178 | TOX_PASS_KEY key2; | 181 | TOX_PASS_KEY key2; |
179 | ret = tox_derive_key_with_salt("123qweasdzxc", 12, salt, &key2, &keyerr); | 182 | ret = tox_derive_key_with_salt((const uint8_t *)"123qweasdzxc", 12, salt, &key2, &keyerr); |
180 | ck_assert_msg(ret, "generic failure 7: %u", keyerr); | 183 | ck_assert_msg(ret, "generic failure 7: %u", keyerr); |
181 | ck_assert_msg(0 == memcmp(&key, &key2, sizeof(TOX_PASS_KEY)), "salt comparison failed"); | 184 | ck_assert_msg(0 == memcmp(&key, &key2, sizeof(TOX_PASS_KEY)), "salt comparison failed"); |
182 | } | 185 | } |
diff --git a/auto_tests/onion_test.c b/auto_tests/onion_test.c index e28c4f11..279467dc 100644 --- a/auto_tests/onion_test.c +++ b/auto_tests/onion_test.c | |||
@@ -275,7 +275,7 @@ Onions *new_onions(uint16_t port) | |||
275 | DHT *dht = new_DHT(new_networking(ip, port)); | 275 | DHT *dht = new_DHT(new_networking(ip, port)); |
276 | on->onion = new_onion(dht); | 276 | on->onion = new_onion(dht); |
277 | on->onion_a = new_onion_announce(dht); | 277 | on->onion_a = new_onion_announce(dht); |
278 | TCP_Proxy_Info inf = {0}; | 278 | TCP_Proxy_Info inf = {{{0}}}; |
279 | on->onion_c = new_onion_client(new_net_crypto(dht, &inf)); | 279 | on->onion_c = new_onion_client(new_net_crypto(dht, &inf)); |
280 | 280 | ||
281 | if (on->onion && on->onion_a && on->onion_c) | 281 | if (on->onion && on->onion_a && on->onion_c) |
@@ -418,8 +418,6 @@ START_TEST(test_announce) | |||
418 | onion_dht_pk_callback(onions[NUM_FIRST]->onion_c, frnum_f, &dht_pk_callback, onions[NUM_FIRST], NUM_FIRST); | 418 | onion_dht_pk_callback(onions[NUM_FIRST]->onion_c, frnum_f, &dht_pk_callback, onions[NUM_FIRST], NUM_FIRST); |
419 | onion_dht_pk_callback(onions[NUM_LAST]->onion_c, frnum, &dht_pk_callback, onions[NUM_LAST], NUM_LAST); | 419 | onion_dht_pk_callback(onions[NUM_LAST]->onion_c, frnum, &dht_pk_callback, onions[NUM_LAST], NUM_LAST); |
420 | 420 | ||
421 | int ok = -1; | ||
422 | |||
423 | IP_Port ip_port; | 421 | IP_Port ip_port; |
424 | 422 | ||
425 | while (!first || !last) { | 423 | while (!first || !last) { |
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 458f40f8..00146318 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "config.h" | 14 | #include "config.h" |
15 | #endif | 15 | #endif |
16 | 16 | ||
17 | #include <sys/param.h> | ||
17 | #include <sys/types.h> | 18 | #include <sys/types.h> |
18 | #include <stdint.h> | 19 | #include <stdint.h> |
19 | #include <string.h> | 20 | #include <string.h> |
@@ -709,11 +710,7 @@ START_TEST(test_few_clients) | |||
709 | uint32_t tox2_interval = tox_iteration_interval(tox2); | 710 | uint32_t tox2_interval = tox_iteration_interval(tox2); |
710 | uint32_t tox3_interval = tox_iteration_interval(tox3); | 711 | uint32_t tox3_interval = tox_iteration_interval(tox3); |
711 | 712 | ||
712 | if (tox2_interval > tox3_interval) { | 713 | c_sleep(MIN(tox1_interval, MIN(tox2_interval, tox3_interval))); |
713 | c_sleep(tox3_interval); | ||
714 | } else { | ||
715 | c_sleep(tox2_interval); | ||
716 | } | ||
717 | } | 714 | } |
718 | 715 | ||
719 | printf("100MB file sent in %llu seconds\n", time(NULL) - f_time); | 716 | printf("100MB file sent in %llu seconds\n", time(NULL) - f_time); |
@@ -721,7 +718,6 @@ START_TEST(test_few_clients) | |||
721 | printf("Starting file streaming transfer test.\n"); | 718 | printf("Starting file streaming transfer test.\n"); |
722 | 719 | ||
723 | file_sending_done = file_accepted = file_size = file_recv = sendf_ok = size_recv = 0; | 720 | file_sending_done = file_accepted = file_size = file_recv = sendf_ok = size_recv = 0; |
724 | f_time = time(NULL); | ||
725 | tox_callback_file_recv_chunk(tox3, write_file, &to_compare); | 721 | tox_callback_file_recv_chunk(tox3, write_file, &to_compare); |
726 | tox_callback_file_recv_control(tox2, file_print_control, &to_compare); | 722 | tox_callback_file_recv_control(tox2, file_print_control, &to_compare); |
727 | tox_callback_file_chunk_request(tox2, tox_file_chunk_request, &to_compare); | 723 | tox_callback_file_chunk_request(tox2, tox_file_chunk_request, &to_compare); |
@@ -762,17 +758,12 @@ START_TEST(test_few_clients) | |||
762 | uint32_t tox2_interval = tox_iteration_interval(tox2); | 758 | uint32_t tox2_interval = tox_iteration_interval(tox2); |
763 | uint32_t tox3_interval = tox_iteration_interval(tox3); | 759 | uint32_t tox3_interval = tox_iteration_interval(tox3); |
764 | 760 | ||
765 | if (tox2_interval > tox3_interval) { | 761 | c_sleep(MIN(tox1_interval, MIN(tox2_interval, tox3_interval))); |
766 | c_sleep(tox3_interval); | ||
767 | } else { | ||
768 | c_sleep(tox2_interval); | ||
769 | } | ||
770 | } | 762 | } |
771 | 763 | ||
772 | printf("Starting file 0 transfer test.\n"); | 764 | printf("Starting file 0 transfer test.\n"); |
773 | 765 | ||
774 | file_sending_done = file_accepted = file_size = file_recv = sendf_ok = size_recv = 0; | 766 | file_sending_done = file_accepted = file_size = file_recv = sendf_ok = size_recv = 0; |
775 | f_time = time(NULL); | ||
776 | tox_callback_file_recv_chunk(tox3, write_file, &to_compare); | 767 | tox_callback_file_recv_chunk(tox3, write_file, &to_compare); |
777 | tox_callback_file_recv_control(tox2, file_print_control, &to_compare); | 768 | tox_callback_file_recv_control(tox2, file_print_control, &to_compare); |
778 | tox_callback_file_chunk_request(tox2, tox_file_chunk_request, &to_compare); | 769 | tox_callback_file_chunk_request(tox2, tox_file_chunk_request, &to_compare); |
@@ -810,11 +801,7 @@ START_TEST(test_few_clients) | |||
810 | uint32_t tox2_interval = tox_iteration_interval(tox2); | 801 | uint32_t tox2_interval = tox_iteration_interval(tox2); |
811 | uint32_t tox3_interval = tox_iteration_interval(tox3); | 802 | uint32_t tox3_interval = tox_iteration_interval(tox3); |
812 | 803 | ||
813 | if (tox2_interval > tox3_interval) { | 804 | c_sleep(MIN(tox1_interval, MIN(tox2_interval, tox3_interval))); |
814 | c_sleep(tox3_interval); | ||
815 | } else { | ||
816 | c_sleep(tox2_interval); | ||
817 | } | ||
818 | } | 805 | } |
819 | 806 | ||
820 | printf("test_few_clients succeeded, took %llu seconds\n", time(NULL) - cur_time); | 807 | printf("test_few_clients succeeded, took %llu seconds\n", time(NULL) - cur_time); |
@@ -988,7 +975,7 @@ loop_top: | |||
988 | } | 975 | } |
989 | 976 | ||
990 | while (1) { | 977 | while (1) { |
991 | uint16_t counter = 0, cc = 0; | 978 | uint16_t counter = 0; |
992 | 979 | ||
993 | for (i = 0; i < NUM_TOXES_TCP; ++i) { | 980 | for (i = 0; i < NUM_TOXES_TCP; ++i) { |
994 | for (j = 0; j < tox_self_get_friend_list_size(toxes[i]); ++j) | 981 | for (j = 0; j < tox_self_get_friend_list_size(toxes[i]); ++j) |
@@ -1216,7 +1203,8 @@ group_test_restart: | |||
1216 | 1203 | ||
1217 | ck_assert_msg(tox_add_groupchat(toxes[0]) != -1, "Failed to create group"); | 1204 | ck_assert_msg(tox_add_groupchat(toxes[0]) != -1, "Failed to create group"); |
1218 | ck_assert_msg(tox_invite_friend(toxes[0], 0, 0) == 0, "Failed to invite friend"); | 1205 | ck_assert_msg(tox_invite_friend(toxes[0], 0, 0) == 0, "Failed to invite friend"); |
1219 | ck_assert_msg(tox_group_set_title(toxes[0], 0, "Gentoo", sizeof("Gentoo") - 1) == 0, "Failed to set group title"); | 1206 | ck_assert_msg(tox_group_set_title(toxes[0], 0, (const uint8_t *)"Gentoo", sizeof("Gentoo") - 1) == 0, |
1207 | "Failed to set group title"); | ||
1220 | invite_counter = ~0; | 1208 | invite_counter = ~0; |
1221 | 1209 | ||
1222 | unsigned int done = ~0; | 1210 | unsigned int done = ~0; |