Cast small-int values through intptr_t when passed as pointers

On 64-bit systems, int and pointers don't have the same size, so GCC gives
warnings about casts between int and pointer types. However, in the cases
covered by this patch, it's always a value that fits in int being stored
temporarily as a pointer and then converted back later, which is safe.
Casting through the pointer-sized integer type intptr_t convinces the
compiler that this is OK.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Jamey Sharp 2009-10-08 13:38:44 +11:00 • committed by Daniel Stone
commit b0dd6be2c8
6 changed files with 14 additions and 12 deletions

View file

@ -99,7 +99,7 @@ static Bool
compRepaintBorder (ClientPtr pClient, pointer closure)
{
WindowPtr pWindow;
int rc = dixLookupWindow(&pWindow, (XID)closure, pClient, DixWriteAccess);
int rc = dixLookupWindow(&pWindow, (XID)(intptr_t)closure, pClient, DixWriteAccess);
if (rc == Success) {
RegionRec exposed;
@ -130,7 +130,7 @@ compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
SetBorderSize (pWindow);
if (HasBorder (pWindow))
QueueWorkProc (compRepaintBorder, serverClient,
(pointer) pWindow->drawable.id);
(pointer)(intptr_t) pWindow->drawable.id);
return WT_WALKCHILDREN;
}