egl: Fix int <-> ptr casts.
authorJosé Fonseca <jfonseca@vmware.com>
Thu, 12 May 2011 14:12:16 +0000 (15:12 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Thu, 12 May 2011 14:12:16 +0000 (15:12 +0100)
Based on zhigang gong <zhigang.gong@gmail.com>'s patch.

src/egl/drivers/dri2/egl_dri2.c
src/egl/drivers/dri2/platform_drm.c
src/egl/drivers/dri2/platform_x11.c
src/egl/main/eglapi.c

index afab679bff605d30c1419638ddd9e5fae2252fcb..1acec51a43370d81653b06a11981abc9c1c281d1 100644 (file)
@@ -835,7 +835,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay *disp, _EGLContext *ctx,
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
    struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);
    struct dri2_egl_image *dri2_img;
-   GLuint renderbuffer = (GLuint) buffer;
+   GLuint renderbuffer = (GLuint) (uintptr_t) buffer;
 
    if (renderbuffer == 0) {
       _eglError(EGL_BAD_PARAMETER, "dri2_create_image_khr");
@@ -870,7 +870,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay *disp, _EGLContext *ctx,
 
    (void) ctx;
 
-   name = (EGLint) buffer;
+   name = (EGLint) (uintptr_t) buffer;
 
    err = _eglParseImageAttribList(&attrs, disp, attr_list);
    if (err != EGL_SUCCESS)
index 68912e3673226bb1af3cd27cb9404681f71e68bb..261cbfed6758b5efb5044df2cc0832456e360d7d 100644 (file)
@@ -690,7 +690,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
    memset(dri2_dpy, 0, sizeof *dri2_dpy);
 
    disp->DriverData = (void *) dri2_dpy;
-   dri2_dpy->fd = (int) disp->PlatformDisplay;
+   dri2_dpy->fd = (int) (intptr_t) disp->PlatformDisplay;
 
    dri2_dpy->driver_name = dri2_get_driver_for_fd(dri2_dpy->fd);
    if (dri2_dpy->driver_name == NULL)
index 5d4ac6ae9482b862aa01f5efed6eb4afa5f24fc1..2e26ff00b67e655016ce5fb2ce54bf49c96bb950 100644 (file)
@@ -784,7 +784,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, _EGLContext *ctx,
 
    (void) ctx;
 
-   drawable = (xcb_drawable_t) buffer;
+   drawable = (xcb_drawable_t) (uintptr_t) buffer;
    xcb_dri2_create_drawable (dri2_dpy->conn, drawable);
    attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;
    buffers_cookie =
index 336ec23da5a318b2006df04b0602b5d38a34181d..bdfdcb3817d42b339f54c92726cc9540888d0778 100644 (file)
@@ -1168,7 +1168,7 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)
 EGLDisplay EGLAPIENTRY
 eglGetDRMDisplayMESA(int fd)
 {
-   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);
+   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) (intptr_t) fd);
    return _eglGetDisplayHandle(dpy);
 }