summaryrefslogtreecommitdiff
path: root/toxav/rtp.h
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2016-09-05 14:43:58 +0100
committeriphydf <iphydf@users.noreply.github.com>2016-09-06 11:09:10 +0100
commit5b57ab6332edc407524a353d3965a4870c33fe00 (patch)
tree238659ca8e218307fff1476d427c94194bc24fad /toxav/rtp.h
parentaad1e0ad3f96786e0fb10d8dd144e5e6ebe93258 (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 'toxav/rtp.h')
-rw-r--r--toxav/rtp.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/toxav/rtp.h b/toxav/rtp.h
index 18929e12..4d60682a 100644
--- a/toxav/rtp.h
+++ b/toxav/rtp.h
@@ -37,21 +37,21 @@ enum {
37struct RTPHeader { 37struct RTPHeader {
38 /* Standard RTP header */ 38 /* Standard RTP header */
39#ifndef WORDS_BIGENDIAN 39#ifndef WORDS_BIGENDIAN
40 uint16_t cc: 4; /* Contributing sources count */ 40 unsigned cc: 4; /* Contributing sources count */
41 uint16_t xe: 1; /* Extra header */ 41 unsigned xe: 1; /* Extra header */
42 uint16_t pe: 1; /* Padding */ 42 unsigned pe: 1; /* Padding */
43 uint16_t ve: 2; /* Version */ 43 unsigned ve: 2; /* Version */
44 44
45 uint16_t pt: 7; /* Payload type */ 45 unsigned pt: 7; /* Payload type */
46 uint16_t ma: 1; /* Marker */ 46 unsigned ma: 1; /* Marker */
47#else 47#else
48 uint16_t ve: 2; /* Version */ 48 unsigned ve: 2; /* Version */
49 uint16_t pe: 1; /* Padding */ 49 unsigned pe: 1; /* Padding */
50 uint16_t xe: 1; /* Extra header */ 50 unsigned xe: 1; /* Extra header */
51 uint16_t cc: 4; /* Contributing sources count */ 51 unsigned cc: 4; /* Contributing sources count */
52 52
53 uint16_t ma: 1; /* Marker */ 53 unsigned ma: 1; /* Marker */
54 uint16_t pt: 7; /* Payload type */ 54 unsigned pt: 7; /* Payload type */
55#endif 55#endif
56 56
57 uint16_t sequnum; 57 uint16_t sequnum;