summaryrefslogtreecommitdiff
path: root/toxcore/friend_connection.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/friend_connection.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/friend_connection.c')
-rw-r--r--toxcore/friend_connection.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/toxcore/friend_connection.c b/toxcore/friend_connection.c
index 314f4e61..5abf6381 100644
--- a/toxcore/friend_connection.c
+++ b/toxcore/friend_connection.c
@@ -63,7 +63,7 @@ static int realloc_friendconns(Friend_Connections *fr_c, uint32_t num)
63 return 0; 63 return 0;
64 } 64 }
65 65
66 Friend_Conn *newgroup_cons = realloc(fr_c->conns, num * sizeof(Friend_Conn)); 66 Friend_Conn *newgroup_cons = (Friend_Conn *)realloc(fr_c->conns, num * sizeof(Friend_Conn));
67 67
68 if (newgroup_cons == NULL) { 68 if (newgroup_cons == NULL) {
69 return -1; 69 return -1;
@@ -261,7 +261,7 @@ static unsigned int send_relays(Friend_Connections *fr_c, int friendcon_id)
261/* callback for recv TCP relay nodes. */ 261/* callback for recv TCP relay nodes. */
262static int tcp_relay_node_callback(void *object, uint32_t number, IP_Port ip_port, const uint8_t *public_key) 262static int tcp_relay_node_callback(void *object, uint32_t number, IP_Port ip_port, const uint8_t *public_key)
263{ 263{
264 Friend_Connections *fr_c = object; 264 Friend_Connections *fr_c = (Friend_Connections *)object;
265 Friend_Conn *friend_con = get_conn(fr_c, number); 265 Friend_Conn *friend_con = get_conn(fr_c, number);
266 266
267 if (!friend_con) { 267 if (!friend_con) {
@@ -279,7 +279,7 @@ static int friend_new_connection(Friend_Connections *fr_c, int friendcon_id);
279/* Callback for DHT ip_port changes. */ 279/* Callback for DHT ip_port changes. */
280static void dht_ip_callback(void *object, int32_t number, IP_Port ip_port) 280static void dht_ip_callback(void *object, int32_t number, IP_Port ip_port)
281{ 281{
282 Friend_Connections *fr_c = object; 282 Friend_Connections *fr_c = (Friend_Connections *)object;
283 Friend_Conn *friend_con = get_conn(fr_c, number); 283 Friend_Conn *friend_con = get_conn(fr_c, number);
284 284
285 if (!friend_con) { 285 if (!friend_con) {
@@ -325,7 +325,7 @@ static void change_dht_pk(Friend_Connections *fr_c, int friendcon_id, const uint
325 325
326static int handle_status(void *object, int number, uint8_t status, void *userdata) 326static int handle_status(void *object, int number, uint8_t status, void *userdata)
327{ 327{
328 Friend_Connections *fr_c = object; 328 Friend_Connections *fr_c = (Friend_Connections *)object;
329 Friend_Conn *friend_con = get_conn(fr_c, number); 329 Friend_Conn *friend_con = get_conn(fr_c, number);
330 330
331 if (!friend_con) { 331 if (!friend_con) {
@@ -369,7 +369,7 @@ static int handle_status(void *object, int number, uint8_t status, void *userdat
369/* Callback for dht public key changes. */ 369/* Callback for dht public key changes. */
370static void dht_pk_callback(void *object, int32_t number, const uint8_t *dht_public_key, void *userdata) 370static void dht_pk_callback(void *object, int32_t number, const uint8_t *dht_public_key, void *userdata)
371{ 371{
372 Friend_Connections *fr_c = object; 372 Friend_Connections *fr_c = (Friend_Connections *)object;
373 Friend_Conn *friend_con = get_conn(fr_c, number); 373 Friend_Conn *friend_con = get_conn(fr_c, number);
374 374
375 if (!friend_con) { 375 if (!friend_con) {
@@ -399,7 +399,7 @@ static int handle_packet(void *object, int number, const uint8_t *data, uint16_t
399 return -1; 399 return -1;
400 } 400 }
401 401
402 Friend_Connections *fr_c = object; 402 Friend_Connections *fr_c = (Friend_Connections *)object;
403 Friend_Conn *friend_con = get_conn(fr_c, number); 403 Friend_Conn *friend_con = get_conn(fr_c, number);
404 404
405 if (!friend_con) { 405 if (!friend_con) {
@@ -461,7 +461,7 @@ static int handle_lossy_packet(void *object, int number, const uint8_t *data, ui
461 return -1; 461 return -1;
462 } 462 }
463 463
464 Friend_Connections *fr_c = object; 464 Friend_Connections *fr_c = (Friend_Connections *)object;
465 Friend_Conn *friend_con = get_conn(fr_c, number); 465 Friend_Conn *friend_con = get_conn(fr_c, number);
466 466
467 if (!friend_con) { 467 if (!friend_con) {
@@ -488,7 +488,7 @@ static int handle_lossy_packet(void *object, int number, const uint8_t *data, ui
488 488
489static int handle_new_connections(void *object, New_Connection *n_c) 489static int handle_new_connections(void *object, New_Connection *n_c)
490{ 490{
491 Friend_Connections *fr_c = object; 491 Friend_Connections *fr_c = (Friend_Connections *)object;
492 int friendcon_id = getfriend_conn_id_pk(fr_c, n_c->public_key); 492 int friendcon_id = getfriend_conn_id_pk(fr_c, n_c->public_key);
493 Friend_Conn *friend_con = get_conn(fr_c, friendcon_id); 493 Friend_Conn *friend_con = get_conn(fr_c, friendcon_id);
494 494
@@ -819,7 +819,7 @@ Friend_Connections *new_friend_connections(Onion_Client *onion_c)
819 return NULL; 819 return NULL;
820 } 820 }
821 821
822 Friend_Connections *temp = calloc(1, sizeof(Friend_Connections)); 822 Friend_Connections *temp = (Friend_Connections *)calloc(1, sizeof(Friend_Connections));
823 823
824 if (temp == NULL) { 824 if (temp == NULL) {
825 return NULL; 825 return NULL;