From c3289c41e794117817895653300bd2cf7daa0a01 Mon Sep 17 00:00:00 2001 From: Dan Stoza Date: Fri, 17 Jan 2014 11:38:34 -0800 Subject: [PATCH] Make libEGL build cleanly under 64-bit Change-Id: I255dfb70b166b7469d59352b1acfc7aececa07de --- opengl/libs/EGL/egl.cpp | 13 +++++++------ opengl/libs/EGL/eglApi.cpp | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index f759e6b6e..67fbae5dd 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -42,6 +41,8 @@ #include "egl_display.h" #include "egl_object.h" +typedef __eglMustCastToProperFunctionPointerType EGLFuncPointer; + // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- @@ -234,11 +235,11 @@ static void early_egl_init(void) pthread_key_create(&gGLTraceKey, NULL); initEglTraceLevel(); #endif - uint32_t addr = (uint32_t)((void*)gl_no_context); - android_memset32( - (uint32_t*)(void*)&gHooksNoContext, - addr, - sizeof(gHooksNoContext)); + int numHooks = sizeof(gHooksNoContext) / sizeof(EGLFuncPointer); + EGLFuncPointer *iter = reinterpret_cast(&gHooksNoContext); + for (int hook = 0; hook < numHooks; ++hook) { + *(iter++) = reinterpret_cast(gl_no_context); + } setGLHooksThreadSpecific(&gHooksNoContext); } diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index b02ee0f8b..b6ffdb2c6 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -204,7 +204,7 @@ EGLDisplay eglGetDisplay(EGLNativeDisplayType display) { clearError(); - uint32_t index = uint32_t(display); + uintptr_t index = reinterpret_cast(display); if (index >= NUM_DISPLAYS) { return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY); }