[Mesa-dev] [PATCH] glsl: there is no need to check for < 0
Christian Gmeiner
christian.gmeiner at gmail.com
Fri Jan 20 22:20:24 UTC 2017
size_t is defined in the C Standard section 4.1.5 as an
'unsigned integral type'.
Fixes the following clang compile warning:
glsl/blob.c:110:15: warning: comparison of unsigned expression < 0 is
always false [-Wtautological-compare]
if (offset < 0 || blob->size - offset < to_write)
~~~~~~ ^ ~
Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
src/compiler/glsl/blob.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/glsl/blob.c b/src/compiler/glsl/blob.c
index dd4341b..ef17255 100644
--- a/src/compiler/glsl/blob.c
+++ b/src/compiler/glsl/blob.c
@@ -107,7 +107,7 @@ blob_overwrite_bytes(struct blob *blob,
size_t to_write)
{
/* Detect an attempt to overwrite data out of bounds. */
- if (offset < 0 || blob->size - offset < to_write)
+ if (blob->size - offset < to_write)
return false;
memcpy(blob->data + offset, bytes, to_write);
--
2.9.3
More information about the mesa-dev
mailing list