Bug 91427

Summary: endianness portability
Product: libcanberra Reporter: Patrick Welche <prlw1>
Component: UnspecifiedAssignee: Lennart Poettering <lennart>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Patrick Welche 2015-07-22 11:18:16 UTC
I'm looking at this bit of code in src/oss.c:

        case CA_SAMPLE_S16RE:
#if __BYTE_ORDER == __LITTLE_ENDIAN
                val = AFMT_S16_BE;
#else
                val = AFMT_S16_LE;
#endif

To my untrained eye, using _BE in a little endian case and _LE in a big endian case seems odd. (Maybe add a comment to the code explaining why it should be that way around?)

The portability issue is the number of underscores in __LITTLE_ENDIAN. In configure.ac, you already have AC_C_BIGENDIAN, so why not test for WORDS_BIGENDIAN like you do in alsa.c instead?

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.