From c0871ad3195c7c36e970daa30406b9633f13cd91 Mon Sep 17 00:00:00 2001 From: Akihiko Odaki Date: Sat, 5 Mar 2022 11:08:55 +0900 Subject: [PATCH] Fix the source integer type of casts to pointers Converting from valid pointer to void to intptr_t and uintptr_t, and then converting back to pointer to void will result in a pointer which compares equal to the original pointer. Using another integer type as intermediate would result in an implementation-defined behavior. Especially using unsigned long for the purpose is problematic for LLP64 model like Windows. Signed-off-by: Akihiko Odaki Part-of: --- src/vrend_blitter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c index fa3de76..060a793 100644 --- a/src/vrend_blitter.c +++ b/src/vrend_blitter.c @@ -369,7 +369,7 @@ static GLuint blit_get_frag_tex_writedepth(struct vrend_blitter_ctx *blit_ctx, i return 0; glDeleteShader(fs_id); - util_hash_table_set(blit_ctx->blit_programs, &key, (void *)(size_t)prog_id); + util_hash_table_set(blit_ctx->blit_programs, &key, (void *)(uintptr_t)prog_id); } return prog_id; } @@ -422,7 +422,7 @@ static GLuint blit_get_frag_tex_col(struct vrend_blitter_ctx *blit_ctx, return 0; glDeleteShader(fs_id); - util_hash_table_set(blit_ctx->blit_programs, &key, (void *)(size_t)prog_id); + util_hash_table_set(blit_ctx->blit_programs, &key, (void *)(uintptr_t)prog_id); } return prog_id;