[flac-dev] GCC/clang compilation issues

Oliver Stöneberg oliverst at online.de
Sat Dec 6 05:51:58 PST 2014


Hi,

I finally got around to trying to update FLAC for the MAME/MESS 
project again. There were several issues I was able to fix and will 
submit patches later, but I hit one roadblock with GCC and clang:

src/lib/libflac/libFLAC/stream_encoder.c:1696:43: error: cast from function call
      of type 'double' to non-matching type 'FLAC__int32' (aka 'int')
      [-Werror,-Wbad-function-cast]
  ...FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+14, 0);
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/lib/libflac/libFLAC/stream_encoder.c:1717:43: error: cast from function call
      of type 'double' to non-matching type 'FLAC__int32' (aka 'int')
      [-Werror,-Wbad-function-cast]
  ...FLAC__int32 tukey_parts = (FLAC__int32)strtod(specification+15, 0);
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

Apparently you are supposed to round() or floor() instead of just 
casting a double to an integer. I have no idea what is the intention 
here, so an official fix is appreciated.

Thanks
Oliver


More information about the flac-dev mailing list