Tomas Carnecky wrote: > By first casting to long and then to the final type. Of course > this assumes that sizeof(long) == sizeof(void *). If the Win32 On this page: http://www.viva64.com/content/articles/64-bit-development/?f=20_issues_of_porting_C++_code_on_the_64-bit_platform.html&lang=en&content=64-bit-development#IDALZBTD
they explain that indeed there are memory models where this doesn't hold. +1 for uintptr_t > folks care enough about warnings, we could make macros for this. > > Signed-off-by: Tomas Carnecky <[email protected]> > --- > > Let's suppose macros would be preferred, into which header > should they go? Into include/os.h? include/misc.h? > > composite/compwindow.c | 4 ++-- > glx/glxcmds.c | 2 +- > hw/xfree86/dri/dri.c | 8 ++++---- > hw/xfree86/os-support/bus/linuxPci.c | 2 +- > hw/xfree86/os-support/linux/lnx_agp.c | 2 +- > mi/miscrinit.c | 2 +- > 6 files changed, 10 insertions(+), 10 deletions(-) > > diff --git a/composite/compwindow.c b/composite/compwindow.c > index 577fa73..efad534 100644 > --- a/composite/compwindow.c > +++ b/composite/compwindow.c > @@ -92,7 +92,7 @@ static Bool > compRepaintBorder (ClientPtr pClient, pointer closure) > { > WindowPtr pWindow; > - int rc = dixLookupWindow(&pWindow, (XID)closure, pClient, > DixWriteAccess); > + int rc = dixLookupWindow(&pWindow, (XID)(long)closure, pClient, > DixWriteAccess); > > if (rc == Success) { > RegionRec exposed; > @@ -123,7 +123,7 @@ compSetPixmapVisitWindow (WindowPtr pWindow, pointer data) > SetBorderSize (pWindow); > if (HasBorder (pWindow)) > QueueWorkProc (compRepaintBorder, serverClient, > - (pointer) pWindow->drawable.id); > + (pointer)(long)pWindow->drawable.id); > return WT_WALKCHILDREN; > } > > diff --git a/glx/glxcmds.c b/glx/glxcmds.c > index 33954ee..003f8e0 100644 > --- a/glx/glxcmds.c > +++ b/glx/glxcmds.c > @@ -2021,7 +2021,7 @@ int __glXDisp_BindSwapBarrierSGIX(__GLXclientState *cl, > GLbyte *pc) > if (ret == Success) { > if (barrier) > /* add source for cleanup when drawable is gone */ > - AddResource(drawable, __glXSwapBarrierRes, > (pointer)screen); > + AddResource(drawable, __glXSwapBarrierRes, > (pointer)(long)screen); > else > /* delete source */ > FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE); > diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c > index 871b6a9..15536af 100644 > --- a/hw/xfree86/dri/dri.c > +++ b/hw/xfree86/dri/dri.c > @@ -429,7 +429,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int > *pDRMFD) > if (!pDRIPriv->pDriverInfo->dontMapFrameBuffer) > { > if (drmAddMap( pDRIPriv->drmFD, > - > (drm_handle_t)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, > + > (drm_handle_t)(long)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, > pDRIPriv->pDriverInfo->frameBufferSize, > DRM_FRAME_BUFFER, > 0, > @@ -1278,7 +1278,7 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, > DrawablePtr pDrawable, > > /* track this in case the client dies */ > AddResource(FakeClientID(client->index), DRIDrawablePrivResType, > - (pointer)pDrawable->id); > + (pointer)(long)pDrawable->id); > > if (pDRIDrawablePriv->hwDrawable) { > drmUpdateDrawableInfo(pDRIPriv->drmFD, > @@ -1349,7 +1349,7 @@ DRIDestroyDrawable(ScreenPtr pScreen, ClientPtr client, > DrawablePtr pDrawable) > if (pDrawable->type == DRAWABLE_WINDOW) { > LookupClientResourceComplex(client, DRIDrawablePrivResType, > DRIDestroyDrawableCB, > - (pointer)pDrawable->id); > + (pointer)(long)pDrawable->id); > } > else { /* pixmap (or for GLX 1.3, a PBuffer) */ > /* NOT_DONE */ > @@ -1364,7 +1364,7 @@ DRIDrawablePrivDelete(pointer pResource, XID id) > { > WindowPtr pWin; > > - id = (XID)pResource; > + id = (XID)(long)pResource; > pWin = LookupIDByType(id, RT_WINDOW); > > if (pWin) { > diff --git a/hw/xfree86/os-support/bus/linuxPci.c > b/hw/xfree86/os-support/bus/linuxPci.c > index 41682c2..c22cfb1 100644 > --- a/hw/xfree86/os-support/bus/linuxPci.c > +++ b/hw/xfree86/os-support/bus/linuxPci.c > @@ -525,7 +525,7 @@ xf86MapLegacyIO(struct pci_device *dev) > PCIIOC_MMAP_IS_IO); > } > else { /* legacy_io file exists, encode fd */ > - DomainMmappedIO[domain] = (pointer)(fd << 24); > + DomainMmappedIO[domain] = (pointer)(long)(fd << 24); > } > } > > diff --git a/hw/xfree86/os-support/linux/lnx_agp.c > b/hw/xfree86/os-support/linux/lnx_agp.c > index 6143740..8553155 100644 > --- a/hw/xfree86/os-support/linux/lnx_agp.c > +++ b/hw/xfree86/os-support/linux/lnx_agp.c > @@ -264,7 +264,7 @@ xf86DeallocateGARTMemory(int screenNum, int key) > } > > #ifdef __linux__ > - if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)key) != 0) { > + if (ioctl(gartFd, AGPIOC_DEALLOCATE, (int *)(long)key) != 0) { > #else > if (ioctl(gartFd, AGPIOC_DEALLOCATE, &key) != 0) { > #endif > diff --git a/mi/miscrinit.c b/mi/miscrinit.c > index 93a6c4b..ea52e58 100644 > --- a/mi/miscrinit.c > +++ b/mi/miscrinit.c > @@ -308,5 +308,5 @@ DevPrivateKey miZeroLineScreenKey = > &miZeroLineScreenKeyIndex; > void > miSetZeroLineBias(ScreenPtr pScreen, unsigned int bias) > { > - dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey, (pointer)bias); > + dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey, > (pointer)(long)bias); > } _______________________________________________ xorg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xorg
