[Mplayer-cvslog] CVS: main/input input.c,1.50,1.51

Arpi of Ize arpi at mplayerhq.hu
Wed Oct 23 19:42:15 CEST 2002


Update of /cvsroot/mplayer/main/input
In directory mail:/var/tmp.root/cvs-serv23984/input

Modified Files:
	input.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 at altkom.com.pl>


Index: input.c
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- input.c	23 Oct 2002 14:46:19 -0000	1.50
+++ input.c	23 Oct 2002 17:42:12 -0000	1.51
@@ -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 @@
       break;
     case MP_CMD_ARG_FLOAT:
       errno = 0;
+      /* <olo at 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;




More information about the MPlayer-cvslog mailing list