summaryrefslogtreecommitdiff
path: root/toxcore/onion_client.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-18 01:31:55 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-24 21:53:50 +0100
commit15cb4261665bab4ef02a5b1b9db48b9477c9b87a (patch)
treed0c40a45afa19fff26ce1eb5bb703e18a9acdd4a /toxcore/onion_client.c
parent0d347c2b2e69aa09b079f6daaa00007fef4fe52f (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 'toxcore/onion_client.c')
-rw-r--r--toxcore/onion_client.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index 316ed3d1..86f4de72 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -662,7 +662,7 @@ static int client_ping_nodes(Onion_Client *onion_c, uint32_t num, const Node_for
662static int handle_announce_response(void *object, IP_Port source, const uint8_t *packet, uint16_t length, 662static int handle_announce_response(void *object, IP_Port source, const uint8_t *packet, uint16_t length,
663 void *userdata) 663 void *userdata)
664{ 664{
665 Onion_Client *onion_c = object; 665 Onion_Client *onion_c = (Onion_Client *)object;
666 666
667 if (length < ONION_ANNOUNCE_RESPONSE_MIN_SIZE || length > ONION_ANNOUNCE_RESPONSE_MAX_SIZE) { 667 if (length < ONION_ANNOUNCE_RESPONSE_MIN_SIZE || length > ONION_ANNOUNCE_RESPONSE_MAX_SIZE) {
668 return 1; 668 return 1;
@@ -727,7 +727,7 @@ static int handle_announce_response(void *object, IP_Port source, const uint8_t
727 727
728static int handle_data_response(void *object, IP_Port source, const uint8_t *packet, uint16_t length, void *userdata) 728static int handle_data_response(void *object, IP_Port source, const uint8_t *packet, uint16_t length, void *userdata)
729{ 729{
730 Onion_Client *onion_c = object; 730 Onion_Client *onion_c = (Onion_Client *)object;
731 731
732 if (length <= (ONION_DATA_RESPONSE_MIN_SIZE + DATA_IN_RESPONSE_MIN_SIZE)) { 732 if (length <= (ONION_DATA_RESPONSE_MIN_SIZE + DATA_IN_RESPONSE_MIN_SIZE)) {
733 return 1; 733 return 1;
@@ -767,7 +767,7 @@ static int handle_data_response(void *object, IP_Port source, const uint8_t *pac
767static int handle_dhtpk_announce(void *object, const uint8_t *source_pubkey, const uint8_t *data, uint16_t length, 767static int handle_dhtpk_announce(void *object, const uint8_t *source_pubkey, const uint8_t *data, uint16_t length,
768 void *userdata) 768 void *userdata)
769{ 769{
770 Onion_Client *onion_c = object; 770 Onion_Client *onion_c = (Onion_Client *)object;
771 771
772 if (length < DHTPK_DATA_MIN_LENGTH) { 772 if (length < DHTPK_DATA_MIN_LENGTH) {
773 return 1; 773 return 1;
@@ -975,7 +975,7 @@ static int send_dht_dhtpk(const Onion_Client *onion_c, int friend_num, const uin
975static int handle_dht_dhtpk(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, 975static int handle_dht_dhtpk(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet,
976 uint16_t length, void *userdata) 976 uint16_t length, void *userdata)
977{ 977{
978 Onion_Client *onion_c = object; 978 Onion_Client *onion_c = (Onion_Client *)object;
979 979
980 if (length < DHTPK_DATA_MIN_LENGTH + DATA_IN_RESPONSE_MIN_SIZE + crypto_box_NONCEBYTES) { 980 if (length < DHTPK_DATA_MIN_LENGTH + DATA_IN_RESPONSE_MIN_SIZE + crypto_box_NONCEBYTES) {
981 return 1; 981 return 1;
@@ -1092,7 +1092,7 @@ static int realloc_onion_friends(Onion_Client *onion_c, uint32_t num)
1092 return 0; 1092 return 0;
1093 } 1093 }
1094 1094
1095 Onion_Friend *newonion_friends = realloc(onion_c->friends_list, num * sizeof(Onion_Friend)); 1095 Onion_Friend *newonion_friends = (Onion_Friend *)realloc(onion_c->friends_list, num * sizeof(Onion_Friend));
1096 1096
1097 if (newonion_friends == NULL) { 1097 if (newonion_friends == NULL) {
1098 return -1; 1098 return -1;
@@ -1605,7 +1605,7 @@ Onion_Client *new_onion_client(Net_Crypto *c)
1605 return NULL; 1605 return NULL;
1606 } 1606 }
1607 1607
1608 Onion_Client *onion_c = calloc(1, sizeof(Onion_Client)); 1608 Onion_Client *onion_c = (Onion_Client *)calloc(1, sizeof(Onion_Client));
1609 1609
1610 if (onion_c == NULL) { 1610 if (onion_c == NULL) {
1611 return NULL; 1611 return NULL;