diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-08-12 21:48:48 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-08-13 10:37:09 +0000 |
commit | d5183748193476e5d3af9c814bdb03feeb5b499a (patch) | |
tree | e1f4b0c15033e319ad57bddce56b8b1540f4b16b /toxav/toxav_old.c | |
parent | df9033dcb9d2b5ee8ef521b75abc32cda6498827 (diff) |
Fix groupav.c style and avoid casts in toxav_old.c.
* No anonymous structs.
* No assignment expressions.
* Only one declarator per struct member declaration.
* Named callback types only, no inline types.
* No `;` empty statements.
* `++i` instead of `i++`.
Avoiding a cast in toxav_old.c avoids some potential (and real) bugs.
Diffstat (limited to 'toxav/toxav_old.c')
-rw-r--r-- | toxav/toxav_old.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/toxav/toxav_old.c b/toxav/toxav_old.c index 24b4f1ec..6c9032e7 100644 --- a/toxav/toxav_old.c +++ b/toxav/toxav_old.c | |||
@@ -35,13 +35,10 @@ | |||
35 | * | 35 | * |
36 | * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). | 36 | * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). |
37 | */ | 37 | */ |
38 | int toxav_add_av_groupchat(Tox *tox, void (*audio_callback)(void *, uint32_t, uint32_t, const int16_t *, unsigned int, | 38 | int toxav_add_av_groupchat(Tox *tox, audio_data_cb *audio_callback, void *userdata) |
39 | uint8_t, uint32_t, void *), void *userdata) | ||
40 | { | 39 | { |
41 | Messenger *m = (Messenger *)tox; | 40 | Messenger *m = (Messenger *)tox; |
42 | return add_av_groupchat(m->log, m->conferences_object, | 41 | return add_av_groupchat(m->log, m->conferences_object, audio_callback, userdata); |
43 | (void (*)(Messenger *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, uint32_t, void *))audio_callback, | ||
44 | userdata); | ||
45 | } | 42 | } |
46 | 43 | ||
47 | /* Join a AV group (you need to have been invited first.) | 44 | /* Join a AV group (you need to have been invited first.) |
@@ -55,14 +52,10 @@ int toxav_add_av_groupchat(Tox *tox, void (*audio_callback)(void *, uint32_t, ui | |||
55 | * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). | 52 | * Note that total size of pcm in bytes is equal to (samples * channels * sizeof(int16_t)). |
56 | */ | 53 | */ |
57 | int toxav_join_av_groupchat(Tox *tox, uint32_t friendnumber, const uint8_t *data, uint16_t length, | 54 | int toxav_join_av_groupchat(Tox *tox, uint32_t friendnumber, const uint8_t *data, uint16_t length, |
58 | void (*audio_callback) | 55 | audio_data_cb *audio_callback, void *userdata) |
59 | (void *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, uint32_t, void *), | ||
60 | void *userdata) | ||
61 | { | 56 | { |
62 | Messenger *m = (Messenger *)tox; | 57 | Messenger *m = (Messenger *)tox; |
63 | return join_av_groupchat(m->log, m->conferences_object, friendnumber, data, length, | 58 | return join_av_groupchat(m->log, m->conferences_object, friendnumber, data, length, audio_callback, userdata); |
64 | (void (*)(Messenger *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, uint32_t, void *))audio_callback, | ||
65 | userdata); | ||
66 | } | 59 | } |
67 | 60 | ||
68 | /* Send audio to the group chat. | 61 | /* Send audio to the group chat. |