[PATCH:xf86-video-mga] Fix pointer cast warning.

Mark Kettenis mark.kettenis at xs4all.nl
Mon Feb 23 22:36:48 PST 2015


>  cast to pointer from integer of different size
>  [-Werror=int-to-pointer-cast]
>
>  Signed-off-by: Thomas Klausner <wiz at NetBSD.org>
>  ---
>   src/mga_exa.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

This code makes no sense to me.  exaGetPixmapFirstPixel() returns a pixel
value.  Interpreting that as a pointer to the first pixel must be wrong.

Note that the actual usage of mgaDownloadFromScreen() is #if 0'ed out. 
Perhaps this code should just be removed from the driver?  Or perhaps the
code was #if 0'ed out because the code didn't work?

>  diff --git a/src/mga_exa.c b/src/mga_exa.c
>  index 69ffa16..5024f54 100644
>  --- a/src/mga_exa.c
>  +++ b/src/mga_exa.c
>  @@ -729,7 +729,7 @@ mgaDownloadFromScreen(PixmapPtr pSrc, int x, int y,
>  int w, int h,
>   {
>       PMGA(pSrc);
>
>  -    char *src = (char *) exaGetPixmapFirstPixel(pSrc);
>  +    char *src = (char *)(unsigned long) exaGetPixmapFirstPixel(pSrc);
>       int src_pitch = exaGetPixmapPitch(pSrc);
>
>       int cpp = (pSrc->drawable.bitsPerPixel + 7) / 8;
>  --
>  2.3.0
>
>  _______________________________________________
>  xorg-devel at lists.x.org: X.Org development
>  Archives: http://lists.x.org/archives/xorg-devel
>  Info: http://lists.x.org/mailman/listinfo/xorg-devel




More information about the xorg-devel mailing list