mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
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:1a66ead1c7("pipebuffer, winsys/svga: Add functionality to update pb_validate_entry flags") Reviewed-by: Brian Paul <brianp@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4297> (cherry picked from commit079cb4949d)
This commit is contained in:
parent
3facfb3435
commit
243cc87032
2 changed files with 3 additions and 3 deletions
|
|
@ -949,7 +949,7 @@
|
|||
"description": "pipebuffer: clean up cast-warnings",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"master_sha": null,
|
||||
"because_sha": "1a66ead1c75246224bf43e82a07b4fdb2891959a"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
util_hash_table_set(ht, buf, (void *) (unsigned long) vl->used);
|
||||
util_hash_table_set(ht, buf, (void *) (uintptr_t) vl->used);
|
||||
|
||||
return PIPE_OK;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue