[virglrenderer-devel] [PATCH 05/16] gallium/aux/tgsi/tgsi_parse.c: Fix warnings
Gert Wollny
gert.wollny at collabora.com
Thu May 31 09:15:37 UTC 2018
tgsi_parse.c: In function 'tgsi_parse_free':
tgsi_parse.c:54:31: warning: unused parameter 'ctx' [-Wunused-parameter]
struct tgsi_parse_context *ctx )
^~~
tgsi_parse.c: In function 'tgsi_parse_end_of_tokens':
tgsi_parse.c:62:25: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
return ctx->Position >=
Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
src/gallium/auxiliary/tgsi/tgsi_parse.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c
index 8891153..95d1616 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_parse.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c
@@ -53,14 +53,19 @@ void
tgsi_parse_free(
struct tgsi_parse_context *ctx )
{
+ VREND_UNUSED(ctx);
}
boolean
tgsi_parse_end_of_tokens(
struct tgsi_parse_context *ctx )
{
- return ctx->Position >=
- ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize;
+ /* All values involved are unsigned, but the sum will be promoted to
+ * a signed value (at least on 64 bit). To capture a possible overflow
+ * make it a signed comparison.
+ */
+ return (int)ctx->Position >=
+ ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize;
}
--
2.16.1
More information about the virglrenderer-devel
mailing list