summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--other/DHT_bootstrap.c2
-rw-r--r--other/Makefile.inc3
-rw-r--r--testing/DHT_test.c2
-rw-r--r--testing/Messenger_test.c2
-rw-r--r--testing/misc_tools.c (renamed from toxcore/misc_tools.c)2
-rw-r--r--testing/nTox.c2
-rw-r--r--toxcore/DHT.c4
-rw-r--r--toxcore/LAN_discovery.c5
-rw-r--r--toxcore/Lossless_UDP.c4
-rw-r--r--toxcore/Makefile.inc3
-rw-r--r--toxcore/misc_tools.h2
11 files changed, 13 insertions, 18 deletions
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c
index 54e4f07d..a42545b1 100644
--- a/other/DHT_bootstrap.c
+++ b/other/DHT_bootstrap.c
@@ -29,7 +29,7 @@
29 29
30#include "../toxcore/DHT.h" 30#include "../toxcore/DHT.h"
31#include "../toxcore/friend_requests.h" 31#include "../toxcore/friend_requests.h"
32#include "../toxcore/misc_tools.h" 32#include "../testing/misc_tools.c"
33 33
34/* Sleep function (x = milliseconds) */ 34/* Sleep function (x = milliseconds) */
35#ifdef WIN32 35#ifdef WIN32
diff --git a/other/Makefile.inc b/other/Makefile.inc
index c737b642..7442fb39 100644
--- a/other/Makefile.inc
+++ b/other/Makefile.inc
@@ -2,8 +2,7 @@ noinst_PROGRAMS += DHT_bootstrap
2 2
3DHT_bootstrap_SOURCES = $(top_srcdir)/other/DHT_bootstrap.c \ 3DHT_bootstrap_SOURCES = $(top_srcdir)/other/DHT_bootstrap.c \
4 $(top_srcdir)/toxcore/DHT.h \ 4 $(top_srcdir)/toxcore/DHT.h \
5 $(top_srcdir)/toxcore/friend_requests.h \ 5 $(top_srcdir)/toxcore/friend_requests.h
6 $(top_srcdir)/toxcore/misc_tools.h
7 6
8DHT_bootstrap_CFLAGS = -I$(top_srcdir)/other \ 7DHT_bootstrap_CFLAGS = -I$(top_srcdir)/other \
9 $(LIBSODIUM_CFLAGS) 8 $(LIBSODIUM_CFLAGS)
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index c4f1e368..58879134 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -30,7 +30,7 @@
30//#include "../core/network.h" 30//#include "../core/network.h"
31#include "../toxcore/DHT.h" 31#include "../toxcore/DHT.h"
32#include "../toxcore/friend_requests.h" 32#include "../toxcore/friend_requests.h"
33#include "../toxcore/misc_tools.h" 33#include "misc_tools.c"
34 34
35#include <string.h> 35#include <string.h>
36 36
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c
index ad71f4b7..ff34cd4c 100644
--- a/testing/Messenger_test.c
+++ b/testing/Messenger_test.c
@@ -38,7 +38,7 @@
38 */ 38 */
39 39
40#include "../toxcore/Messenger.h" 40#include "../toxcore/Messenger.h"
41#include "../toxcore/misc_tools.h" 41#include "misc_tools.c"
42 42
43#ifdef WIN32 43#ifdef WIN32
44 44
diff --git a/toxcore/misc_tools.c b/testing/misc_tools.c
index 7268f3cb..6e775867 100644
--- a/toxcore/misc_tools.c
+++ b/testing/misc_tools.c
@@ -21,8 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include "misc_tools.h"
25
26#include <string.h> 24#include <string.h>
27#include <stdlib.h> 25#include <stdlib.h>
28#include <stdio.h> 26#include <stdio.h>
diff --git a/testing/nTox.c b/testing/nTox.c
index d86a7739..438468bd 100644
--- a/testing/nTox.c
+++ b/testing/nTox.c
@@ -38,7 +38,7 @@
38 38
39 39
40#include "nTox.h" 40#include "nTox.h"
41#include "../toxcore/misc_tools.h" 41#include "misc_tools.c"
42 42
43#include <stdio.h> 43#include <stdio.h>
44#include <time.h> 44#include <time.h>
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index f1cef9f4..c2a0377f 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -675,7 +675,7 @@ IP_Port DHT_getfriendip(DHT *dht, uint8_t *client_id)
675{ 675{
676 uint32_t i, j; 676 uint32_t i, j;
677 uint64_t temp_time = unix_time(); 677 uint64_t temp_time = unix_time();
678 IP_Port empty = { .ip = {0}, .port = 0, .padding = 0 }; 678 IP_Port empty = { .ip = {{0}}, .port = 0, .padding = 0 };
679 679
680 for (i = 0; i < dht->num_friends; ++i) { 680 for (i = 0; i < dht->num_friends; ++i) {
681 /* Equal */ 681 /* Equal */
@@ -1040,7 +1040,7 @@ static void punch_holes(DHT *dht, IP ip, uint16_t *port_list, uint16_t numports,
1040 for (i = dht->friends_list[friend_num].punching_index; i != top; i++) { 1040 for (i = dht->friends_list[friend_num].punching_index; i != top; i++) {
1041 /* TODO: improve port guessing algorithm */ 1041 /* TODO: improve port guessing algorithm */
1042 uint16_t port = port_list[(i / 2) % numports] + (i / (2 * numports)) * ((i % 2) ? -1 : 1); 1042 uint16_t port = port_list[(i / 2) % numports] + (i / (2 * numports)) * ((i % 2) ? -1 : 1);
1043 IP_Port pinging = {ip, htons(port)}; 1043 IP_Port pinging = {.ip = ip, .port = htons(port)};
1044 send_ping_request(dht->ping, dht->c, pinging, dht->friends_list[friend_num].client_id); 1044 send_ping_request(dht->ping, dht->c, pinging, dht->friends_list[friend_num].client_id);
1045 } 1045 }
1046 1046
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c
index cb27c024..33570c73 100644
--- a/toxcore/LAN_discovery.c
+++ b/toxcore/LAN_discovery.c
@@ -117,7 +117,8 @@ static int LAN_ip(IP ip)
117 if (ip.uint8[0] == 192 && ip.uint8[1] == 168) /* 192.168.0.0 to 192.168.255.255 range. */ 117 if (ip.uint8[0] == 192 && ip.uint8[1] == 168) /* 192.168.0.0 to 192.168.255.255 range. */
118 return 0; 118 return 0;
119 119
120 if (ip.uint8[0] == 169 && ip.uint8[1] == 254 && ip.uint8[2] != 0 && ip.uint8[2] != 255)/* 169.254.1.0 to 169.254.254.255 range. */ 120 if (ip.uint8[0] == 169 && ip.uint8[1] == 254 && ip.uint8[2] != 0
121 && ip.uint8[2] != 255)/* 169.254.1.0 to 169.254.254.255 range. */
121 return 0; 122 return 0;
122 123
123 return -1; 124 return -1;
@@ -143,7 +144,7 @@ int send_LANdiscovery(uint16_t port, Net_Crypto *c)
143 uint8_t data[crypto_box_PUBLICKEYBYTES + 1]; 144 uint8_t data[crypto_box_PUBLICKEYBYTES + 1];
144 data[0] = NET_PACKET_LAN_DISCOVERY; 145 data[0] = NET_PACKET_LAN_DISCOVERY;
145 memcpy(data + 1, c->self_public_key, crypto_box_PUBLICKEYBYTES); 146 memcpy(data + 1, c->self_public_key, crypto_box_PUBLICKEYBYTES);
146 IP_Port ip_port = {broadcast_ip(), port}; 147 IP_Port ip_port = {.ip = broadcast_ip(), .port = port};
147 return sendpacket(c->lossless_udp->net->sock, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES); 148 return sendpacket(c->lossless_udp->net->sock, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES);
148} 149}
149 150
diff --git a/toxcore/Lossless_UDP.c b/toxcore/Lossless_UDP.c
index 4bc3c27c..070f5231 100644
--- a/toxcore/Lossless_UDP.c
+++ b/toxcore/Lossless_UDP.c
@@ -39,7 +39,7 @@
39int getconnection_id(Lossless_UDP *ludp, IP_Port ip_port) 39int getconnection_id(Lossless_UDP *ludp, IP_Port ip_port)
40{ 40{
41 tox_array_for_each(&ludp->connections, Connection, tmp) { 41 tox_array_for_each(&ludp->connections, Connection, tmp) {
42 if (tmp->ip_port.ip.i == ip_port.ip.i && 42 if (tmp->ip_port.ip.uint32 == ip_port.ip.uint32 &&
43 tmp->ip_port.port == ip_port.port && 43 tmp->ip_port.port == ip_port.port &&
44 tmp->status > 0) { 44 tmp->status > 0) {
45 return tmp_i; 45 return tmp_i;
@@ -261,7 +261,7 @@ IP_Port connection_ip(Lossless_UDP *ludp, int connection_id)
261 if (connection_id >= 0 && connection_id < ludp->connections.len) 261 if (connection_id >= 0 && connection_id < ludp->connections.len)
262 return tox_array_get(&ludp->connections, connection_id, Connection).ip_port; 262 return tox_array_get(&ludp->connections, connection_id, Connection).ip_port;
263 263
264 IP_Port zero = { .ip = {0}, .port = 0, .padding = 0 }; 264 IP_Port zero = { .ip = {{0}}, .port = 0, .padding = 0 };
265 return zero; 265 return zero;
266} 266}
267 267
diff --git a/toxcore/Makefile.inc b/toxcore/Makefile.inc
index 44ba69b5..d79a7e1c 100644
--- a/toxcore/Makefile.inc
+++ b/toxcore/Makefile.inc
@@ -25,8 +25,7 @@ libtoxcore_la_SOURCES = $(top_srcdir)/toxcore/DHT.h \
25 $(top_srcdir)/toxcore/tox.c \ 25 $(top_srcdir)/toxcore/tox.c \
26 $(top_srcdir)/toxcore/util.h \ 26 $(top_srcdir)/toxcore/util.h \
27 $(top_srcdir)/toxcore/util.c \ 27 $(top_srcdir)/toxcore/util.c \
28 $(top_srcdir)/toxcore/misc_tools.h \ 28 $(top_srcdir)/toxcore/misc_tools.h
29 $(top_srcdir)/toxcore/misc_tools.c
30 29
31libtoxcore_la_CFLAGS = -I$(top_srcdir) \ 30libtoxcore_la_CFLAGS = -I$(top_srcdir) \
32 -I$(top_srcdir)/toxcore \ 31 -I$(top_srcdir)/toxcore \
diff --git a/toxcore/misc_tools.h b/toxcore/misc_tools.h
index d6308015..9aa98ba0 100644
--- a/toxcore/misc_tools.h
+++ b/toxcore/misc_tools.h
@@ -28,8 +28,6 @@
28#include <stdint.h> 28#include <stdint.h>
29#include <string.h> /* for memcpy() */ 29#include <string.h> /* for memcpy() */
30 30
31unsigned char *hex_string_to_bin(char hex_string[]);
32
33/*********************Debugging Macros******************** 31/*********************Debugging Macros********************
34 * wiki.tox.im/index.php/Internal_functions_and_data_structures#Debugging 32 * wiki.tox.im/index.php/Internal_functions_and_data_structures#Debugging
35 *********************************************************/ 33 *********************************************************/