diff options
author | Andres Gomez <agomez@igalia.com> | 2018-08-01 13:22:00 +0300 |
---|---|---|
committer | Andres Gomez <agomez@igalia.com> | 2018-08-02 10:06:44 +0300 |
commit | 9d220fa950850d751fbbbc2cd4ec24d024fcad70 (patch) | |
tree | 267eb39384acf8649af9f5d3a7bb296248be8ab5 /src/compiler/glsl_types.cpp | |
parent | 8fcdb71d8c9e6a0d9d9b70550bb764b654377714 (diff) |
glsl: use util_snprintf()
Instead of plain snprintf(). To fix the MSVC 2013 build.
Fixes: 6ff0c6f4ebc ("gallium: move ddebug, noop, rbug, trace to auxiliary to improve build times")
Cc: Marek Olšák <marek.olsak@amd.com>
Cc: Brian Paul <brianp@vmware.com>
Cc: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/compiler/glsl_types.cpp')
-rw-r--r-- | src/compiler/glsl_types.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index d11c365e191..ca5368aa53f 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -26,6 +26,7 @@ #include "compiler/glsl/glsl_parser_extras.h" #include "glsl_types.h" #include "util/hash_table.h" +#include "util/u_string.h" mtx_t glsl_type::hash_mutex = _MTX_INITIALIZER_NP; @@ -459,7 +460,7 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : char *const n = (char *) ralloc_size(this->mem_ctx, name_length); if (length == 0) - snprintf(n, name_length, "%s[]", array->name); + util_snprintf(n, name_length, "%s[]", array->name); else { /* insert outermost dimensions in the correct spot * otherwise the dimension order will be backwards @@ -467,11 +468,11 @@ glsl_type::glsl_type(const glsl_type *array, unsigned length) : const char *pos = strchr(array->name, '['); if (pos) { int idx = pos - array->name; - snprintf(n, idx+1, "%s", array->name); - snprintf(n + idx, name_length - idx, "[%u]%s", - length, array->name + idx); + util_snprintf(n, idx+1, "%s", array->name); + util_snprintf(n + idx, name_length - idx, "[%u]%s", + length, array->name + idx); } else { - snprintf(n, name_length, "%s[%u]", array->name, length); + util_snprintf(n, name_length, "%s[%u]", array->name, length); } } @@ -853,7 +854,7 @@ glsl_type::get_array_instance(const glsl_type *base, unsigned array_size) * named 'foo'. */ char key[128]; - snprintf(key, sizeof(key), "%p[%u]", (void *) base, array_size); + util_snprintf(key, sizeof(key), "%p[%u]", (void *) base, array_size); mtx_lock(&glsl_type::hash_mutex); |