laforge has submitted this change. ( https://gerrit.osmocom.org/c/gapk/+/31389 )
Change subject: Run struct_endianness.py ......................................................................
Run struct_endianness.py
Use the OSMO_IS_LITTLE_ENDIAN / OSMO_IS_BIG_ENDIAN macros from libosmocore and run struct_endianness.py to auto-generate the big endian part.
Related: OS#5884 Change-Id: Ibeb96f61054b11ca9d82f8d9a00c3935ffb086a6 --- M src/pq_rtp.c 1 file changed, 20 insertions(+), 18 deletions(-)
Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved
diff --git a/src/pq_rtp.c b/src/pq_rtp.c index 3a09ba7..a5543a6 100644 --- a/src/pq_rtp.c +++ b/src/pq_rtp.c @@ -30,33 +30,21 @@ #include <osmocom/gapk/codecs.h> #include <osmocom/gapk/formats.h> #include <osmocom/gapk/procqueue.h> - -#ifndef __BYTE_ORDER -# ifdef __APPLE__ -# define __BYTE_ORDER __DARWIN_BYTE_ORDER -# define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN -# define __BIG_ENDIAN __DARWIN_BIG_ENDIAN -# else -# error "__BYTE_ORDER should be defined by someone" -# endif -#endif +#include <osmocom/core/endian.h>
/* according to RFC 3550 */ struct rtp_hdr { -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if OSMO_IS_LITTLE_ENDIAN uint8_t csrc_count:4, extension:1, padding:1, version:2; uint8_t payload_type:7, marker:1; -#elif __BYTE_ORDER == __BIG_ENDIAN - uint8_t version:2, - padding:1, - extension:1, - csrc_count:4; - uint8_t marker:1, - payload_type:7; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */ + uint8_t version:2, padding:1, extension:1, csrc_count:4; + uint8_t marker:1, payload_type:7; #endif uint16_t sequence; uint32_t timestamp;