diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-09-01 00:38:58 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-09-01 14:54:17 +0100 |
commit | 45d1f9acb9dbec6ea84a81b2cc0b7df276ee15a9 (patch) | |
tree | 01410fdcdb33837d671bdc199783140a77aed655 | |
parent | 576f13061595dae46af025b4fce1a9b4ef95d37f (diff) |
Match parameter names in declarations with their definitions.
The parameter names were taken from function definitions to update the names in
function declarations (prototypes).
-rw-r--r-- | toxav/rtp.h | 2 | ||||
-rw-r--r-- | toxav/toxav.c | 20 | ||||
-rw-r--r-- | toxav/toxav.h | 42 | ||||
-rw-r--r-- | toxcore/assoc.h | 4 | ||||
-rw-r--r-- | toxcore/net_crypto.h | 2 | ||||
-rw-r--r-- | toxcore/tox.c | 141 |
6 files changed, 105 insertions, 106 deletions
diff --git a/toxav/rtp.h b/toxav/rtp.h index 4d62a466..9a5db78a 100644 --- a/toxav/rtp.h +++ b/toxav/rtp.h | |||
@@ -98,7 +98,7 @@ typedef struct { | |||
98 | } RTPSession; | 98 | } RTPSession; |
99 | 99 | ||
100 | 100 | ||
101 | RTPSession *rtp_new (int payload_type, Messenger *m, uint32_t friend_num, | 101 | RTPSession *rtp_new (int payload_type, Messenger *m, uint32_t friendnumber, |
102 | BWController *bwc, void *cs, | 102 | BWController *bwc, void *cs, |
103 | int (*mcb) (void *, struct RTPMessage *)); | 103 | int (*mcb) (void *, struct RTPMessage *)); |
104 | void rtp_kill (RTPSession *session); | 104 | void rtp_kill (RTPSession *session); |
diff --git a/toxav/toxav.c b/toxav/toxav.c index d7b367f7..126e29a7 100644 --- a/toxav/toxav.c +++ b/toxav/toxav.c | |||
@@ -327,10 +327,10 @@ END: | |||
327 | 327 | ||
328 | return rc == TOXAV_ERR_CALL_OK; | 328 | return rc == TOXAV_ERR_CALL_OK; |
329 | } | 329 | } |
330 | void toxav_callback_call(ToxAV *av, toxav_call_cb *function, void *user_data) | 330 | void toxav_callback_call(ToxAV *av, toxav_call_cb *callback, void *user_data) |
331 | { | 331 | { |
332 | pthread_mutex_lock(av->mutex); | 332 | pthread_mutex_lock(av->mutex); |
333 | av->ccb.first = function; | 333 | av->ccb.first = callback; |
334 | av->ccb.second = user_data; | 334 | av->ccb.second = user_data; |
335 | pthread_mutex_unlock(av->mutex); | 335 | pthread_mutex_unlock(av->mutex); |
336 | } | 336 | } |
@@ -386,10 +386,10 @@ END: | |||
386 | 386 | ||
387 | return rc == TOXAV_ERR_ANSWER_OK; | 387 | return rc == TOXAV_ERR_ANSWER_OK; |
388 | } | 388 | } |
389 | void toxav_callback_call_state(ToxAV *av, toxav_call_state_cb *function, void *user_data) | 389 | void toxav_callback_call_state(ToxAV *av, toxav_call_state_cb *callback, void *user_data) |
390 | { | 390 | { |
391 | pthread_mutex_lock(av->mutex); | 391 | pthread_mutex_lock(av->mutex); |
392 | av->scb.first = function; | 392 | av->scb.first = callback; |
393 | av->scb.second = user_data; | 393 | av->scb.second = user_data; |
394 | pthread_mutex_unlock(av->mutex); | 394 | pthread_mutex_unlock(av->mutex); |
395 | } | 395 | } |
@@ -662,10 +662,10 @@ END: | |||
662 | 662 | ||
663 | return rc == TOXAV_ERR_BIT_RATE_SET_OK; | 663 | return rc == TOXAV_ERR_BIT_RATE_SET_OK; |
664 | } | 664 | } |
665 | void toxav_callback_bit_rate_status(ToxAV *av, toxav_bit_rate_status_cb *function, void *user_data) | 665 | void toxav_callback_bit_rate_status(ToxAV *av, toxav_bit_rate_status_cb *callback, void *user_data) |
666 | { | 666 | { |
667 | pthread_mutex_lock(av->mutex); | 667 | pthread_mutex_lock(av->mutex); |
668 | av->bcb.first = function; | 668 | av->bcb.first = callback; |
669 | av->bcb.second = user_data; | 669 | av->bcb.second = user_data; |
670 | pthread_mutex_unlock(av->mutex); | 670 | pthread_mutex_unlock(av->mutex); |
671 | } | 671 | } |
@@ -854,17 +854,17 @@ END: | |||
854 | 854 | ||
855 | return rc == TOXAV_ERR_SEND_FRAME_OK; | 855 | return rc == TOXAV_ERR_SEND_FRAME_OK; |
856 | } | 856 | } |
857 | void toxav_callback_audio_receive_frame(ToxAV *av, toxav_audio_receive_frame_cb *function, void *user_data) | 857 | void toxav_callback_audio_receive_frame(ToxAV *av, toxav_audio_receive_frame_cb *callback, void *user_data) |
858 | { | 858 | { |
859 | pthread_mutex_lock(av->mutex); | 859 | pthread_mutex_lock(av->mutex); |
860 | av->acb.first = function; | 860 | av->acb.first = callback; |
861 | av->acb.second = user_data; | 861 | av->acb.second = user_data; |
862 | pthread_mutex_unlock(av->mutex); | 862 | pthread_mutex_unlock(av->mutex); |
863 | } | 863 | } |
864 | void toxav_callback_video_receive_frame(ToxAV *av, toxav_video_receive_frame_cb *function, void *user_data) | 864 | void toxav_callback_video_receive_frame(ToxAV *av, toxav_video_receive_frame_cb *callback, void *user_data) |
865 | { | 865 | { |
866 | pthread_mutex_lock(av->mutex); | 866 | pthread_mutex_lock(av->mutex); |
867 | av->vcb.first = function; | 867 | av->vcb.first = callback; |
868 | av->vcb.second = user_data; | 868 | av->vcb.second = user_data; |
869 | pthread_mutex_unlock(av->mutex); | 869 | pthread_mutex_unlock(av->mutex); |
870 | } | 870 | } |
diff --git a/toxav/toxav.h b/toxav/toxav.h index 947d3c2c..58619c6c 100644 --- a/toxav/toxav.h +++ b/toxav/toxav.h | |||
@@ -212,12 +212,12 @@ ToxAV *toxav_new(Tox *tox, TOXAV_ERR_NEW *error); | |||
212 | * notifying peers. After calling this function, no other functions may be | 212 | * notifying peers. After calling this function, no other functions may be |
213 | * called and the av pointer becomes invalid. | 213 | * called and the av pointer becomes invalid. |
214 | */ | 214 | */ |
215 | void toxav_kill(ToxAV *toxAV); | 215 | void toxav_kill(ToxAV *av); |
216 | 216 | ||
217 | /** | 217 | /** |
218 | * Returns the Tox instance the A/V object was created for. | 218 | * Returns the Tox instance the A/V object was created for. |
219 | */ | 219 | */ |
220 | Tox *toxav_get_tox(const ToxAV *toxAV); | 220 | Tox *toxav_get_tox(const ToxAV *av); |
221 | 221 | ||
222 | 222 | ||
223 | /******************************************************************************* | 223 | /******************************************************************************* |
@@ -232,14 +232,14 @@ Tox *toxav_get_tox(const ToxAV *toxAV); | |||
232 | * Returns the interval in milliseconds when the next toxav_iterate call should | 232 | * Returns the interval in milliseconds when the next toxav_iterate call should |
233 | * be. If no call is active at the moment, this function returns 200. | 233 | * be. If no call is active at the moment, this function returns 200. |
234 | */ | 234 | */ |
235 | uint32_t toxav_iteration_interval(const ToxAV *toxAV); | 235 | uint32_t toxav_iteration_interval(const ToxAV *av); |
236 | 236 | ||
237 | /** | 237 | /** |
238 | * Main loop for the session. This function needs to be called in intervals of | 238 | * Main loop for the session. This function needs to be called in intervals of |
239 | * toxav_iteration_interval() milliseconds. It is best called in the separate | 239 | * toxav_iteration_interval() milliseconds. It is best called in the separate |
240 | * thread from tox_iterate. | 240 | * thread from tox_iterate. |
241 | */ | 241 | */ |
242 | void toxav_iterate(ToxAV *toxAV); | 242 | void toxav_iterate(ToxAV *av); |
243 | 243 | ||
244 | 244 | ||
245 | /******************************************************************************* | 245 | /******************************************************************************* |
@@ -306,7 +306,7 @@ typedef enum TOXAV_ERR_CALL { | |||
306 | * @param video_bit_rate Video bit rate in Kb/sec. Set this to 0 to disable | 306 | * @param video_bit_rate Video bit rate in Kb/sec. Set this to 0 to disable |
307 | * video sending. | 307 | * video sending. |
308 | */ | 308 | */ |
309 | bool toxav_call(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate, | 309 | bool toxav_call(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate, |
310 | TOXAV_ERR_CALL *error); | 310 | TOXAV_ERR_CALL *error); |
311 | 311 | ||
312 | /** | 312 | /** |
@@ -316,15 +316,14 @@ bool toxav_call(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, u | |||
316 | * @param audio_enabled True if friend is sending audio. | 316 | * @param audio_enabled True if friend is sending audio. |
317 | * @param video_enabled True if friend is sending video. | 317 | * @param video_enabled True if friend is sending video. |
318 | */ | 318 | */ |
319 | typedef void toxav_call_cb(ToxAV *toxAV, uint32_t friend_number, bool audio_enabled, bool video_enabled, | 319 | typedef void toxav_call_cb(ToxAV *av, uint32_t friend_number, bool audio_enabled, bool video_enabled, void *user_data); |
320 | void *user_data); | ||
321 | 320 | ||
322 | 321 | ||
323 | /** | 322 | /** |
324 | * Set the callback for the `call` event. Pass NULL to unset. | 323 | * Set the callback for the `call` event. Pass NULL to unset. |
325 | * | 324 | * |
326 | */ | 325 | */ |
327 | void toxav_callback_call(ToxAV *toxAV, toxav_call_cb *callback, void *user_data); | 326 | void toxav_callback_call(ToxAV *av, toxav_call_cb *callback, void *user_data); |
328 | 327 | ||
329 | typedef enum TOXAV_ERR_ANSWER { | 328 | typedef enum TOXAV_ERR_ANSWER { |
330 | 329 | ||
@@ -377,7 +376,7 @@ typedef enum TOXAV_ERR_ANSWER { | |||
377 | * @param video_bit_rate Video bit rate in Kb/sec. Set this to 0 to disable | 376 | * @param video_bit_rate Video bit rate in Kb/sec. Set this to 0 to disable |
378 | * video sending. | 377 | * video sending. |
379 | */ | 378 | */ |
380 | bool toxav_answer(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate, | 379 | bool toxav_answer(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate, uint32_t video_bit_rate, |
381 | TOXAV_ERR_ANSWER *error); | 380 | TOXAV_ERR_ANSWER *error); |
382 | 381 | ||
383 | 382 | ||
@@ -438,14 +437,14 @@ enum TOXAV_FRIEND_CALL_STATE { | |||
438 | * paused. The bitmask represents all the activities currently performed by the | 437 | * paused. The bitmask represents all the activities currently performed by the |
439 | * friend. | 438 | * friend. |
440 | */ | 439 | */ |
441 | typedef void toxav_call_state_cb(ToxAV *toxAV, uint32_t friend_number, uint32_t state, void *user_data); | 440 | typedef void toxav_call_state_cb(ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data); |
442 | 441 | ||
443 | 442 | ||
444 | /** | 443 | /** |
445 | * Set the callback for the `call_state` event. Pass NULL to unset. | 444 | * Set the callback for the `call_state` event. Pass NULL to unset. |
446 | * | 445 | * |
447 | */ | 446 | */ |
448 | void toxav_callback_call_state(ToxAV *toxAV, toxav_call_state_cb *callback, void *user_data); | 447 | void toxav_callback_call_state(ToxAV *av, toxav_call_state_cb *callback, void *user_data); |
449 | 448 | ||
450 | 449 | ||
451 | /******************************************************************************* | 450 | /******************************************************************************* |
@@ -543,8 +542,7 @@ typedef enum TOXAV_ERR_CALL_CONTROL { | |||
543 | * | 542 | * |
544 | * @return true on success. | 543 | * @return true on success. |
545 | */ | 544 | */ |
546 | bool toxav_call_control(ToxAV *toxAV, uint32_t friend_number, TOXAV_CALL_CONTROL control, | 545 | bool toxav_call_control(ToxAV *av, uint32_t friend_number, TOXAV_CALL_CONTROL control, TOXAV_ERR_CALL_CONTROL *error); |
547 | TOXAV_ERR_CALL_CONTROL *error); | ||
548 | 546 | ||
549 | 547 | ||
550 | /******************************************************************************* | 548 | /******************************************************************************* |
@@ -601,7 +599,7 @@ typedef enum TOXAV_ERR_BIT_RATE_SET { | |||
601 | * video sending. Set to -1 to leave unchanged. | 599 | * video sending. Set to -1 to leave unchanged. |
602 | * | 600 | * |
603 | */ | 601 | */ |
604 | bool toxav_bit_rate_set(ToxAV *toxAV, uint32_t friend_number, int32_t audio_bit_rate, int32_t video_bit_rate, | 602 | bool toxav_bit_rate_set(ToxAV *av, uint32_t friend_number, int32_t audio_bit_rate, int32_t video_bit_rate, |
605 | TOXAV_ERR_BIT_RATE_SET *error); | 603 | TOXAV_ERR_BIT_RATE_SET *error); |
606 | 604 | ||
607 | /** | 605 | /** |
@@ -614,7 +612,7 @@ bool toxav_bit_rate_set(ToxAV *toxAV, uint32_t friend_number, int32_t audio_bit_ | |||
614 | * @param audio_bit_rate Suggested maximum audio bit rate in Kb/sec. | 612 | * @param audio_bit_rate Suggested maximum audio bit rate in Kb/sec. |
615 | * @param video_bit_rate Suggested maximum video bit rate in Kb/sec. | 613 | * @param video_bit_rate Suggested maximum video bit rate in Kb/sec. |
616 | */ | 614 | */ |
617 | typedef void toxav_bit_rate_status_cb(ToxAV *toxAV, uint32_t friend_number, uint32_t audio_bit_rate, | 615 | typedef void toxav_bit_rate_status_cb(ToxAV *av, uint32_t friend_number, uint32_t audio_bit_rate, |
618 | uint32_t video_bit_rate, void *user_data); | 616 | uint32_t video_bit_rate, void *user_data); |
619 | 617 | ||
620 | 618 | ||
@@ -622,7 +620,7 @@ typedef void toxav_bit_rate_status_cb(ToxAV *toxAV, uint32_t friend_number, uint | |||
622 | * Set the callback for the `bit_rate_status` event. Pass NULL to unset. | 620 | * Set the callback for the `bit_rate_status` event. Pass NULL to unset. |
623 | * | 621 | * |
624 | */ | 622 | */ |
625 | void toxav_callback_bit_rate_status(ToxAV *toxAV, toxav_bit_rate_status_cb *callback, void *user_data); | 623 | void toxav_callback_bit_rate_status(ToxAV *av, toxav_bit_rate_status_cb *callback, void *user_data); |
626 | 624 | ||
627 | 625 | ||
628 | /******************************************************************************* | 626 | /******************************************************************************* |
@@ -701,7 +699,7 @@ typedef enum TOXAV_ERR_SEND_FRAME { | |||
701 | * @param sampling_rate Audio sampling rate used in this frame. Valid sampling | 699 | * @param sampling_rate Audio sampling rate used in this frame. Valid sampling |
702 | * rates are 8000, 12000, 16000, 24000, or 48000. | 700 | * rates are 8000, 12000, 16000, 24000, or 48000. |
703 | */ | 701 | */ |
704 | bool toxav_audio_send_frame(ToxAV *toxAV, uint32_t friend_number, const int16_t *pcm, size_t sample_count, | 702 | bool toxav_audio_send_frame(ToxAV *av, uint32_t friend_number, const int16_t *pcm, size_t sample_count, |
705 | uint8_t channels, uint32_t sampling_rate, TOXAV_ERR_SEND_FRAME *error); | 703 | uint8_t channels, uint32_t sampling_rate, TOXAV_ERR_SEND_FRAME *error); |
706 | 704 | ||
707 | /** | 705 | /** |
@@ -719,7 +717,7 @@ bool toxav_audio_send_frame(ToxAV *toxAV, uint32_t friend_number, const int16_t | |||
719 | * @param u U (Chroma) plane data. | 717 | * @param u U (Chroma) plane data. |
720 | * @param v V (Chroma) plane data. | 718 | * @param v V (Chroma) plane data. |
721 | */ | 719 | */ |
722 | bool toxav_video_send_frame(ToxAV *toxAV, uint32_t friend_number, uint16_t width, uint16_t height, const uint8_t *y, | 720 | bool toxav_video_send_frame(ToxAV *av, uint32_t friend_number, uint16_t width, uint16_t height, const uint8_t *y, |
723 | const uint8_t *u, const uint8_t *v, TOXAV_ERR_SEND_FRAME *error); | 721 | const uint8_t *u, const uint8_t *v, TOXAV_ERR_SEND_FRAME *error); |
724 | 722 | ||
725 | 723 | ||
@@ -743,7 +741,7 @@ bool toxav_video_send_frame(ToxAV *toxAV, uint32_t friend_number, uint16_t width | |||
743 | * @param sampling_rate Sampling rate used in this frame. | 741 | * @param sampling_rate Sampling rate used in this frame. |
744 | * | 742 | * |
745 | */ | 743 | */ |
746 | typedef void toxav_audio_receive_frame_cb(ToxAV *toxAV, uint32_t friend_number, const int16_t *pcm, size_t sample_count, | 744 | typedef void toxav_audio_receive_frame_cb(ToxAV *av, uint32_t friend_number, const int16_t *pcm, size_t sample_count, |
747 | uint8_t channels, uint32_t sampling_rate, void *user_data); | 745 | uint8_t channels, uint32_t sampling_rate, void *user_data); |
748 | 746 | ||
749 | 747 | ||
@@ -751,7 +749,7 @@ typedef void toxav_audio_receive_frame_cb(ToxAV *toxAV, uint32_t friend_number, | |||
751 | * Set the callback for the `audio_receive_frame` event. Pass NULL to unset. | 749 | * Set the callback for the `audio_receive_frame` event. Pass NULL to unset. |
752 | * | 750 | * |
753 | */ | 751 | */ |
754 | void toxav_callback_audio_receive_frame(ToxAV *toxAV, toxav_audio_receive_frame_cb *callback, void *user_data); | 752 | void toxav_callback_audio_receive_frame(ToxAV *av, toxav_audio_receive_frame_cb *callback, void *user_data); |
755 | 753 | ||
756 | /** | 754 | /** |
757 | * The function type for the video_receive_frame callback. | 755 | * The function type for the video_receive_frame callback. |
@@ -774,7 +772,7 @@ void toxav_callback_audio_receive_frame(ToxAV *toxAV, toxav_audio_receive_frame_ | |||
774 | * image is bottom-up hence why you MUST abs() it when | 772 | * image is bottom-up hence why you MUST abs() it when |
775 | * calculating plane buffer size. | 773 | * calculating plane buffer size. |
776 | */ | 774 | */ |
777 | typedef void toxav_video_receive_frame_cb(ToxAV *toxAV, uint32_t friend_number, uint16_t width, uint16_t height, | 775 | typedef void toxav_video_receive_frame_cb(ToxAV *av, uint32_t friend_number, uint16_t width, uint16_t height, |
778 | const uint8_t *y, const uint8_t *u, const uint8_t *v, int32_t ystride, int32_t ustride, int32_t vstride, | 776 | const uint8_t *y, const uint8_t *u, const uint8_t *v, int32_t ystride, int32_t ustride, int32_t vstride, |
779 | void *user_data); | 777 | void *user_data); |
780 | 778 | ||
@@ -783,7 +781,7 @@ typedef void toxav_video_receive_frame_cb(ToxAV *toxAV, uint32_t friend_number, | |||
783 | * Set the callback for the `video_receive_frame` event. Pass NULL to unset. | 781 | * Set the callback for the `video_receive_frame` event. Pass NULL to unset. |
784 | * | 782 | * |
785 | */ | 783 | */ |
786 | void toxav_callback_video_receive_frame(ToxAV *toxAV, toxav_video_receive_frame_cb *callback, void *user_data); | 784 | void toxav_callback_video_receive_frame(ToxAV *av, toxav_video_receive_frame_cb *callback, void *user_data); |
787 | 785 | ||
788 | /** | 786 | /** |
789 | * NOTE Compatibility with old toxav group calls TODO remove | 787 | * NOTE Compatibility with old toxav group calls TODO remove |
diff --git a/toxcore/assoc.h b/toxcore/assoc.h index 62eecee1..e42e9c29 100644 --- a/toxcore/assoc.h +++ b/toxcore/assoc.h | |||
@@ -74,7 +74,7 @@ typedef struct Assoc_close_entries { | |||
74 | * the caller is assumed to be registered from Assoc_register_callback() | 74 | * the caller is assumed to be registered from Assoc_register_callback() |
75 | * if they aren't, they should copy the Client_data and call Assoc_client_drop() | 75 | * if they aren't, they should copy the Client_data and call Assoc_client_drop() |
76 | */ | 76 | */ |
77 | uint8_t Assoc_get_close_entries(Assoc *assoc, Assoc_close_entries *close_entries); | 77 | uint8_t Assoc_get_close_entries(Assoc *assoc, Assoc_close_entries *state); |
78 | 78 | ||
79 | /*****************************************************************************/ | 79 | /*****************************************************************************/ |
80 | 80 | ||
@@ -91,7 +91,7 @@ Assoc *new_Assoc_default(Logger *log, const uint8_t *public_id); | |||
91 | Assoc *new_Assoc(Logger *log, size_t bits, size_t entries, const uint8_t *public_id); | 91 | Assoc *new_Assoc(Logger *log, size_t bits, size_t entries, const uint8_t *public_id); |
92 | 92 | ||
93 | /* public_id changed (loaded), update which entry isn't stored */ | 93 | /* public_id changed (loaded), update which entry isn't stored */ |
94 | void Assoc_self_client_id_changed(Assoc *assoc, const uint8_t *public_id); | 94 | void Assoc_self_client_id_changed(Assoc *assoc, const uint8_t *id); |
95 | 95 | ||
96 | /* every 45s send out a getnodes() for a "random" bucket */ | 96 | /* every 45s send out a getnodes() for a "random" bucket */ |
97 | #define ASSOC_BUCKET_REFRESH 45 | 97 | #define ASSOC_BUCKET_REFRESH 45 |
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index ce78e72f..9be71020 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h | |||
@@ -367,7 +367,7 @@ int get_random_tcp_con_number(Net_Crypto *c); | |||
367 | * return 0 on success. | 367 | * return 0 on success. |
368 | * return -1 on failure. | 368 | * return -1 on failure. |
369 | */ | 369 | */ |
370 | int send_tcp_onion_request(Net_Crypto *c, unsigned int TCP_conn_number, const uint8_t *data, uint16_t length); | 370 | int send_tcp_onion_request(Net_Crypto *c, unsigned int tcp_connections_number, const uint8_t *data, uint16_t length); |
371 | 371 | ||
372 | /* Copy a maximum of num TCP relays we are connected to to tcp_relays. | 372 | /* Copy a maximum of num TCP relays we are connected to to tcp_relays. |
373 | * NOTE that the family of the copied ip ports will be set to TCP_INET or TCP_INET6. | 373 | * NOTE that the family of the copied ip ports will be set to TCP_INET or TCP_INET6. |
diff --git a/toxcore/tox.c b/toxcore/tox.c index 960fb618..94cb7261 100644 --- a/toxcore/tox.c +++ b/toxcore/tox.c | |||
@@ -114,35 +114,36 @@ CONST_FUNCTION(file_id_length, FILE_ID_LENGTH) | |||
114 | CONST_FUNCTION(max_filename_length, MAX_FILENAME_LENGTH) | 114 | CONST_FUNCTION(max_filename_length, MAX_FILENAME_LENGTH) |
115 | 115 | ||
116 | 116 | ||
117 | #define ACCESSORS(type, name) \ | 117 | #define ACCESSORS(type, ns, name) \ |
118 | type tox_options_get_##name(const struct Tox_Options *options) \ | 118 | type tox_options_get_##ns##name(const struct Tox_Options *options) \ |
119 | { \ | 119 | { \ |
120 | return options->name; \ | 120 | return options->ns##name; \ |
121 | } \ | 121 | } \ |
122 | void tox_options_set_##name(struct Tox_Options *options, type name) \ | 122 | void tox_options_set_##ns##name(struct Tox_Options *options, type name) \ |
123 | { \ | 123 | { \ |
124 | options->name = name; \ | 124 | options->ns##name = name; \ |
125 | } | 125 | } |
126 | 126 | ||
127 | ACCESSORS(bool, ipv6_enabled) | 127 | ACCESSORS(bool, , ipv6_enabled) |
128 | ACCESSORS(bool, udp_enabled) | 128 | ACCESSORS(bool, , udp_enabled) |
129 | ACCESSORS(TOX_PROXY_TYPE, proxy_type) | 129 | ACCESSORS(TOX_PROXY_TYPE, proxy_ , type) |
130 | ACCESSORS(const char *, proxy_host) | 130 | ACCESSORS(const char *, proxy_ , host) |
131 | ACCESSORS(uint16_t, proxy_port) | 131 | ACCESSORS(uint16_t, proxy_ , port) |
132 | ACCESSORS(uint16_t, start_port) | 132 | ACCESSORS(uint16_t, , start_port) |
133 | ACCESSORS(uint16_t, end_port) | 133 | ACCESSORS(uint16_t, , end_port) |
134 | ACCESSORS(uint16_t, tcp_port) | 134 | ACCESSORS(uint16_t, , tcp_port) |
135 | ACCESSORS(TOX_SAVEDATA_TYPE, savedata_type) | 135 | ACCESSORS(TOX_SAVEDATA_TYPE, savedata_, type) |
136 | ACCESSORS(size_t, savedata_length) | 136 | ACCESSORS(size_t, savedata_, length) |
137 | 137 | ||
138 | const uint8_t *tox_options_get_savedata_data(const struct Tox_Options *options) | 138 | const uint8_t *tox_options_get_savedata_data(const struct Tox_Options *options) |
139 | { | 139 | { |
140 | return options->savedata_data; | 140 | return options->savedata_data; |
141 | } | 141 | } |
142 | 142 | ||
143 | void tox_options_set_savedata_data(struct Tox_Options *options, const uint8_t *savedata_data, size_t length) | 143 | void tox_options_set_savedata_data(struct Tox_Options *options, const uint8_t *data, size_t length) |
144 | { | 144 | { |
145 | options->savedata_data = savedata_data; | 145 | options->savedata_data = data; |
146 | options->savedata_length = length; | ||
146 | } | 147 | } |
147 | 148 | ||
148 | 149 | ||
@@ -307,10 +308,10 @@ void tox_kill(Tox *tox) | |||
307 | logger_kill(log); | 308 | logger_kill(log); |
308 | } | 309 | } |
309 | 310 | ||
310 | void tox_callback_log(Tox *tox, tox_log_cb *function, void *userdata) | 311 | void tox_callback_log(Tox *tox, tox_log_cb *callback, void *user_data) |
311 | { | 312 | { |
312 | Messenger *m = tox; | 313 | Messenger *m = tox; |
313 | m_callback_log(m, (logger_cb *)function, userdata); | 314 | m_callback_log(m, (logger_cb *)callback, user_data); |
314 | } | 315 | } |
315 | 316 | ||
316 | size_t tox_get_savedata_size(const Tox *tox) | 317 | size_t tox_get_savedata_size(const Tox *tox) |
@@ -319,11 +320,11 @@ size_t tox_get_savedata_size(const Tox *tox) | |||
319 | return messenger_size(m); | 320 | return messenger_size(m); |
320 | } | 321 | } |
321 | 322 | ||
322 | void tox_get_savedata(const Tox *tox, uint8_t *data) | 323 | void tox_get_savedata(const Tox *tox, uint8_t *savedata) |
323 | { | 324 | { |
324 | if (data) { | 325 | if (savedata) { |
325 | const Messenger *m = tox; | 326 | const Messenger *m = tox; |
326 | messenger_save(m, data); | 327 | messenger_save(m, savedata); |
327 | } | 328 | } |
328 | } | 329 | } |
329 | 330 | ||
@@ -457,10 +458,10 @@ TOX_CONNECTION tox_self_get_connection_status(const Tox *tox) | |||
457 | } | 458 | } |
458 | 459 | ||
459 | 460 | ||
460 | void tox_callback_self_connection_status(Tox *tox, tox_self_connection_status_cb *function) | 461 | void tox_callback_self_connection_status(Tox *tox, tox_self_connection_status_cb *callback) |
461 | { | 462 | { |
462 | Messenger *m = tox; | 463 | Messenger *m = tox; |
463 | m_callback_core_connection(m, function); | 464 | m_callback_core_connection(m, callback); |
464 | } | 465 | } |
465 | 466 | ||
466 | uint32_t tox_iteration_interval(const Tox *tox) | 467 | uint32_t tox_iteration_interval(const Tox *tox) |
@@ -469,10 +470,10 @@ uint32_t tox_iteration_interval(const Tox *tox) | |||
469 | return messenger_run_interval(m); | 470 | return messenger_run_interval(m); |
470 | } | 471 | } |
471 | 472 | ||
472 | void tox_iterate(Tox *tox, void *userdata) | 473 | void tox_iterate(Tox *tox, void *user_data) |
473 | { | 474 | { |
474 | Messenger *m = tox; | 475 | Messenger *m = tox; |
475 | do_messenger(m, userdata); | 476 | do_messenger(m, user_data); |
476 | do_groupchats(m->group_chat_object); | 477 | do_groupchats(m->group_chat_object); |
477 | } | 478 | } |
478 | 479 | ||
@@ -548,16 +549,16 @@ void tox_self_get_name(const Tox *tox, uint8_t *name) | |||
548 | } | 549 | } |
549 | } | 550 | } |
550 | 551 | ||
551 | bool tox_self_set_status_message(Tox *tox, const uint8_t *status, size_t length, TOX_ERR_SET_INFO *error) | 552 | bool tox_self_set_status_message(Tox *tox, const uint8_t *status_message, size_t length, TOX_ERR_SET_INFO *error) |
552 | { | 553 | { |
553 | if (!status && length != 0) { | 554 | if (!status_message && length != 0) { |
554 | SET_ERROR_PARAMETER(error, TOX_ERR_SET_INFO_NULL); | 555 | SET_ERROR_PARAMETER(error, TOX_ERR_SET_INFO_NULL); |
555 | return 0; | 556 | return 0; |
556 | } | 557 | } |
557 | 558 | ||
558 | Messenger *m = tox; | 559 | Messenger *m = tox; |
559 | 560 | ||
560 | if (m_set_statusmessage(m, status, length) == 0) { | 561 | if (m_set_statusmessage(m, status_message, length) == 0) { |
561 | SET_ERROR_PARAMETER(error, TOX_ERR_SET_INFO_OK); | 562 | SET_ERROR_PARAMETER(error, TOX_ERR_SET_INFO_OK); |
562 | return 1; | 563 | return 1; |
563 | } else { | 564 | } else { |
@@ -572,18 +573,18 @@ size_t tox_self_get_status_message_size(const Tox *tox) | |||
572 | return m_get_self_statusmessage_size(m); | 573 | return m_get_self_statusmessage_size(m); |
573 | } | 574 | } |
574 | 575 | ||
575 | void tox_self_get_status_message(const Tox *tox, uint8_t *status) | 576 | void tox_self_get_status_message(const Tox *tox, uint8_t *status_message) |
576 | { | 577 | { |
577 | if (status) { | 578 | if (status_message) { |
578 | const Messenger *m = tox; | 579 | const Messenger *m = tox; |
579 | m_copy_self_statusmessage(m, status); | 580 | m_copy_self_statusmessage(m, status_message); |
580 | } | 581 | } |
581 | } | 582 | } |
582 | 583 | ||
583 | void tox_self_set_status(Tox *tox, TOX_USER_STATUS user_status) | 584 | void tox_self_set_status(Tox *tox, TOX_USER_STATUS status) |
584 | { | 585 | { |
585 | Messenger *m = tox; | 586 | Messenger *m = tox; |
586 | m_set_userstatus(m, user_status); | 587 | m_set_userstatus(m, status); |
587 | } | 588 | } |
588 | 589 | ||
589 | TOX_USER_STATUS tox_self_get_status(const Tox *tox) | 590 | TOX_USER_STATUS tox_self_get_status(const Tox *tox) |
@@ -743,12 +744,12 @@ size_t tox_self_get_friend_list_size(const Tox *tox) | |||
743 | return count_friendlist(m); | 744 | return count_friendlist(m); |
744 | } | 745 | } |
745 | 746 | ||
746 | void tox_self_get_friend_list(const Tox *tox, uint32_t *list) | 747 | void tox_self_get_friend_list(const Tox *tox, uint32_t *friend_list) |
747 | { | 748 | { |
748 | if (list) { | 749 | if (friend_list) { |
749 | const Messenger *m = tox; | 750 | const Messenger *m = tox; |
750 | //TODO: size parameter? | 751 | //TODO: size parameter? |
751 | copy_friendlist(m, list, tox_self_get_friend_list_size(tox)); | 752 | copy_friendlist(m, friend_list, tox_self_get_friend_list_size(tox)); |
752 | } | 753 | } |
753 | } | 754 | } |
754 | 755 | ||
@@ -785,10 +786,10 @@ bool tox_friend_get_name(const Tox *tox, uint32_t friend_number, uint8_t *name, | |||
785 | return 1; | 786 | return 1; |
786 | } | 787 | } |
787 | 788 | ||
788 | void tox_callback_friend_name(Tox *tox, tox_friend_name_cb *function) | 789 | void tox_callback_friend_name(Tox *tox, tox_friend_name_cb *callback) |
789 | { | 790 | { |
790 | Messenger *m = tox; | 791 | Messenger *m = tox; |
791 | m_callback_namechange(m, function); | 792 | m_callback_namechange(m, callback); |
792 | } | 793 | } |
793 | 794 | ||
794 | size_t tox_friend_get_status_message_size(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) | 795 | size_t tox_friend_get_status_message_size(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) |
@@ -805,17 +806,17 @@ size_t tox_friend_get_status_message_size(const Tox *tox, uint32_t friend_number | |||
805 | return ret; | 806 | return ret; |
806 | } | 807 | } |
807 | 808 | ||
808 | bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8_t *message, | 809 | bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8_t *status_message, |
809 | TOX_ERR_FRIEND_QUERY *error) | 810 | TOX_ERR_FRIEND_QUERY *error) |
810 | { | 811 | { |
811 | if (!message) { | 812 | if (!status_message) { |
812 | SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_NULL); | 813 | SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_NULL); |
813 | return 0; | 814 | return 0; |
814 | } | 815 | } |
815 | 816 | ||
816 | const Messenger *m = tox; | 817 | const Messenger *m = tox; |
817 | //TODO: size parameter? | 818 | //TODO: size parameter? |
818 | int ret = m_copy_statusmessage(m, friend_number, message, m_get_statusmessage_size(m, friend_number)); | 819 | int ret = m_copy_statusmessage(m, friend_number, status_message, m_get_statusmessage_size(m, friend_number)); |
819 | 820 | ||
820 | if (ret == -1) { | 821 | if (ret == -1) { |
821 | SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_FRIEND_NOT_FOUND); | 822 | SET_ERROR_PARAMETER(error, TOX_ERR_FRIEND_QUERY_FRIEND_NOT_FOUND); |
@@ -826,10 +827,10 @@ bool tox_friend_get_status_message(const Tox *tox, uint32_t friend_number, uint8 | |||
826 | return 1; | 827 | return 1; |
827 | } | 828 | } |
828 | 829 | ||
829 | void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *function) | 830 | void tox_callback_friend_status_message(Tox *tox, tox_friend_status_message_cb *callback) |
830 | { | 831 | { |
831 | Messenger *m = tox; | 832 | Messenger *m = tox; |
832 | m_callback_statusmessage(m, function); | 833 | m_callback_statusmessage(m, callback); |
833 | } | 834 | } |
834 | 835 | ||
835 | TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) | 836 | TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) |
@@ -847,10 +848,10 @@ TOX_USER_STATUS tox_friend_get_status(const Tox *tox, uint32_t friend_number, TO | |||
847 | return ret; | 848 | return ret; |
848 | } | 849 | } |
849 | 850 | ||
850 | void tox_callback_friend_status(Tox *tox, tox_friend_status_cb *function) | 851 | void tox_callback_friend_status(Tox *tox, tox_friend_status_cb *callback) |
851 | { | 852 | { |
852 | Messenger *m = tox; | 853 | Messenger *m = tox; |
853 | m_callback_userstatus(m, function); | 854 | m_callback_userstatus(m, callback); |
854 | } | 855 | } |
855 | 856 | ||
856 | TOX_CONNECTION tox_friend_get_connection_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) | 857 | TOX_CONNECTION tox_friend_get_connection_status(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) |
@@ -868,10 +869,10 @@ TOX_CONNECTION tox_friend_get_connection_status(const Tox *tox, uint32_t friend_ | |||
868 | return ret; | 869 | return ret; |
869 | } | 870 | } |
870 | 871 | ||
871 | void tox_callback_friend_connection_status(Tox *tox, tox_friend_connection_status_cb *function, void *user_data) | 872 | void tox_callback_friend_connection_status(Tox *tox, tox_friend_connection_status_cb *callback, void *user_data) |
872 | { | 873 | { |
873 | Messenger *m = tox; | 874 | Messenger *m = tox; |
874 | m_callback_connectionstatus(m, function, user_data); | 875 | m_callback_connectionstatus(m, callback, user_data); |
875 | } | 876 | } |
876 | 877 | ||
877 | bool tox_friend_get_typing(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) | 878 | bool tox_friend_get_typing(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEND_QUERY *error) |
@@ -888,17 +889,17 @@ bool tox_friend_get_typing(const Tox *tox, uint32_t friend_number, TOX_ERR_FRIEN | |||
888 | return !!ret; | 889 | return !!ret; |
889 | } | 890 | } |
890 | 891 | ||
891 | void tox_callback_friend_typing(Tox *tox, tox_friend_typing_cb *function) | 892 | void tox_callback_friend_typing(Tox *tox, tox_friend_typing_cb *callback) |
892 | { | 893 | { |
893 | Messenger *m = tox; | 894 | Messenger *m = tox; |
894 | m_callback_typingchange(m, function); | 895 | m_callback_typingchange(m, callback); |
895 | } | 896 | } |
896 | 897 | ||
897 | bool tox_self_set_typing(Tox *tox, uint32_t friend_number, bool is_typing, TOX_ERR_SET_TYPING *error) | 898 | bool tox_self_set_typing(Tox *tox, uint32_t friend_number, bool typing, TOX_ERR_SET_TYPING *error) |
898 | { | 899 | { |
899 | Messenger *m = tox; | 900 | Messenger *m = tox; |
900 | 901 | ||
901 | if (m_set_usertyping(m, friend_number, is_typing) == -1) { | 902 | if (m_set_usertyping(m, friend_number, typing) == -1) { |
902 | SET_ERROR_PARAMETER(error, TOX_ERR_SET_TYPING_FRIEND_NOT_FOUND); | 903 | SET_ERROR_PARAMETER(error, TOX_ERR_SET_TYPING_FRIEND_NOT_FOUND); |
903 | return 0; | 904 | return 0; |
904 | } | 905 | } |
@@ -955,22 +956,22 @@ uint32_t tox_friend_send_message(Tox *tox, uint32_t friend_number, TOX_MESSAGE_T | |||
955 | return message_id; | 956 | return message_id; |
956 | } | 957 | } |
957 | 958 | ||
958 | void tox_callback_friend_read_receipt(Tox *tox, tox_friend_read_receipt_cb *function) | 959 | void tox_callback_friend_read_receipt(Tox *tox, tox_friend_read_receipt_cb *callback) |
959 | { | 960 | { |
960 | Messenger *m = tox; | 961 | Messenger *m = tox; |
961 | m_callback_read_receipt(m, function); | 962 | m_callback_read_receipt(m, callback); |
962 | } | 963 | } |
963 | 964 | ||
964 | void tox_callback_friend_request(Tox *tox, tox_friend_request_cb *function, void *user_data) | 965 | void tox_callback_friend_request(Tox *tox, tox_friend_request_cb *callback, void *user_data) |
965 | { | 966 | { |
966 | Messenger *m = tox; | 967 | Messenger *m = tox; |
967 | m_callback_friendrequest(m, function, user_data); | 968 | m_callback_friendrequest(m, callback, user_data); |
968 | } | 969 | } |
969 | 970 | ||
970 | void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *function) | 971 | void tox_callback_friend_message(Tox *tox, tox_friend_message_cb *callback) |
971 | { | 972 | { |
972 | Messenger *m = tox; | 973 | Messenger *m = tox; |
973 | m_callback_friendmessage(m, function); | 974 | m_callback_friendmessage(m, callback); |
974 | } | 975 | } |
975 | 976 | ||
976 | bool tox_hash(uint8_t *hash, const uint8_t *data, size_t length) | 977 | bool tox_hash(uint8_t *hash, const uint8_t *data, size_t length) |
@@ -1074,10 +1075,10 @@ bool tox_file_seek(Tox *tox, uint32_t friend_number, uint32_t file_number, uint6 | |||
1074 | return 0; | 1075 | return 0; |
1075 | } | 1076 | } |
1076 | 1077 | ||
1077 | void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *function, void *user_data) | 1078 | void tox_callback_file_recv_control(Tox *tox, tox_file_recv_control_cb *callback, void *user_data) |
1078 | { | 1079 | { |
1079 | Messenger *m = tox; | 1080 | Messenger *m = tox; |
1080 | callback_file_control(m, function, user_data); | 1081 | callback_file_control(m, callback, user_data); |
1081 | } | 1082 | } |
1082 | 1083 | ||
1083 | bool tox_file_get_file_id(const Tox *tox, uint32_t friend_number, uint32_t file_number, uint8_t *file_id, | 1084 | bool tox_file_get_file_id(const Tox *tox, uint32_t friend_number, uint32_t file_number, uint8_t *file_id, |
@@ -1194,22 +1195,22 @@ bool tox_file_send_chunk(Tox *tox, uint32_t friend_number, uint32_t file_number, | |||
1194 | return 0; | 1195 | return 0; |
1195 | } | 1196 | } |
1196 | 1197 | ||
1197 | void tox_callback_file_chunk_request(Tox *tox, tox_file_chunk_request_cb *function, void *user_data) | 1198 | void tox_callback_file_chunk_request(Tox *tox, tox_file_chunk_request_cb *callback, void *user_data) |
1198 | { | 1199 | { |
1199 | Messenger *m = tox; | 1200 | Messenger *m = tox; |
1200 | callback_file_reqchunk(m, function, user_data); | 1201 | callback_file_reqchunk(m, callback, user_data); |
1201 | } | 1202 | } |
1202 | 1203 | ||
1203 | void tox_callback_file_recv(Tox *tox, tox_file_recv_cb *function, void *user_data) | 1204 | void tox_callback_file_recv(Tox *tox, tox_file_recv_cb *callback, void *user_data) |
1204 | { | 1205 | { |
1205 | Messenger *m = tox; | 1206 | Messenger *m = tox; |
1206 | callback_file_sendrequest(m, function, user_data); | 1207 | callback_file_sendrequest(m, callback, user_data); |
1207 | } | 1208 | } |
1208 | 1209 | ||
1209 | void tox_callback_file_recv_chunk(Tox *tox, tox_file_recv_chunk_cb *function, void *user_data) | 1210 | void tox_callback_file_recv_chunk(Tox *tox, tox_file_recv_chunk_cb *callback, void *user_data) |
1210 | { | 1211 | { |
1211 | Messenger *m = tox; | 1212 | Messenger *m = tox; |
1212 | callback_file_data(m, function, user_data); | 1213 | callback_file_data(m, callback, user_data); |
1213 | } | 1214 | } |
1214 | 1215 | ||
1215 | static void set_custom_packet_error(int ret, TOX_ERR_FRIEND_CUSTOM_PACKET *error) | 1216 | static void set_custom_packet_error(int ret, TOX_ERR_FRIEND_CUSTOM_PACKET *error) |
@@ -1272,10 +1273,10 @@ bool tox_friend_send_lossy_packet(Tox *tox, uint32_t friend_number, const uint8_ | |||
1272 | } | 1273 | } |
1273 | } | 1274 | } |
1274 | 1275 | ||
1275 | void tox_callback_friend_lossy_packet(Tox *tox, tox_friend_lossy_packet_cb *function, void *user_data) | 1276 | void tox_callback_friend_lossy_packet(Tox *tox, tox_friend_lossy_packet_cb *callback, void *user_data) |
1276 | { | 1277 | { |
1277 | Messenger *m = tox; | 1278 | Messenger *m = tox; |
1278 | custom_lossy_packet_registerhandler(m, function, user_data); | 1279 | custom_lossy_packet_registerhandler(m, callback, user_data); |
1279 | } | 1280 | } |
1280 | 1281 | ||
1281 | bool tox_friend_send_lossless_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length, | 1282 | bool tox_friend_send_lossless_packet(Tox *tox, uint32_t friend_number, const uint8_t *data, size_t length, |
@@ -1304,10 +1305,10 @@ bool tox_friend_send_lossless_packet(Tox *tox, uint32_t friend_number, const uin | |||
1304 | } | 1305 | } |
1305 | } | 1306 | } |
1306 | 1307 | ||
1307 | void tox_callback_friend_lossless_packet(Tox *tox, tox_friend_lossless_packet_cb *function, void *user_data) | 1308 | void tox_callback_friend_lossless_packet(Tox *tox, tox_friend_lossless_packet_cb *callback, void *user_data) |
1308 | { | 1309 | { |
1309 | Messenger *m = tox; | 1310 | Messenger *m = tox; |
1310 | custom_lossless_packet_registerhandler(m, function, user_data); | 1311 | custom_lossless_packet_registerhandler(m, callback, user_data); |
1311 | } | 1312 | } |
1312 | 1313 | ||
1313 | void tox_self_get_dht_id(const Tox *tox, uint8_t *dht_id) | 1314 | void tox_self_get_dht_id(const Tox *tox, uint8_t *dht_id) |