raysan5/raylib — pull request #3 by debiatan (2014-11-09 07:46:37+00:00)
Title: Fixed WAV loading under 64-bit systems.

Hi!

The size of the long integer type varies across operating systems and compilers. On windows, both the 32-bit and the 64-bit of Microsoft Visual C++ and MinGW use 4 bytes for integers as well as for long integers, while GCC on a 64-bit linux system makes them 8-byte long. That difference **breaks the recognition of WAV file headers** in `src/audio.c` under 64-bit linuces, triggering an `Invalid RIFF or WAVE Header` error.

To ensure compatibility in the recognition of the WAV header, it is preferable to stick to plain integers, which take four bytes under all target systems. That way, both MinGW and GCC behave the same way, regardless of the underlying OS.

Just so you can double check my reasoning, here's a [short article](https://software.intel.com/en-us/articles/size-of-long-integer-type-on-different-architecture-and-os) detailing Intel's thoughts on the issue. They have their own C compiler that must remain compatible to the dominant compiler of any given platform (Visual C++ for windows, GCC for linux and macosx). MinGW [shares those concerns](http://sourceforge.net/p/mingw-w64/discussion/723798/thread/134f7720), so the same reasoning applies.

Thanks and keep up the good work!