diff options
-rw-r--r-- | auto_tests/save_compatibility_test.c | 43 | ||||
-rwxr-xr-x | other/analysis/run-clang | 1 | ||||
-rw-r--r-- | other/fun/save-generator.c | 21 | ||||
-rw-r--r-- | toxav/video.c | 4 |
4 files changed, 37 insertions, 32 deletions
diff --git a/auto_tests/save_compatibility_test.c b/auto_tests/save_compatibility_test.c index 08ac9e17..07ffc52a 100644 --- a/auto_tests/save_compatibility_test.c +++ b/auto_tests/save_compatibility_test.c | |||
@@ -6,16 +6,16 @@ | |||
6 | 6 | ||
7 | #include <string.h> | 7 | #include <string.h> |
8 | 8 | ||
9 | #define SAVE_FILE "../auto_tests/data/save.tox" | 9 | #define LOADED_SAVE_FILE "../auto_tests/data/save.tox" |
10 | 10 | ||
11 | // Information from the save file | 11 | // Information from the save file |
12 | #define NAME "name" | 12 | #define EXPECTED_NAME "name" |
13 | #define NAME_SIZE strlen(NAME) | 13 | #define EXPECTED_NAME_SIZE strlen(EXPECTED_NAME) |
14 | #define STATUS_MESSAGE "Hello World" | 14 | #define EXPECTED_STATUS_MESSAGE "Hello World" |
15 | #define STATUS_MESSAGE_SIZE strlen(STATUS_MESSAGE) | 15 | #define EXPECTED_STATUS_MESSAGE_SIZE strlen(EXPECTED_STATUS_MESSAGE) |
16 | #define NUM_FRIENDS 1 | 16 | #define EXPECTED_NUM_FRIENDS 1 |
17 | #define NOSPAM "4C762C7D" | 17 | #define EXPECTED_NOSPAM "4C762C7D" |
18 | #define TOX_ID "B70E97D41F69B7F4C42A5BC7BD7A76B95B8030BE1B7C0E9E6FC19FC4ABEB195B4C762C7D800B" | 18 | #define EXPECTED_TOX_ID "B70E97D41F69B7F4C42A5BC7BD7A76B95B8030BE1B7C0E9E6FC19FC4ABEB195B4C762C7D800B" |
19 | 19 | ||
20 | static size_t get_file_size(const char *save_path) | 20 | static size_t get_file_size(const char *save_path) |
21 | { | 21 | { |
@@ -83,38 +83,41 @@ static void test_save_compatibility(const char *save_path) | |||
83 | free(save_data); | 83 | free(save_data); |
84 | 84 | ||
85 | const size_t name_size = tox_self_get_name_size(tox); | 85 | const size_t name_size = tox_self_get_name_size(tox); |
86 | ck_assert_msg(name_size == NAME_SIZE, "name sizes do not match expected %zu got %zu", NAME_SIZE, name_size); | 86 | ck_assert_msg(name_size == EXPECTED_NAME_SIZE, "name sizes do not match expected %zu got %zu", EXPECTED_NAME_SIZE, |
87 | name_size); | ||
87 | 88 | ||
88 | uint8_t name[TOX_MAX_NAME_LENGTH]; | 89 | uint8_t name[TOX_MAX_NAME_LENGTH]; |
89 | tox_self_get_name(tox, name); | 90 | tox_self_get_name(tox, name); |
90 | ck_assert_msg(strncmp((const char *)name, NAME, name_size) == 0, "names do not match, expected %s got %s", NAME, name); | 91 | ck_assert_msg(strncmp((const char *)name, EXPECTED_NAME, name_size) == 0, |
92 | "names do not match, expected %s got %s", EXPECTED_NAME, name); | ||
91 | 93 | ||
92 | const size_t status_message_size = tox_self_get_status_message_size(tox); | 94 | const size_t status_message_size = tox_self_get_status_message_size(tox); |
93 | ck_assert_msg(status_message_size == STATUS_MESSAGE_SIZE, "status message sizes do not match, expected %zu got %zu", | 95 | ck_assert_msg(status_message_size == EXPECTED_STATUS_MESSAGE_SIZE, |
94 | STATUS_MESSAGE_SIZE, status_message_size); | 96 | "status message sizes do not match, expected %zu got %zu", EXPECTED_STATUS_MESSAGE_SIZE, status_message_size); |
95 | 97 | ||
96 | uint8_t status_message[TOX_MAX_STATUS_MESSAGE_LENGTH]; | 98 | uint8_t status_message[TOX_MAX_STATUS_MESSAGE_LENGTH]; |
97 | tox_self_get_status_message(tox, status_message); | 99 | tox_self_get_status_message(tox, status_message); |
98 | ck_assert_msg(strncmp((const char *)status_message, STATUS_MESSAGE, status_message_size) == 0, | 100 | ck_assert_msg(strncmp((const char *)status_message, EXPECTED_STATUS_MESSAGE, status_message_size) == 0, |
99 | "status messages do not match, expected %s got %s", | 101 | "status messages do not match, expected %s got %s", |
100 | STATUS_MESSAGE, status_message); | 102 | EXPECTED_STATUS_MESSAGE, status_message); |
101 | 103 | ||
102 | const size_t num_friends = tox_self_get_friend_list_size(tox); | 104 | const size_t num_friends = tox_self_get_friend_list_size(tox); |
103 | ck_assert_msg(num_friends == NUM_FRIENDS, "number of friends do not match, expected %d got %zu", NUM_FRIENDS, | 105 | ck_assert_msg(num_friends == EXPECTED_NUM_FRIENDS, |
104 | num_friends); | 106 | "number of friends do not match, expected %d got %zu", EXPECTED_NUM_FRIENDS, num_friends); |
105 | 107 | ||
106 | const uint32_t nospam = tox_self_get_nospam(tox); | 108 | const uint32_t nospam = tox_self_get_nospam(tox); |
107 | char nospam_str[(TOX_NOSPAM_SIZE * 2) + 1]; | 109 | char nospam_str[(TOX_NOSPAM_SIZE * 2) + 1]; |
108 | const size_t length = snprintf(nospam_str, sizeof(nospam_str), "%08X", nospam); | 110 | const size_t length = snprintf(nospam_str, sizeof(nospam_str), "%08X", nospam); |
109 | nospam_str[length] = '\0'; | 111 | nospam_str[length] = '\0'; |
110 | ck_assert_msg(strcmp(nospam_str, NOSPAM) == 0, "nospam does not match, expected %s got %s", NOSPAM, nospam_str); | 112 | ck_assert_msg(strcmp(nospam_str, EXPECTED_NOSPAM) == 0, |
113 | "nospam does not match, expected %s got %s", EXPECTED_NOSPAM, nospam_str); | ||
111 | 114 | ||
112 | uint8_t tox_id[TOX_ADDRESS_SIZE]; | 115 | uint8_t tox_id[TOX_ADDRESS_SIZE]; |
113 | char tox_id_str[TOX_ADDRESS_SIZE * 2]; | 116 | char tox_id_str[TOX_ADDRESS_SIZE * 2]; |
114 | tox_self_get_address(tox, tox_id); | 117 | tox_self_get_address(tox, tox_id); |
115 | to_hex(tox_id_str, tox_id, TOX_ADDRESS_SIZE); | 118 | to_hex(tox_id_str, tox_id, TOX_ADDRESS_SIZE); |
116 | ck_assert_msg(strncmp(tox_id_str, TOX_ID, TOX_ADDRESS_SIZE * 2) == 0, "tox ids do not match, expected %s got %s", | 119 | ck_assert_msg(strncmp(tox_id_str, EXPECTED_TOX_ID, TOX_ADDRESS_SIZE * 2) == 0, |
117 | TOX_ID, tox_id_str); | 120 | "tox ids do not match, expected %s got %s", EXPECTED_TOX_ID, tox_id_str); |
118 | 121 | ||
119 | tox_kill(tox); | 122 | tox_kill(tox); |
120 | } | 123 | } |
@@ -133,7 +136,7 @@ int main(int argc, char *argv[]) | |||
133 | } | 136 | } |
134 | 137 | ||
135 | char save_path[4096]; | 138 | char save_path[4096]; |
136 | snprintf(save_path, sizeof(save_path), "%s/%s", base_path, SAVE_FILE); | 139 | snprintf(save_path, sizeof(save_path), "%s/%s", base_path, LOADED_SAVE_FILE); |
137 | 140 | ||
138 | test_save_compatibility(save_path); | 141 | test_save_compatibility(save_path); |
139 | 142 | ||
diff --git a/other/analysis/run-clang b/other/analysis/run-clang index 60e59eab..d1a5e4dc 100755 --- a/other/analysis/run-clang +++ b/other/analysis/run-clang | |||
@@ -7,6 +7,7 @@ clang++ -o /dev/null amalgamation.cc \ | |||
7 | $CPPFLAGS \ | 7 | $CPPFLAGS \ |
8 | $LDFLAGS \ | 8 | $LDFLAGS \ |
9 | -std=c++11 \ | 9 | -std=c++11 \ |
10 | -Werror \ | ||
10 | -Weverything \ | 11 | -Weverything \ |
11 | -Wno-c++98-compat-pedantic \ | 12 | -Wno-c++98-compat-pedantic \ |
12 | -Wno-c99-extensions \ | 13 | -Wno-c99-extensions \ |
diff --git a/other/fun/save-generator.c b/other/fun/save-generator.c index e73a2f01..c0b5a8a5 100644 --- a/other/fun/save-generator.c +++ b/other/fun/save-generator.c | |||
@@ -7,16 +7,16 @@ | |||
7 | #include "../../toxcore/ccompat.h" | 7 | #include "../../toxcore/ccompat.h" |
8 | #include "../../toxcore/tox.h" | 8 | #include "../../toxcore/tox.h" |
9 | 9 | ||
10 | #define SAVE_FILE "save.tox" | 10 | #define GENERATED_SAVE_FILE "save.tox" |
11 | #define STATUS_MESSAGE "Hello World" | 11 | #define GENERATED_STATUS_MESSAGE "Hello World" |
12 | #define REQUEST_MESSAGE "Add me." | 12 | #define GENERATED_REQUEST_MESSAGE "Add me." |
13 | #define BOOTSTRAP_IP "185.14.30.213" | 13 | #define BOOTSTRAP_IP "185.14.30.213" |
14 | #define BOOTSTRAP_ADDRESS "2555763C8C460495B14157D234DD56B86300A2395554BCAE4621AC345B8C1B1B" | 14 | #define BOOTSTRAP_ADDRESS "2555763C8C460495B14157D234DD56B86300A2395554BCAE4621AC345B8C1B1B" |
15 | #define UDP_PORT 443 | 15 | #define BOOTSTRAP_UDP_PORT 443 |
16 | 16 | ||
17 | static bool write_save(const uint8_t *data, size_t length) | 17 | static bool write_save(const uint8_t *data, size_t length) |
18 | { | 18 | { |
19 | FILE *fp = fopen(SAVE_FILE, "w"); | 19 | FILE *fp = fopen(GENERATED_SAVE_FILE, "w"); |
20 | 20 | ||
21 | if (!fp) { | 21 | if (!fp) { |
22 | return false; | 22 | return false; |
@@ -41,7 +41,7 @@ static bool bootstrap_tox(Tox *tox) | |||
41 | } | 41 | } |
42 | 42 | ||
43 | Tox_Err_Bootstrap err; | 43 | Tox_Err_Bootstrap err; |
44 | tox_bootstrap(tox, BOOTSTRAP_IP, UDP_PORT, key, &err); | 44 | tox_bootstrap(tox, BOOTSTRAP_IP, BOOTSTRAP_UDP_PORT, key, &err); |
45 | free(key); | 45 | free(key); |
46 | 46 | ||
47 | if (err != TOX_ERR_BOOTSTRAP_OK) { | 47 | if (err != TOX_ERR_BOOTSTRAP_OK) { |
@@ -80,7 +80,7 @@ static void print_information(Tox *tox) | |||
80 | printf("Tox ID: %.*s.\n", (int)TOX_ADDRESS_SIZE * 2, tox_id_str); | 80 | printf("Tox ID: %.*s.\n", (int)TOX_ADDRESS_SIZE * 2, tox_id_str); |
81 | printf("Nospam: %s.\n", nospam_str); | 81 | printf("Nospam: %s.\n", nospam_str); |
82 | printf("Name: %s.\n", name); | 82 | printf("Name: %s.\n", name); |
83 | printf("Status message: %s.\n", STATUS_MESSAGE); | 83 | printf("Status message: %s.\n", GENERATED_STATUS_MESSAGE); |
84 | printf("Number of friends: %zu.\n", tox_self_get_friend_list_size(tox)); | 84 | printf("Number of friends: %zu.\n", tox_self_get_friend_list_size(tox)); |
85 | printf("----------------------------------\n"); | 85 | printf("----------------------------------\n"); |
86 | } | 86 | } |
@@ -121,7 +121,7 @@ int main(int argc, char *argv[]) | |||
121 | printf("Failed to set name. Error number %d\n", err); | 121 | printf("Failed to set name. Error number %d\n", err); |
122 | } | 122 | } |
123 | 123 | ||
124 | tox_self_set_status_message(tox, (const uint8_t *)STATUS_MESSAGE, strlen(STATUS_MESSAGE), &err); | 124 | tox_self_set_status_message(tox, (const uint8_t *)GENERATED_STATUS_MESSAGE, strlen(GENERATED_STATUS_MESSAGE), &err); |
125 | 125 | ||
126 | if (err != TOX_ERR_SET_INFO_OK) { | 126 | if (err != TOX_ERR_SET_INFO_OK) { |
127 | printf("Failed to set status. Error number: %d\n", err); | 127 | printf("Failed to set status. Error number: %d\n", err); |
@@ -130,7 +130,8 @@ int main(int argc, char *argv[]) | |||
130 | for (unsigned int i = 2; i < argc; i++) { //start at 2 because that is where the tox ids are | 130 | for (unsigned int i = 2; i < argc; i++) { //start at 2 because that is where the tox ids are |
131 | uint8_t *address = hex_string_to_bin(argv[i]); | 131 | uint8_t *address = hex_string_to_bin(argv[i]); |
132 | Tox_Err_Friend_Add friend_err; | 132 | Tox_Err_Friend_Add friend_err; |
133 | tox_friend_add(tox, address, (const uint8_t *)REQUEST_MESSAGE, strlen(REQUEST_MESSAGE), &friend_err); | 133 | tox_friend_add(tox, address, (const uint8_t *)GENERATED_REQUEST_MESSAGE, strlen(GENERATED_REQUEST_MESSAGE), |
134 | &friend_err); | ||
134 | free(address); | 135 | free(address); |
135 | 136 | ||
136 | if (friend_err != TOX_ERR_FRIEND_ADD_OK) { | 137 | if (friend_err != TOX_ERR_FRIEND_ADD_OK) { |
@@ -158,7 +159,7 @@ int main(int argc, char *argv[]) | |||
158 | return -1; | 159 | return -1; |
159 | } | 160 | } |
160 | 161 | ||
161 | printf("Wrote tox save to %s\n", SAVE_FILE); | 162 | printf("Wrote tox save to %s\n", GENERATED_SAVE_FILE); |
162 | 163 | ||
163 | print_information(tox); | 164 | print_information(tox); |
164 | 165 | ||
diff --git a/toxav/video.c b/toxav/video.c index bc164cea..4f9d8c84 100644 --- a/toxav/video.c +++ b/toxav/video.c | |||
@@ -88,7 +88,7 @@ static const vpx_codec_iface_t *video_codec_encoder_interface(void) | |||
88 | 88 | ||
89 | #define VPX_MAX_ENCODER_THREADS 4 | 89 | #define VPX_MAX_ENCODER_THREADS 4 |
90 | #define VPX_MAX_DECODER_THREADS 4 | 90 | #define VPX_MAX_DECODER_THREADS 4 |
91 | #define VIDEO__VP8_DECODER_POST_PROCESSING_ENABLED 0 | 91 | #define VIDEO_VP8_DECODER_POST_PROCESSING_ENABLED 0 |
92 | 92 | ||
93 | static void vc_init_encoder_cfg(const Logger *log, vpx_codec_enc_cfg_t *cfg, int16_t kf_max_dist) | 93 | static void vc_init_encoder_cfg(const Logger *log, vpx_codec_enc_cfg_t *cfg, int16_t kf_max_dist) |
94 | { | 94 | { |
@@ -210,7 +210,7 @@ VCSession *vc_new(const Mono_Time *mono_time, const Logger *log, ToxAV *av, uint | |||
210 | goto BASE_CLEANUP; | 210 | goto BASE_CLEANUP; |
211 | } | 211 | } |
212 | 212 | ||
213 | if (VIDEO__VP8_DECODER_POST_PROCESSING_ENABLED == 1) { | 213 | if (VIDEO_VP8_DECODER_POST_PROCESSING_ENABLED == 1) { |
214 | vp8_postproc_cfg_t pp = {VP8_DEBLOCK, 1, 0}; | 214 | vp8_postproc_cfg_t pp = {VP8_DEBLOCK, 1, 0}; |
215 | vpx_codec_err_t cc_res = vpx_codec_control(vc->decoder, VP8_SET_POSTPROC, &pp); | 215 | vpx_codec_err_t cc_res = vpx_codec_control(vc->decoder, VP8_SET_POSTPROC, &pp); |
216 | 216 | ||