summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schütz <schuetzm@gmx.net>2014-06-13 22:18:37 +0200
committerMarc Schütz <schuetzm@gmx.net>2014-06-13 22:18:37 +0200
commit920a87be35e005fc8fe88599dede70cac56d7d6a (patch)
tree17456257194bd8db1d95afc17cfb0c2fe8ea68fa
parent5a34595f58d0739d60d363c7f6557665e85eeb18 (diff)
Const correctness in toxcore/friend_requests.c
-rw-r--r--toxcore/friend_requests.c6
-rw-r--r--toxcore/friend_requests.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/toxcore/friend_requests.c b/toxcore/friend_requests.c
index 9b05cc51..8366a8cb 100644
--- a/toxcore/friend_requests.c
+++ b/toxcore/friend_requests.c
@@ -35,7 +35,7 @@
35 * return 0 if it sent the friend request directly to the friend. 35 * return 0 if it sent the friend request directly to the friend.
36 * return the number of peers it was routed through if it did not send it directly. 36 * return the number of peers it was routed through if it did not send it directly.
37 */ 37 */
38int send_friendrequest(Onion_Client *onion_c, uint8_t *public_key, uint32_t nospam_num, uint8_t *data, uint32_t length) 38int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data, uint32_t length)
39{ 39{
40 if (1 + sizeof(nospam_num) + length > ONION_CLIENT_MAX_DATA_SIZE || length == 0) 40 if (1 + sizeof(nospam_num) + length > ONION_CLIENT_MAX_DATA_SIZE || length == 0)
41 return -1; 41 return -1;
@@ -65,7 +65,7 @@ void set_nospam(Friend_Requests *fr, uint32_t num)
65 fr->nospam = num; 65 fr->nospam = num;
66} 66}
67 67
68uint32_t get_nospam(Friend_Requests *fr) 68uint32_t get_nospam(const Friend_Requests *fr)
69{ 69{
70 return fr->nospam; 70 return fr->nospam;
71} 71}
@@ -118,7 +118,7 @@ static int request_received(Friend_Requests *fr, const uint8_t *client_id)
118 * return 0 if it removed it successfully. 118 * return 0 if it removed it successfully.
119 * return -1 if it didn't find it. 119 * return -1 if it didn't find it.
120 */ 120 */
121int remove_request_received(Friend_Requests *fr, uint8_t *client_id) 121int remove_request_received(Friend_Requests *fr, const uint8_t *client_id)
122{ 122{
123 uint32_t i; 123 uint32_t i;
124 124
diff --git a/toxcore/friend_requests.h b/toxcore/friend_requests.h
index 8d429a7e..e669607b 100644
--- a/toxcore/friend_requests.h
+++ b/toxcore/friend_requests.h
@@ -51,17 +51,17 @@ typedef struct {
51 * data is the data in the request and length is the length. 51 * data is the data in the request and length is the length.
52 * Maximum length of data is MAX_FRIEND_REQUEST_DATA_SIZE. 52 * Maximum length of data is MAX_FRIEND_REQUEST_DATA_SIZE.
53 */ 53 */
54int send_friendrequest(Onion_Client *onion_c, uint8_t *public_key, uint32_t nospam_num, uint8_t *data, uint32_t length); 54int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data, uint32_t length);
55/* Set and get the nospam variable used to prevent one type of friend request spam. */ 55/* Set and get the nospam variable used to prevent one type of friend request spam. */
56void set_nospam(Friend_Requests *fr, uint32_t num); 56void set_nospam(Friend_Requests *fr, uint32_t num);
57uint32_t get_nospam(Friend_Requests *fr); 57uint32_t get_nospam(const Friend_Requests *fr);
58 58
59/* Remove client id from received_requests list. 59/* Remove client id from received_requests list.
60 * 60 *
61 * return 0 if it removed it successfully. 61 * return 0 if it removed it successfully.
62 * return -1 if it didn't find it. 62 * return -1 if it didn't find it.
63 */ 63 */
64int remove_request_received(Friend_Requests *fr, uint8_t *client_id); 64int remove_request_received(Friend_Requests *fr, const uint8_t *client_id);
65 65
66/* Set the function that will be executed when a friend request for us is received. 66/* Set the function that will be executed when a friend request for us is received.
67 * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length, void * userdata) 67 * Function format is function(uint8_t * public_key, uint8_t * data, uint16_t length, void * userdata)