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

Gert Wollny gert.wollny at collabora.com
Fri Jun 1 08:47:56 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: Warning: 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: Warning: unused parameter »ctx« [-Wunused-
parameter]
 static int vrend_transfer_send_readonly(struct vrend_context *ctx,
                                                               ^~~
vrend_renderer.c:5505:75: Warning: unused parameter »info« [-Wunused-
parameter]
                    const struct vrend_transfer_info *info)

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

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 98f84be..270f840 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -5142,7 +5142,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);
@@ -5164,7 +5164,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 {
@@ -5183,7 +5183,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
@@ -5391,7 +5391,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);
@@ -5460,13 +5461,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);
          }
       }
@@ -5504,10 +5505,12 @@ static int vrend_transfer_send_readonly(struct vrend_context *ctx,
                                         struct iovec *iov, int num_iovs,
                                         const struct vrend_transfer_info *info)
 {
+   VREND_UNUSED(ctx);
+   VREND_UNUSED(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.17.0



More information about the virglrenderer-devel mailing list