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

Author: Erik Faye-Lund <erik.faye-l...@collabora.com>
Date:   Tue Mar 24 10:58:14 2020 +0100

pipebuffer: clean up cast-warnings

This code produces warnings, so let's fix that. The problem is that
casting a pointer to an integer of non-pointer-size triggers warnings on
MSVC, and on 64-bit Windows unsigned long is 32-bit large.

So let's instead use uintptr_t, which is exactly for these kinds of
things.

While we're at it, let's make the resulting index a plain "unsigned",
which is the type this originated from before we started with this
cast-dance.

Fixes: 1a66ead1c75 ("pipebuffer, winsys/svga: Add functionality to update 
pb_validate_entry flags")
Reviewed-by: Brian Paul <bri...@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4297>

---

 src/gallium/auxiliary/pipebuffer/pb_validate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.c 
b/src/gallium/auxiliary/pipebuffer/pb_validate.c
index 404bdfcec51..8d36148d3a7 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_validate.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_validate.c
@@ -78,7 +78,7 @@ pb_validate_add_buffer(struct pb_validate *vl,
    flags &= PB_USAGE_GPU_READ_WRITE;
 
    if (ht) {
-      unsigned long entry_idx = (unsigned long) util_hash_table_get(ht, buf);
+      unsigned entry_idx = (unsigned)(uintptr_t)util_hash_table_get(ht, buf);
 
       if (entry_idx) {
          struct pb_validate_entry *entry = &vl->entries[entry_idx - 1];
@@ -118,7 +118,7 @@ pb_validate_add_buffer(struct pb_validate *vl,
    ++vl->used;
 
    if (ht)
-      _mesa_hash_table_insert(ht, buf, (void *) (unsigned long) vl->used);
+      _mesa_hash_table_insert(ht, buf, (void *) (uintptr_t) vl->used);
 
    return PIPE_OK;
 }

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to