Check the return value of fread

This silences warnings on linux/gcc.
Add a cast when converting from double to float

This fixes warnings with MSVC.
Merge pull request #1511 from mstorsjo/check-fread-return-value

Check the return value of fread
Merge pull request #1512 from mstorsjo/add-float-cast

Add a cast when converting from double to float