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 <akihiko.odaki@gmail.com>
Part-of: <https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/726>
macos/master
Akihiko Odaki 2 years ago committed by Marge Bot
parent 1c0ec811ee
commit c0871ad319
  1. 4
      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;

Loading…
Cancel
Save