From: Steinar H. Gunderson Date: Fri, 18 Jan 2013 23:04:37 +0000 (+0100) Subject: Force the LC_NUMERIC locale temporarily to C in finalize(), to avoid problems with... X-Git-Tag: 1.0~163 X-Git-Url: https://git.sesse.net/?p=movit;a=commitdiff_plain;h=745efab6c4ac0886c03a0387f669226d078b5386 Force the LC_NUMERIC locale temporarily to C in finalize(), to avoid problems with locales messing with %f. --- 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)