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

Gert Wollny gert.wollny at collabora.com
Fri Jun 1 08:47:55 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)
                                           ^

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 dc00f68..98f84be 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -4603,7 +4603,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);
@@ -4872,7 +4872,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)
@@ -4915,7 +4915,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;
 
@@ -4978,11 +4978,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.17.0



More information about the virglrenderer-devel mailing list