summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-30 15:15:50 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-30 19:06:44 +0100
commit1977d56caaff40ea9bbf6754b69bec9539a5a969 (patch)
treedb9c6d6c59dc0f91900dafe85dea1ab90f0ca8d9 /testing
parent949ef785a4e7aa7868c9605b6bbed15c3f4beab9 (diff)
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.
Diffstat (limited to 'testing')
-rw-r--r--testing/DHT_test.c2
-rw-r--r--testing/Messenger_test.c4
-rw-r--r--testing/irc_syncbot.c16
-rw-r--r--testing/nTox.c1
-rw-r--r--testing/tox_shell.c2
-rw-r--r--testing/tox_sync.c2
6 files changed, 9 insertions, 18 deletions
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[])
259 print_friendlist(dht); 259 print_friendlist(dht);
260 c_sleep(300); 260 c_sleep(300);
261 } 261 }
262
263 return 0;
264} 262}
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
67 * networking_requesthandler and so cannot take a Messenger * */ 67 * networking_requesthandler and so cannot take a Messenger * */
68static Messenger *m; 68static Messenger *m;
69 69
70static void print_request(Messenger *m, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata) 70static void print_request(Messenger *m2, const uint8_t *public_key, const uint8_t *data, size_t length, void *userdata)
71{ 71{
72 printf("Friend request received from: \n"); 72 printf("Friend request received from: \n");
73 printf("ClientID: "); 73 printf("ClientID: ");
@@ -91,7 +91,7 @@ static void print_request(Messenger *m, const uint8_t *public_key, const uint8_t
91 //if the request contained the message of peace the person is obviously a friend so we add him. 91 //if the request contained the message of peace the person is obviously a friend so we add him.
92 { 92 {
93 printf("Friend request accepted.\n"); 93 printf("Friend request accepted.\n");
94 m_addfriend_norequest(m, public_key); 94 m_addfriend_norequest(m2, public_key);
95 } 95 }
96} 96}
97 97
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)
47 47
48static int reconnect(void) 48static int reconnect(void)
49{ 49{
50 int sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); 50 int new_sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
51 51
52 if (sock < 0) { 52 if (new_sock < 0) {
53 printf("error socket\n"); 53 printf("error socket\n");
54 return -1; 54 return -1;
55 } 55 }
@@ -68,14 +68,14 @@ static int reconnect(void)
68 68
69 addr4->sin_port = htons(port); 69 addr4->sin_port = htons(port);
70 70
71 if (connect(sock, (struct sockaddr *)&addr, addrsize) != 0) { 71 if (connect(new_sock, (struct sockaddr *)&addr, addrsize) != 0) {
72 printf("error connect\n"); 72 printf("error connect\n");
73 return -1; 73 return -1;
74 } 74 }
75 75
76 send(sock, SERVER_CONNECT, sizeof(SERVER_CONNECT) - 1, MSG_NOSIGNAL); 76 send(new_sock, SERVER_CONNECT, sizeof(SERVER_CONNECT) - 1, MSG_NOSIGNAL);
77 77
78 return sock; 78 return new_sock;
79} 79}
80 80
81#include "../toxcore/tox.h" 81#include "../toxcore/tox.h"
@@ -256,9 +256,9 @@ static Tox *init_tox(int argc, char *argv[])
256 exit(1); 256 exit(1);
257 } 257 }
258 258
259 uint16_t port = atoi(argv[argvoffset + 2]); 259 uint16_t bootstrap_port = atoi(argv[argvoffset + 2]);
260 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]); 260 unsigned char *binary_string = hex_string_to_bin(argv[argvoffset + 3]);
261 tox_bootstrap(tox, argv[argvoffset + 1], port, binary_string, 0); 261 tox_bootstrap(tox, argv[argvoffset + 1], bootstrap_port, binary_string, 0);
262 free(binary_string); 262 free(binary_string);
263 263
264 uint8_t *bin_id = hex_string_to_bin(temp_id); 264 uint8_t *bin_id = hex_string_to_bin(temp_id);
@@ -372,6 +372,4 @@ int main(int argc, char *argv[])
372 tox_iterate(tox, NULL); 372 tox_iterate(tox, NULL);
373 usleep(1000 * 50); 373 usleep(1000 * 50);
374 } 374 }
375
376 return 0;
377} 375}
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
1233 if (file_senders[i].file && file_senders[i].friendnum == friend_number && file_senders[i].filenumber == file_number) { 1233 if (file_senders[i].file && file_senders[i].friendnum == friend_number && file_senders[i].filenumber == file_number) {
1234 fclose(file_senders[i].file); 1234 fclose(file_senders[i].file);
1235 file_senders[i].file = 0; 1235 file_senders[i].file = 0;
1236 char msg[512];
1237 sprintf(msg, "[t] %u file transfer: %u cancelled", file_senders[i].friendnum, file_senders[i].filenumber); 1236 sprintf(msg, "[t] %u file transfer: %u cancelled", file_senders[i].friendnum, file_senders[i].filenumber);
1238 new_lines(msg); 1237 new_lines(msg);
1239 } 1238 }
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[])
159 tox_iterate(tox, master); 159 tox_iterate(tox, master);
160 c_sleep(1); 160 c_sleep(1);
161 } 161 }
162
163 return 0;
164} 162}
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[])
333 tox_iterate(tox, NULL); 333 tox_iterate(tox, NULL);
334 c_sleep(1); 334 c_sleep(1);
335 } 335 }
336
337 return 0;
338} 336}