diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-02-23 02:22:38 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-02-24 22:20:22 +0000 |
commit | d3b286cb434ed228e7b62cc70cb293e7a5554bfa (patch) | |
tree | 9ab3dd66f9dba2ca861ba8c6e098fb96754aa80b /toxcore | |
parent | afc80922e720f5d2a93bdfb3745da058e5ddf81b (diff) |
Fix a bunch of compiler warnings and remove suppressions.
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/BUILD.bazel | 10 | ||||
-rw-r--r-- | toxcore/DHT.c | 52 | ||||
-rw-r--r-- | toxcore/LAN_discovery.c | 4 | ||||
-rw-r--r-- | toxcore/Messenger.c | 18 | ||||
-rw-r--r-- | toxcore/Messenger.h | 8 | ||||
-rw-r--r-- | toxcore/TCP_client.c | 4 | ||||
-rw-r--r-- | toxcore/TCP_server.c | 2 | ||||
-rw-r--r-- | toxcore/ccompat.h | 8 | ||||
-rw-r--r-- | toxcore/crypto_core.c | 2 | ||||
-rw-r--r-- | toxcore/logger.h | 6 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 2 | ||||
-rw-r--r-- | toxcore/network.c | 23 | ||||
-rw-r--r-- | toxcore/network.h | 5 | ||||
-rw-r--r-- | toxcore/onion_client.c | 4 | ||||
-rw-r--r-- | toxcore/tox.api.h | 14 | ||||
-rw-r--r-- | toxcore/tox.c | 11 | ||||
-rw-r--r-- | toxcore/tox.h | 14 |
17 files changed, 98 insertions, 89 deletions
diff --git a/toxcore/BUILD.bazel b/toxcore/BUILD.bazel index d6c3693e..3dfa1648 100644 --- a/toxcore/BUILD.bazel +++ b/toxcore/BUILD.bazel | |||
@@ -48,6 +48,7 @@ cc_library( | |||
48 | name = "logger", | 48 | name = "logger", |
49 | srcs = ["logger.c"], | 49 | srcs = ["logger.c"], |
50 | hdrs = ["logger.h"], | 50 | hdrs = ["logger.h"], |
51 | deps = [":ccompat"], | ||
51 | ) | 52 | ) |
52 | 53 | ||
53 | cc_library( | 54 | cc_library( |
@@ -100,9 +101,6 @@ cc_library( | |||
100 | "LAN_discovery.h", | 101 | "LAN_discovery.h", |
101 | "ping.h", | 102 | "ping.h", |
102 | ], | 103 | ], |
103 | copts = [ | ||
104 | "-Wno-parentheses", | ||
105 | ], | ||
106 | visibility = ["//c-toxcore/other/bootstrap_daemon:__pkg__"], | 104 | visibility = ["//c-toxcore/other/bootstrap_daemon:__pkg__"], |
107 | deps = [ | 105 | deps = [ |
108 | ":crypto_core", | 106 | ":crypto_core", |
@@ -205,9 +203,6 @@ cc_library( | |||
205 | "tox.h", | 203 | "tox.h", |
206 | "tox_api.c", | 204 | "tox_api.c", |
207 | ], | 205 | ], |
208 | copts = [ | ||
209 | "-Wno-parentheses", | ||
210 | ], | ||
211 | visibility = ["//c-toxcore:__subpackages__"], | 206 | visibility = ["//c-toxcore:__subpackages__"], |
212 | deps = [ | 207 | deps = [ |
213 | ":group", | 208 | ":group", |
@@ -221,9 +216,6 @@ cc_library( | |||
221 | "*.c", | 216 | "*.c", |
222 | "*.h", | 217 | "*.h", |
223 | ]), | 218 | ]), |
224 | copts = [ | ||
225 | "-Wno-parentheses", | ||
226 | ], | ||
227 | linkopts = ["-lpthread"], | 219 | linkopts = ["-lpthread"], |
228 | visibility = ["//c-toxcore/other:__pkg__"], | 220 | visibility = ["//c-toxcore/other:__pkg__"], |
229 | deps = [ | 221 | deps = [ |
diff --git a/toxcore/DHT.c b/toxcore/DHT.c index 10ea659e..4acfa161 100644 --- a/toxcore/DHT.c +++ b/toxcore/DHT.c | |||
@@ -615,8 +615,8 @@ static uint32_t index_of_node_pk(const Node_format *array, uint32_t size, const | |||
615 | static uint32_t index_of_client_ip_port(const Client_data *array, uint32_t size, const IP_Port *ip_port) | 615 | static uint32_t index_of_client_ip_port(const Client_data *array, uint32_t size, const IP_Port *ip_port) |
616 | { | 616 | { |
617 | for (uint32_t i = 0; i < size; ++i) { | 617 | for (uint32_t i = 0; i < size; ++i) { |
618 | if (ip_port->ip.family == TOX_AF_INET && ipport_equal(&array[i].assoc4.ip_port, ip_port) || | 618 | if ((ip_port->ip.family == TOX_AF_INET && ipport_equal(&array[i].assoc4.ip_port, ip_port)) || |
619 | ip_port->ip.family == TOX_AF_INET6 && ipport_equal(&array[i].assoc6.ip_port, ip_port)) { | 619 | (ip_port->ip.family == TOX_AF_INET6 && ipport_equal(&array[i].assoc6.ip_port, ip_port))) { |
620 | return i; | 620 | return i; |
621 | } | 621 | } |
622 | } | 622 | } |
@@ -1084,18 +1084,20 @@ static bool ping_node_from_getnodes_ok(DHT *dht, const uint8_t *public_key, IP_P | |||
1084 | ret = true; | 1084 | ret = true; |
1085 | } | 1085 | } |
1086 | 1086 | ||
1087 | unsigned int *const num = &dht->num_to_bootstrap; | 1087 | { |
1088 | const uint32_t index = index_of_node_pk(dht->to_bootstrap, *num, public_key); | 1088 | unsigned int *const num = &dht->num_to_bootstrap; |
1089 | const bool in_close_list = is_pk_in_close_list(dht, public_key, ip_port); | 1089 | const uint32_t index = index_of_node_pk(dht->to_bootstrap, *num, public_key); |
1090 | const bool in_close_list = is_pk_in_close_list(dht, public_key, ip_port); | ||
1090 | 1091 | ||
1091 | if (ret && index == UINT32_MAX && !in_close_list) { | 1092 | if (ret && index == UINT32_MAX && !in_close_list) { |
1092 | if (*num < MAX_CLOSE_TO_BOOTSTRAP_NODES) { | 1093 | if (*num < MAX_CLOSE_TO_BOOTSTRAP_NODES) { |
1093 | memcpy(dht->to_bootstrap[*num].public_key, public_key, CRYPTO_PUBLIC_KEY_SIZE); | 1094 | memcpy(dht->to_bootstrap[*num].public_key, public_key, CRYPTO_PUBLIC_KEY_SIZE); |
1094 | dht->to_bootstrap[*num].ip_port = ip_port; | 1095 | dht->to_bootstrap[*num].ip_port = ip_port; |
1095 | ++*num; | 1096 | ++*num; |
1096 | } else { | 1097 | } else { |
1097 | // TODO(irungentoo): ipv6 vs v4 | 1098 | // TODO(irungentoo): ipv6 vs v4 |
1098 | add_to_list(dht->to_bootstrap, MAX_CLOSE_TO_BOOTSTRAP_NODES, public_key, ip_port, dht->self_public_key); | 1099 | add_to_list(dht->to_bootstrap, MAX_CLOSE_TO_BOOTSTRAP_NODES, public_key, ip_port, dht->self_public_key); |
1100 | } | ||
1099 | } | 1101 | } |
1100 | } | 1102 | } |
1101 | 1103 | ||
@@ -1655,8 +1657,8 @@ static uint8_t do_ping_and_sendnode_requests(DHT *dht, uint64_t *lastgetnode, co | |||
1655 | 1657 | ||
1656 | IPPTsPng *assocs[ASSOC_COUNT] = { &client->assoc6, &client->assoc4 }; | 1658 | IPPTsPng *assocs[ASSOC_COUNT] = { &client->assoc6, &client->assoc4 }; |
1657 | 1659 | ||
1658 | for (size_t i = 0; i < ASSOC_COUNT; i++) { | 1660 | for (size_t j = 0; j < ASSOC_COUNT; j++) { |
1659 | IPPTsPng *assoc = assocs[i]; | 1661 | IPPTsPng *assoc = assocs[j]; |
1660 | 1662 | ||
1661 | if (!is_timeout(assoc->timestamp, KILL_NODE_TIMEOUT)) { | 1663 | if (!is_timeout(assoc->timestamp, KILL_NODE_TIMEOUT)) { |
1662 | sort = 0; | 1664 | sort = 0; |
@@ -1677,7 +1679,7 @@ static uint8_t do_ping_and_sendnode_requests(DHT *dht, uint64_t *lastgetnode, co | |||
1677 | ++sort; | 1679 | ++sort; |
1678 | 1680 | ||
1679 | /* Timed out should be at beginning, if they are not, sort the list. */ | 1681 | /* Timed out should be at beginning, if they are not, sort the list. */ |
1680 | if (sort > 1 && sort < (((i + 1) * 2) - 1)) { | 1682 | if (sort > 1 && sort < (((j + 1) * 2) - 1)) { |
1681 | sort_ok = true; | 1683 | sort_ok = true; |
1682 | } | 1684 | } |
1683 | } | 1685 | } |
@@ -2237,14 +2239,17 @@ static void do_NAT(DHT *dht) | |||
2237 | /*----------------------------------------------------------------------------------*/ | 2239 | /*----------------------------------------------------------------------------------*/ |
2238 | /*-----------------------END OF NAT PUNCHING FUNCTIONS------------------------------*/ | 2240 | /*-----------------------END OF NAT PUNCHING FUNCTIONS------------------------------*/ |
2239 | 2241 | ||
2242 | #define DHT_HARDENING 0 | ||
2240 | #define HARDREQ_DATA_SIZE 384 /* Attempt to prevent amplification/other attacks*/ | 2243 | #define HARDREQ_DATA_SIZE 384 /* Attempt to prevent amplification/other attacks*/ |
2241 | 2244 | ||
2242 | #define CHECK_TYPE_ROUTE_REQ 0 | 2245 | enum { |
2243 | #define CHECK_TYPE_ROUTE_RES 1 | 2246 | CHECK_TYPE_ROUTE_REQ = 0, |
2244 | #define CHECK_TYPE_GETNODE_REQ 2 | 2247 | CHECK_TYPE_ROUTE_RES = 1, |
2245 | #define CHECK_TYPE_GETNODE_RES 3 | 2248 | CHECK_TYPE_GETNODE_REQ = 2, |
2246 | #define CHECK_TYPE_TEST_REQ 4 | 2249 | CHECK_TYPE_GETNODE_RES = 3, |
2247 | #define CHECK_TYPE_TEST_RES 5 | 2250 | CHECK_TYPE_TEST_REQ = 4, |
2251 | CHECK_TYPE_TEST_RES = 5, | ||
2252 | }; | ||
2248 | 2253 | ||
2249 | #if DHT_HARDENING | 2254 | #if DHT_HARDENING |
2250 | static int send_hardening_req(DHT *dht, Node_format *sendto, uint8_t type, uint8_t *contents, uint16_t length) | 2255 | static int send_hardening_req(DHT *dht, Node_format *sendto, uint8_t type, uint8_t *contents, uint16_t length) |
@@ -2350,7 +2355,6 @@ static uint32_t have_nodes_closelist(DHT *dht, Node_format *nodes, uint16_t num) | |||
2350 | 2355 | ||
2351 | /* Interval in seconds between hardening checks */ | 2356 | /* Interval in seconds between hardening checks */ |
2352 | #define HARDENING_INTERVAL 120 | 2357 | #define HARDENING_INTERVAL 120 |
2353 | #define HARDEN_TIMEOUT 1200 | ||
2354 | 2358 | ||
2355 | /* Handle a received hardening packet */ | 2359 | /* Handle a received hardening packet */ |
2356 | static int handle_hardening(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, | 2360 | static int handle_hardening(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, |
@@ -2429,6 +2433,8 @@ static int handle_hardening(void *object, IP_Port source, const uint8_t *source_ | |||
2429 | } | 2433 | } |
2430 | 2434 | ||
2431 | #if DHT_HARDENING | 2435 | #if DHT_HARDENING |
2436 | #define HARDEN_TIMEOUT 1200 | ||
2437 | |||
2432 | /* Return a random node from all the nodes we are connected to. | 2438 | /* Return a random node from all the nodes we are connected to. |
2433 | * TODO(irungentoo): improve this function. | 2439 | * TODO(irungentoo): improve this function. |
2434 | */ | 2440 | */ |
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c index f5883060..70b71fea 100644 --- a/toxcore/LAN_discovery.c +++ b/toxcore/LAN_discovery.c | |||
@@ -156,9 +156,9 @@ static void fetch_broadcast_info(uint16_t port) | |||
156 | * a larger array, not done (640kB and 16 interfaces shall be | 156 | * a larger array, not done (640kB and 16 interfaces shall be |
157 | * enough, for everybody!) | 157 | * enough, for everybody!) |
158 | */ | 158 | */ |
159 | int i, n = ifconf.ifc_len / sizeof(struct ifreq); | 159 | int n = ifconf.ifc_len / sizeof(struct ifreq); |
160 | 160 | ||
161 | for (i = 0; i < n; i++) { | 161 | for (int i = 0; i < n; i++) { |
162 | /* there are interfaces with are incapable of broadcast */ | 162 | /* there are interfaces with are incapable of broadcast */ |
163 | if (ioctl(sock, SIOCGIFBRDADDR, &i_faces[i]) < 0) { | 163 | if (ioctl(sock, SIOCGIFBRDADDR, &i_faces[i]) < 0) { |
164 | continue; | 164 | continue; |
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index 5542ee1b..2bebae92 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c | |||
@@ -33,7 +33,6 @@ | |||
33 | 33 | ||
34 | #include <assert.h> | 34 | #include <assert.h> |
35 | 35 | ||
36 | static void set_friend_status(Messenger *m, int32_t friendnumber, uint8_t status, void *userdata); | ||
37 | static int write_cryptpacket_id(const Messenger *m, int32_t friendnumber, uint8_t packet_id, const uint8_t *data, | 36 | static int write_cryptpacket_id(const Messenger *m, int32_t friendnumber, uint8_t packet_id, const uint8_t *data, |
38 | uint32_t length, uint8_t congestion_control); | 37 | uint32_t length, uint8_t congestion_control); |
39 | 38 | ||
@@ -949,7 +948,7 @@ static void check_friend_connectionstatus(Messenger *m, int32_t friendnumber, ui | |||
949 | } | 948 | } |
950 | } | 949 | } |
951 | 950 | ||
952 | void set_friend_status(Messenger *m, int32_t friendnumber, uint8_t status, void *userdata) | 951 | static void set_friend_status(Messenger *m, int32_t friendnumber, uint8_t status, void *userdata) |
953 | { | 952 | { |
954 | check_friend_connectionstatus(m, friendnumber, status, userdata); | 953 | check_friend_connectionstatus(m, friendnumber, status, userdata); |
955 | m->friendlist[friendnumber].status = status; | 954 | m->friendlist[friendnumber].status = status; |
@@ -1825,13 +1824,13 @@ static int m_handle_custom_lossy_packet(void *object, int friend_num, const uint | |||
1825 | return 1; | 1824 | return 1; |
1826 | } | 1825 | } |
1827 | 1826 | ||
1828 | void custom_lossy_packet_registerhandler(Messenger *m, void (*packet_handler_callback)(Messenger *m, | 1827 | void custom_lossy_packet_registerhandler(Messenger *m, void (*lossy_packethandler)(Messenger *m, |
1829 | uint32_t friendnumber, const uint8_t *data, size_t len, void *object)) | 1828 | uint32_t friendnumber, const uint8_t *data, size_t len, void *object)) |
1830 | { | 1829 | { |
1831 | m->lossy_packethandler = packet_handler_callback; | 1830 | m->lossy_packethandler = lossy_packethandler; |
1832 | } | 1831 | } |
1833 | 1832 | ||
1834 | int m_callback_rtp_packet(Messenger *m, int32_t friendnumber, uint8_t byte, int (*packet_handler_callback)(Messenger *m, | 1833 | int m_callback_rtp_packet(Messenger *m, int32_t friendnumber, uint8_t byte, int (*function)(Messenger *m, |
1835 | uint32_t friendnumber, const uint8_t *data, uint16_t len, void *object), void *object) | 1834 | uint32_t friendnumber, const uint8_t *data, uint16_t len, void *object), void *object) |
1836 | { | 1835 | { |
1837 | if (friend_not_valid(m, friendnumber)) { | 1836 | if (friend_not_valid(m, friendnumber)) { |
@@ -1846,8 +1845,7 @@ int m_callback_rtp_packet(Messenger *m, int32_t friendnumber, uint8_t byte, int | |||
1846 | return -1; | 1845 | return -1; |
1847 | } | 1846 | } |
1848 | 1847 | ||
1849 | m->friendlist[friendnumber].lossy_rtp_packethandlers[byte % PACKET_LOSSY_AV_RESERVED].function = | 1848 | m->friendlist[friendnumber].lossy_rtp_packethandlers[byte % PACKET_LOSSY_AV_RESERVED].function = function; |
1850 | packet_handler_callback; | ||
1851 | m->friendlist[friendnumber].lossy_rtp_packethandlers[byte % PACKET_LOSSY_AV_RESERVED].object = object; | 1849 | m->friendlist[friendnumber].lossy_rtp_packethandlers[byte % PACKET_LOSSY_AV_RESERVED].object = object; |
1852 | return 0; | 1850 | return 0; |
1853 | } | 1851 | } |
@@ -1907,10 +1905,10 @@ static int handle_custom_lossless_packet(void *object, int friend_num, const uin | |||
1907 | return 1; | 1905 | return 1; |
1908 | } | 1906 | } |
1909 | 1907 | ||
1910 | void custom_lossless_packet_registerhandler(Messenger *m, void (*packet_handler_callback)(Messenger *m, | 1908 | void custom_lossless_packet_registerhandler(Messenger *m, void (*lossless_packethandler)(Messenger *m, |
1911 | uint32_t friendnumber, const uint8_t *data, size_t len, void *object)) | 1909 | uint32_t friendnumber, const uint8_t *data, size_t len, void *object)) |
1912 | { | 1910 | { |
1913 | m->lossless_packethandler = packet_handler_callback; | 1911 | m->lossless_packethandler = lossless_packethandler; |
1914 | } | 1912 | } |
1915 | 1913 | ||
1916 | int send_custom_lossless_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t length) | 1914 | int send_custom_lossless_packet(const Messenger *m, int32_t friendnumber, const uint8_t *data, uint32_t length) |
@@ -2765,7 +2763,7 @@ struct SAVED_FRIEND { | |||
2765 | uint64_t last_seen_time; | 2763 | uint64_t last_seen_time; |
2766 | }; | 2764 | }; |
2767 | 2765 | ||
2768 | static uint32_t friend_size() | 2766 | static uint32_t friend_size(void) |
2769 | { | 2767 | { |
2770 | uint32_t data = 0; | 2768 | uint32_t data = 0; |
2771 | const struct SAVED_FRIEND *const temp = nullptr; | 2769 | const struct SAVED_FRIEND *const temp = nullptr; |
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 956f8ac5..402eb916 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h | |||
@@ -37,7 +37,7 @@ | |||
37 | /* This cannot be bigger than 256 */ | 37 | /* This cannot be bigger than 256 */ |
38 | #define MAX_CONCURRENT_FILE_PIPES 256 | 38 | #define MAX_CONCURRENT_FILE_PIPES 256 |
39 | 39 | ||
40 | #if MAX_CONCURRENT_FILE_PIPES > UINT8_MAX + 1 | 40 | #if !defined(__SPLINT__) && MAX_CONCURRENT_FILE_PIPES > UINT8_MAX + 1 |
41 | #error "uint8_t cannot represent all file transfer numbers" | 41 | #error "uint8_t cannot represent all file transfer numbers" |
42 | #endif | 42 | #endif |
43 | 43 | ||
@@ -74,13 +74,13 @@ enum { | |||
74 | #define PACKET_LOSSY_AV_RESERVED 8 /* Number of lossy packet types at start of range reserved for A/V. */ | 74 | #define PACKET_LOSSY_AV_RESERVED 8 /* Number of lossy packet types at start of range reserved for A/V. */ |
75 | 75 | ||
76 | typedef struct { | 76 | typedef struct { |
77 | uint8_t ipv6enabled; | 77 | bool ipv6enabled; |
78 | uint8_t udp_disabled; | 78 | bool udp_disabled; |
79 | TCP_Proxy_Info proxy_info; | 79 | TCP_Proxy_Info proxy_info; |
80 | uint16_t port_range[2]; | 80 | uint16_t port_range[2]; |
81 | uint16_t tcp_server_port; | 81 | uint16_t tcp_server_port; |
82 | 82 | ||
83 | uint8_t hole_punching_enabled; | 83 | bool hole_punching_enabled; |
84 | bool local_discovery_enabled; | 84 | bool local_discovery_enabled; |
85 | 85 | ||
86 | logger_cb *log_callback; | 86 | logger_cb *log_callback; |
diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index e3f55a73..a6c32f9c 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c | |||
@@ -110,9 +110,9 @@ void tcp_con_set_custom_object(TCP_Client_Connection *con, void *object) | |||
110 | { | 110 | { |
111 | con->custom_object = object; | 111 | con->custom_object = object; |
112 | } | 112 | } |
113 | void tcp_con_set_custom_uint(TCP_Client_Connection *con, uint32_t uint) | 113 | void tcp_con_set_custom_uint(TCP_Client_Connection *con, uint32_t value) |
114 | { | 114 | { |
115 | con->custom_uint = uint; | 115 | con->custom_uint = value; |
116 | } | 116 | } |
117 | 117 | ||
118 | /* return 1 on success | 118 | /* return 1 on success |
diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c index ae73b804..4541fce0 100644 --- a/toxcore/TCP_server.c +++ b/toxcore/TCP_server.c | |||
@@ -98,9 +98,11 @@ size_t tcp_server_listen_count(const TCP_Server *tcp_server) | |||
98 | 98 | ||
99 | /* This is needed to compile on Android below API 21 | 99 | /* This is needed to compile on Android below API 21 |
100 | */ | 100 | */ |
101 | #ifdef TCP_SERVER_USE_EPOLL | ||
101 | #ifndef EPOLLRDHUP | 102 | #ifndef EPOLLRDHUP |
102 | #define EPOLLRDHUP 0x2000 | 103 | #define EPOLLRDHUP 0x2000 |
103 | #endif | 104 | #endif |
105 | #endif | ||
104 | 106 | ||
105 | /* Set the size of the connection list to numfriends. | 107 | /* Set the size of the connection list to numfriends. |
106 | * | 108 | * |
diff --git a/toxcore/ccompat.h b/toxcore/ccompat.h index 90db8bc6..1ceb5a5a 100644 --- a/toxcore/ccompat.h +++ b/toxcore/ccompat.h | |||
@@ -13,7 +13,7 @@ | |||
13 | // "function") is used. Note the semantic difference: alloca'd memory does not | 13 | // "function") is used. Note the semantic difference: alloca'd memory does not |
14 | // get freed at the end of the declaration's scope. Do not use VLA() in loops or | 14 | // get freed at the end of the declaration's scope. Do not use VLA() in loops or |
15 | // you may run out of stack space. | 15 | // you may run out of stack space. |
16 | #if !defined(_MSC_VER) && __STDC_VERSION__ >= 199901L | 16 | #if !defined(_MSC_VER) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
17 | // C99 VLAs. | 17 | // C99 VLAs. |
18 | #define VLA(type, name, size) type name[size] | 18 | #define VLA(type, name, size) type name[size] |
19 | #define SIZEOF_VLA sizeof | 19 | #define SIZEOF_VLA sizeof |
@@ -42,4 +42,10 @@ | |||
42 | #define nullptr NULL | 42 | #define nullptr NULL |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #ifdef __GNUC__ | ||
46 | #define GNU_PRINTF __attribute__((__format__(__printf__, 6, 7))) | ||
47 | #else | ||
48 | #define GNU_PRINTF | ||
49 | #endif | ||
50 | |||
45 | #endif /* CCOMPAT_H */ | 51 | #endif /* CCOMPAT_H */ |
diff --git a/toxcore/crypto_core.c b/toxcore/crypto_core.c index d5333e67..26589219 100644 --- a/toxcore/crypto_core.c +++ b/toxcore/crypto_core.c | |||
@@ -219,7 +219,7 @@ void increment_nonce(uint8_t *nonce) | |||
219 | 219 | ||
220 | static uint32_t host_to_network(uint32_t x) | 220 | static uint32_t host_to_network(uint32_t x) |
221 | { | 221 | { |
222 | #if BYTE_ORDER == LITTLE_ENDIAN | 222 | #if !defined(BYTE_ORDER) || BYTE_ORDER == LITTLE_ENDIAN |
223 | return | 223 | return |
224 | ((x >> 24) & 0x000000FF) | // move byte 3 to byte 0 | 224 | ((x >> 24) & 0x000000FF) | // move byte 3 to byte 0 |
225 | ((x >> 8) & 0x0000FF00) | // move byte 2 to byte 1 | 225 | ((x >> 8) & 0x0000FF00) | // move byte 2 to byte 1 |
diff --git a/toxcore/logger.h b/toxcore/logger.h index 8c8a639b..b3a8f7dc 100644 --- a/toxcore/logger.h +++ b/toxcore/logger.h | |||
@@ -26,6 +26,8 @@ | |||
26 | 26 | ||
27 | #include <stdint.h> | 27 | #include <stdint.h> |
28 | 28 | ||
29 | #include "ccompat.h" | ||
30 | |||
29 | #ifndef MIN_LOGGER_LEVEL | 31 | #ifndef MIN_LOGGER_LEVEL |
30 | #define MIN_LOGGER_LEVEL LOG_INFO | 32 | #define MIN_LOGGER_LEVEL LOG_INFO |
31 | #endif | 33 | #endif |
@@ -59,8 +61,8 @@ void logger_callback_log(Logger *log, logger_cb *function, void *context, void * | |||
59 | /** | 61 | /** |
60 | * Main write function. If logging disabled does nothing. | 62 | * Main write function. If logging disabled does nothing. |
61 | */ | 63 | */ |
62 | void logger_write(Logger *log, LOGGER_LEVEL level, const char *file, int line, const char *func, const char *format, | 64 | void logger_write( |
63 | ...); | 65 | Logger *log, LOGGER_LEVEL level, const char *file, int line, const char *func, const char *format, ...) GNU_PRINTF; |
64 | 66 | ||
65 | 67 | ||
66 | #define LOGGER_WRITE(log, level, ...) \ | 68 | #define LOGGER_WRITE(log, level, ...) \ |
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index fbdbaab8..65c81d92 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -1542,8 +1542,6 @@ static int handle_data_packet_core(Net_Crypto *c, int crypt_connection_id, const | |||
1542 | return -1; | 1542 | return -1; |
1543 | } | 1543 | } |
1544 | 1544 | ||
1545 | // else { /* TODO(irungentoo): ? */ } | ||
1546 | |||
1547 | set_buffer_end(&conn->recv_array, num); | 1545 | set_buffer_end(&conn->recv_array, num); |
1548 | } else if (real_data[0] >= CRYPTO_RESERVED_PACKETS && real_data[0] < PACKET_ID_LOSSY_RANGE_START) { | 1546 | } else if (real_data[0] >= CRYPTO_RESERVED_PACKETS && real_data[0] < PACKET_ID_LOSSY_RANGE_START) { |
1549 | Packet_Data dt; | 1547 | Packet_Data dt; |
diff --git a/toxcore/network.c b/toxcore/network.c index 99768829..6090b6e3 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -25,7 +25,10 @@ | |||
25 | #include "config.h" | 25 | #include "config.h" |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #ifdef __APPLE__ | ||
28 | #define _DARWIN_C_SOURCE | 29 | #define _DARWIN_C_SOURCE |
30 | #endif | ||
31 | |||
29 | #ifndef _XOPEN_SOURCE | 32 | #ifndef _XOPEN_SOURCE |
30 | #define _XOPEN_SOURCE 600 | 33 | #define _XOPEN_SOURCE 600 |
31 | #endif | 34 | #endif |
@@ -185,14 +188,14 @@ const IP6 IP6_BROADCAST = { | |||
185 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } | 188 | { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } |
186 | }; | 189 | }; |
187 | 190 | ||
188 | IP4 get_ip4_loopback() | 191 | IP4 get_ip4_loopback(void) |
189 | { | 192 | { |
190 | IP4 loopback; | 193 | IP4 loopback; |
191 | loopback.uint32 = htonl(INADDR_LOOPBACK); | 194 | loopback.uint32 = htonl(INADDR_LOOPBACK); |
192 | return loopback; | 195 | return loopback; |
193 | } | 196 | } |
194 | 197 | ||
195 | IP6 get_ip6_loopback() | 198 | IP6 get_ip6_loopback(void) |
196 | { | 199 | { |
197 | IP6 loopback; | 200 | IP6 loopback; |
198 | get_ip6(&loopback, &in6addr_loopback); | 201 | get_ip6(&loopback, &in6addr_loopback); |
@@ -374,18 +377,18 @@ static void loglogdata(Logger *log, const char *message, const uint8_t *buffer, | |||
374 | char ip_str[IP_NTOA_LEN]; | 377 | char ip_str[IP_NTOA_LEN]; |
375 | 378 | ||
376 | if (res < 0) { /* Windows doesn't necessarily know %zu */ | 379 | if (res < 0) { /* Windows doesn't necessarily know %zu */ |
377 | LOGGER_TRACE(log, "[%2u] %s %3hu%c %s:%hu (%u: %s) | %04x%04x", | 380 | LOGGER_TRACE(log, "[%2u] %s %3u%c %s:%u (%u: %s) | %04x%04x", |
378 | buffer[0], message, (buflen < 999 ? (uint16_t)buflen : 999), 'E', | 381 | buffer[0], message, (buflen < 999 ? buflen : 999), 'E', |
379 | ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), errno, | 382 | ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), errno, |
380 | strerror(errno), data_0(buflen, buffer), data_1(buflen, buffer)); | 383 | strerror(errno), data_0(buflen, buffer), data_1(buflen, buffer)); |
381 | } else if ((res > 0) && ((size_t)res <= buflen)) { | 384 | } else if ((res > 0) && ((size_t)res <= buflen)) { |
382 | LOGGER_TRACE(log, "[%2u] %s %3zu%c %s:%hu (%u: %s) | %04x%04x", | 385 | LOGGER_TRACE(log, "[%2u] %s %3u%c %s:%u (%u: %s) | %04x%04x", |
383 | buffer[0], message, (res < 999 ? (size_t)res : 999), ((size_t)res < buflen ? '<' : '='), | 386 | buffer[0], message, (res < 999 ? res : 999), ((size_t)res < buflen ? '<' : '='), |
384 | ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK", | 387 | ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK", |
385 | data_0(buflen, buffer), data_1(buflen, buffer)); | 388 | data_0(buflen, buffer), data_1(buflen, buffer)); |
386 | } else { /* empty or overwrite */ | 389 | } else { /* empty or overwrite */ |
387 | LOGGER_TRACE(log, "[%2u] %s %zu%c%zu %s:%hu (%u: %s) | %04x%04x", | 390 | LOGGER_TRACE(log, "[%2u] %s %u%c%u %s:%u (%u: %s) | %04x%04x", |
388 | buffer[0], message, (size_t)res, (!res ? '!' : '>'), buflen, | 391 | buffer[0], message, res, (!res ? '!' : '>'), buflen, |
389 | ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK", | 392 | ip_ntoa(&ip_port.ip, ip_str, sizeof(ip_str)), net_ntohs(ip_port.port), 0, "OK", |
390 | data_0(buflen, buffer), data_1(buflen, buffer)); | 393 | data_0(buflen, buffer), data_1(buflen, buffer)); |
391 | } | 394 | } |
@@ -951,7 +954,7 @@ void ip_reset(IP *ip) | |||
951 | } | 954 | } |
952 | 955 | ||
953 | /* nulls out ip, sets family according to flag */ | 956 | /* nulls out ip, sets family according to flag */ |
954 | void ip_init(IP *ip, uint8_t ipv6enabled) | 957 | void ip_init(IP *ip, bool ipv6enabled) |
955 | { | 958 | { |
956 | if (!ip) { | 959 | if (!ip) { |
957 | return; | 960 | return; |
@@ -1298,7 +1301,7 @@ int32_t net_getipport(const char *node, IP_Port **res, int tox_type) | |||
1298 | const size_t MAX_COUNT = MIN(SIZE_MAX, INT32_MAX) / sizeof(IP_Port); | 1301 | const size_t MAX_COUNT = MIN(SIZE_MAX, INT32_MAX) / sizeof(IP_Port); |
1299 | int type = make_socktype(tox_type); | 1302 | int type = make_socktype(tox_type); |
1300 | struct addrinfo *cur; | 1303 | struct addrinfo *cur; |
1301 | int32_t count = 0; | 1304 | size_t count = 0; |
1302 | 1305 | ||
1303 | for (cur = infos; count < MAX_COUNT && cur != nullptr; cur = cur->ai_next) { | 1306 | for (cur = infos; count < MAX_COUNT && cur != nullptr; cur = cur->ai_next) { |
1304 | if (cur->ai_socktype && type > 0 && cur->ai_socktype != type) { | 1307 | if (cur->ai_socktype && type > 0 && cur->ai_socktype != type) { |
diff --git a/toxcore/network.h b/toxcore/network.h index 8b5af47c..405721b2 100644 --- a/toxcore/network.h +++ b/toxcore/network.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include "ccompat.h" | 33 | #include "ccompat.h" |
34 | #include "logger.h" | 34 | #include "logger.h" |
35 | 35 | ||
36 | #include <stdbool.h> | ||
36 | #include <stdint.h> | 37 | #include <stdint.h> |
37 | #include <stdio.h> | 38 | #include <stdio.h> |
38 | #include <stdlib.h> | 39 | #include <stdlib.h> |
@@ -187,7 +188,7 @@ size_t net_unpack_u64(const uint8_t *bytes, uint64_t *v); | |||
187 | #define SIZE_PORT 2 | 188 | #define SIZE_PORT 2 |
188 | #define SIZE_IPPORT (SIZE_IP + SIZE_PORT) | 189 | #define SIZE_IPPORT (SIZE_IP + SIZE_PORT) |
189 | 190 | ||
190 | #define TOX_ENABLE_IPV6_DEFAULT 1 | 191 | #define TOX_ENABLE_IPV6_DEFAULT true |
191 | 192 | ||
192 | /* addr_resolve return values */ | 193 | /* addr_resolve return values */ |
193 | #define TOX_ADDR_RESOLVE_INET 1 | 194 | #define TOX_ADDR_RESOLVE_INET 1 |
@@ -260,7 +261,7 @@ int ipport_equal(const IP_Port *a, const IP_Port *b); | |||
260 | /* nulls out ip */ | 261 | /* nulls out ip */ |
261 | void ip_reset(IP *ip); | 262 | void ip_reset(IP *ip); |
262 | /* nulls out ip, sets family according to flag */ | 263 | /* nulls out ip, sets family according to flag */ |
263 | void ip_init(IP *ip, uint8_t ipv6enabled); | 264 | void ip_init(IP *ip, bool ipv6enabled); |
264 | /* checks if ip is valid */ | 265 | /* checks if ip is valid */ |
265 | int ip_isset(const IP *ip); | 266 | int ip_isset(const IP *ip); |
266 | /* checks if ip is valid */ | 267 | /* checks if ip is valid */ |
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index e6743559..c4eb3fc1 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -1351,14 +1351,14 @@ int onion_delfriend(Onion_Client *onion_c, int friend_num) | |||
1351 | * return -1 on failure. | 1351 | * return -1 on failure. |
1352 | * return 0 on success. | 1352 | * return 0 on success. |
1353 | */ | 1353 | */ |
1354 | int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num, int (*tcp_relay_node_callback)(void *object, | 1354 | int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num, int (*callback)(void *object, |
1355 | uint32_t number, IP_Port ip_port, const uint8_t *public_key), void *object, uint32_t number) | 1355 | uint32_t number, IP_Port ip_port, const uint8_t *public_key), void *object, uint32_t number) |
1356 | { | 1356 | { |
1357 | if ((uint32_t)friend_num >= onion_c->num_friends) { | 1357 | if ((uint32_t)friend_num >= onion_c->num_friends) { |
1358 | return -1; | 1358 | return -1; |
1359 | } | 1359 | } |
1360 | 1360 | ||
1361 | onion_c->friends_list[friend_num].tcp_relay_node_callback = tcp_relay_node_callback; | 1361 | onion_c->friends_list[friend_num].tcp_relay_node_callback = callback; |
1362 | onion_c->friends_list[friend_num].tcp_relay_node_callback_object = object; | 1362 | onion_c->friends_list[friend_num].tcp_relay_node_callback_object = object; |
1363 | onion_c->friends_list[friend_num].tcp_relay_node_callback_number = number; | 1363 | onion_c->friends_list[friend_num].tcp_relay_node_callback_number = number; |
1364 | return 0; | 1364 | return 0; |
diff --git a/toxcore/tox.api.h b/toxcore/tox.api.h index 493307e9..fc5d5593 100644 --- a/toxcore/tox.api.h +++ b/toxcore/tox.api.h | |||
@@ -188,19 +188,19 @@ const VERSION_PATCH = 0; | |||
188 | * features, but can't break the API. | 188 | * features, but can't break the API. |
189 | */ | 189 | */ |
190 | #define TOX_VERSION_IS_API_COMPATIBLE(MAJOR, MINOR, PATCH) \ | 190 | #define TOX_VERSION_IS_API_COMPATIBLE(MAJOR, MINOR, PATCH) \ |
191 | (TOX_VERSION_MAJOR > 0 && TOX_VERSION_MAJOR == MAJOR) && ( \ | 191 | ((TOX_VERSION_MAJOR > 0 && TOX_VERSION_MAJOR == MAJOR) && ( \ |
192 | /* 1.x.x, 2.x.x, etc. with matching major version. */ \ | 192 | /* 1.x.x, 2.x.x, etc. with matching major version. */ \ |
193 | TOX_VERSION_MINOR > MINOR || \ | 193 | TOX_VERSION_MINOR > MINOR || \ |
194 | TOX_VERSION_MINOR == MINOR && TOX_VERSION_PATCH >= PATCH \ | 194 | (TOX_VERSION_MINOR == MINOR && TOX_VERSION_PATCH >= PATCH) \ |
195 | ) || (TOX_VERSION_MAJOR == 0 && MAJOR == 0) && ( \ | 195 | )) || ((TOX_VERSION_MAJOR == 0 && MAJOR == 0) && ( \ |
196 | /* 0.x.x makes minor behave like major above. */ \ | 196 | /* 0.x.x makes minor behave like major above. */ \ |
197 | (TOX_VERSION_MINOR > 0 && TOX_VERSION_MINOR == MINOR) && ( \ | 197 | ((TOX_VERSION_MINOR > 0 && TOX_VERSION_MINOR == MINOR) && ( \ |
198 | TOX_VERSION_PATCH >= PATCH \ | 198 | TOX_VERSION_PATCH >= PATCH \ |
199 | ) || (TOX_VERSION_MINOR == 0 && MINOR == 0) && ( \ | 199 | )) || ((TOX_VERSION_MINOR == 0 && MINOR == 0) && ( \ |
200 | /* 0.0.x and 0.0.y are only compatible if x == y. */ \ | 200 | /* 0.0.x and 0.0.y are only compatible if x == y. */ \ |
201 | TOX_VERSION_PATCH == PATCH \ | 201 | TOX_VERSION_PATCH == PATCH \ |
202 | ) \ | 202 | )) \ |
203 | ) | 203 | )) |
204 | 204 | ||
205 | static namespace version { | 205 | static namespace version { |
206 | 206 | ||
diff --git a/toxcore/tox.c b/toxcore/tox.c index 747411f1..caaaedba 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -82,7 +82,7 @@ Tox *tox_new(const struct Tox_Options *options, TOX_ERR_NEW *error) | |||
82 | { | 82 | { |
83 | Messenger_Options m_options = {0}; | 83 | Messenger_Options m_options = {0}; |
84 | 84 | ||
85 | bool load_savedata_sk = 0, load_savedata_tox = 0; | 85 | bool load_savedata_sk = false, load_savedata_tox = false; |
86 | 86 | ||
87 | if (options == nullptr) { | 87 | if (options == nullptr) { |
88 | m_options.ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; | 88 | m_options.ipv6enabled = TOX_ENABLE_IPV6_DEFAULT; |
@@ -100,7 +100,7 @@ Tox *tox_new(const struct Tox_Options *options, TOX_ERR_NEW *error) | |||
100 | return nullptr; | 100 | return nullptr; |
101 | } | 101 | } |
102 | 102 | ||
103 | load_savedata_sk = 1; | 103 | load_savedata_sk = true; |
104 | } else if (tox_options_get_savedata_type(options) == TOX_SAVEDATA_TYPE_TOX_SAVE) { | 104 | } else if (tox_options_get_savedata_type(options) == TOX_SAVEDATA_TYPE_TOX_SAVE) { |
105 | if (tox_options_get_savedata_length(options) < TOX_ENC_SAVE_MAGIC_LENGTH) { | 105 | if (tox_options_get_savedata_length(options) < TOX_ENC_SAVE_MAGIC_LENGTH) { |
106 | SET_ERROR_PARAMETER(error, TOX_ERR_NEW_LOAD_BAD_FORMAT); | 106 | SET_ERROR_PARAMETER(error, TOX_ERR_NEW_LOAD_BAD_FORMAT); |
@@ -112,7 +112,7 @@ Tox *tox_new(const struct Tox_Options *options, TOX_ERR_NEW *error) | |||
112 | return nullptr; | 112 | return nullptr; |
113 | } | 113 | } |
114 | 114 | ||
115 | load_savedata_tox = 1; | 115 | load_savedata_tox = true; |
116 | } | 116 | } |
117 | 117 | ||
118 | m_options.ipv6enabled = tox_options_get_ipv6_enabled(options); | 118 | m_options.ipv6enabled = tox_options_get_ipv6_enabled(options); |
@@ -156,7 +156,7 @@ Tox *tox_new(const struct Tox_Options *options, TOX_ERR_NEW *error) | |||
156 | m_options.proxy_info.ip_port.ip.family = TOX_AF_UNSPEC; | 156 | m_options.proxy_info.ip_port.ip.family = TOX_AF_UNSPEC; |
157 | } | 157 | } |
158 | 158 | ||
159 | if (!addr_resolve_or_parse_ip(tox_options_get_proxy_host(options), &m_options.proxy_info.ip_port.ip, nullptr)) { | 159 | if (addr_resolve_or_parse_ip(tox_options_get_proxy_host(options), &m_options.proxy_info.ip_port.ip, nullptr) == 0) { |
160 | SET_ERROR_PARAMETER(error, TOX_ERR_NEW_PROXY_BAD_HOST); | 160 | SET_ERROR_PARAMETER(error, TOX_ERR_NEW_PROXY_BAD_HOST); |
161 | // TODO(irungentoo): TOX_ERR_NEW_PROXY_NOT_FOUND if domain. | 161 | // TODO(irungentoo): TOX_ERR_NEW_PROXY_NOT_FOUND if domain. |
162 | return nullptr; | 162 | return nullptr; |
@@ -457,7 +457,8 @@ void tox_self_set_status(Tox *tox, TOX_USER_STATUS status) | |||
457 | TOX_USER_STATUS tox_self_get_status(const Tox *tox) | 457 | TOX_USER_STATUS tox_self_get_status(const Tox *tox) |
458 | { | 458 | { |
459 | const Messenger *m = tox; | 459 | const Messenger *m = tox; |
460 | return (TOX_USER_STATUS)m_get_self_userstatus(m); | 460 | const uint8_t status = m_get_self_userstatus(m); |
461 | return (TOX_USER_STATUS)status; | ||
461 | } | 462 | } |
462 | 463 | ||
463 | static void set_friend_error(int32_t ret, TOX_ERR_FRIEND_ADD *error) | 464 | static void set_friend_error(int32_t ret, TOX_ERR_FRIEND_ADD *error) |
diff --git a/toxcore/tox.h b/toxcore/tox.h index f2e746c8..cf5b2c28 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h | |||
@@ -191,19 +191,19 @@ uint32_t tox_version_patch(void); | |||
191 | * features, but can't break the API. | 191 | * features, but can't break the API. |
192 | */ | 192 | */ |
193 | #define TOX_VERSION_IS_API_COMPATIBLE(MAJOR, MINOR, PATCH) \ | 193 | #define TOX_VERSION_IS_API_COMPATIBLE(MAJOR, MINOR, PATCH) \ |
194 | (TOX_VERSION_MAJOR > 0 && TOX_VERSION_MAJOR == MAJOR) && ( \ | 194 | ((TOX_VERSION_MAJOR > 0 && TOX_VERSION_MAJOR == MAJOR) && ( \ |
195 | /* 1.x.x, 2.x.x, etc. with matching major version. */ \ | 195 | /* 1.x.x, 2.x.x, etc. with matching major version. */ \ |
196 | TOX_VERSION_MINOR > MINOR || \ | 196 | TOX_VERSION_MINOR > MINOR || \ |
197 | TOX_VERSION_MINOR == MINOR && TOX_VERSION_PATCH >= PATCH \ | 197 | (TOX_VERSION_MINOR == MINOR && TOX_VERSION_PATCH >= PATCH) \ |
198 | ) || (TOX_VERSION_MAJOR == 0 && MAJOR == 0) && ( \ | 198 | )) || ((TOX_VERSION_MAJOR == 0 && MAJOR == 0) && ( \ |
199 | /* 0.x.x makes minor behave like major above. */ \ | 199 | /* 0.x.x makes minor behave like major above. */ \ |
200 | (TOX_VERSION_MINOR > 0 && TOX_VERSION_MINOR == MINOR) && ( \ | 200 | ((TOX_VERSION_MINOR > 0 && TOX_VERSION_MINOR == MINOR) && ( \ |
201 | TOX_VERSION_PATCH >= PATCH \ | 201 | TOX_VERSION_PATCH >= PATCH \ |
202 | ) || (TOX_VERSION_MINOR == 0 && MINOR == 0) && ( \ | 202 | )) || ((TOX_VERSION_MINOR == 0 && MINOR == 0) && ( \ |
203 | /* 0.0.x and 0.0.y are only compatible if x == y. */ \ | 203 | /* 0.0.x and 0.0.y are only compatible if x == y. */ \ |
204 | TOX_VERSION_PATCH == PATCH \ | 204 | TOX_VERSION_PATCH == PATCH \ |
205 | ) \ | 205 | )) \ |
206 | ) | 206 | )) |
207 | 207 | ||
208 | /** | 208 | /** |
209 | * Return whether the compiled library version is compatible with the passed | 209 | * Return whether the compiled library version is compatible with the passed |