OSDN Git Service

opengl: Fix 64-bit build.
authorDavid 'Digit' Turner <digit@google.com>
Fri, 31 Oct 2014 22:11:27 +0000 (23:11 +0100)
committerDavid 'Digit' Turner <digit@google.com>
Fri, 31 Oct 2014 22:11:27 +0000 (23:11 +0100)
A previous patch broke the 64-bit with the following error message:

  device/generic/goldfish/opengl/system/egl/egl.cpp: In function 'EGLBoolean eglGetConfigs(EGLDisplay, void**, EGLint, EGLint*)':
  device/generic/goldfish/opengl/system/egl/egl.cpp:559:33: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
      *configs++ = (EGLConfig)i;

This was due to the fact that the type of |i| went from uintptr_t to int.
This patch fixes the issue by casting i to (EGLConfig)(uintptr_t)i.

Change-Id: I3158c91d63b13eff3f8e8babb1faba8b58dc7373

system/egl/egl.cpp

index 7ff7429..1ad91ff 100644 (file)
@@ -554,9 +554,9 @@ EGLBoolean eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size,
         return EGL_TRUE;
     }
 
-    EGLint i=0;
-    for (i=0 ; i<numConfigs && i<config_size ; i++) {
-        *configs++ = (EGLConfig)i;
+    EGLint i;
+    for (i = 0 ; i < numConfigs && i < config_size ; i++) {
+        *configs++ = (EGLConfig)(uintptr_t)i;
     }
     *num_config = i;
     return EGL_TRUE;