From b505d9c830755a4008d56c515629b42d26450b67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Sun, 23 Dec 2018 11:40:18 +0100 Subject: [PATCH] a2dp-codecs: Add needed includes and properly check for endian macros Without stdint.h type uint8_t cannot be used. And without endian.h macros __BYTE_ORDER, __LITTLE_ENDIAN and __BIG_ENDIAN are not defined. When both __BYTE_ORDER and __LITTLE_ENDIAN macros are not defined, then condition #if __BYTE_ORDER == __LITTLE_ENDIAN is true. Change-Id: I8e583cbf8c2f05cb5c2980301d383904b3e42020 Signed-off-by: himanshu --- profiles/audio/a2dp-codecs.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/profiles/audio/a2dp-codecs.h b/profiles/audio/a2dp-codecs.h index a310efe..649e241 100755 --- a/profiles/audio/a2dp-codecs.h +++ b/profiles/audio/a2dp-codecs.h @@ -22,6 +22,9 @@ * */ +#include +#include + #define A2DP_CODEC_SBC 0x00 #define A2DP_CODEC_MPEG12 0x01 #define A2DP_CODEC_MPEG24 0x02 @@ -222,7 +225,8 @@ typedef struct { .codec_id1 = (((c) >> 8) & 0xff), \ }) -#if __BYTE_ORDER == __LITTLE_ENDIAN +#if defined(__BYTE_ORDER) && defined(__LITTLE_ENDIAN) && \ + __BYTE_ORDER == __LITTLE_ENDIAN typedef struct { uint8_t channel_mode:4; @@ -269,7 +273,8 @@ typedef struct { uint8_t unknown[2]; } __attribute__ ((packed)) a2dp_ldac_t; -#elif __BYTE_ORDER == __BIG_ENDIAN +#elif defined(__BYTE_ORDER) && defined(__BIG_ENDIAN) && \ + __BYTE_ORDER == __BIG_ENDIAN typedef struct { uint8_t frequency:4; -- 2.7.4