taglib/taglib — pull request #123 by rakuco (2013-04-08 18:17:16+00:00)
Title: Use more platform-independent byteswap functions.

The code introduced in a4e68a0 is not very cross-platform, and makes the
faulty assumption that byteswap.h is a GCC header, while it is actually a
glibc one. The immediate result is that the code did not compile on other
systems which used GCC anymore (BSDs and probably OS X/Windows too).

Fix this by doing this more portably:
- Instead of only implementing the byteSwap() functions for a few
selected little-endian systems, resort to always calling the
htobe{16,32,64} family of functions, which, although not part of POSIX,
are present on pretty much every system and just evaluate to null macros
on big-endian systems.
- Windows is the exception, as usual. For now, we just assume Windows is
always running on little-endian systems and we can thus just call its
_byteswap_{ushort,ulong,uint64} functions. This would not be possible on
other systems because we may end up erroneously swapping the bytes on
big-endian systems.