[virglrenderer-devel] [PATCH v2 10/21] vrend_renderer.c: Fix warnings

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


vrend_renderer.c: in function »vrend_renderer_transfer_write_iov«:
vrend_renderer.c:5145:65: warning: comparison between 
signed and unsigned integer expressions [-Wsign-compare]
          if (res->readback_fb_id == 0 ||
             res->readback_fb_level != info->level) {
                                    ^~
vrend_renderer.c:5167:86: Warnung: signed and unsigned type in
conditional expression [-Wsign-compare]
    glWindowPos2i(info->box->x, res->y_0_top ? res->base.height0 -
                   info->box->y : info->box->y);

vrend_renderer.c:5186:76: warning: signed and unsigned type in
conditional expression [-Wsign-compare]
     y = invert ? res->base.height0 - info->box->y - info->box-
                > height : info->box->y;

vrend_renderer.c: in function »vrend_transfer_send_readpixels«:
vrend_renderer.c:5394:59: warning: comparison between 
signed and unsigned integer expressions [-Wsign-
compare]
    if (res->readback_fb_id == 0 || res->readback_fb_level != info-
>level || res->readback_fb_z != info->box->z) {
                                                           ^~
vrend_renderer.c:5394:96: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
    if (res->readback_fb_id == 0 ||
        res->readback_fb_level != info->level ||
        res->readback_fb_z != info->box->z) {
                           ^~
vrend_renderer.c:5463:18: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
          if (imp != type) {
                  ^~
vrend_renderer.c:5469:18: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
          if (imp != format) {
                  ^~
vrend_renderer.c: in function »vrend_transfer_send_readonly«:
vrend_renderer.c:5510:22: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
    if (res->num_iovs == num_iovs) {
                      ^~
vrend_renderer.c:5511:21: warning: comparison between 
signed and unsigned integer expressions[-Wsign-compare]
       for (i = 0; i < res->num_iovs; i++) {
                     ^
vrend_renderer.c:5502:63: Warnung: unused parameter »ctx« [-Wunused-
parameter]
 static int vrend_transfer_send_readonly(struct vrend_context *ctx,
                                                               ^~~
vrend_renderer.c:5505:75: Warnung: unused parameter »info« [-Wunused-
parameter]
                    const struct vrend_transfer_info *info)
		    
v2: use mesa style UNUSED define for unused parameter annotation
    correct language in some warning messages 

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

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 90166df..2152279 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -5135,7 +5135,7 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
       if ((!vrend_state.use_core_profile) && (res->y_0_top)) {
          GLuint buffers;
 
-         if (res->readback_fb_id == 0 || res->readback_fb_level != info->level) {
+         if (res->readback_fb_id == 0 || (int)res->readback_fb_level != info->level) {
             GLuint fb_id;
             if (res->readback_fb_id)
                glDeleteFramebuffers(1, &res->readback_fb_id);
@@ -5157,7 +5157,7 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
          vrend_alpha_test_enable(ctx, false);
          vrend_stencil_test_enable(ctx, false);
          glPixelZoom(1.0f, res->y_0_top ? -1.0f : 1.0f);
-         glWindowPos2i(info->box->x, res->y_0_top ? res->base.height0 - info->box->y : info->box->y);
+         glWindowPos2i(info->box->x, res->y_0_top ? (int)res->base.height0 - info->box->y : info->box->y);
          glDrawPixels(info->box->width, info->box->height, glformat, gltype,
                       data);
       } else {
@@ -5176,7 +5176,7 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
          }
 
          x = info->box->x;
-         y = invert ? res->base.height0 - info->box->y - info->box->height : info->box->y;
+         y = invert ? (int)res->base.height0 - info->box->y - info->box->height : info->box->y;
 
          if (res->base.format == (enum pipe_format)VIRGL_FORMAT_Z24X8_UNORM) {
             /* we get values from the guest as 24-bit scaled integers
@@ -5384,7 +5384,8 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
       data = myptr;
    }
 
-   if (res->readback_fb_id == 0 || res->readback_fb_level != info->level || res->readback_fb_z != info->box->z) {
+   if (res->readback_fb_id == 0 || (int)res->readback_fb_level != info->level ||
+       (int)res->readback_fb_z != info->box->z) {
 
       if (res->readback_fb_id)
          glDeleteFramebuffers(1, &res->readback_fb_id);
@@ -5453,13 +5454,13 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
       if (type != GL_UNSIGNED_BYTE && type != GL_UNSIGNED_INT &&
           type != GL_INT && type != GL_FLOAT) {
          glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_TYPE, &imp);
-         if (imp != type) {
+         if (imp != (GLint)type) {
             fprintf(stderr, "GL_IMPLEMENTATION_COLOR_READ_TYPE is not expected native type 0x%x != imp 0x%x\n", type, imp);
          }
       }
       if (format != GL_RGBA && format != GL_RGBA_INTEGER) {
          glGetIntegerv(GL_IMPLEMENTATION_COLOR_READ_FORMAT, &imp);
-         if (imp != format) {
+         if (imp != (GLint)format) {
             fprintf(stderr, "GL_IMPLEMENTATION_COLOR_READ_FORMAT is not expected native format 0x%x != imp 0x%x\n", format, imp);
          }
       }
@@ -5492,15 +5493,15 @@ static int vrend_transfer_send_readpixels(struct vrend_context *ctx,
    return 0;
 }
 
-static int vrend_transfer_send_readonly(struct vrend_context *ctx,
+static int vrend_transfer_send_readonly(UNUSED struct vrend_context *ctx,
                                         struct vrend_resource *res,
                                         struct iovec *iov, int num_iovs,
-                                        const struct vrend_transfer_info *info)
+                                        UNUSED const struct vrend_transfer_info *info)
 {
    bool same_iov = true;
-   int i;
+   uint i;
 
-   if (res->num_iovs == num_iovs) {
+   if (res->num_iovs == (uint32_t)num_iovs) {
       for (i = 0; i < res->num_iovs; i++) {
          if (res->iov[i].iov_len != iov[i].iov_len ||
              res->iov[i].iov_base != iov[i].iov_base) {
-- 
2.16.4



More information about the virglrenderer-devel mailing list