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/groupav.h | |
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/groupav.h')
-rw-r--r-- | toxav/groupav.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/toxav/groupav.h b/toxav/groupav.h index 42f2c578..4d9efafb 100644 --- a/toxav/groupav.h +++ b/toxav/groupav.h | |||
@@ -27,13 +27,15 @@ | |||
27 | 27 | ||
28 | #define GROUP_AUDIO_PACKET_ID 192 | 28 | #define GROUP_AUDIO_PACKET_ID 192 |
29 | 29 | ||
30 | typedef void audio_data_cb(void *tox, uint32_t groupnumber, uint32_t peernumber, const int16_t *pcm, | ||
31 | uint32_t samples, uint8_t channels, uint32_t sample_rate, void *userdata); | ||
32 | |||
30 | /* Create a new toxav group. | 33 | /* Create a new toxav group. |
31 | * | 34 | * |
32 | * return group number on success. | 35 | * return group number on success. |
33 | * return -1 on failure. | 36 | * return -1 on failure. |
34 | */ | 37 | */ |
35 | int add_av_groupchat(const Logger *log, Group_Chats *g_c, void (*audio_callback)(Messenger *, uint32_t, uint32_t, | 38 | int add_av_groupchat(const Logger *log, Group_Chats *g_c, audio_data_cb *audio_callback, void *userdata); |
36 | const int16_t *, unsigned int, uint8_t, uint32_t, void *), void *userdata); | ||
37 | 39 | ||
38 | /* Join a AV group (you need to have been invited first.) | 40 | /* Join a AV group (you need to have been invited first.) |
39 | * | 41 | * |
@@ -41,8 +43,7 @@ int add_av_groupchat(const Logger *log, Group_Chats *g_c, void (*audio_callback) | |||
41 | * returns -1 on failure. | 43 | * returns -1 on failure. |
42 | */ | 44 | */ |
43 | int join_av_groupchat(const Logger *log, Group_Chats *g_c, uint32_t friendnumber, const uint8_t *data, uint16_t length, | 45 | int join_av_groupchat(const Logger *log, Group_Chats *g_c, uint32_t friendnumber, const uint8_t *data, uint16_t length, |
44 | void (*audio_callback)(Messenger *, uint32_t, uint32_t, const int16_t *, unsigned int, uint8_t, uint32_t, void *), | 46 | audio_data_cb *audio_callback, void *userdata); |
45 | void *userdata); | ||
46 | 47 | ||
47 | 48 | ||
48 | /* Send audio to the group chat. | 49 | /* Send audio to the group chat. |