summaryrefslogtreecommitdiff
path: root/hw/xfree86/dri
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2009-10-08 13:38:44 +1100
committerDaniel Stone <daniel@fooishbar.org>2009-10-08 13:38:44 +1100
commitb0dd6be2c8703f7062d45ac9fd646550c7d54e3b (patch)
tree98c7ac7a8d90fea6fcdd44525fc42e84d0cb4914 /hw/xfree86/dri
parentb680a89262efcfef4644adb4a61ae42ea0db0c93 (diff)
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>
Diffstat (limited to 'hw/xfree86/dri')
-rw-r--r--hw/xfree86/dri/dri.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index faddfe6ec..0de9be621 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1277,7 +1277,7 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable,
/* track this in case the client dies */
AddResource(FakeClientID(client->index), DRIDrawablePrivResType,
- (pointer)pDrawable->id);
+ (pointer)(intptr_t)pDrawable->id);
if (pDRIDrawablePriv->hwDrawable) {
drmUpdateDrawableInfo(pDRIPriv->drmFD,
@@ -1348,7 +1348,7 @@ DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable)
if (pDrawable->type == DRAWABLE_WINDOW) {
LookupClientResourceComplex(client, DRIDrawablePrivResType,
DRIDestroyDrawableCB,
- (pointer)pDrawable->id);
+ (pointer)(intptr_t)pDrawable->id);
}
else { /* pixmap (or for GLX 1.3, a PBuffer) */
/* NOT_DONE */
@@ -1364,7 +1364,9 @@ DRIDrawablePrivDelete(pointer pResource, XID id)
WindowPtr pWin;
int rc;
- id = (XID)pResource;
+ /* For DRIDrawablePrivResType, the XID is the client's fake ID. The
+ * important XID is the value in pResource. */
+ id = (XID)(intptr_t)pResource;
rc = dixLookupWindow(&pWin, id, serverClient, DixGetAttrAccess);
if (rc == Success) {