summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cfgparser.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/cfgparser.c b/cfgparser.c
index 89b54e6aa8..e3c783e16e 100644
--- a/cfgparser.c
+++ b/cfgparser.c
@@ -15,6 +15,7 @@
#include <fcntl.h>
#include <string.h>
#include <errno.h>
+#include <math.h>
#include "config.h"
#include "mp_msg.h"
@@ -552,8 +553,22 @@ static int config_read_option(m_config_t *config,config_t** conf_list, char *opt
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"