From 15a500d3edb03668b43cc6898fafcda024d0f006 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 29 Feb 2012 13:34:55 +0100 Subject: xserver fontconfig mesa pixman git update 29 Feb 2012 --- mesalib/src/glsl/link_uniforms.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'mesalib/src/glsl/link_uniforms.cpp') diff --git a/mesalib/src/glsl/link_uniforms.cpp b/mesalib/src/glsl/link_uniforms.cpp index d51850c21..613c9b7ae 100644 --- a/mesalib/src/glsl/link_uniforms.cpp +++ b/mesalib/src/glsl/link_uniforms.cpp @@ -67,7 +67,7 @@ uniform_field_visitor::process(ir_variable *var) void uniform_field_visitor::recursion(const glsl_type *t, char **name, - unsigned name_length) + size_t name_length) { /* Records need to have each field processed individually. * @@ -78,22 +78,21 @@ uniform_field_visitor::recursion(const glsl_type *t, char **name, if (t->is_record()) { for (unsigned i = 0; i < t->length; i++) { const char *field = t->fields.structure[i].name; + size_t new_length = name_length; /* Append '.field' to the current uniform name. */ - ralloc_asprintf_rewrite_tail(name, name_length, ".%s", field); + ralloc_asprintf_rewrite_tail(name, &new_length, ".%s", field); - recursion(t->fields.structure[i].type, name, - name_length + 1 + strlen(field)); + recursion(t->fields.structure[i].type, name, new_length); } } else if (t->is_array() && t->fields.array->is_record()) { for (unsigned i = 0; i < t->length; i++) { - char subscript[13]; + size_t new_length = name_length; /* Append the subscript to the current uniform name */ - const unsigned subscript_length = snprintf(subscript, 13, "[%u]", i); - ralloc_asprintf_rewrite_tail(name, name_length, "%s", subscript); + ralloc_asprintf_rewrite_tail(name, &new_length, "[%u]", i); - recursion(t->fields.array, name, name_length + subscript_length); + recursion(t->fields.array, name, new_length); } } else { this->visit_field(t, *name); -- cgit v1.2.3