I would be wary of assuming you can typecast long -&gt; pointer, or pointer -&gt; long. On 64-bit Windows,  sizeof(int) == sizeof(long) == 4 but sizeof(void*) == 8. On 64-bit Linux (gcc), sizeof(int) == 4, sizeof(long) == sizeof(void*) == 8. It would be better to use &lt;stdint.h&gt; with uintptr_t -- it was designed to solve this problem exactly. If you insist on using long, why not use long long (C99) which is 64-bits on both platforms.<div>
<br></div><div><br><div><br><div class="gmail_quote">On Thu, May 12, 2011 at 3:49 AM, zhigang gong <span dir="ltr">&lt;<a href="mailto:zhigang.gong@gmail.com">zhigang.gong@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
glu.h: typedef void (GLAPIENTRYP _GLUfuncptr)(); causes the following<br>
       warning: function declaration isn&#39;t a prototype.<br>
egl:   When convert a (void *) to a int type, it&#39;s better to<br>
       convert to long firstly, otherwise in 64 bit envirnonment, it<br>
       causes compilation warning.<br>
---<br>
 include/GL/glu.h                    |    2 +-<br>
 src/egl/drivers/dri2/egl_dri2.c     |    4 ++--<br>
 src/egl/drivers/dri2/platform_drm.c |    4 ++--<br>
 src/egl/drivers/dri2/platform_x11.c |    2 +-<br>
 src/egl/main/eglapi.c               |    2 +-<br>
 5 files changed, 7 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/include/GL/glu.h b/include/GL/glu.h<br>
index cd967ac..ba2228d 100644<br>
--- a/include/GL/glu.h<br>
+++ b/include/GL/glu.h<br>
@@ -284,7 +284,7 @@ typedef GLUtesselator GLUtriangulatorObj;<br>
 #define GLU_TESS_MAX_COORD 1.0e150<br>
<br>
 /* Internal convenience typedefs */<br>
-typedef void (GLAPIENTRYP _GLUfuncptr)();<br>
+typedef void (GLAPIENTRYP _GLUfuncptr)(void);<br>
<br>
 GLAPI void GLAPIENTRY gluBeginCurve (GLUnurbs* nurb);<br>
 GLAPI void GLAPIENTRY gluBeginPolygon (GLUtesselator* tess);<br>
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c<br>
index afab679..f5f5ac3 100644<br>
--- a/src/egl/drivers/dri2/egl_dri2.c<br>
+++ b/src/egl/drivers/dri2/egl_dri2.c<br>
@@ -835,7 +835,7 @@ dri2_create_image_khr_renderbuffer(_EGLDisplay<br>
*disp, _EGLContext *ctx,<br>
    struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);<br>
    struct dri2_egl_context *dri2_ctx = dri2_egl_context(ctx);<br>
    struct dri2_egl_image *dri2_img;<br>
-   GLuint renderbuffer = (GLuint) buffer;<br>
+   GLuint renderbuffer =  (unsigned long) buffer;<br>
<br>
    if (renderbuffer == 0) {<br>
       _eglError(EGL_BAD_PARAMETER, &quot;dri2_create_image_khr&quot;);<br>
@@ -870,7 +870,7 @@ dri2_create_image_mesa_drm_buffer(_EGLDisplay<br>
*disp, _EGLContext *ctx,<br>
<br>
    (void) ctx;<br>
<br>
-   name = (EGLint) buffer;<br>
+   name = (unsigned long) buffer;<br>
<br>
    err = _eglParseImageAttribList(&amp;attrs, disp, attr_list);<br>
    if (err != EGL_SUCCESS)<br>
diff --git a/src/egl/drivers/dri2/platform_drm.c<br>
b/src/egl/drivers/dri2/platform_drm.c<br>
index 68912e3..cea8418 100644<br>
--- a/src/egl/drivers/dri2/platform_drm.c<br>
+++ b/src/egl/drivers/dri2/platform_drm.c<br>
@@ -596,7 +596,7 @@ dri2_get_device_name(int fd)<br>
       goto out;<br>
    }<br>
<br>
-   device_name = udev_device_get_devnode(device);<br>
+   device_name = (char*)udev_device_get_devnode(device);<br>
    if (!device_name)<br>
           goto out;<br>
    device_name = strdup(device_name);<br>
@@ -690,7 +690,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)<br>
    memset(dri2_dpy, 0, sizeof *dri2_dpy);<br>
<br>
    disp-&gt;DriverData = (void *) dri2_dpy;<br>
-   dri2_dpy-&gt;fd = (int) disp-&gt;PlatformDisplay;<br>
+   dri2_dpy-&gt;fd = (long) disp-&gt;PlatformDisplay;<br>
<br>
    dri2_dpy-&gt;driver_name = dri2_get_driver_for_fd(dri2_dpy-&gt;fd);<br>
    if (dri2_dpy-&gt;driver_name == NULL)<br>
diff --git a/src/egl/drivers/dri2/platform_x11.c<br>
b/src/egl/drivers/dri2/platform_x11.c<br>
index 5d4ac6a..90136f4 100644<br>
--- a/src/egl/drivers/dri2/platform_x11.c<br>
+++ b/src/egl/drivers/dri2/platform_x11.c<br>
@@ -784,7 +784,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp,<br>
_EGLContext *ctx,<br>
<br>
    (void) ctx;<br>
<br>
-   drawable = (xcb_drawable_t) buffer;<br>
+   drawable = (xcb_drawable_t) (long)buffer;<br>
    xcb_dri2_create_drawable (dri2_dpy-&gt;conn, drawable);<br>
    attachments[0] = XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT;<br>
    buffers_cookie =<br>
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c<br>
index 336ec23..9063752 100644<br>
--- a/src/egl/main/eglapi.c<br>
+++ b/src/egl/main/eglapi.c<br>
@@ -1168,7 +1168,7 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode)<br>
 EGLDisplay EGLAPIENTRY<br>
 eglGetDRMDisplayMESA(int fd)<br>
 {<br>
-   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) fd);<br>
+   _EGLDisplay *dpy = _eglFindDisplay(_EGL_PLATFORM_DRM, (void *) (long)fd);<br>
    return _eglGetDisplayHandle(dpy);<br>
 }<br>
<font color="#888888"><br>
--<br>
1.7.3.1<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></blockquote></div><br></div></div>