util: use standard name for snprintf()

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Eric Engestrom
2018-11-20 11:59:28 +00:00
parent 00e23cd969
commit dffeaa55dd
43 changed files with 125 additions and 126 deletions

View File

@@ -718,9 +718,8 @@ ir_builder_print_visitor::visit_leave(ir_call *ir)
const struct hash_entry *const he =
_mesa_hash_table_search(index_map, ir->return_deref);
util_snprintf(return_deref_string, sizeof(return_deref_string),
"operand(r%04X).val",
(unsigned)(uintptr_t) he->data);
snprintf(return_deref_string, sizeof(return_deref_string),
"operand(r%04X).val", (unsigned)(uintptr_t) he->data);
} else {
strcpy(return_deref_string, "NULL");
}

View File

@@ -167,31 +167,31 @@ void ir_print_visitor::visit(ir_variable *ir)
char binding[32] = {0};
if (ir->data.binding)
util_snprintf(binding, sizeof(binding), "binding=%i ", ir->data.binding);
snprintf(binding, sizeof(binding), "binding=%i ", ir->data.binding);
char loc[32] = {0};
if (ir->data.location != -1)
util_snprintf(loc, sizeof(loc), "location=%i ", ir->data.location);
snprintf(loc, sizeof(loc), "location=%i ", ir->data.location);
char component[32] = {0};
if (ir->data.explicit_component || ir->data.location_frac != 0)
util_snprintf(component, sizeof(component), "component=%i ",
snprintf(component, sizeof(component), "component=%i ",
ir->data.location_frac);
char stream[32] = {0};
if (ir->data.stream & (1u << 31)) {
if (ir->data.stream & ~(1u << 31)) {
util_snprintf(stream, sizeof(stream), "stream(%u,%u,%u,%u) ",
ir->data.stream & 3, (ir->data.stream >> 2) & 3,
(ir->data.stream >> 4) & 3, (ir->data.stream >> 6) & 3);
snprintf(stream, sizeof(stream), "stream(%u,%u,%u,%u) ",
ir->data.stream & 3, (ir->data.stream >> 2) & 3,
(ir->data.stream >> 4) & 3, (ir->data.stream >> 6) & 3);
}
} else if (ir->data.stream) {
util_snprintf(stream, sizeof(stream), "stream%u ", ir->data.stream);
snprintf(stream, sizeof(stream), "stream%u ", ir->data.stream);
}
char image_format[32] = {0};
if (ir->data.image_format) {
util_snprintf(image_format, sizeof(image_format), "format=%x ",
snprintf(image_format, sizeof(image_format), "format=%x ",
ir->data.image_format);
}

View File

@@ -239,7 +239,7 @@ public:
if (var->data.explicit_location &&
var->data.location >= VARYING_SLOT_VAR0) {
char location_str[11];
util_snprintf(location_str, 11, "%d", var->data.location);
snprintf(location_str, 11, "%d", var->data.location);
const struct hash_entry *entry =
_mesa_hash_table_search(ht, location_str);
@@ -265,7 +265,7 @@ public:
* unsigned location value which is overkill but future proof.
*/
char location_str[11];
util_snprintf(location_str, 11, "%d", var->data.location);
snprintf(location_str, 11, "%d", var->data.location);
_mesa_hash_table_insert(ht, ralloc_strdup(mem_ctx, location_str), var);
} else {
_mesa_hash_table_insert(ht,

View File

@@ -4204,8 +4204,8 @@ is_top_level_shader_storage_block_member(const char* name,
return false;
}
util_snprintf(full_instanced_name, name_length, "%s.%s",
interface_name, field_name);
snprintf(full_instanced_name, name_length, "%s.%s",
interface_name, field_name);
/* Check if its top-level shader storage block member of an
* instanced interface block, or of a unnamed interface block.

View File

@@ -323,14 +323,14 @@ public:
if (!(external_color_usage & (1 << i))) {
if (info->color[i]) {
util_snprintf(name, 32, "gl_%s_FrontColor%i_dummy", mode_str, i);
snprintf(name, 32, "gl_%s_FrontColor%i_dummy", mode_str, i);
this->new_color[i] =
new (ctx) ir_variable(glsl_type::vec4_type, name,
ir_var_temporary);
}
if (info->backcolor[i]) {
util_snprintf(name, 32, "gl_%s_BackColor%i_dummy", mode_str, i);
snprintf(name, 32, "gl_%s_BackColor%i_dummy", mode_str, i);
this->new_backcolor[i] =
new (ctx) ir_variable(glsl_type::vec4_type, name,
ir_var_temporary);
@@ -342,7 +342,7 @@ public:
info->fog) {
char name[32];
util_snprintf(name, 32, "gl_%s_FogFragCoord_dummy", mode_str);
snprintf(name, 32, "gl_%s_FogFragCoord_dummy", mode_str);
this->new_fog = new (ctx) ir_variable(glsl_type::float_type, name,
ir_var_temporary);
}
@@ -366,13 +366,13 @@ public:
if (!(external_usage & (1 << i))) {
/* This varying is unused in the next stage. Declare
* a temporary instead of an output. */
util_snprintf(name, 32, "gl_%s_%s%i_dummy", mode_str, var_name, i);
snprintf(name, 32, "gl_%s_%s%i_dummy", mode_str, var_name, i);
new_var[i] =
new (ctx) ir_variable(glsl_type::vec4_type, name,
ir_var_temporary);
}
else {
util_snprintf(name, 32, "gl_%s_%s%i", mode_str, var_name, i);
snprintf(name, 32, "gl_%s_%s%i", mode_str, var_name, i);
new_var[i] =
new(ctx) ir_variable(glsl_type::vec4_type, name,
this->info->mode);