CVS: main cfgparser.c,1.57,1.58
Update of /cvsroot/mplayer/main In directory mail:/var/tmp.root/cvs-serv23984 Modified Files: cfgparser.c Log Message: Fixed a bug in MPlayer which would prevent proper parsing of some floating point options when the locale used has a decimal point other than the dot character ("."). My patch inserts calls to setlocale around float parsing functions strtod() and atof() in cfgparser.c and input/input.c. patch by Aleksander Adamowski <olo@altkom.com.pl> Index: cfgparser.c =================================================================== RCS file: /cvsroot/mplayer/main/cfgparser.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- cfgparser.c 6 Oct 2002 05:54:12 -0000 1.57 +++ cfgparser.c 23 Oct 2002 17:42:11 -0000 1.58 @@ -16,6 +16,11 @@ #include <string.h> #include <errno.h> #include <math.h> + +#ifdef USE_SETLOCALE +#include <locale.h> +#endif + #include "config.h" #include "mp_msg.h" @@ -550,25 +555,22 @@ case CONF_TYPE_FLOAT: if (param == NULL) goto err_missing_param; - + /* <olo@altkom.com.pl> Use portable C locale for parsing floats: */ +#ifdef USE_SETLOCALE + setlocale(LC_NUMERIC, "C"); +#endif tmp_float = strtod(param, &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); + default: break; } +#ifdef USE_SETLOCALE + setlocale(LC_NUMERIC, ""); +#endif if (*endptr) { mp_msg(MSGT_CFGPARSER, MSGL_ERR, "parameter must be a floating point number"
participants (1)
-
Arpi of Ize