mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Fixed warnings and moved hex_string_to_bin to testing/
This commit is contained in:
parent
7441a234b7
commit
8f0bef5f20
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "../toxcore/DHT.h"
|
#include "../toxcore/DHT.h"
|
||||||
#include "../toxcore/friend_requests.h"
|
#include "../toxcore/friend_requests.h"
|
||||||
#include "../toxcore/misc_tools.h"
|
#include "../testing/misc_tools.c"
|
||||||
|
|
||||||
/* Sleep function (x = milliseconds) */
|
/* Sleep function (x = milliseconds) */
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -2,8 +2,7 @@ noinst_PROGRAMS += DHT_bootstrap
|
|||||||
|
|
||||||
DHT_bootstrap_SOURCES = $(top_srcdir)/other/DHT_bootstrap.c \
|
DHT_bootstrap_SOURCES = $(top_srcdir)/other/DHT_bootstrap.c \
|
||||||
$(top_srcdir)/toxcore/DHT.h \
|
$(top_srcdir)/toxcore/DHT.h \
|
||||||
$(top_srcdir)/toxcore/friend_requests.h \
|
$(top_srcdir)/toxcore/friend_requests.h
|
||||||
$(top_srcdir)/toxcore/misc_tools.h
|
|
||||||
|
|
||||||
DHT_bootstrap_CFLAGS = -I$(top_srcdir)/other \
|
DHT_bootstrap_CFLAGS = -I$(top_srcdir)/other \
|
||||||
$(LIBSODIUM_CFLAGS)
|
$(LIBSODIUM_CFLAGS)
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
//#include "../core/network.h"
|
//#include "../core/network.h"
|
||||||
#include "../toxcore/DHT.h"
|
#include "../toxcore/DHT.h"
|
||||||
#include "../toxcore/friend_requests.h"
|
#include "../toxcore/friend_requests.h"
|
||||||
#include "../toxcore/misc_tools.h"
|
#include "misc_tools.c"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../toxcore/Messenger.h"
|
#include "../toxcore/Messenger.h"
|
||||||
#include "../toxcore/misc_tools.h"
|
#include "misc_tools.c"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "misc_tools.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "nTox.h"
|
#include "nTox.h"
|
||||||
#include "../toxcore/misc_tools.h"
|
#include "misc_tools.c"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -675,7 +675,7 @@ IP_Port DHT_getfriendip(DHT *dht, uint8_t *client_id)
|
|||||||
{
|
{
|
||||||
uint32_t i, j;
|
uint32_t i, j;
|
||||||
uint64_t temp_time = unix_time();
|
uint64_t temp_time = unix_time();
|
||||||
IP_Port empty = { .ip = {0}, .port = 0, .padding = 0 };
|
IP_Port empty = { .ip = {{0}}, .port = 0, .padding = 0 };
|
||||||
|
|
||||||
for (i = 0; i < dht->num_friends; ++i) {
|
for (i = 0; i < dht->num_friends; ++i) {
|
||||||
/* Equal */
|
/* Equal */
|
||||||
@ -1040,7 +1040,7 @@ static void punch_holes(DHT *dht, IP ip, uint16_t *port_list, uint16_t numports,
|
|||||||
for (i = dht->friends_list[friend_num].punching_index; i != top; i++) {
|
for (i = dht->friends_list[friend_num].punching_index; i != top; i++) {
|
||||||
/* TODO: improve port guessing algorithm */
|
/* TODO: improve port guessing algorithm */
|
||||||
uint16_t port = port_list[(i / 2) % numports] + (i / (2 * numports)) * ((i % 2) ? -1 : 1);
|
uint16_t port = port_list[(i / 2) % numports] + (i / (2 * numports)) * ((i % 2) ? -1 : 1);
|
||||||
IP_Port pinging = {ip, htons(port)};
|
IP_Port pinging = {.ip = ip, .port = htons(port)};
|
||||||
send_ping_request(dht->ping, dht->c, pinging, dht->friends_list[friend_num].client_id);
|
send_ping_request(dht->ping, dht->c, pinging, dht->friends_list[friend_num].client_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,8 @@ static int LAN_ip(IP ip)
|
|||||||
if (ip.uint8[0] == 192 && ip.uint8[1] == 168) /* 192.168.0.0 to 192.168.255.255 range. */
|
if (ip.uint8[0] == 192 && ip.uint8[1] == 168) /* 192.168.0.0 to 192.168.255.255 range. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
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. */
|
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. */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@ -143,7 +144,7 @@ int send_LANdiscovery(uint16_t port, Net_Crypto *c)
|
|||||||
uint8_t data[crypto_box_PUBLICKEYBYTES + 1];
|
uint8_t data[crypto_box_PUBLICKEYBYTES + 1];
|
||||||
data[0] = NET_PACKET_LAN_DISCOVERY;
|
data[0] = NET_PACKET_LAN_DISCOVERY;
|
||||||
memcpy(data + 1, c->self_public_key, crypto_box_PUBLICKEYBYTES);
|
memcpy(data + 1, c->self_public_key, crypto_box_PUBLICKEYBYTES);
|
||||||
IP_Port ip_port = {broadcast_ip(), port};
|
IP_Port ip_port = {.ip = broadcast_ip(), .port = port};
|
||||||
return sendpacket(c->lossless_udp->net->sock, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES);
|
return sendpacket(c->lossless_udp->net->sock, ip_port, data, 1 + crypto_box_PUBLICKEYBYTES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
int getconnection_id(Lossless_UDP *ludp, IP_Port ip_port)
|
int getconnection_id(Lossless_UDP *ludp, IP_Port ip_port)
|
||||||
{
|
{
|
||||||
tox_array_for_each(&ludp->connections, Connection, tmp) {
|
tox_array_for_each(&ludp->connections, Connection, tmp) {
|
||||||
if (tmp->ip_port.ip.i == ip_port.ip.i &&
|
if (tmp->ip_port.ip.uint32 == ip_port.ip.uint32 &&
|
||||||
tmp->ip_port.port == ip_port.port &&
|
tmp->ip_port.port == ip_port.port &&
|
||||||
tmp->status > 0) {
|
tmp->status > 0) {
|
||||||
return tmp_i;
|
return tmp_i;
|
||||||
@ -261,7 +261,7 @@ IP_Port connection_ip(Lossless_UDP *ludp, int connection_id)
|
|||||||
if (connection_id >= 0 && connection_id < ludp->connections.len)
|
if (connection_id >= 0 && connection_id < ludp->connections.len)
|
||||||
return tox_array_get(&ludp->connections, connection_id, Connection).ip_port;
|
return tox_array_get(&ludp->connections, connection_id, Connection).ip_port;
|
||||||
|
|
||||||
IP_Port zero = { .ip = {0}, .port = 0, .padding = 0 };
|
IP_Port zero = { .ip = {{0}}, .port = 0, .padding = 0 };
|
||||||
return zero;
|
return zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,7 @@ libtoxcore_la_SOURCES = $(top_srcdir)/toxcore/DHT.h \
|
|||||||
$(top_srcdir)/toxcore/tox.c \
|
$(top_srcdir)/toxcore/tox.c \
|
||||||
$(top_srcdir)/toxcore/util.h \
|
$(top_srcdir)/toxcore/util.h \
|
||||||
$(top_srcdir)/toxcore/util.c \
|
$(top_srcdir)/toxcore/util.c \
|
||||||
$(top_srcdir)/toxcore/misc_tools.h \
|
$(top_srcdir)/toxcore/misc_tools.h
|
||||||
$(top_srcdir)/toxcore/misc_tools.c
|
|
||||||
|
|
||||||
libtoxcore_la_CFLAGS = -I$(top_srcdir) \
|
libtoxcore_la_CFLAGS = -I$(top_srcdir) \
|
||||||
-I$(top_srcdir)/toxcore \
|
-I$(top_srcdir)/toxcore \
|
||||||
|
@ -28,8 +28,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h> /* for memcpy() */
|
#include <string.h> /* for memcpy() */
|
||||||
|
|
||||||
unsigned char *hex_string_to_bin(char hex_string[]);
|
|
||||||
|
|
||||||
/*********************Debugging Macros********************
|
/*********************Debugging Macros********************
|
||||||
* wiki.tox.im/index.php/Internal_functions_and_data_structures#Debugging
|
* wiki.tox.im/index.php/Internal_functions_and_data_structures#Debugging
|
||||||
*********************************************************/
|
*********************************************************/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user