aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/link_uniforms.cpp
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-29 13:34:55 +0100
committermarha <marha@users.sourceforge.net>2012-02-29 13:34:55 +0100
commit15a500d3edb03668b43cc6898fafcda024d0f006 (patch)
tree5bdb867e749ea1f56b9c480d195027e38a0bbab2 /mesalib/src/glsl/link_uniforms.cpp
parentc4f44c07c6662d1ce08603945ccc4fa5afaa742a (diff)
downloadvcxsrv-15a500d3edb03668b43cc6898fafcda024d0f006.tar.gz
vcxsrv-15a500d3edb03668b43cc6898fafcda024d0f006.tar.bz2
vcxsrv-15a500d3edb03668b43cc6898fafcda024d0f006.zip
xserver fontconfig mesa pixman git update 29 Feb 2012
Diffstat (limited to 'mesalib/src/glsl/link_uniforms.cpp')
-rw-r--r--mesalib/src/glsl/link_uniforms.cpp15
1 files changed, 7 insertions, 8 deletions
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);