diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-09-18 01:31:55 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-09-24 21:53:50 +0100 |
commit | 15cb4261665bab4ef02a5b1b9db48b9477c9b87a (patch) | |
tree | d0c40a45afa19fff26ce1eb5bb703e18a9acdd4a /toxdns/toxdns.c | |
parent | 0d347c2b2e69aa09b079f6daaa00007fef4fe52f (diff) |
Make toxcore code C++ compatible.
It is still C code, so still compatible with C compilers as well. This
change lets us see more clearly where implicit conversions occur by
making them explicit.
Diffstat (limited to 'toxdns/toxdns.c')
-rw-r--r-- | toxdns/toxdns.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/toxdns/toxdns.c b/toxdns/toxdns.c index c420c944..6622d6a5 100644 --- a/toxdns/toxdns.c +++ b/toxdns/toxdns.c | |||
@@ -29,7 +29,11 @@ | |||
29 | #include "../toxcore/logger.h" | 29 | #include "../toxcore/logger.h" |
30 | #include "toxdns.h" | 30 | #include "toxdns.h" |
31 | 31 | ||
32 | static const char base32[32] = {"abcdefghijklmnopqrstuvwxyz012345"}; | 32 | static const char base32[32] = { |
33 | 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', | ||
34 | 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', | ||
35 | '0', '1', '2', '3', '4', '5', | ||
36 | }; | ||
33 | 37 | ||
34 | #define _encode(a, b, c) \ | 38 | #define _encode(a, b, c) \ |
35 | { \ | 39 | { \ |
@@ -68,7 +72,7 @@ static void dns_new_temp_keys(DNS_Object *d) | |||
68 | */ | 72 | */ |
69 | void *tox_dns3_new(uint8_t *server_public_key) | 73 | void *tox_dns3_new(uint8_t *server_public_key) |
70 | { | 74 | { |
71 | DNS_Object *d = malloc(sizeof(DNS_Object)); | 75 | DNS_Object *d = (DNS_Object *)malloc(sizeof(DNS_Object)); |
72 | 76 | ||
73 | if (d == NULL) { | 77 | if (d == NULL) { |
74 | return NULL; | 78 | return NULL; |
@@ -111,7 +115,7 @@ int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string | |||
111 | return -1; | 115 | return -1; |
112 | } | 116 | } |
113 | 117 | ||
114 | DNS_Object *d = dns3_object; | 118 | DNS_Object *d = (DNS_Object *)dns3_object; |
115 | uint8_t buffer[1024]; | 119 | uint8_t buffer[1024]; |
116 | uint8_t nonce[crypto_box_NONCEBYTES] = {0}; | 120 | uint8_t nonce[crypto_box_NONCEBYTES] = {0}; |
117 | memcpy(nonce, &d->nonce, sizeof(uint32_t)); | 121 | memcpy(nonce, &d->nonce, sizeof(uint32_t)); |
@@ -202,7 +206,7 @@ static int decode(uint8_t *dest, uint8_t *src) | |||
202 | int tox_decrypt_dns3_TXT(void *dns3_object, uint8_t *tox_id, uint8_t *id_record, uint32_t id_record_len, | 206 | int tox_decrypt_dns3_TXT(void *dns3_object, uint8_t *tox_id, uint8_t *id_record, uint32_t id_record_len, |
203 | uint32_t request_id) | 207 | uint32_t request_id) |
204 | { | 208 | { |
205 | DNS_Object *d = dns3_object; | 209 | DNS_Object *d = (DNS_Object *)dns3_object; |
206 | 210 | ||
207 | if (id_record_len != 87) { | 211 | if (id_record_len != 87) { |
208 | return -1; | 212 | return -1; |