summarylogtreecommitdiffstats
path: root/vo_gl_locale_fix.patch
blob: 2e6a4bea68986fd8e13b9fffe31da5bf540161ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
The generated output may use something other than "." for decimal
point, which GLSL requires. This is caused by locale. C uses ".", 
so locale is temporaily set to "C" when sprinting floats. 
diff -Naur libvo/gl_common.c-orig mplayer2/libvo/gl_common.c
--- libvo/gl_common.c.orig	2014-02-24 21:57:13.493418840 +0100
+++ libvo/gl_common.c	2014-02-24 22:00:25.136048921 +0100
@@ -39,6 +39,7 @@
 #include <ctype.h>
 #include <stdbool.h>
 #include <math.h>
+#include <locale.h>
 #include "talloc.h"
 #include "gl_common.h"
 #include "old_vo_wrapper.h"
@@ -823,7 +824,10 @@
 
 static void replace_var_float(char **text, const char *name, float replace)
 {
+    char *tmp = setlocale(LC_NUMERIC, NULL);
+    setlocale(LC_NUMERIC, "C");
     char *s = talloc_asprintf(NULL, "%e", replace);
+    setlocale(LC_NUMERIC, tmp);
     replace_var_str(text, name, s);
     talloc_free(s);
 }