# HG changeset patch # User reimar # Date 1368096800 0 # Node ID d13733fdf7899a7d5ccbcd60cefed132f789d938 # Parent cb10031f4ead47ed29c53aeb9d8b7f46f9e303be Avoid using swab() This is the only place where it is used and it is not available universally (missing e.g. on Android). diff -r cb10031f4ead -r d13733fdf789 libmpcodecs/ad_hwac3.c --- a/libmpcodecs/ad_hwac3.c Thu May 09 10:53:18 2013 +0000 +++ b/libmpcodecs/ad_hwac3.c Thu May 09 10:53:20 2013 +0000 @@ -20,11 +20,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#define _XOPEN_SOURCE 600 #include #include #include -#include #include "config.h" #include "mp_msg.h" @@ -556,10 +554,16 @@ memcpy(&buf[8], indata_ptr, fsize); else { - swab(indata_ptr, &buf[8], fsize); + int i = fsize >> 1; + uint16_t *d = buf16 + 4; + uint8_t *s = indata_ptr; + while (i--) { + *d++ = HAVE_BIGENDIAN ? AV_RL16(s) : AV_RB16(s); + s += 2; + } if (fsize & 1) { - buf[8+fsize-1] = 0; - buf[8+fsize] = indata_ptr[fsize-1]; + // treat as if there was an additional 0 + *d++ = HAVE_BIGENDIAN ? *s : *s << 8; fsize++; } }