diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-02-23 17:11:00 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-03-16 01:57:26 +0000 |
commit | aa050954195f6323775ed68f4262edf2341c6953 (patch) | |
tree | 0b2f53b23b97dc1e90f798ae97321a727c413462 /testing | |
parent | 78d5b74dcee1208efe19dd115006034501c4380f (diff) |
Remove the use of the 'hh' format specifier.
It's not supported in mingw.
See https://github.com/TokTok/c-toxcore/issues/786.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/DHT_test.c | 12 | ||||
-rw-r--r-- | testing/Messenger_test.c | 4 | ||||
-rw-r--r-- | testing/misc_tools.c | 4 |
3 files changed, 11 insertions, 9 deletions
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; |