Mesa (master): st/mesa: fix wrong comparison in update_framebuffer_state()

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Thu Apr 13 08:06:58 UTC 2017


Module: Mesa
Branch: master
Commit: b6b566b48e0240c1be9b3fd5ff1bb227a40f9260
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b6b566b48e0240c1be9b3fd5ff1bb227a40f9260

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Tue Apr 11 14:19:19 2017 +0200

st/mesa: fix wrong comparison in update_framebuffer_state()

state_tracker/st_atom_framebuffer.c:208:27: warning: comparison of constant 4294967295 with expression of type 'uint16_t' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
   if (framebuffer->width == UINT_MAX)
       ~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~
state_tracker/st_atom_framebuffer.c:210:28: warning: comparison of constant 4294967295 with expression of type 'uint16_t' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
   if (framebuffer->height == UINT_MAX)
       ~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~
2 warnings generated.

Fixes: eb0fd0e5f86 ("gallium: decrease the size of pipe_framebuffer_state - 96 -> 80 bytes")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/mesa/state_tracker/st_atom_framebuffer.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index ea41d9dcd7..7435c00a4f 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -59,8 +59,8 @@ update_framebuffer_size(struct pipe_framebuffer_state *framebuffer,
                         struct pipe_surface *surface)
 {
    assert(surface);
-   assert(surface->width  < UINT_MAX);
-   assert(surface->height < UINT_MAX);
+   assert(surface->width  < USHRT_MAX);
+   assert(surface->height < USHRT_MAX);
    framebuffer->width  = MIN2(framebuffer->width,  surface->width);
    framebuffer->height = MIN2(framebuffer->height, surface->height);
 }
@@ -205,9 +205,9 @@ update_framebuffer_state( struct st_context *st )
    }
 #endif
 
-   if (framebuffer->width == UINT_MAX)
+   if (framebuffer->width == USHRT_MAX)
       framebuffer->width = 0;
-   if (framebuffer->height == UINT_MAX)
+   if (framebuffer->height == USHRT_MAX)
       framebuffer->height = 0;
 
    cso_set_framebuffer(st->cso_context, framebuffer);




More information about the mesa-commit mailing list