diff options
-rw-r--r-- | auto_tests/dht_test.c | 2 | ||||
-rw-r--r-- | auto_tests/file_saving_test.c | 4 | ||||
-rw-r--r-- | auto_tests/messenger_test.c | 42 | ||||
-rw-r--r-- | auto_tests/onion_test.c | 2 | ||||
-rw-r--r-- | auto_tests/simple_conference_test.c | 7 | ||||
-rw-r--r-- | auto_tests/toxav_many_test.c | 4 | ||||
-rw-r--r-- | other/DHT_bootstrap.c | 4 | ||||
-rw-r--r-- | other/bootstrap_daemon/src/config.c | 4 | ||||
-rw-r--r-- | other/bootstrap_daemon/src/tox-bootstrapd.c | 2 | ||||
-rw-r--r-- | other/fun/cracker.c | 2 | ||||
-rw-r--r-- | other/fun/sign.c | 4 | ||||
-rw-r--r-- | other/fun/strkey.c | 4 | ||||
-rw-r--r-- | testing/DHT_test.c | 12 | ||||
-rw-r--r-- | testing/Messenger_test.c | 4 | ||||
-rw-r--r-- | testing/misc_tools.c | 4 | ||||
-rw-r--r-- | toxav/bwcontroller.c | 3 | ||||
-rw-r--r-- | toxav/rtp.c | 3 | ||||
-rw-r--r-- | toxcore/network.c | 6 |
18 files changed, 60 insertions, 53 deletions
diff --git a/auto_tests/dht_test.c b/auto_tests/dht_test.c index fe23a598..2814263f 100644 --- a/auto_tests/dht_test.c +++ b/auto_tests/dht_test.c | |||
@@ -413,7 +413,7 @@ static void print_pk(uint8_t *public_key) | |||
413 | uint32_t j; | 413 | uint32_t j; |
414 | 414 | ||
415 | for (j = 0; j < CRYPTO_PUBLIC_KEY_SIZE; j++) { | 415 | for (j = 0; j < CRYPTO_PUBLIC_KEY_SIZE; j++) { |
416 | printf("%02hhX", public_key[j]); | 416 | printf("%02X", public_key[j]); |
417 | } | 417 | } |
418 | 418 | ||
419 | printf("\n"); | 419 | printf("\n"); |
diff --git a/auto_tests/file_saving_test.c b/auto_tests/file_saving_test.c index 8aa14dc3..23a4c701 100644 --- a/auto_tests/file_saving_test.c +++ b/auto_tests/file_saving_test.c | |||
@@ -61,7 +61,7 @@ static void save_data_encrypted(void) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | size_t written_value = fwrite(cipher, sizeof(*cipher), size, f); | 63 | size_t written_value = fwrite(cipher, sizeof(*cipher), size, f); |
64 | printf("written written_value = %zu of %zu\n", written_value, size); | 64 | printf("written written_value = %u of %u\n", (unsigned)written_value, (unsigned)size); |
65 | 65 | ||
66 | free(cipher); | 66 | free(cipher); |
67 | free(clear); | 67 | free(clear); |
@@ -79,7 +79,7 @@ static void load_data_decrypted(void) | |||
79 | uint8_t *cipher = (uint8_t *)malloc(size); | 79 | uint8_t *cipher = (uint8_t *)malloc(size); |
80 | uint8_t *clear = (uint8_t *)malloc(size - TOX_PASS_ENCRYPTION_EXTRA_LENGTH); | 80 | uint8_t *clear = (uint8_t *)malloc(size - TOX_PASS_ENCRYPTION_EXTRA_LENGTH); |
81 | size_t read_value = fread(cipher, sizeof(*cipher), size, f); | 81 | size_t read_value = fread(cipher, sizeof(*cipher), size, f); |
82 | printf("read read_vavue = %zu of %ld\n", read_value, size); | 82 | printf("read read_vavue = %u of %ld\n", (unsigned)read_value, size); |
83 | 83 | ||
84 | TOX_ERR_DECRYPTION derr; | 84 | TOX_ERR_DECRYPTION derr; |
85 | 85 | ||
diff --git a/auto_tests/messenger_test.c b/auto_tests/messenger_test.c index 12b00fd7..bf3ea179 100644 --- a/auto_tests/messenger_test.c +++ b/auto_tests/messenger_test.c | |||
@@ -240,32 +240,31 @@ START_TEST(test_dht_state_saveloadsave) | |||
240 | * b) a save()d state can be load()ed back successfully | 240 | * b) a save()d state can be load()ed back successfully |
241 | * c) a second save() is of equal size | 241 | * c) a second save() is of equal size |
242 | * d) the second save() is of equal content */ | 242 | * d) the second save() is of equal content */ |
243 | size_t i, extra = 64; | 243 | const size_t extra = 64; |
244 | size_t size = DHT_size(m->dht); | 244 | const size_t size = DHT_size(m->dht); |
245 | VLA(uint8_t, buffer, size + 2 * extra); | 245 | VLA(uint8_t, buffer, size + 2 * extra); |
246 | memset(buffer, 0xCD, extra); | 246 | memset(buffer, 0xCD, extra); |
247 | memset(buffer + extra + size, 0xCD, extra); | 247 | memset(buffer + extra + size, 0xCD, extra); |
248 | DHT_save(m->dht, buffer + extra); | 248 | DHT_save(m->dht, buffer + extra); |
249 | 249 | ||
250 | for (i = 0; i < extra; i++) { | 250 | for (size_t i = 0; i < extra; i++) { |
251 | ck_assert_msg(buffer[i] == 0xCD, "Buffer underwritten from DHT_save() @%u", (unsigned)i); | 251 | ck_assert_msg(buffer[i] == 0xCD, "Buffer underwritten from DHT_save() @%u", (unsigned)i); |
252 | ck_assert_msg(buffer[extra + size + i] == 0xCD, "Buffer overwritten from DHT_save() @%u", (unsigned)i); | 252 | ck_assert_msg(buffer[extra + size + i] == 0xCD, "Buffer overwritten from DHT_save() @%u", (unsigned)i); |
253 | } | 253 | } |
254 | 254 | ||
255 | int res = DHT_load(m->dht, buffer + extra, size); | 255 | const int res = DHT_load(m->dht, buffer + extra, size); |
256 | 256 | ||
257 | if (res == -1) { | 257 | if (res == -1) { |
258 | ck_assert_msg(res == 0, "Failed to load back stored buffer: res == -1"); | 258 | ck_assert_msg(res == 0, "Failed to load back stored buffer: res == -1"); |
259 | } else { | 259 | } else { |
260 | char msg[128]; | 260 | const size_t offset = res >> 4; |
261 | size_t offset = res >> 4; | 261 | const uint8_t *ptr = buffer + extra + offset; |
262 | uint8_t *ptr = buffer + extra + offset; | 262 | ck_assert_msg(res == 0, "Failed to load back stored buffer: 0x%02x%02x%02x%02x%02x%02x%02x%02x @%u/%u, code %d", |
263 | sprintf(msg, "Failed to load back stored buffer: 0x%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx @%zu/%zu, code %d", | 263 | ptr[-2], ptr[-1], ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], |
264 | ptr[-2], ptr[-1], ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], offset, size, res & 0x0F); | 264 | (unsigned)offset, (unsigned)size, res & 0x0F); |
265 | ck_assert_msg(res == 0, "%s", msg); | ||
266 | } | 265 | } |
267 | 266 | ||
268 | size_t size2 = DHT_size(m->dht); | 267 | const size_t size2 = DHT_size(m->dht); |
269 | ck_assert_msg(size == size2, "Messenger \"grew\" in size from a store/load cycle: %u -> %u", (unsigned)size, | 268 | ck_assert_msg(size == size2, "Messenger \"grew\" in size from a store/load cycle: %u -> %u", (unsigned)size, |
270 | (unsigned)size2); | 269 | (unsigned)size2); |
271 | 270 | ||
@@ -283,32 +282,31 @@ START_TEST(test_messenger_state_saveloadsave) | |||
283 | * b) a save()d state can be load()ed back successfully | 282 | * b) a save()d state can be load()ed back successfully |
284 | * c) a second save() is of equal size | 283 | * c) a second save() is of equal size |
285 | * d) the second save() is of equal content */ | 284 | * d) the second save() is of equal content */ |
286 | size_t i, extra = 64; | 285 | const size_t extra = 64; |
287 | size_t size = messenger_size(m); | 286 | const size_t size = messenger_size(m); |
288 | VLA(uint8_t, buffer, size + 2 * extra); | 287 | VLA(uint8_t, buffer, size + 2 * extra); |
289 | memset(buffer, 0xCD, extra); | 288 | memset(buffer, 0xCD, extra); |
290 | memset(buffer + extra + size, 0xCD, extra); | 289 | memset(buffer + extra + size, 0xCD, extra); |
291 | messenger_save(m, buffer + extra); | 290 | messenger_save(m, buffer + extra); |
292 | 291 | ||
293 | for (i = 0; i < extra; i++) { | 292 | for (size_t i = 0; i < extra; i++) { |
294 | ck_assert_msg(buffer[i] == 0xCD, "Buffer underwritten from messenger_save() @%u", (unsigned)i); | 293 | ck_assert_msg(buffer[i] == 0xCD, "Buffer underwritten from messenger_save() @%u", (unsigned)i); |
295 | ck_assert_msg(buffer[extra + size + i] == 0xCD, "Buffer overwritten from messenger_save() @%u", (unsigned)i); | 294 | ck_assert_msg(buffer[extra + size + i] == 0xCD, "Buffer overwritten from messenger_save() @%u", (unsigned)i); |
296 | } | 295 | } |
297 | 296 | ||
298 | int res = messenger_load(m, buffer + extra, size); | 297 | const int res = messenger_load(m, buffer + extra, size); |
299 | 298 | ||
300 | if (res == -1) { | 299 | if (res == -1) { |
301 | ck_assert_msg(res == 0, "Failed to load back stored buffer: res == -1"); | 300 | ck_assert_msg(res == 0, "Failed to load back stored buffer: res == -1"); |
302 | } else { | 301 | } else { |
303 | char msg[128]; | 302 | const size_t offset = res >> 4; |
304 | size_t offset = res >> 4; | 303 | const uint8_t *ptr = buffer + extra + offset; |
305 | uint8_t *ptr = buffer + extra + offset; | 304 | ck_assert_msg(res == 0, "Failed to load back stored buffer: 0x%02x%02x%02x%02x%02x%02x%02x%02x @%u/%u, code %d", |
306 | sprintf(msg, "Failed to load back stored buffer: 0x%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx @%zu/%zu, code %d", | 305 | ptr[-2], ptr[-1], ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], |
307 | ptr[-2], ptr[-1], ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], offset, size, res & 0x0F); | 306 | (unsigned)offset, (unsigned)size, res & 0x0F); |
308 | ck_assert_msg(res == 0, "%s", msg); | ||
309 | } | 307 | } |
310 | 308 | ||
311 | size_t size2 = messenger_size(m); | 309 | const size_t size2 = messenger_size(m); |
312 | ck_assert_msg(size == size2, "Messenger \"grew\" in size from a store/load cycle: %u -> %u", | 310 | ck_assert_msg(size == size2, "Messenger \"grew\" in size from a store/load cycle: %u -> %u", |
313 | (unsigned)size, (unsigned)size2); | 311 | (unsigned)size, (unsigned)size2); |
314 | 312 | ||
diff --git a/auto_tests/onion_test.c b/auto_tests/onion_test.c index e3eb3e5e..128e122b 100644 --- a/auto_tests/onion_test.c +++ b/auto_tests/onion_test.c | |||
@@ -81,7 +81,7 @@ void print_client_id(uint8_t *client_id, uint32_t length) | |||
81 | uint32_t j; | 81 | uint32_t j; |
82 | 82 | ||
83 | for (j = 0; j < length; j++) { | 83 | for (j = 0; j < length; j++) { |
84 | printf("%02hhX", client_id[j]); | 84 | printf("%02X", client_id[j]); |
85 | } | 85 | } |
86 | 86 | ||
87 | printf("\n"); | 87 | printf("\n"); |
diff --git a/auto_tests/simple_conference_test.c b/auto_tests/simple_conference_test.c index e6254b79..c1c6e730 100644 --- a/auto_tests/simple_conference_test.c +++ b/auto_tests/simple_conference_test.c | |||
@@ -44,7 +44,8 @@ static void handle_conference_invite(Tox *tox, uint32_t friend_number, TOX_CONFE | |||
44 | { | 44 | { |
45 | State *state = (State *)user_data; | 45 | State *state = (State *)user_data; |
46 | 46 | ||
47 | fprintf(stderr, "\nhandle_conference_invite(#%d, %d, %d, uint8_t[%zd], _)\n", state->id, friend_number, type, length); | 47 | fprintf(stderr, "\nhandle_conference_invite(#%d, %d, %d, uint8_t[%u], _)\n", |
48 | state->id, friend_number, type, (unsigned)length); | ||
48 | fprintf(stderr, "tox%d joining conference\n", state->id); | 49 | fprintf(stderr, "tox%d joining conference\n", state->id); |
49 | 50 | ||
50 | { | 51 | { |
@@ -74,8 +75,8 @@ static void handle_conference_message(Tox *tox, uint32_t conference_number, uint | |||
74 | { | 75 | { |
75 | State *state = (State *)user_data; | 76 | State *state = (State *)user_data; |
76 | 77 | ||
77 | fprintf(stderr, "\nhandle_conference_message(#%d, %d, %d, %d, uint8_t[%zd], _)\n", | 78 | fprintf(stderr, "\nhandle_conference_message(#%d, %d, %d, %d, uint8_t[%u], _)\n", |
78 | state->id, conference_number, peer_number, type, length); | 79 | state->id, conference_number, peer_number, type, (unsigned)length); |
79 | 80 | ||
80 | fprintf(stderr, "tox%d got message: %s\n", state->id, (const char *)message); | 81 | fprintf(stderr, "tox%d got message: %s\n", state->id, (const char *)message); |
81 | state->received = true; | 82 | state->received = true; |
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index ed4aa211..e89a6823 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -215,8 +215,8 @@ static void test_av_three_calls(void) | |||
215 | tox_callback_friend_request(Alice, t_accept_friend_request_cb); | 215 | tox_callback_friend_request(Alice, t_accept_friend_request_cb); |
216 | tox_self_get_address(Alice, address); | 216 | tox_self_get_address(Alice, address); |
217 | 217 | ||
218 | printf("bootstrapping Alice and the %zd Bobs off a third bootstrap node\n", | 218 | printf("bootstrapping Alice and the %u Bobs off a third bootstrap node\n", |
219 | sizeof(Bobs) / sizeof(Bobs[0])); | 219 | (unsigned)(sizeof(Bobs) / sizeof(Bobs[0]))); |
220 | uint8_t dht_key[TOX_PUBLIC_KEY_SIZE]; | 220 | uint8_t dht_key[TOX_PUBLIC_KEY_SIZE]; |
221 | tox_self_get_dht_id(bootstrap, dht_key); | 221 | tox_self_get_dht_id(bootstrap, dht_key); |
222 | const uint16_t dht_port = tox_self_get_udp_port(bootstrap, nullptr); | 222 | const uint16_t dht_port = tox_self_get_udp_port(bootstrap, nullptr); |
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c index bbb4844e..5f04e415 100644 --- a/other/DHT_bootstrap.c +++ b/other/DHT_bootstrap.c | |||
@@ -156,8 +156,8 @@ int main(int argc, char *argv[]) | |||
156 | 156 | ||
157 | for (i = 0; i < 32; i++) { | 157 | for (i = 0; i < 32; i++) { |
158 | const uint8_t *const self_public_key = dht_get_self_public_key(dht); | 158 | const uint8_t *const self_public_key = dht_get_self_public_key(dht); |
159 | printf("%02hhX", self_public_key[i]); | 159 | printf("%02X", self_public_key[i]); |
160 | fprintf(file, "%02hhX", self_public_key[i]); | 160 | fprintf(file, "%02X", self_public_key[i]); |
161 | } | 161 | } |
162 | 162 | ||
163 | fclose(file); | 163 | fclose(file); |
diff --git a/other/bootstrap_daemon/src/config.c b/other/bootstrap_daemon/src/config.c index 3f1592e6..a3c1f250 100644 --- a/other/bootstrap_daemon/src/config.c +++ b/other/bootstrap_daemon/src/config.c | |||
@@ -316,7 +316,9 @@ static uint8_t *hex_string_to_bin(const char *hex_string) | |||
316 | size_t i; | 316 | size_t i; |
317 | 317 | ||
318 | for (i = 0; i < len; ++i, pos += 2) { | 318 | for (i = 0; i < len; ++i, pos += 2) { |
319 | sscanf(pos, "%2hhx", &ret[i]); | 319 | unsigned int val; |
320 | sscanf(pos, "%02x", &val); | ||
321 | ret[i] = val; | ||
320 | } | 322 | } |
321 | 323 | ||
322 | return ret; | 324 | return ret; |
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c index bdf679c9..9f1a2db4 100644 --- a/other/bootstrap_daemon/src/tox-bootstrapd.c +++ b/other/bootstrap_daemon/src/tox-bootstrapd.c | |||
@@ -109,7 +109,7 @@ static void print_public_key(const uint8_t *public_key) | |||
109 | size_t i; | 109 | size_t i; |
110 | 110 | ||
111 | for (i = 0; i < CRYPTO_PUBLIC_KEY_SIZE; i++) { | 111 | for (i = 0; i < CRYPTO_PUBLIC_KEY_SIZE; i++) { |
112 | index += sprintf(buffer + index, "%02hhX", public_key[i]); | 112 | index += sprintf(buffer + index, "%02X", public_key[i]); |
113 | } | 113 | } |
114 | 114 | ||
115 | log_write(LOG_LEVEL_INFO, "Public Key: %s\n", buffer); | 115 | log_write(LOG_LEVEL_INFO, "Public Key: %s\n", buffer); |
diff --git a/other/fun/cracker.c b/other/fun/cracker.c index 7b020bb7..9cfe96d7 100644 --- a/other/fun/cracker.c +++ b/other/fun/cracker.c | |||
@@ -24,7 +24,7 @@ void print_key(uint8_t *client_id) | |||
24 | uint32_t j; | 24 | uint32_t j; |
25 | 25 | ||
26 | for (j = 0; j < 32; j++) { | 26 | for (j = 0; j < 32; j++) { |
27 | printf("%02hhX", client_id[j]); | 27 | printf("%02X", client_id[j]); |
28 | } | 28 | } |
29 | } | 29 | } |
30 | 30 | ||
diff --git a/other/fun/sign.c b/other/fun/sign.c index b24cdae7..369bc848 100644 --- a/other/fun/sign.c +++ b/other/fun/sign.c | |||
@@ -56,13 +56,13 @@ int main(int argc, char *argv[]) | |||
56 | int i; | 56 | int i; |
57 | 57 | ||
58 | for (i = 0; i < crypto_sign_ed25519_PUBLICKEYBYTES; i++) { | 58 | for (i = 0; i < crypto_sign_ed25519_PUBLICKEYBYTES; i++) { |
59 | printf("%02hhX", pk[i]); | 59 | printf("%02X", pk[i]); |
60 | } | 60 | } |
61 | 61 | ||
62 | printf("\nSecret key:\n"); | 62 | printf("\nSecret key:\n"); |
63 | 63 | ||
64 | for (i = 0; i < crypto_sign_ed25519_SECRETKEYBYTES; i++) { | 64 | for (i = 0; i < crypto_sign_ed25519_SECRETKEYBYTES; i++) { |
65 | printf("%02hhX", sk[i]); | 65 | printf("%02X", sk[i]); |
66 | } | 66 | } |
67 | 67 | ||
68 | printf("\n"); | 68 | printf("\n"); |
diff --git a/other/fun/strkey.c b/other/fun/strkey.c index 649b26dd..ef54a404 100644 --- a/other/fun/strkey.c +++ b/other/fun/strkey.c | |||
@@ -86,7 +86,9 @@ int main(int argc, char *argv[]) | |||
86 | size_t i; | 86 | size_t i; |
87 | 87 | ||
88 | for (i = 0; i < len; pos += 2) { | 88 | for (i = 0; i < len; pos += 2) { |
89 | sscanf(pos, "%2hhx", &desired_bin[i]); | 89 | unsigned int value; |
90 | sscanf(pos, "%02x", &value); | ||
91 | desired_bin[i] = value; | ||
90 | ++i; | 92 | ++i; |
91 | } | 93 | } |
92 | } else { | 94 | } else { |
diff --git a/testing/DHT_test.c b/testing/DHT_test.c index c7db4092..496c855c 100644 --- a/testing/DHT_test.c +++ b/testing/DHT_test.c | |||
@@ -54,22 +54,22 @@ static void print_client_id(const uint8_t *public_key) | |||
54 | uint32_t j; | 54 | uint32_t j; |
55 | 55 | ||
56 | for (j = 0; j < CRYPTO_PUBLIC_KEY_SIZE; j++) { | 56 | for (j = 0; j < CRYPTO_PUBLIC_KEY_SIZE; j++) { |
57 | printf("%02hhX", public_key[j]); | 57 | printf("%02X", public_key[j]); |
58 | } | 58 | } |
59 | } | 59 | } |
60 | 60 | ||
61 | static void print_hardening(const Hardening *h) | 61 | static void print_hardening(const Hardening *h) |
62 | { | 62 | { |
63 | printf("Hardening:\n"); | 63 | printf("Hardening:\n"); |
64 | printf("routes_requests_ok: %hhu\n", h->routes_requests_ok); | 64 | printf("routes_requests_ok: %u\n", h->routes_requests_ok); |
65 | printf("routes_requests_timestamp: %llu\n", (long long unsigned int)h->routes_requests_timestamp); | 65 | printf("routes_requests_timestamp: %llu\n", (long long unsigned int)h->routes_requests_timestamp); |
66 | printf("routes_requests_pingedid: "); | 66 | printf("routes_requests_pingedid: "); |
67 | print_client_id(h->routes_requests_pingedid); | 67 | print_client_id(h->routes_requests_pingedid); |
68 | printf("\nsend_nodes_ok: %hhu\n", h->send_nodes_ok); | 68 | printf("\nsend_nodes_ok: %u\n", h->send_nodes_ok); |
69 | printf("send_nodes_timestamp: %llu\n", (long long unsigned int)h->send_nodes_timestamp); | 69 | printf("send_nodes_timestamp: %llu\n", (long long unsigned int)h->send_nodes_timestamp); |
70 | printf("send_nodes_pingedid: "); | 70 | printf("send_nodes_pingedid: "); |
71 | print_client_id(h->send_nodes_pingedid); | 71 | print_client_id(h->send_nodes_pingedid); |
72 | printf("\ntesting_requests: %hhu\n", h->testing_requests); | 72 | printf("\ntesting_requests: %u\n", h->testing_requests); |
73 | printf("testing_timestamp: %llu\n", (long long unsigned int)h->testing_timestamp); | 73 | printf("testing_timestamp: %llu\n", (long long unsigned int)h->testing_timestamp); |
74 | printf("testing_pingedid: "); | 74 | printf("testing_pingedid: "); |
75 | print_client_id(h->testing_pingedid); | 75 | print_client_id(h->testing_pingedid); |
@@ -162,7 +162,7 @@ static void printpacket(uint8_t *data, uint32_t length, IP_Port ip_port) | |||
162 | printf("0"); | 162 | printf("0"); |
163 | } | 163 | } |
164 | 164 | ||
165 | printf("%hhX", data[i]); | 165 | printf("%X", data[i]); |
166 | } | 166 | } |
167 | 167 | ||
168 | printf("\n--------------------END-----------------------------\n\n\n"); | 168 | printf("\n--------------------END-----------------------------\n\n\n"); |
@@ -201,7 +201,7 @@ int main(int argc, char *argv[]) | |||
201 | printf("0"); | 201 | printf("0"); |
202 | } | 202 | } |
203 | 203 | ||
204 | printf("%hhX", self_public_key[i]); | 204 | printf("%X", self_public_key[i]); |
205 | } | 205 | } |
206 | 206 | ||
207 | char temp_id[128]; | 207 | char temp_id[128]; |
diff --git a/testing/Messenger_test.c b/testing/Messenger_test.c index daf2d125..ebc1975a 100644 --- a/testing/Messenger_test.c +++ b/testing/Messenger_test.c | |||
@@ -55,7 +55,7 @@ | |||
55 | static void print_message(Messenger *m, uint32_t friendnumber, unsigned int type, const uint8_t *string, size_t length, | 55 | static void print_message(Messenger *m, uint32_t friendnumber, unsigned int type, const uint8_t *string, size_t length, |
56 | void *userdata) | 56 | void *userdata) |
57 | { | 57 | { |
58 | printf("Message with length %zu received from %u: %s \n", length, friendnumber, string); | 58 | printf("Message with length %u received from %u: %s \n", (unsigned)length, friendnumber, string); |
59 | m_send_message_generic(m, friendnumber, type, (const uint8_t *)"Test1", 6, 0); | 59 | m_send_message_generic(m, friendnumber, type, (const uint8_t *)"Test1", 6, 0); |
60 | } | 60 | } |
61 | 61 | ||
@@ -77,7 +77,7 @@ static void print_request(Messenger *m2, const uint8_t *public_key, const uint8_ | |||
77 | printf("%hhX", public_key[j]); | 77 | printf("%hhX", public_key[j]); |
78 | } | 78 | } |
79 | 79 | ||
80 | printf("\nOf length: %zu with data: %s \n", length, data); | 80 | printf("\nOf length: %u with data: %s \n", (unsigned)length, data); |
81 | 81 | ||
82 | if (length != sizeof("Install Gentoo")) { | 82 | if (length != sizeof("Install Gentoo")) { |
83 | return; | 83 | return; |
diff --git a/testing/misc_tools.c b/testing/misc_tools.c index 3a6a3333..9b0d9956 100644 --- a/testing/misc_tools.c +++ b/testing/misc_tools.c | |||
@@ -64,7 +64,9 @@ uint8_t *hex_string_to_bin(const char *hex_string) | |||
64 | const char *pos = hex_string; | 64 | const char *pos = hex_string; |
65 | 65 | ||
66 | for (i = 0; i < len; ++i, pos += 2) { | 66 | for (i = 0; i < len; ++i, pos += 2) { |
67 | sscanf(pos, "%2hhx", &ret[i]); | 67 | unsigned int val; |
68 | sscanf(pos, "%02x", &val); | ||
69 | ret[i] = val; | ||
68 | } | 70 | } |
69 | 71 | ||
70 | return ret; | 72 | return ret; |
diff --git a/toxav/bwcontroller.c b/toxav/bwcontroller.c index 6464a437..5c6782ba 100644 --- a/toxav/bwcontroller.c +++ b/toxav/bwcontroller.c | |||
@@ -145,7 +145,8 @@ void send_update(BWController *bwc) | |||
145 | msg->recv = net_htonl(bwc->cycle.recv); | 145 | msg->recv = net_htonl(bwc->cycle.recv); |
146 | 146 | ||
147 | if (-1 == m_send_custom_lossy_packet(bwc->m, bwc->friend_number, bwc_packet, sizeof(bwc_packet))) { | 147 | if (-1 == m_send_custom_lossy_packet(bwc->m, bwc->friend_number, bwc_packet, sizeof(bwc_packet))) { |
148 | LOGGER_WARNING(bwc->m->log, "BWC send failed (len: %zu)! std error: %s", sizeof(bwc_packet), strerror(errno)); | 148 | LOGGER_WARNING(bwc->m->log, "BWC send failed (len: %u)! std error: %s", |
149 | (unsigned)sizeof(bwc_packet), strerror(errno)); | ||
149 | } | 150 | } |
150 | } | 151 | } |
151 | 152 | ||
diff --git a/toxav/rtp.c b/toxav/rtp.c index 6093babf..c760d333 100644 --- a/toxav/rtp.c +++ b/toxav/rtp.c | |||
@@ -802,7 +802,8 @@ int rtp_send_data(RTPSession *session, const uint8_t *data, uint32_t length, | |||
802 | memcpy(rdata + 1 + RTP_HEADER_SIZE, data, length); | 802 | memcpy(rdata + 1 + RTP_HEADER_SIZE, data, length); |
803 | 803 | ||
804 | if (-1 == m_send_custom_lossy_packet(session->m, session->friend_number, rdata, SIZEOF_VLA(rdata))) { | 804 | if (-1 == m_send_custom_lossy_packet(session->m, session->friend_number, rdata, SIZEOF_VLA(rdata))) { |
805 | LOGGER_WARNING(session->m->log, "RTP send failed (len: %zu)! std error: %s", SIZEOF_VLA(rdata), strerror(errno)); | 805 | LOGGER_WARNING(session->m->log, "RTP send failed (len: %u)! std error: %s", |
806 | (unsigned)SIZEOF_VLA(rdata), strerror(errno)); | ||
806 | } | 807 | } |
807 | } else { | 808 | } else { |
808 | /** | 809 | /** |
diff --git a/toxcore/network.c b/toxcore/network.c index 3aaeb075..d88ba816 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -500,7 +500,7 @@ static int receivepacket(Logger *log, Socket sock, IP_Port *ip_port, uint8_t *da | |||
500 | if (fail_or_len < 0) { | 500 | if (fail_or_len < 0) { |
501 | 501 | ||
502 | if (fail_or_len < 0 && errno != EWOULDBLOCK) { | 502 | if (fail_or_len < 0 && errno != EWOULDBLOCK) { |
503 | LOGGER_ERROR(log, "Unexpected error reading from socket: %u, %s\n", errno, strerror(errno)); | 503 | LOGGER_ERROR(log, "Unexpected error reading from socket: %u, %s", errno, strerror(errno)); |
504 | } | 504 | } |
505 | 505 | ||
506 | return -1; /* Nothing received. */ | 506 | return -1; /* Nothing received. */ |
@@ -657,7 +657,7 @@ Networking_Core *new_networking_ex(Logger *log, IP ip, uint16_t port_from, uint1 | |||
657 | 657 | ||
658 | /* maybe check for invalid IPs like 224+.x.y.z? if there is any IP set ever */ | 658 | /* maybe check for invalid IPs like 224+.x.y.z? if there is any IP set ever */ |
659 | if (ip.family != TOX_AF_INET && ip.family != TOX_AF_INET6) { | 659 | if (ip.family != TOX_AF_INET && ip.family != TOX_AF_INET6) { |
660 | LOGGER_ERROR(log, "Invalid address family: %u\n", ip.family); | 660 | LOGGER_ERROR(log, "Invalid address family: %u", ip.family); |
661 | return nullptr; | 661 | return nullptr; |
662 | } | 662 | } |
663 | 663 | ||
@@ -681,7 +681,7 @@ Networking_Core *new_networking_ex(Logger *log, IP ip, uint16_t port_from, uint1 | |||
681 | 681 | ||
682 | /* Check for socket error. */ | 682 | /* Check for socket error. */ |
683 | if (!sock_valid(temp->sock)) { | 683 | if (!sock_valid(temp->sock)) { |
684 | LOGGER_ERROR(log, "Failed to get a socket?! %u, %s\n", errno, strerror(errno)); | 684 | LOGGER_ERROR(log, "Failed to get a socket?! %u, %s", errno, strerror(errno)); |
685 | free(temp); | 685 | free(temp); |
686 | 686 | ||
687 | if (error) { | 687 | if (error) { |