[virglrenderer-devel] [PATCH v2 09/21] vrend_renderer.c: fix warnings

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


vrend_renderer.c: in function »vrend_renderer_resource_create«:
vrend_renderer.c:4735:35: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
             for (level = 0; level <= args->last_level; level++) {
                                   ^~
vrend_renderer.c:4745:32: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
          for (level = 0; level <= args->last_level; level++) {
                                ^~
vrend_renderer.c:4756:32: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
          for (level = 0; level <= args->last_level; level++) {
                                ^~
vrend_renderer.c:4763:32: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
          for (level = 0; level <= args->last_level; level++) {
                                ^~
vrend_renderer.c: in function »read_transfer_data«:
vrend_renderer.c:4893:27: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
             for (h = 0; h < bh; h++) {
                           ^
vrend_renderer.c: in function »write_transfer_data«:
vrend_renderer.c:4936:24: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
          for (h = 0; h < bh; h++) {
                        ^
vrend_renderer.c: in function »check_transfer_bounds«:
vrend_renderer.c:4981:28: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
       if (info->box->depth > res->base.array_size)
                            ^
vrend_renderer.c:4983:24: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
       if (info->box->z > res->base.array_size)
                        ^
vrend_renderer.c:4985:43: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
       if (info->box->z + info->box->depth > res->base.array_size)

v2: Correct language of warnings 

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

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 0fb4181..90166df 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -4596,7 +4596,7 @@ static void vrend_create_buffer(struct vrend_resource *gr, uint32_t width)
 int vrend_renderer_resource_create(struct vrend_renderer_resource_create_args *args, struct iovec *iov, uint32_t num_iovs)
 {
    struct vrend_resource *gr;
-   int level;
+   uint32_t level;
    int ret;
 
    ret = check_resource_valid(args);
@@ -4865,7 +4865,7 @@ static void read_transfer_data(struct pipe_resource *res,
    uint32_t send_size = util_format_get_nblocks(res->format, box->width,
                                               box->height) * blsize * box->depth;
    uint32_t bwx = util_format_get_nblocksx(res->format, box->width) * blsize;
-   uint32_t bh = util_format_get_nblocksy(res->format, box->height);
+   int32_t bh = util_format_get_nblocksy(res->format, box->height);
    int d, h;
 
    if ((send_size == size || bh == 1) && !invert && box->depth == 1)
@@ -4908,7 +4908,7 @@ static void write_transfer_data(struct pipe_resource *res,
    uint32_t send_size = util_format_get_nblocks(res->format, box->width,
                                                 box->height) * blsize * box->depth;
    uint32_t bwx = util_format_get_nblocksx(res->format, box->width) * blsize;
-   uint32_t bh = util_format_get_nblocksy(res->format, box->height);
+   int32_t bh = util_format_get_nblocksy(res->format, box->height);
    int d, h;
    uint32_t stride = dst_stride ? dst_stride : util_format_get_nblocksx(res->format, u_minify(res->width0, level)) * blsize;
 
@@ -4971,11 +4971,11 @@ static bool check_transfer_bounds(struct vrend_resource *res,
       if (info->box->z + info->box->depth > ldepth)
          return false;
    } else {
-      if (info->box->depth > res->base.array_size)
+      if (info->box->depth > (int)res->base.array_size)
          return false;
-      if (info->box->z > res->base.array_size)
+      if (info->box->z > (int)res->base.array_size)
          return false;
-      if (info->box->z + info->box->depth > res->base.array_size)
+      if (info->box->z + info->box->depth > (int)res->base.array_size)
          return false;
    }
 
-- 
2.16.4



More information about the virglrenderer-devel mailing list