* Fix warnings about incorrect format specifiers.
GCC only wants to see void pointers for %p formatters, so cast as appropriate.
* Fix a warning about an invalid enum value.
The following warning was observed when compiling with -pedantic:
warning: ISO C restricts enumerator values to range of 'int' (2147483648 is too large)
The values of these enums don't escape wav_read_header() and are only used to set bits in a bitmask, so simply use the next bit rather than jumping to a huge number.
* Give anonymous unions a name.
This fixes the 'anonymous unions are a C11 extension' warning when compiling with -pedantic.
* Use flexible array members rather than zero sized arrays.
This flagged up the following warning when compiling with -pedantic:
warning: zero size arrays are an extension [-Wzero-length-array]
* Safely return the smallest value of a short.
GCC gives the following warning when compiling with -pedantic:
warning: overflow in conversion from 'int' to 'short int' changes value from '32768' to '-32768' [-Woverflow]
This looks intentional from the surrounding code, so return -32768 in a legal way rather than depending on undefined behaviour.
* Use the same min/max approach with all compilers.
The GCC specific code gives the following warning from GCC when compiled with -pedantic:
warning: ISO C forbids braced-groups within expressions [-pedantic]
This code was also a fundamentally different way of calculating min/max since it didn't evaluate the inputs more than once, which meant there was potentially a difference in behaviour when the library was built with different compilers if the evaluation of 'a' or 'b' had side effects.