summaryrefslogtreecommitdiffstats
path: root/input/input.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-23 17:42:12 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-10-23 17:42:12 +0000
commit4aeac332f6ed5c0be1a1664903bf7794c1226b1c (patch)
treeeb61ed6fe05a2f370330867fee7d288e43036ab5 /input/input.c
parent57f9f8fa14ba1c8b731a627153ab565fcfa816d5 (diff)
downloadmpv-4aeac332f6ed5c0be1a1664903bf7794c1226b1c.tar.bz2
mpv-4aeac332f6ed5c0be1a1664903bf7794c1226b1c.tar.xz
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> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7871 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'input/input.c')
-rw-r--r--input/input.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/input/input.c b/input/input.c
index 66484fa20f..e12316c04d 100644
--- a/input/input.c
+++ b/input/input.c
@@ -12,6 +12,10 @@
#include <fcntl.h>
#include <ctype.h>
+#ifdef USE_SETLOCALE
+#include <locale.h>
+#endif
+
#include "input.h"
#include "mouse.h"
#ifdef MP_DEBUG
@@ -470,7 +474,14 @@ mp_input_parse_cmd(char* str) {
break;
case MP_CMD_ARG_FLOAT:
errno = 0;
+ /* <olo@altkom.com.pl> Use portable C locale for parsing floats: */
+#ifdef USE_SETLOCALE
+ setlocale(LC_NUMERIC, "C");
+#endif
cmd->args[i].v.f = atof(ptr);
+#ifdef USE_SETLOCALE
+ setlocale(LC_NUMERIC, "");
+#endif
if(errno != 0) {
mp_msg(MSGT_INPUT,MSGL_ERR,"Command %s : argument %d isn't a float\n",cmd_def->name,i+1);
ptr = NULL;