summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-01-28 21:30:39 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-01-30 23:35:50 +0000
commit92ffad1a72bc8c422426d52ac408bd71242dd047 (patch)
treef592f353068dd2043525dd2cc04d6124a4ed4bc4 /testing
parent623e9ac331df7323660e21c8a2226523a5ee713b (diff)
Use nullptr as NULL pointer constant instead of NULL or 0.
This changes only code, no string literals or comments.
Diffstat (limited to 'testing')
-rw-r--r--testing/BUILD.bazel1
-rw-r--r--testing/DHT_test.c4
-rw-r--r--testing/Messenger_test.c6
-rw-r--r--testing/av_test.c78
-rw-r--r--testing/irc_syncbot.c16
-rw-r--r--testing/misc_tools.c7
-rw-r--r--testing/tox_shell.c4
-rw-r--r--testing/tox_sync.c4
8 files changed, 64 insertions, 56 deletions
diff --git a/testing/BUILD.bazel b/testing/BUILD.bazel
index 3c8f8293..37141cbd 100644
--- a/testing/BUILD.bazel
+++ b/testing/BUILD.bazel
@@ -6,6 +6,7 @@ cc_library(
6 "misc_tools.c", 6 "misc_tools.c",
7 ], 7 ],
8 visibility = ["//c-toxcore:__subpackages__"], 8 visibility = ["//c-toxcore:__subpackages__"],
9 deps = ["//c-toxcore/toxcore:ccompat"],
9) 10)
10 11
11cc_binary( 12cc_binary(
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index c9d34238..c7db4092 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -190,7 +190,7 @@ int main(int argc, char *argv[])
190 IP ip; 190 IP ip;
191 ip_init(&ip, ipv6enabled); 191 ip_init(&ip, ipv6enabled);
192 192
193 DHT *dht = new_DHT(NULL, new_networking(NULL, ip, PORT), true); 193 DHT *dht = new_DHT(nullptr, new_networking(nullptr, ip, PORT), true);
194 printf("OUR ID: "); 194 printf("OUR ID: ");
195 uint32_t i; 195 uint32_t i;
196 196
@@ -252,7 +252,7 @@ int main(int argc, char *argv[])
252 } 252 }
253 253
254#endif 254#endif
255 networking_poll(dht_get_net(dht), NULL); 255 networking_poll(dht_get_net(dht), nullptr);
256 256
257 print_clientlist(dht); 257 print_clientlist(dht);
258 print_friendlist(dht); 258 print_friendlist(dht);
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c
index 8d0c8515..50e0fa57 100644
--- a/testing/Messenger_test.c
+++ b/testing/Messenger_test.c
@@ -132,7 +132,7 @@ int main(int argc, char *argv[])
132 } else { 132 } else {
133 FILE *file = fopen(argv[argvoffset + 1], "rb"); 133 FILE *file = fopen(argv[argvoffset + 1], "rb");
134 134
135 if (file == NULL) { 135 if (file == nullptr) {
136 printf("Failed to open \"%s\" - does it exist?\n", argv[argvoffset + 1]); 136 printf("Failed to open \"%s\" - does it exist?\n", argv[argvoffset + 1]);
137 return 1; 137 return 1;
138 } 138 }
@@ -185,11 +185,11 @@ int main(int argc, char *argv[])
185 printf("%s\n", name); 185 printf("%s\n", name);
186 186
187 m_send_message_generic(m, num, MESSAGE_NORMAL, (const uint8_t *)"Test", 5, 0); 187 m_send_message_generic(m, num, MESSAGE_NORMAL, (const uint8_t *)"Test", 5, 0);
188 do_messenger(m, NULL); 188 do_messenger(m, nullptr);
189 c_sleep(30); 189 c_sleep(30);
190 FILE *file = fopen("Save.bak", "wb"); 190 FILE *file = fopen("Save.bak", "wb");
191 191
192 if (file == NULL) { 192 if (file == nullptr) {
193 return 1; 193 return 1;
194 } 194 }
195 195
diff --git a/testing/av_test.c b/testing/av_test.c
index ce982e32..0d61edec 100644
--- a/testing/av_test.c
+++ b/testing/av_test.c
@@ -111,7 +111,7 @@ struct toxav_thread_data {
111}; 111};
112 112
113static const char *vdout = "AV Test"; /* Video output */ 113static const char *vdout = "AV Test"; /* Video output */
114static PaStream *adout = NULL; /* Audio output */ 114static PaStream *adout = nullptr; /* Audio output */
115 115
116typedef struct { 116typedef struct {
117 uint16_t size; 117 uint16_t size;
@@ -139,7 +139,7 @@ static void *pa_write_thread(void *d)
139 } 139 }
140 } 140 }
141 141
142 return NULL; 142 return nullptr;
143} 143}
144 144
145/** 145/**
@@ -224,7 +224,7 @@ static void t_accept_friend_request_cb(Tox *m, const uint8_t *public_key, const
224 void *userdata) 224 void *userdata)
225{ 225{
226 if (length == 7 && memcmp("gentoo", data, 7) == 0) { 226 if (length == 7 && memcmp("gentoo", data, 7) == 0) {
227 assert(tox_friend_add_norequest(m, public_key, NULL) != (uint32_t) ~0); 227 assert(tox_friend_add_norequest(m, public_key, nullptr) != (uint32_t) ~0);
228 } 228 }
229} 229}
230 230
@@ -235,8 +235,8 @@ static void initialize_tox(Tox **bootstrap, ToxAV **AliceAV, CallControl *AliceC
235 Tox *Alice; 235 Tox *Alice;
236 Tox *Bob; 236 Tox *Bob;
237 237
238 struct Tox_Options *opts = tox_options_new(NULL); 238 struct Tox_Options *opts = tox_options_new(nullptr);
239 assert(opts != NULL); 239 assert(opts != nullptr);
240 240
241 tox_options_set_end_port(opts, 0); 241 tox_options_set_end_port(opts, 0);
242 tox_options_set_ipv6_enabled(opts, false); 242 tox_options_set_ipv6_enabled(opts, false);
@@ -261,7 +261,7 @@ static void initialize_tox(Tox **bootstrap, ToxAV **AliceAV, CallControl *AliceC
261 261
262 printf("Created 3 instances of Tox\n"); 262 printf("Created 3 instances of Tox\n");
263 printf("Preparing network...\n"); 263 printf("Preparing network...\n");
264 long long unsigned int cur_time = time(NULL); 264 long long unsigned int cur_time = time(nullptr);
265 265
266 uint32_t to_compare = 974536; 266 uint32_t to_compare = 974536;
267 uint8_t address[TOX_ADDRESS_SIZE]; 267 uint8_t address[TOX_ADDRESS_SIZE];
@@ -270,7 +270,7 @@ static void initialize_tox(Tox **bootstrap, ToxAV **AliceAV, CallControl *AliceC
270 tox_self_get_address(Alice, address); 270 tox_self_get_address(Alice, address);
271 271
272 272
273 assert(tox_friend_add(Bob, address, (const uint8_t *)"gentoo", 7, NULL) != (uint32_t) ~0); 273 assert(tox_friend_add(Bob, address, (const uint8_t *)"gentoo", 7, nullptr) != (uint32_t) ~0);
274 274
275 uint8_t off = 1; 275 uint8_t off = 1;
276 276
@@ -282,12 +282,12 @@ static void initialize_tox(Tox **bootstrap, ToxAV **AliceAV, CallControl *AliceC
282 if (tox_self_get_connection_status(*bootstrap) && 282 if (tox_self_get_connection_status(*bootstrap) &&
283 tox_self_get_connection_status(Alice) && 283 tox_self_get_connection_status(Alice) &&
284 tox_self_get_connection_status(Bob) && off) { 284 tox_self_get_connection_status(Bob) && off) {
285 printf("Toxes are online, took %llu seconds\n", time(NULL) - cur_time); 285 printf("Toxes are online, took %llu seconds\n", time(nullptr) - cur_time);
286 off = 0; 286 off = 0;
287 } 287 }
288 288
289 if (tox_friend_get_connection_status(Alice, 0, NULL) == TOX_CONNECTION_UDP && 289 if (tox_friend_get_connection_status(Alice, 0, nullptr) == TOX_CONNECTION_UDP &&
290 tox_friend_get_connection_status(Bob, 0, NULL) == TOX_CONNECTION_UDP) { 290 tox_friend_get_connection_status(Bob, 0, nullptr) == TOX_CONNECTION_UDP) {
291 break; 291 break;
292 } 292 }
293 293
@@ -321,7 +321,7 @@ static void initialize_tox(Tox **bootstrap, ToxAV **AliceAV, CallControl *AliceC
321 321
322 322
323 printf("Created 2 instances of ToxAV\n"); 323 printf("Created 2 instances of ToxAV\n");
324 printf("All set after %llu seconds!\n", time(NULL) - cur_time); 324 printf("All set after %llu seconds!\n", time(nullptr) - cur_time);
325} 325}
326static int iterate_tox(Tox *bootstrap, ToxAV *AliceAV, ToxAV *BobAV, void *userdata) 326static int iterate_tox(Tox *bootstrap, ToxAV *AliceAV, ToxAV *BobAV, void *userdata)
327{ 327{
@@ -364,7 +364,7 @@ static void *iterate_toxav(void *data)
364 cvDestroyWindow(vdout); 364 cvDestroyWindow(vdout);
365#endif 365#endif
366 366
367 pthread_exit(NULL); 367 pthread_exit(nullptr);
368} 368}
369 369
370static int send_opencv_img(ToxAV *av, uint32_t friend_number, const IplImage *img) 370static int send_opencv_img(ToxAV *av, uint32_t friend_number, const IplImage *img)
@@ -399,7 +399,7 @@ static int send_opencv_img(ToxAV *av, uint32_t friend_number, const IplImage *im
399 } 399 }
400 400
401 int rc = toxav_video_send_frame(av, friend_number, img->width, img->height, 401 int rc = toxav_video_send_frame(av, friend_number, img->width, img->height,
402 planes[0], planes[1], planes[2], NULL); 402 planes[0], planes[1], planes[2], nullptr);
403 free(planes[0]); 403 free(planes[0]);
404 free(planes[1]); 404 free(planes[1]);
405 free(planes[2]); 405 free(planes[2]);
@@ -441,8 +441,8 @@ int main(int argc, char **argv)
441 struct stat st; 441 struct stat st;
442 442
443 /* AV files for testing */ 443 /* AV files for testing */
444 const char *af_name = NULL; 444 const char *af_name = nullptr;
445 const char *vf_name = NULL; 445 const char *vf_name = nullptr;
446 long audio_out_dev_idx = -1; 446 long audio_out_dev_idx = -1;
447 447
448 int32_t audio_frame_duration = 20; 448 int32_t audio_frame_duration = 20;
@@ -574,8 +574,8 @@ CHECK_ARG:
574 memset(&AliceCC, 0, sizeof(CallControl)); 574 memset(&AliceCC, 0, sizeof(CallControl));
575 memset(&BobCC, 0, sizeof(CallControl)); 575 memset(&BobCC, 0, sizeof(CallControl));
576 576
577 pthread_mutex_init(AliceCC.arb_mutex, NULL); 577 pthread_mutex_init(AliceCC.arb_mutex, nullptr);
578 pthread_mutex_init(BobCC.arb_mutex, NULL); 578 pthread_mutex_init(BobCC.arb_mutex, nullptr);
579 579
580 AliceCC.arb = rb_new(16); 580 AliceCC.arb = rb_new(16);
581 BobCC.arb = rb_new(16); 581 BobCC.arb = rb_new(16);
@@ -591,7 +591,7 @@ CHECK_ARG:
591 } 591 }
592 592
593 while (!BobCC.incoming) { 593 while (!BobCC.incoming) {
594 iterate_tox(bootstrap, AliceAV, BobAV, NULL); 594 iterate_tox(bootstrap, AliceAV, BobAV, nullptr);
595 } 595 }
596 596
597 { /* Answer */ 597 { /* Answer */
@@ -605,20 +605,20 @@ CHECK_ARG:
605 } 605 }
606 606
607 while (AliceCC.state == 0) { 607 while (AliceCC.state == 0) {
608 iterate_tox(bootstrap, AliceAV, BobAV, NULL); 608 iterate_tox(bootstrap, AliceAV, BobAV, nullptr);
609 } 609 }
610 610
611 /* Open audio file */ 611 /* Open audio file */
612 af_handle = sf_open(af_name, SFM_READ, &af_info); 612 af_handle = sf_open(af_name, SFM_READ, &af_info);
613 613
614 if (af_handle == NULL) { 614 if (af_handle == nullptr) {
615 printf("Failed to open the file.\n"); 615 printf("Failed to open the file.\n");
616 exit(1); 616 exit(1);
617 } 617 }
618 618
619 int16_t PCM[5760]; 619 int16_t PCM[5760];
620 620
621 time_t start_time = time(NULL); 621 time_t start_time = time(nullptr);
622 time_t expected_time = af_info.frames / af_info.samplerate + 2; 622 time_t expected_time = af_info.frames / af_info.samplerate + 2;
623 623
624 624
@@ -630,7 +630,7 @@ CHECK_ARG:
630 }; 630 };
631 631
632 pthread_t dect; 632 pthread_t dect;
633 pthread_create(&dect, NULL, iterate_toxav, &data); 633 pthread_create(&dect, nullptr, iterate_toxav, &data);
634 pthread_detach(dect); 634 pthread_detach(dect);
635 635
636 int frame_size = (af_info.samplerate * audio_frame_duration / 1000) * af_info.channels; 636 int frame_size = (af_info.samplerate * audio_frame_duration / 1000) * af_info.channels;
@@ -640,24 +640,24 @@ CHECK_ARG:
640 output.channelCount = af_info.channels; 640 output.channelCount = af_info.channels;
641 output.sampleFormat = paInt16; 641 output.sampleFormat = paInt16;
642 output.suggestedLatency = audio_dev->defaultHighOutputLatency; 642 output.suggestedLatency = audio_dev->defaultHighOutputLatency;
643 output.hostApiSpecificStreamInfo = NULL; 643 output.hostApiSpecificStreamInfo = nullptr;
644 644
645 PaError err = Pa_OpenStream(&adout, NULL, &output, af_info.samplerate, frame_size, paNoFlag, NULL, NULL); 645 PaError err = Pa_OpenStream(&adout, nullptr, &output, af_info.samplerate, frame_size, paNoFlag, nullptr, nullptr);
646 assert(err == paNoError); 646 assert(err == paNoError);
647 647
648 err = Pa_StartStream(adout); 648 err = Pa_StartStream(adout);
649 assert(err == paNoError); 649 assert(err == paNoError);
650 650
651// toxav_audio_bit_rate_set(AliceAV, 0, 64, false, NULL); 651// toxav_audio_bit_rate_set(AliceAV, 0, 64, false, nullptr);
652 652
653 /* Start write thread */ 653 /* Start write thread */
654 pthread_t t; 654 pthread_t t;
655 pthread_create(&t, NULL, pa_write_thread, &BobCC); 655 pthread_create(&t, nullptr, pa_write_thread, &BobCC);
656 pthread_detach(t); 656 pthread_detach(t);
657 657
658 printf("Sample rate %d\n", af_info.samplerate); 658 printf("Sample rate %d\n", af_info.samplerate);
659 659
660 while (start_time + expected_time > time(NULL)) { 660 while (start_time + expected_time > time(nullptr)) {
661 uint64_t enc_start_time = current_time_monotonic(); 661 uint64_t enc_start_time = current_time_monotonic();
662 int64_t count = sf_read_short(af_handle, PCM, frame_size); 662 int64_t count = sf_read_short(af_handle, PCM, frame_size);
663 663
@@ -670,11 +670,11 @@ CHECK_ARG:
670 } 670 }
671 } 671 }
672 672
673 iterate_tox(bootstrap, AliceAV, BobAV, NULL); 673 iterate_tox(bootstrap, AliceAV, BobAV, nullptr);
674 c_sleep((audio_frame_duration - (current_time_monotonic() - enc_start_time) - 1)); 674 c_sleep((audio_frame_duration - (current_time_monotonic() - enc_start_time) - 1));
675 } 675 }
676 676
677 printf("Played file in: %lu; stopping stream...\n", time(NULL) - start_time); 677 printf("Played file in: %lu; stopping stream...\n", time(nullptr) - start_time);
678 678
679 Pa_StopStream(adout); 679 Pa_StopStream(adout);
680 sf_close(af_handle); 680 sf_close(af_handle);
@@ -689,7 +689,7 @@ CHECK_ARG:
689 } 689 }
690 } 690 }
691 691
692 iterate_tox(bootstrap, AliceAV, BobAV, NULL); 692 iterate_tox(bootstrap, AliceAV, BobAV, nullptr);
693 assert(BobCC.state == TOXAV_FRIEND_CALL_STATE_FINISHED); 693 assert(BobCC.state == TOXAV_FRIEND_CALL_STATE_FINISHED);
694 694
695 /* Stop decode thread */ 695 /* Stop decode thread */
@@ -702,7 +702,7 @@ CHECK_ARG:
702 pthread_mutex_destroy(AliceCC.arb_mutex); 702 pthread_mutex_destroy(AliceCC.arb_mutex);
703 pthread_mutex_destroy(BobCC.arb_mutex); 703 pthread_mutex_destroy(BobCC.arb_mutex);
704 704
705 void *f = NULL; 705 void *f = nullptr;
706 706
707 while (rb_read(AliceCC.arb, &f)) { 707 while (rb_read(AliceCC.arb, &f)) {
708 free(f); 708 free(f);
@@ -732,7 +732,7 @@ CHECK_ARG:
732 } 732 }
733 733
734 while (!BobCC.incoming) { 734 while (!BobCC.incoming) {
735 iterate_tox(bootstrap, AliceAV, BobAV, NULL); 735 iterate_tox(bootstrap, AliceAV, BobAV, nullptr);
736 } 736 }
737 737
738 { /* Answer */ 738 { /* Answer */
@@ -745,7 +745,7 @@ CHECK_ARG:
745 } 745 }
746 } 746 }
747 747
748 iterate_tox(bootstrap, AliceAV, BobAV, NULL); 748 iterate_tox(bootstrap, AliceAV, BobAV, nullptr);
749 749
750 /* Start decode thread */ 750 /* Start decode thread */
751 struct toxav_thread_data data = { 751 struct toxav_thread_data data = {
@@ -755,7 +755,7 @@ CHECK_ARG:
755 }; 755 };
756 756
757 pthread_t dect; 757 pthread_t dect;
758 pthread_create(&dect, NULL, iterate_toxav, &data); 758 pthread_create(&dect, nullptr, iterate_toxav, &data);
759 pthread_detach(dect); 759 pthread_detach(dect);
760 760
761 CvCapture *capture = cvCreateFileCapture(vf_name); 761 CvCapture *capture = cvCreateFileCapture(vf_name);
@@ -766,12 +766,12 @@ CHECK_ARG:
766 } 766 }
767 767
768#if 0 768#if 0
769 toxav_video_bit_rate_set(AliceAV, 0, 5000, false, NULL); 769 toxav_video_bit_rate_set(AliceAV, 0, 5000, false, nullptr);
770#endif 770#endif
771 771
772 time_t start_time = time(NULL); 772 time_t start_time = time(nullptr);
773 773
774 while (start_time + 90 > time(NULL)) { 774 while (start_time + 90 > time(nullptr)) {
775 IplImage *frame = cvQueryFrame(capture); 775 IplImage *frame = cvQueryFrame(capture);
776 776
777 if (!frame) { 777 if (!frame) {
@@ -779,7 +779,7 @@ CHECK_ARG:
779 } 779 }
780 780
781 send_opencv_img(AliceAV, 0, frame); 781 send_opencv_img(AliceAV, 0, frame);
782 iterate_tox(bootstrap, AliceAV, BobAV, NULL); 782 iterate_tox(bootstrap, AliceAV, BobAV, nullptr);
783 c_sleep(10); 783 c_sleep(10);
784 } 784 }
785 785
@@ -795,7 +795,7 @@ CHECK_ARG:
795 } 795 }
796 } 796 }
797 797
798 iterate_tox(bootstrap, AliceAV, BobAV, NULL); 798 iterate_tox(bootstrap, AliceAV, BobAV, nullptr);
799 assert(BobCC.state == TOXAV_FRIEND_CALL_STATE_FINISHED); 799 assert(BobCC.state == TOXAV_FRIEND_CALL_STATE_FINISHED);
800 800
801 /* Stop decode thread */ 801 /* Stop decode thread */
diff --git a/testing/irc_syncbot.c b/testing/irc_syncbot.c
index 83b86a19..329dfb85 100644
--- a/testing/irc_syncbot.c
+++ b/testing/irc_syncbot.c
@@ -94,7 +94,7 @@ static void callback_group_invite(Tox *tox, uint32_t fid, TOX_CONFERENCE_TYPE ty
94 void *userdata) 94 void *userdata)
95{ 95{
96 if (current_group == -1) { 96 if (current_group == -1) {
97 current_group = tox_conference_join(tox, fid, data, length, NULL); 97 current_group = tox_conference_join(tox, fid, data, length, nullptr);
98 } 98 }
99} 99}
100 100
@@ -103,13 +103,13 @@ static void callback_friend_message(Tox *tox, uint32_t fid, TOX_MESSAGE_TYPE typ
103 void *userdata) 103 void *userdata)
104{ 104{
105 if (length == 1 && *message == 'c') { 105 if (length == 1 && *message == 'c') {
106 if (tox_conference_delete(tox, current_group, NULL) == 0) { 106 if (tox_conference_delete(tox, current_group, nullptr) == 0) {
107 current_group = -1; 107 current_group = -1;
108 } 108 }
109 } 109 }
110 110
111 if (length == 1 && *message == 'i') { 111 if (length == 1 && *message == 'i') {
112 tox_conference_invite(tox, fid, current_group, NULL); 112 tox_conference_invite(tox, fid, current_group, nullptr);
113 } 113 }
114 114
115 if (length == 1 && *message == 'j' && sock >= 0) { 115 if (length == 1 && *message == 'j' && sock >= 0) {
@@ -121,14 +121,14 @@ static void copy_groupmessage(Tox *tox, uint32_t groupnumber, uint32_t friendgro
121 const uint8_t *message, size_t length, 121 const uint8_t *message, size_t length,
122 void *userdata) 122 void *userdata)
123{ 123{
124 if (tox_conference_peer_number_is_ours(tox, groupnumber, friendgroupnumber, NULL)) { 124 if (tox_conference_peer_number_is_ours(tox, groupnumber, friendgroupnumber, nullptr)) {
125 return; 125 return;
126 } 126 }
127 127
128 TOX_ERR_CONFERENCE_PEER_QUERY error; 128 TOX_ERR_CONFERENCE_PEER_QUERY error;
129 size_t namelen = tox_conference_peer_get_name_size(tox, groupnumber, friendgroupnumber, &error); 129 size_t namelen = tox_conference_peer_get_name_size(tox, groupnumber, friendgroupnumber, &error);
130 uint8_t name[TOX_MAX_NAME_LENGTH]; 130 uint8_t name[TOX_MAX_NAME_LENGTH];
131 tox_conference_peer_get_name(tox, groupnumber, friendgroupnumber, name, NULL); 131 tox_conference_peer_get_name(tox, groupnumber, friendgroupnumber, name, nullptr);
132 132
133 if (namelen == 0 || error != TOX_ERR_CONFERENCE_PEER_QUERY_OK) { 133 if (namelen == 0 || error != TOX_ERR_CONFERENCE_PEER_QUERY_OK) {
134 memcpy(name, "<unknown>", 9); 134 memcpy(name, "<unknown>", 9);
@@ -205,7 +205,7 @@ static void send_irc_group(Tox *tox, uint8_t *msg, uint16_t len)
205 205
206 uint8_t *pmsg = (uint8_t *)strstr((char *)req, " PRIVMSG"); 206 uint8_t *pmsg = (uint8_t *)strstr((char *)req, " PRIVMSG");
207 207
208 if (pmsg == NULL) { 208 if (pmsg == nullptr) {
209 return; 209 return;
210 } 210 }
211 211
@@ -227,7 +227,7 @@ static void send_irc_group(Tox *tox, uint8_t *msg, uint16_t len)
227 227
228 memcpy(message + length, msg + req_len + 2, len - (req_len + 2)); 228 memcpy(message + length, msg + req_len + 2, len - (req_len + 2));
229 length += len - (req_len + 2); 229 length += len - (req_len + 2);
230 tox_conference_send_message(tox, current_group, TOX_MESSAGE_TYPE_NORMAL, message, length, NULL); 230 tox_conference_send_message(tox, current_group, TOX_MESSAGE_TYPE_NORMAL, message, length, nullptr);
231} 231}
232 232
233static Tox *init_tox(int argc, char *argv[]) 233static Tox *init_tox(int argc, char *argv[])
@@ -377,7 +377,7 @@ int main(int argc, char *argv[])
377 } 377 }
378 } 378 }
379 379
380 tox_iterate(tox, NULL); 380 tox_iterate(tox, nullptr);
381 usleep(1000 * 50); 381 usleep(1000 * 50);
382 } 382 }
383} 383}
diff --git a/testing/misc_tools.c b/testing/misc_tools.c
index a3a89c2f..14e0ba7e 100644
--- a/testing/misc_tools.c
+++ b/testing/misc_tools.c
@@ -21,6 +21,9 @@
21 * You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 * along with Tox. If not, see <http://www.gnu.org/licenses/>. 22 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
23 */ 23 */
24#ifndef MISC_TOOLS_C
25#define MISC_TOOLS_C
26
24#ifdef HAVE_CONFIG_H 27#ifdef HAVE_CONFIG_H
25#include "config.h" 28#include "config.h"
26#endif 29#endif
@@ -42,6 +45,8 @@
42#endif 45#endif
43#endif 46#endif
44 47
48#include "../toxcore/ccompat.h"
49
45// You are responsible for freeing the return value! 50// You are responsible for freeing the return value!
46uint8_t *hex_string_to_bin(const char *hex_string) 51uint8_t *hex_string_to_bin(const char *hex_string)
47{ 52{
@@ -111,3 +116,5 @@ int cmdline_parsefor_ipv46(int argc, char **argv, uint8_t *ipv6enabled)
111 116
112 return argvoffset; 117 return argvoffset;
113} 118}
119
120#endif // MISC_TOOLS_C
diff --git a/testing/tox_shell.c b/testing/tox_shell.c
index 43e0b544..d0f38e24 100644
--- a/testing/tox_shell.c
+++ b/testing/tox_shell.c
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
77 } 77 }
78 78
79 int *master = (int *)malloc(sizeof(int)); 79 int *master = (int *)malloc(sizeof(int));
80 int ret = forkpty(master, NULL, NULL, NULL); 80 int ret = forkpty(master, nullptr, nullptr, nullptr);
81 81
82 if (ret == -1) { 82 if (ret == -1) {
83 printf("fork failed\n"); 83 printf("fork failed\n");
@@ -86,7 +86,7 @@ int main(int argc, char *argv[])
86 } 86 }
87 87
88 if (ret == 0) { 88 if (ret == 0) {
89 execl("/bin/sh", "sh", NULL); 89 execl("/bin/sh", "sh", nullptr);
90 return 0; 90 return 0;
91 } 91 }
92 92
diff --git a/testing/tox_sync.c b/testing/tox_sync.c
index 954c64e1..382e49f9 100644
--- a/testing/tox_sync.c
+++ b/testing/tox_sync.c
@@ -312,7 +312,7 @@ int main(int argc, char *argv[])
312 d = opendir(path); 312 d = opendir(path);
313 313
314 if (d) { 314 if (d) {
315 while ((dir = readdir(d)) != NULL) { 315 while ((dir = readdir(d)) != nullptr) {
316 VLA(char, filepath, strlen(path) + strlen(dir->d_name) + 1); 316 VLA(char, filepath, strlen(path) + strlen(dir->d_name) + 1);
317 memcpy(filepath, path, strlen(path)); 317 memcpy(filepath, path, strlen(path));
318 memcpy(filepath + strlen(path), dir->d_name, strlen(dir->d_name) + 1); 318 memcpy(filepath + strlen(path), dir->d_name, strlen(dir->d_name) + 1);
@@ -338,7 +338,7 @@ int main(int argc, char *argv[])
338 } 338 }
339 } 339 }
340 340
341 tox_iterate(tox, NULL); 341 tox_iterate(tox, nullptr);
342 c_sleep(1); 342 c_sleep(1);
343 } 343 }
344} 344}