diff options
author | Marc Schütz <schuetzm@gmx.net> | 2014-06-10 20:54:48 +0200 |
---|---|---|
committer | Marc Schütz <schuetzm@gmx.net> | 2014-06-10 20:54:48 +0200 |
commit | 99d594014014a37fdee9e83575a8895400c9cd60 (patch) | |
tree | 55152fcfb850511b17ae2af9c77bf30778b465d2 /toxcore/onion_client.c | |
parent | 8bdf487d199b82db85883b613e86deeba15f9b32 (diff) |
Const correctness in various interdependent files
Diffstat (limited to 'toxcore/onion_client.c')
-rw-r--r-- | toxcore/onion_client.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c index dfdb1638..8e28eae5 100644 --- a/toxcore/onion_client.c +++ b/toxcore/onion_client.c | |||
@@ -467,7 +467,7 @@ static int handle_data_response(void *object, IP_Port source, uint8_t *packet, u | |||
467 | #define FAKEID_DATA_ID 156 | 467 | #define FAKEID_DATA_ID 156 |
468 | #define FAKEID_DATA_MIN_LENGTH (1 + sizeof(uint64_t) + crypto_box_PUBLICKEYBYTES) | 468 | #define FAKEID_DATA_MIN_LENGTH (1 + sizeof(uint64_t) + crypto_box_PUBLICKEYBYTES) |
469 | #define FAKEID_DATA_MAX_LENGTH (FAKEID_DATA_MIN_LENGTH + sizeof(Node_format)*MAX_SENT_NODES) | 469 | #define FAKEID_DATA_MAX_LENGTH (FAKEID_DATA_MIN_LENGTH + sizeof(Node_format)*MAX_SENT_NODES) |
470 | static int handle_fakeid_announce(void *object, uint8_t *source_pubkey, uint8_t *data, uint32_t length) | 470 | static int handle_fakeid_announce(void *object, const uint8_t *source_pubkey, const uint8_t *data, uint32_t length) |
471 | { | 471 | { |
472 | Onion_Client *onion_c = object; | 472 | Onion_Client *onion_c = object; |
473 | 473 | ||
@@ -483,8 +483,8 @@ static int handle_fakeid_announce(void *object, uint8_t *source_pubkey, uint8_t | |||
483 | return 1; | 483 | return 1; |
484 | 484 | ||
485 | uint64_t no_replay; | 485 | uint64_t no_replay; |
486 | net_to_host(data + 1, sizeof(no_replay)); | ||
487 | memcpy(&no_replay, data + 1, sizeof(uint64_t)); | 486 | memcpy(&no_replay, data + 1, sizeof(uint64_t)); |
487 | net_to_host((uint8_t *) &no_replay, sizeof(no_replay)); | ||
488 | 488 | ||
489 | if (no_replay <= onion_c->friends_list[friend_num].last_noreplay) | 489 | if (no_replay <= onion_c->friends_list[friend_num].last_noreplay) |
490 | return 1; | 490 | return 1; |
@@ -623,7 +623,7 @@ static int send_dht_fakeid(Onion_Client *onion_c, int friend_num, uint8_t *data, | |||
623 | return route_tofriend(onion_c->dht, onion_c->friends_list[friend_num].fake_client_id, packet, len); | 623 | return route_tofriend(onion_c->dht, onion_c->friends_list[friend_num].fake_client_id, packet, len); |
624 | } | 624 | } |
625 | 625 | ||
626 | static int handle_dht_fakeid(void *object, IP_Port source, uint8_t *source_pubkey, uint8_t *packet, uint32_t length) | 626 | static int handle_dht_fakeid(void *object, IP_Port source, const uint8_t *source_pubkey, const uint8_t *packet, uint32_t length) |
627 | { | 627 | { |
628 | Onion_Client *onion_c = object; | 628 | Onion_Client *onion_c = object; |
629 | 629 | ||
@@ -702,7 +702,7 @@ static int send_fakeid_announce(Onion_Client *onion_c, uint16_t friend_num, uint | |||
702 | * return -1 on failure. | 702 | * return -1 on failure. |
703 | * return friend number on success. | 703 | * return friend number on success. |
704 | */ | 704 | */ |
705 | int onion_friend_num(Onion_Client *onion_c, uint8_t *client_id) | 705 | int onion_friend_num(const Onion_Client *onion_c, const uint8_t *client_id) |
706 | { | 706 | { |
707 | uint32_t i; | 707 | uint32_t i; |
708 | 708 | ||
@@ -744,7 +744,7 @@ static int realloc_onion_friends(Onion_Client *onion_c, uint32_t num) | |||
744 | * return -1 on failure. | 744 | * return -1 on failure. |
745 | * return the friend number on success or if the friend was already added. | 745 | * return the friend number on success or if the friend was already added. |
746 | */ | 746 | */ |
747 | int onion_addfriend(Onion_Client *onion_c, uint8_t *client_id) | 747 | int onion_addfriend(Onion_Client *onion_c, const uint8_t *client_id) |
748 | { | 748 | { |
749 | int num = onion_friend_num(onion_c, client_id); | 749 | int num = onion_friend_num(onion_c, client_id); |
750 | 750 | ||
@@ -831,7 +831,7 @@ int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num, int (*tcp_rela | |||
831 | * return -1 on failure. | 831 | * return -1 on failure. |
832 | * return 0 on success. | 832 | * return 0 on success. |
833 | */ | 833 | */ |
834 | int onion_set_friend_DHT_pubkey(Onion_Client *onion_c, int friend_num, uint8_t *dht_key, uint64_t timestamp) | 834 | int onion_set_friend_DHT_pubkey(Onion_Client *onion_c, int friend_num, const uint8_t *dht_key, uint64_t timestamp) |
835 | { | 835 | { |
836 | if ((uint32_t)friend_num >= onion_c->num_friends) | 836 | if ((uint32_t)friend_num >= onion_c->num_friends) |
837 | return -1; | 837 | return -1; |