[flac-dev] make fullcheck fails: strtod/atof and locale

lvqcl lvqcl.mail at gmail.com
Wed Apr 30 09:01:26 PDT 2014


make fullcheck fails on my computer: flac cannot recognize --skip option
that contains decimal point, e.g. "--skip=1.234".

System locale uses comma as a separator, so strtod/atof expect comma, not point,
and "make fullcheck" fails.



Here's what I can see in FLAC source code:


atof() function found in:

file: src/share/grabbag/seektable.c
function: grabbag__seektable_convert_specification_to_template()
(option: -S)


strtod() function found in:

src/flac/main.c
parse_option()
(--apply-replaygain-which-is-not-lossless)

src/flac/utils.c
local__parse_timecode_() <= flac__utils_parse_skip_until_specification()
(--skip, --until)

src/libFLAC/stream_encoder.c
FLAC__stream_encoder_set_apodization()
(-A gauss, -A tukey)

src/share/grabbag/cuesheet.c
local__parse_ms_() <= local__cuesheet_parse_() <= grabbag__cuesheet_parse()

src/share/grabbag/replaygain.c
parse_double_() <= grabbag__replaygain_load_from_vorbiscomment()


*** comments ***

1) local__parse_ms_() have strspn(s, "0123456789.") so decimal comma is not allowed in cuesheets

2) local__parse_timecode_() have strspn(s, "1234567890.,") so comma is allowed in --skip and --until options

3) grabbag__replaygain_load_from_vorbiscomment() uses the following sequence:
         setlocale(LC_ALL, "C"); use printf/strtod; setlocale(LC_ALL, saved_locale);
  so RG tags always have decimal point

4) flac and metaflac: main() calls setlocale(LC_ALL, "") which sets default system locale

5) Probably it's better to use local version of strtod() that accepts both comma and point
as separators (just as FLAC uses local_strdup or flac_snprintf).


More information about the flac-dev mailing list