[virglrenderer-devel] [PATCH v2 15/21] vrend_decode.c: Fix warnings

Gert Wollny gert.wollny at collabora.com
Tue Jun 5 20:11:12 UTC 2018


vrend_decode.c: In function »vrend_decode_create_shader«:
vrend_decode.c:92:24: warning: comparison between signed and
    unsigned integer expressions  [-Wsign-compare]
          for (i = 0; i < so_info.num_outputs; i++) {
                        ^
vrend_decode.c: In function »vrend_decode_set_framebuffer_state«:
vrend_decode.c:139:15: warning: comparison between signed and
    unsigned integer expressions  [-Wsign-compare]
    if (length != (2 + nr_cbufs))
               ^~
vrend_decode.c:145:18: warning: comparison between signed and
    unsigned integer expressions  [-Wsign-compare]
    for (i = 0; i < nr_cbufs; i++)
                  ^
vrend_decode.c: In function »vrend_decode_set_viewport_state«:
vrend_decode.c:195:18: warning: comparison between signed and
    unsigned integer expressions  [-Wsign-compare]
    for (v = 0; v < num_viewports; v++) {
                  ^
vrend_decode.c: In function »vrend_decode_set_sampler_views«:
vrend_decode.c:296:19: warning: comparison between signed and
    unsigned integer expressions  [-Wsign-compare]
        start_slot > (PIPE_MAX_SHADER_SAMPLER_VIEWS - num_samps))
                   ^
vrend_decode.c: In function »vrend_decode_set_scissor_state«:
vrend_decode.c:810:18: warning: comparison between signed and
    unsigned integer expressions  [-Wsign-compare]
    for (s = 0; s < num_scissor; s++) {
                  ^
vrend_decode.c: In function »vrend_decode_set_streamout_targets«:
vrend_decode.c:1064:18: warning: comparison between signed and
    unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < num_handles; i++)

v2: correct language of warnung messages

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
---
 src/vrend_decode.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/vrend_decode.c b/src/vrend_decode.c
index 1e31573..c7cfd3f 100644
--- a/src/vrend_decode.c
+++ b/src/vrend_decode.c
@@ -66,7 +66,8 @@ static int vrend_decode_create_shader(struct vrend_decode_ctx *ctx,
                                       uint16_t length)
 {
    struct pipe_stream_output_info so_info;
-   int i, ret;
+   uint i;
+   int ret;
    uint32_t shader_offset;
    unsigned num_tokens, num_so_outputs, offlen;
    uint8_t *shd_text;
@@ -131,7 +132,7 @@ static int vrend_decode_set_framebuffer_state(struct vrend_decode_ctx *ctx, int
    if (length < 2)
       return EINVAL;
 
-   uint32_t nr_cbufs = get_buf_entry(ctx, VIRGL_SET_FRAMEBUFFER_STATE_NR_CBUFS);
+   int32_t nr_cbufs = get_buf_entry(ctx, VIRGL_SET_FRAMEBUFFER_STATE_NR_CBUFS);
    uint32_t zsurf_handle = get_buf_entry(ctx, VIRGL_SET_FRAMEBUFFER_STATE_NR_ZSURF_HANDLE);
    uint32_t surf_handle[8];
    int i;
@@ -177,7 +178,7 @@ static float uif(unsigned int ui)
 static int vrend_decode_set_viewport_state(struct vrend_decode_ctx *ctx, int length)
 {
    struct pipe_viewport_state vps[PIPE_MAX_VIEWPORTS];
-   int i, v;
+   uint i, v;
    uint32_t num_viewports, start_slot;
    if (length < 1)
       return EINVAL;
@@ -281,7 +282,8 @@ static int vrend_decode_set_sampler_views(struct vrend_decode_ctx *ctx, uint16_t
 {
    int num_samps;
    int i;
-   uint32_t shader_type, start_slot;
+   uint32_t shader_type;
+   int32_t start_slot;
 
    if (length < 2)
       return EINVAL;
@@ -793,7 +795,8 @@ static int vrend_decode_set_scissor_state(struct vrend_decode_ctx *ctx, int leng
 {
    struct pipe_scissor_state ss[PIPE_MAX_VIEWPORTS];
    uint32_t temp;
-   uint32_t num_scissor, start_slot;
+   int32_t num_scissor;
+   uint32_t start_slot;
    int s;
    if (length < 1)
       return EINVAL;
@@ -1053,7 +1056,7 @@ static int vrend_decode_set_streamout_targets(struct vrend_decode_ctx *ctx,
    uint32_t handles[16];
    uint32_t num_handles = length - 1;
    uint32_t append_bitmask;
-   int i;
+   uint i;
 
    if (length < 1)
       return EINVAL;
-- 
2.16.4



More information about the virglrenderer-devel mailing list