From 745efab6c4ac0886c03a0387f669226d078b5386 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 19 Jan 2013 00:04:37 +0100 Subject: [PATCH] Force the LC_NUMERIC locale temporarily to C in finalize(), to avoid problems with locales messing with %f. --- effect_chain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/effect_chain.cpp b/effect_chain.cpp index 933553c..8767f7e 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -1307,6 +1308,10 @@ Node *EffectChain::find_output_node() void EffectChain::finalize() { + // Save the current locale, and set it to C, so that we can output decimal + // numbers with printf and be sure to get them in the format mandated by GLSL. + char *saved_locale = setlocale(LC_NUMERIC, "C"); + // Output the graph as it is before we do any conversions on it. output_dot("step0-start.dot"); @@ -1399,6 +1404,7 @@ void EffectChain::finalize() assert(phases[0]->inputs.empty()); finalized = true; + setlocale(LC_NUMERIC, saved_locale); } void EffectChain::render_to_fbo(GLuint dest_fbo, unsigned width, unsigned height) -- 2.39.2