# HG changeset patch # User atmos4 # Date 1033883652 0 # Node ID 411886c03c545e8d07d58950b242aab4758898d6 # Parent 876495f714dca43460c05e22fb48bd9c4dac4c34 strtod is locale-dependant, so it may only accept either '.' or ',' as decimal point, we do now make sure both works by providing a fallback. If anyone knows a better/simpler algorithmn than I used, feel free to improve. diff -r 876495f714dc -r 411886c03c54 cfgparser.c --- a/cfgparser.c Sun Oct 06 02:59:04 2002 +0000 +++ b/cfgparser.c Sun Oct 06 05:54:12 2002 +0000 @@ -15,6 +15,7 @@ #include #include #include +#include #include "config.h" #include "mp_msg.h" @@ -552,8 +553,22 @@ tmp_float = strtod(param, &endptr); - if ((*endptr == ':') || (*endptr == '/')) + switch(*endptr) { + case ':': + case '/': tmp_float /= strtod(endptr+1, &endptr); + break; + case '.': + case ',': + /* we also handle floats specified with + * non-locale decimal point ::atmos + */ + if(tmp_float<0) + tmp_float -= 1.0/pow(10,strlen(endptr+1)) * strtod(endptr+1, &endptr); + else + tmp_float += 1.0/pow(10,strlen(endptr+1)) * strtod(endptr+1, &endptr); + break; + } if (*endptr) { mp_msg(MSGT_CFGPARSER, MSGL_ERR, "parameter must be a floating point number"