material-arbfp: Use locale-independent double to string conversion

The ARBfp programs are created with a printf() wrapper, which usually
fails in non-en locales as soon as you start throwing things like
floating point values in the mix.

We should use the g_ascii_dtostr() function which places a double into a
string buffer in a locale-independent way.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2219
This commit is contained in:
Emmanuele Bassi 2010-07-16 23:37:59 +01:00
parent 6f220399ae
commit 6983429e4a

View File

@ -525,18 +525,24 @@ setup_arg (CoglMaterial *material,
CoglMaterialLayer *authority =
_cogl_material_layer_get_authority (layer, state);
CoglMaterialLayerBigState *big_state = authority->big_state;
char buf[G_ASCII_DTOSTR_BUF_SIZE];
arg->type = COGL_MATERIAL_BACKEND_ARBFP_ARG_TYPE_CONSTANT;
arg->name = "constant%d";
arg->constant_id = priv->next_constant_id++;
g_string_append_printf (priv->source,
"PARAM constant%d = "
" {%f, %f, %f, %f};\n",
" {%s, %s, %s, %s};\n",
arg->constant_id,
big_state->texture_combine_constant[0],
big_state->texture_combine_constant[1],
big_state->texture_combine_constant[2],
big_state->texture_combine_constant[3]);
g_ascii_dtostr (buf, sizeof (buf),
big_state->texture_combine_constant[0]),
g_ascii_dtostr (buf, sizeof (buf),
big_state->texture_combine_constant[1]),
g_ascii_dtostr (buf, sizeof (buf),
big_state->texture_combine_constant[2]),
g_ascii_dtostr (buf, sizeof (buf),
big_state->texture_combine_constant[3]));
break;
}
case GL_PRIMARY_COLOR: