diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-09-05 14:43:58 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-09-06 11:09:10 +0100 |
commit | 5b57ab6332edc407524a353d3965a4870c33fe00 (patch) | |
tree | 238659ca8e218307fff1476d427c94194bc24fad /auto_tests/toxav_many_test.c | |
parent | aad1e0ad3f96786e0fb10d8dd144e5e6ebe93258 (diff) |
Improve C standard compliance.
- Don't cast between object and function pointers.
- Use standard compliant `__VA_ARGS__` in macros.
- Add explicit `__extension__` on unnamed union in struct (it's a GNU
extension).
- Remove ; after function definitions.
- Replace `const T foo = 3;` for integral types `T` with `enum { foo = 3 };`.
Folding integral constants like that as compile time constants is a GNU
extension. Arrays allocated with `foo` as dimension are VLAs on strictly
compliant C99 compilers.
- Replace empty initialiser list `{}` with zero-initialiser-list `{0}`.
The former is a GNU extension meaning the latter.
- Cast `T*` (where `T != void`) to `void *` in format arguments. While any
object pointer can be implicitly converted to and from `void *`, this
conversion does not happen in variadic function calls.
- Replace arithmetic on `void *` with arithmetic on `char *`. The former
is non-compliant.
- Replace non-`int`-derived types (like `uint16_t`, which is
`short`-derived) in bit fields with `int`-derived types. Using any type
other than `int` or `unsigned int` (or any of their aliases) in bit
fields is a GNU extension.
Diffstat (limited to 'auto_tests/toxav_many_test.c')
-rw-r--r-- | auto_tests/toxav_many_test.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/auto_tests/toxav_many_test.c b/auto_tests/toxav_many_test.c index 9a58e648..5d889032 100644 --- a/auto_tests/toxav_many_test.c +++ b/auto_tests/toxav_many_test.c | |||
@@ -63,7 +63,7 @@ void t_toxav_call_cb(ToxAV *av, uint32_t friend_number, bool audio_enabled, bool | |||
63 | } | 63 | } |
64 | void t_toxav_call_state_cb(ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data) | 64 | void t_toxav_call_state_cb(ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data) |
65 | { | 65 | { |
66 | printf("Handling CALL STATE callback: %d %p\n", state, av); | 66 | printf("Handling CALL STATE callback: %d %p\n", state, (void *)av); |
67 | ((CallControl *)user_data)[friend_number].state = state; | 67 | ((CallControl *)user_data)[friend_number].state = state; |
68 | } | 68 | } |
69 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, | 69 | void t_toxav_receive_video_frame_cb(ToxAV *av, uint32_t friend_number, |
@@ -188,7 +188,7 @@ void *call_thread(void *pd) | |||
188 | toxav_call_control(AliceAV, friend_number, TOXAV_CALL_CONTROL_CANCEL, &rc); | 188 | toxav_call_control(AliceAV, friend_number, TOXAV_CALL_CONTROL_CANCEL, &rc); |
189 | 189 | ||
190 | if (rc != TOXAV_ERR_CALL_CONTROL_OK) { | 190 | if (rc != TOXAV_ERR_CALL_CONTROL_OK) { |
191 | printf("toxav_call_control failed: %d %p %p\n", rc, AliceAV, BobAV); | 191 | printf("toxav_call_control failed: %d %p %p\n", rc, (void *)AliceAV, (void *)BobAV); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||