diff options
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | auto_tests/TCP_test.c | 2 | ||||
-rw-r--r-- | auto_tests/conference_test.c | 8 | ||||
-rw-r--r-- | auto_tests/dht_test.c | 2 | ||||
-rw-r--r-- | auto_tests/network_test.c | 4 | ||||
-rw-r--r-- | auto_tests/onion_test.c | 2 | ||||
-rw-r--r-- | auto_tests/save_friend_test.c | 3 | ||||
-rw-r--r-- | auto_tests/tox_many_tcp_test.c | 2 | ||||
-rw-r--r-- | auto_tests/tox_many_test.c | 2 | ||||
-rw-r--r-- | auto_tests/tox_test.c | 2 | ||||
-rw-r--r-- | auto_tests/toxav_basic_test.c | 2 | ||||
-rw-r--r-- | auto_tests/toxav_many_test.c | 2 | ||||
-rw-r--r-- | other/DHT_bootstrap.c | 2 | ||||
-rw-r--r-- | other/bootstrap_daemon/src/log.c | 19 | ||||
-rw-r--r-- | other/bootstrap_daemon/src/tox-bootstrapd.c | 2 | ||||
-rw-r--r-- | testing/DHT_test.c | 2 | ||||
-rw-r--r-- | testing/Messenger_test.c | 2 | ||||
-rw-r--r-- | testing/av_test.c | 2 | ||||
-rw-r--r-- | testing/irc_syncbot.c | 9 | ||||
-rw-r--r-- | testing/misc_tools.c | 1 | ||||
-rw-r--r-- | testing/tox_shell.c | 2 | ||||
-rw-r--r-- | testing/tox_sync.c | 11 | ||||
-rw-r--r-- | toxcore/TCP_server.c | 4 | ||||
-rw-r--r-- | toxcore/network.c | 2 | ||||
-rw-r--r-- | toxcore/tox.c | 2 | ||||
-rw-r--r-- | toxcore/util.c | 2 |
27 files changed, 24 insertions, 92 deletions
@@ -21,9 +21,6 @@ install_manifest.txt | |||
21 | tags | 21 | tags |
22 | Makefile.in | 22 | Makefile.in |
23 | CMakeLists.txt.user | 23 | CMakeLists.txt.user |
24 | DartConfiguration.tcl | ||
25 | CTestTestfile.cmake | ||
26 | *.pc | ||
27 | 24 | ||
28 | # Testing | 25 | # Testing |
29 | testing/data | 26 | testing/data |
@@ -43,9 +40,6 @@ testing/data | |||
43 | *.app | 40 | *.app |
44 | *.la | 41 | *.la |
45 | 42 | ||
46 | # Libraries | ||
47 | *.so | ||
48 | |||
49 | # Misc (?) | 43 | # Misc (?) |
50 | m4/* | 44 | m4/* |
51 | configure | 45 | configure |
@@ -57,6 +51,8 @@ config.log | |||
57 | config.status | 51 | config.status |
58 | stamp-h1 | 52 | stamp-h1 |
59 | autom4te.cache | 53 | autom4te.cache |
54 | libtoxcore.pc | ||
55 | libtoxav.pc | ||
60 | libtool | 56 | libtool |
61 | .deps | 57 | .deps |
62 | .libs | 58 | .libs |
diff --git a/CMakeLists.txt b/CMakeLists.txt index f0707a76..e0f5d123 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -56,21 +56,22 @@ macro(add_flag flag) | |||
56 | add_cflag(${flag}) | 56 | add_cflag(${flag}) |
57 | add_cxxflag(${flag}) | 57 | add_cxxflag(${flag}) |
58 | endmacro() | 58 | endmacro() |
59 | |||
60 | # Set standard version for compiler. | ||
61 | add_cflag("-std=c99") | ||
62 | add_cxxflag("-std=c++11") | ||
63 | |||
64 | # Error on non-ISO C. | ||
65 | add_cflag("-pedantic-errors") | ||
66 | 59 | ||
67 | option(WARNINGS "Enable additional compiler warnings" ON) | 60 | option(WARNINGS "Enable additional compiler warnings" ON) |
68 | if(WARNINGS) | 61 | if(WARNINGS) |
62 | # Set standard version for compiler. | ||
63 | add_cflag("-std=gnu99") | ||
64 | add_cxxflag("-std=c++98") | ||
65 | |||
69 | # Add all warning flags we can. | 66 | # Add all warning flags we can. |
70 | add_flag("-Wall") | 67 | add_flag("-Wall") |
71 | add_flag("-Wextra") | 68 | add_flag("-Wextra") |
72 | add_flag("-Weverything") | 69 | add_flag("-Weverything") |
73 | 70 | ||
71 | # -pedantic only for C, because in C++ we want to allow the GNU/C99 extension | ||
72 | # of having a comma at the end of an enumerator list. | ||
73 | add_cflag("-pedantic") | ||
74 | |||
74 | # Disable specific warning flags for both C and C++. | 75 | # Disable specific warning flags for both C and C++. |
75 | add_flag("-Wno-cast-align") | 76 | add_flag("-Wno-cast-align") |
76 | add_flag("-Wno-conversion") | 77 | add_flag("-Wno-conversion") |
diff --git a/auto_tests/TCP_test.c b/auto_tests/TCP_test.c index 6a439261..d9013378 100644 --- a/auto_tests/TCP_test.c +++ b/auto_tests/TCP_test.c | |||
@@ -1,5 +1,3 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
3 | #ifdef HAVE_CONFIG_H | 1 | #ifdef HAVE_CONFIG_H |
4 | #include "config.h" | 2 | #include "config.h" |
5 | #endif | 3 | #endif |
diff --git a/auto_tests/conference_test.c b/auto_tests/conference_test.c index 36707e0f..aa2f8e13 100644 --- a/auto_tests/conference_test.c +++ b/auto_tests/conference_test.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Auto Tests: Conferences. | 1 | /* Auto Tests: Conferences. |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #define _XOPEN_SOURCE 600 | ||
5 | |||
6 | #ifdef HAVE_CONFIG_H | 4 | #ifdef HAVE_CONFIG_H |
7 | #include "config.h" | 5 | #include "config.h" |
8 | #endif | 6 | #endif |
@@ -177,7 +175,7 @@ group_test_restart: | |||
177 | * Either way in this case it's fine */ | 175 | * Either way in this case it's fine */ |
178 | if (peer_count != NUM_GROUP_TOX) { | 176 | if (peer_count != NUM_GROUP_TOX) { |
179 | ++test_run; | 177 | ++test_run; |
180 | printf("\tError starting up the first group (peer_count %" PRIu32 " != %d, test_run = %d)\n", peer_count, NUM_GROUP_TOX, | 178 | printf("\tError starting up the first group (peer_count %"PRIu32" != %d, test_run = %d)\n", peer_count, NUM_GROUP_TOX, |
181 | test_run); | 179 | test_run); |
182 | 180 | ||
183 | for (j = 0; j < NUM_GROUP_TOX; ++j) { | 181 | for (j = 0; j < NUM_GROUP_TOX; ++j) { |
@@ -196,7 +194,7 @@ group_test_restart: | |||
196 | * important again. | 194 | * important again. |
197 | */ | 195 | */ |
198 | ck_assert_msg(peer_count == NUM_GROUP_TOX, "\n\tBad number of group peers (pre check)." | 196 | ck_assert_msg(peer_count == NUM_GROUP_TOX, "\n\tBad number of group peers (pre check)." |
199 | "\n\t\t\tExpected: %u but tox_instance(%u) only has: %" PRIu32 "\n\n", | 197 | "\n\t\t\tExpected: %u but tox_instance(%u) only has: %"PRIu32"\n\n", |
200 | NUM_GROUP_TOX, i, peer_count); | 198 | NUM_GROUP_TOX, i, peer_count); |
201 | 199 | ||
202 | uint8_t title[2048]; | 200 | uint8_t title[2048]; |
@@ -243,7 +241,7 @@ group_test_restart: | |||
243 | for (i = 0; i < (k - 1); ++i) { | 241 | for (i = 0; i < (k - 1); ++i) { |
244 | uint32_t peer_count = tox_conference_peer_count(toxes[i], 0, NULL); | 242 | uint32_t peer_count = tox_conference_peer_count(toxes[i], 0, NULL); |
245 | ck_assert_msg(peer_count == (k - 1), "\n\tBad number of group peers (post check)." | 243 | ck_assert_msg(peer_count == (k - 1), "\n\tBad number of group peers (post check)." |
246 | "\n\t\t\tExpected: %u but tox_instance(%u) only has: %" PRIu32 "\n\n", | 244 | "\n\t\t\tExpected: %u but tox_instance(%u) only has: %"PRIu32"\n\n", |
247 | (k - 1), i, peer_count); | 245 | (k - 1), i, peer_count); |
248 | } | 246 | } |
249 | } | 247 | } |
diff --git a/auto_tests/dht_test.c b/auto_tests/dht_test.c index 633e7002..9cec1643 100644 --- a/auto_tests/dht_test.c +++ b/auto_tests/dht_test.c | |||
@@ -1,5 +1,3 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
3 | #ifdef HAVE_CONFIG_H | 1 | #ifdef HAVE_CONFIG_H |
4 | #include "config.h" | 2 | #include "config.h" |
5 | #endif | 3 | #endif |
diff --git a/auto_tests/network_test.c b/auto_tests/network_test.c index ca918778..783f3f7b 100644 --- a/auto_tests/network_test.c +++ b/auto_tests/network_test.c | |||
@@ -114,8 +114,8 @@ START_TEST(test_ip_equal) | |||
114 | ip2.ip6.uint32[2] = htonl(0xFFFF); | 114 | ip2.ip6.uint32[2] = htonl(0xFFFF); |
115 | ip2.ip6.uint32[3] = htonl(0x7F000001); | 115 | ip2.ip6.uint32[3] = htonl(0x7F000001); |
116 | 116 | ||
117 | ck_assert_msg(IPV6_IPV4_IN_V6(ip2.ip6) != 0, | 117 | ck_assert_msg(IN6_IS_ADDR_V4MAPPED(&ip2.ip6.in6_addr) != 0, |
118 | "IPV6_IPV4_IN_V6(::ffff:127.0.0.1): expected != 0, got 0."); | 118 | "IN6_IS_ADDR_V4MAPPED(::ffff:127.0.0.1): expected != 0, got 0."); |
119 | 119 | ||
120 | res = ip_equal(&ip1, &ip2); | 120 | res = ip_equal(&ip1, &ip2); |
121 | ck_assert_msg(res != 0, "ip_equal( {AF_INET, 127.0.0.1}, {AF_INET6, ::ffff:127.0.0.1} ): expected result != 0, got 0."); | 121 | ck_assert_msg(res != 0, "ip_equal( {AF_INET, 127.0.0.1}, {AF_INET6, ::ffff:127.0.0.1} ): expected result != 0, got 0."); |
diff --git a/auto_tests/onion_test.c b/auto_tests/onion_test.c index 05264927..44ea9c7d 100644 --- a/auto_tests/onion_test.c +++ b/auto_tests/onion_test.c | |||
@@ -1,5 +1,3 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
3 | #ifdef HAVE_CONFIG_H | 1 | #ifdef HAVE_CONFIG_H |
4 | #include "config.h" | 2 | #include "config.h" |
5 | #endif | 3 | #endif |
diff --git a/auto_tests/save_friend_test.c b/auto_tests/save_friend_test.c index 448160c0..9d36ff2d 100644 --- a/auto_tests/save_friend_test.c +++ b/auto_tests/save_friend_test.c | |||
@@ -1,10 +1,7 @@ | |||
1 | /* Auto Tests: Save and load friends. | 1 | /* Auto Tests: Save and load friends. |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #define _XOPEN_SOURCE 600 | ||
5 | |||
6 | #include "helpers.h" | 4 | #include "helpers.h" |
7 | #include "../toxcore/tox.h" | ||
8 | 5 | ||
9 | #include <assert.h> | 6 | #include <assert.h> |
10 | #include <stdio.h> | 7 | #include <stdio.h> |
diff --git a/auto_tests/tox_many_tcp_test.c b/auto_tests/tox_many_tcp_test.c index 48f5671c..197c6e47 100644 --- a/auto_tests/tox_many_tcp_test.c +++ b/auto_tests/tox_many_tcp_test.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Auto Tests: Many TCP. | 1 | /* Auto Tests: Many TCP. |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #define _XOPEN_SOURCE 600 | ||
5 | |||
6 | #ifdef HAVE_CONFIG_H | 4 | #ifdef HAVE_CONFIG_H |
7 | #include "config.h" | 5 | #include "config.h" |
8 | #endif | 6 | #endif |
diff --git a/auto_tests/tox_many_test.c b/auto_tests/tox_many_test.c index b44bbb0c..0c4c8c7d 100644 --- a/auto_tests/tox_many_test.c +++ b/auto_tests/tox_many_test.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* Auto Tests: Many clients. | 1 | /* Auto Tests: Many clients. |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #define _XOPEN_SOURCE 600 | ||
5 | |||
6 | #ifdef HAVE_CONFIG_H | 4 | #ifdef HAVE_CONFIG_H |
7 | #include "config.h" | 5 | #include "config.h" |
8 | #endif | 6 | #endif |
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index ab2202d1..dfd1d80a 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -10,8 +10,6 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define _XOPEN_SOURCE 600 | ||
14 | |||
15 | #ifdef HAVE_CONFIG_H | 13 | #ifdef HAVE_CONFIG_H |
16 | #include "config.h" | 14 | #include "config.h" |
17 | #endif | 15 | #endif |
diff --git a/auto_tests/toxav_basic_test.c b/auto_tests/toxav_basic_test.c index 79f552de..767fca87 100644 --- a/auto_tests/toxav_basic_test.c +++ b/auto_tests/toxav_basic_test.c | |||
@@ -1,5 +1,3 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
3 | #ifdef HAVE_CONFIG_H | 1 | #ifdef HAVE_CONFIG_H |
4 | #include "config.h" | 2 | #include "config.h" |
5 | #endif | 3 | #endif |
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index 1a10db44..b33b93c8 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -1,5 +1,3 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | |||
3 | #ifdef HAVE_CONFIG_H | 1 | #ifdef HAVE_CONFIG_H |
4 | #include "config.h" | 2 | #include "config.h" |
5 | #endif | 3 | #endif |
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index fa71d920..e056de41 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c | |||
@@ -22,8 +22,6 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #define _XOPEN_SOURCE 600 | ||
26 | |||
27 | #ifdef HAVE_CONFIG_H | 25 | #ifdef HAVE_CONFIG_H |
28 | #include "config.h" | 26 | #include "config.h" |
29 | #endif | 27 | #endif |
diff --git a/other/bootstrap_daemon/src/log.c b/other/bootstrap_daemon/src/log.c index ae418f93..7632d739 100644 --- a/other/bootstrap_daemon/src/log.c +++ b/other/bootstrap_daemon/src/log.c | |||
@@ -26,8 +26,8 @@ | |||
26 | 26 | ||
27 | #include "global.h" | 27 | #include "global.h" |
28 | 28 | ||
29 | #include <assert.h> | ||
30 | #include <syslog.h> | 29 | #include <syslog.h> |
30 | |||
31 | #include <stdarg.h> | 31 | #include <stdarg.h> |
32 | #include <stdio.h> | 32 | #include <stdio.h> |
33 | 33 | ||
@@ -82,22 +82,7 @@ static int level_syslog(LOG_LEVEL level) | |||
82 | 82 | ||
83 | static void log_syslog(LOG_LEVEL level, const char *format, va_list args) | 83 | static void log_syslog(LOG_LEVEL level, const char *format, va_list args) |
84 | { | 84 | { |
85 | va_list args2; | 85 | vsyslog(level_syslog(level), format, args); |
86 | |||
87 | va_copy(args2, args); | ||
88 | int size = vsnprintf(NULL, 0, format, args2); | ||
89 | va_end(args2); | ||
90 | |||
91 | assert(size >= 0); | ||
92 | |||
93 | if (size < 0) { | ||
94 | return; | ||
95 | } | ||
96 | |||
97 | char buf[size + 1]; | ||
98 | vsnprintf(buf, size + 1, format, args); | ||
99 | |||
100 | syslog(level_syslog(level), "%s", buf); | ||
101 | } | 86 | } |
102 | 87 | ||
103 | static FILE *level_stdout(LOG_LEVEL level) | 88 | static FILE *level_stdout(LOG_LEVEL level) |
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c index a0504eee..4495f88e 100644 --- a/other/bootstrap_daemon/src/tox-bootstrapd.c +++ b/other/bootstrap_daemon/src/tox-bootstrapd.c | |||
@@ -22,8 +22,6 @@ | |||
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #define _XOPEN_SOURCE 600 | ||
26 | |||
27 | // system provided | 25 | // system provided |
28 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
29 | #include <unistd.h> | 27 | #include <unistd.h> |
diff --git a/testing/DHT_test.c b/testing/DHT_test.c index 6d20d550..c994f543 100644 --- a/testing/DHT_test.c +++ b/testing/DHT_test.c | |||
@@ -27,8 +27,6 @@ | |||
27 | * | 27 | * |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define _XOPEN_SOURCE 600 | ||
31 | |||
32 | #ifdef HAVE_CONFIG_H | 30 | #ifdef HAVE_CONFIG_H |
33 | #include "config.h" | 31 | #include "config.h" |
34 | #endif | 32 | #endif |
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index 695c50ae..4fd81649 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c | |||
@@ -37,8 +37,6 @@ | |||
37 | * | 37 | * |
38 | */ | 38 | */ |
39 | 39 | ||
40 | #define _XOPEN_SOURCE 600 | ||
41 | |||
42 | #ifdef HAVE_CONFIG_H | 40 | #ifdef HAVE_CONFIG_H |
43 | #include "config.h" | 41 | #include "config.h" |
44 | #endif | 42 | #endif |
diff --git a/testing/av_test.c b/testing/av_test.c index aeb661be..7418a15a 100644 --- a/testing/av_test.c +++ b/testing/av_test.c | |||
@@ -22,8 +22,6 @@ | |||
22 | * -lopencv_highgui -lopencv_imgproc -lsndfile -pthread -lvpx -lopus -lsodium -lportaudio | 22 | * -lopencv_highgui -lopencv_imgproc -lsndfile -pthread -lvpx -lopus -lsodium -lportaudio |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #define _XOPEN_SOURCE 600 | ||
26 | |||
27 | #ifdef __cplusplus | 25 | #ifdef __cplusplus |
28 | extern "C" { | 26 | extern "C" { |
29 | #endif | 27 | #endif |
diff --git a/testing/irc_syncbot.c b/testing/irc_syncbot.c index b63b6151..affc0296 100644 --- a/testing/irc_syncbot.c +++ b/testing/irc_syncbot.c | |||
@@ -1,4 +1,3 @@ | |||
1 | #define _XOPEN_SOURCE 600 | ||
2 | 1 | ||
3 | #include <stdint.h> | 2 | #include <stdint.h> |
4 | #include <stdio.h> | 3 | #include <stdio.h> |
@@ -35,8 +34,8 @@ static uint16_t port = 6667; | |||
35 | 34 | ||
36 | static int sock; | 35 | static int sock; |
37 | 36 | ||
38 | #define SERVER_CONNECT "NICK " IRC_NAME "\nUSER " IRC_NAME " 8 * :" IRC_NAME "\n" | 37 | #define SERVER_CONNECT "NICK "IRC_NAME"\nUSER "IRC_NAME" 8 * :"IRC_NAME"\n" |
39 | #define CHANNEL_JOIN "JOIN " IRC_CHANNEL "\n" | 38 | #define CHANNEL_JOIN "JOIN "IRC_CHANNEL"\n" |
40 | 39 | ||
41 | /* In toxcore/network.c */ | 40 | /* In toxcore/network.c */ |
42 | uint64_t current_time_monotonic(void); | 41 | uint64_t current_time_monotonic(void); |
@@ -132,8 +131,8 @@ static void copy_groupmessage(Tox *tox, uint32_t groupnumber, uint32_t friendgro | |||
132 | uint8_t sendbuf[2048]; | 131 | uint8_t sendbuf[2048]; |
133 | uint16_t send_len = 0; | 132 | uint16_t send_len = 0; |
134 | 133 | ||
135 | memcpy(sendbuf, "PRIVMSG " IRC_CHANNEL " :", sizeof("PRIVMSG " IRC_CHANNEL " :")); | 134 | memcpy(sendbuf, "PRIVMSG "IRC_CHANNEL" :", sizeof("PRIVMSG "IRC_CHANNEL" :")); |
136 | send_len += sizeof("PRIVMSG " IRC_CHANNEL " :") - 1; | 135 | send_len += sizeof("PRIVMSG "IRC_CHANNEL" :") - 1; |
137 | memcpy(sendbuf + send_len, name, namelen); | 136 | memcpy(sendbuf + send_len, name, namelen); |
138 | send_len += namelen; | 137 | send_len += namelen; |
139 | sendbuf[send_len] = ':'; | 138 | sendbuf[send_len] = ':'; |
diff --git a/testing/misc_tools.c b/testing/misc_tools.c index 30c813ca..c1292ed8 100644 --- a/testing/misc_tools.c +++ b/testing/misc_tools.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include <strings.h> | ||
33 | 32 | ||
34 | #ifdef TOX_DEBUG | 33 | #ifdef TOX_DEBUG |
35 | #include <assert.h> | 34 | #include <assert.h> |
diff --git a/testing/tox_shell.c b/testing/tox_shell.c index d5de3e67..18aad9c7 100644 --- a/testing/tox_shell.c +++ b/testing/tox_shell.c | |||
@@ -26,8 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #define _XOPEN_SOURCE 600 | ||
30 | |||
31 | #ifdef HAVE_CONFIG_H | 29 | #ifdef HAVE_CONFIG_H |
32 | #include "config.h" | 30 | #include "config.h" |
33 | #endif | 31 | #endif |
diff --git a/testing/tox_sync.c b/testing/tox_sync.c index 6ac3dcf0..0c91abfd 100644 --- a/testing/tox_sync.c +++ b/testing/tox_sync.c | |||
@@ -28,8 +28,6 @@ | |||
28 | * | 28 | * |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #define _XOPEN_SOURCE 600 | ||
32 | |||
33 | #ifdef HAVE_CONFIG_H | 31 | #ifdef HAVE_CONFIG_H |
34 | #include "config.h" | 32 | #include "config.h" |
35 | #endif | 33 | #endif |
@@ -44,7 +42,6 @@ | |||
44 | #include <dirent.h> | 42 | #include <dirent.h> |
45 | #include <netinet/in.h> | 43 | #include <netinet/in.h> |
46 | #include <stdio.h> | 44 | #include <stdio.h> |
47 | #include <sys/stat.h> | ||
48 | 45 | ||
49 | #define NUM_FILE_SENDERS 256 | 46 | #define NUM_FILE_SENDERS 256 |
50 | typedef struct { | 47 | typedef struct { |
@@ -300,7 +297,6 @@ int main(int argc, char *argv[]) | |||
300 | memcpy(path, argv[argvoffset + 4], strlen(argv[argvoffset + 4])); | 297 | memcpy(path, argv[argvoffset + 4], strlen(argv[argvoffset + 4])); |
301 | DIR *d; | 298 | DIR *d; |
302 | struct dirent *dir; | 299 | struct dirent *dir; |
303 | struct stat statbuf; | ||
304 | uint8_t notconnected = 1; | 300 | uint8_t notconnected = 1; |
305 | 301 | ||
306 | while (1) { | 302 | while (1) { |
@@ -314,12 +310,7 @@ int main(int argc, char *argv[]) | |||
314 | 310 | ||
315 | if (d) { | 311 | if (d) { |
316 | while ((dir = readdir(d)) != NULL) { | 312 | while ((dir = readdir(d)) != NULL) { |
317 | char filepath[strlen(path) + strlen(dir->d_name) + 1]; | 313 | if (dir->d_type == DT_REG) { |
318 | memcpy(filepath, path, strlen(path)); | ||
319 | memcpy(filepath + strlen(path), dir->d_name, strlen(dir->d_name) + 1); | ||
320 | stat(filepath, &statbuf); | ||
321 | |||
322 | if (S_ISREG(statbuf.st_mode)) { | ||
323 | char fullpath[1024]; | 314 | char fullpath[1024]; |
324 | 315 | ||
325 | if (path[strlen(path) - 1] == '/') { | 316 | if (path[strlen(path) - 1] == '/') { |
diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c index d9ace28a..0e2d0085 100644 --- a/toxcore/TCP_server.c +++ b/toxcore/TCP_server.c | |||
@@ -619,7 +619,7 @@ static int send_routing_response(TCP_Secure_Connection *con, uint8_t rpid, const | |||
619 | */ | 619 | */ |
620 | static int send_connect_notification(TCP_Secure_Connection *con, uint8_t id) | 620 | static int send_connect_notification(TCP_Secure_Connection *con, uint8_t id) |
621 | { | 621 | { |
622 | uint8_t data[2] = {TCP_PACKET_CONNECTION_NOTIFICATION, (uint8_t)(id + NUM_RESERVED_PORTS)}; | 622 | uint8_t data[2] = {TCP_PACKET_CONNECTION_NOTIFICATION, id + NUM_RESERVED_PORTS}; |
623 | return write_packet_TCP_secure_connection(con, data, sizeof(data), 1); | 623 | return write_packet_TCP_secure_connection(con, data, sizeof(data), 1); |
624 | } | 624 | } |
625 | 625 | ||
@@ -629,7 +629,7 @@ static int send_connect_notification(TCP_Secure_Connection *con, uint8_t id) | |||
629 | */ | 629 | */ |
630 | static int send_disconnect_notification(TCP_Secure_Connection *con, uint8_t id) | 630 | static int send_disconnect_notification(TCP_Secure_Connection *con, uint8_t id) |
631 | { | 631 | { |
632 | uint8_t data[2] = {TCP_PACKET_DISCONNECT_NOTIFICATION, (uint8_t)(id + NUM_RESERVED_PORTS)}; | 632 | uint8_t data[2] = {TCP_PACKET_DISCONNECT_NOTIFICATION, id + NUM_RESERVED_PORTS}; |
633 | return write_packet_TCP_secure_connection(con, data, sizeof(data), 1); | 633 | return write_packet_TCP_secure_connection(con, data, sizeof(data), 1); |
634 | } | 634 | } |
635 | 635 | ||
diff --git a/toxcore/network.c b/toxcore/network.c index 250a304b..31e8fd8b 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -21,8 +21,6 @@ | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define _XOPEN_SOURCE 600 | ||
25 | |||
26 | #if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_WINXP | 24 | #if defined(_WIN32) && _WIN32_WINNT >= _WIN32_WINNT_WINXP |
27 | #define _WIN32_WINNT 0x501 | 25 | #define _WIN32_WINNT 0x501 |
28 | #endif | 26 | #endif |
diff --git a/toxcore/tox.c b/toxcore/tox.c index 3276d2d5..37298ce2 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -21,8 +21,6 @@ | |||
21 | * | 21 | * |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define _XOPEN_SOURCE 600 | ||
25 | |||
26 | #ifdef HAVE_CONFIG_H | 24 | #ifdef HAVE_CONFIG_H |
27 | #include "config.h" | 25 | #include "config.h" |
28 | #endif | 26 | #endif |
diff --git a/toxcore/util.c b/toxcore/util.c index 1d2a85dc..7a390ea9 100644 --- a/toxcore/util.c +++ b/toxcore/util.c | |||
@@ -22,8 +22,6 @@ | |||
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 | 24 | ||
25 | #define _XOPEN_SOURCE 600 | ||
26 | |||
27 | #ifdef HAVE_CONFIG_H | 25 | #ifdef HAVE_CONFIG_H |
28 | #include "config.h" | 26 | #include "config.h" |
29 | #endif | 27 | #endif |