summaryrefslogtreecommitdiff
path: root/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'opengl')
-rw-r--r--opengl/libagl/egl.cpp4
-rw-r--r--opengl/libs/EGL/Loader.cpp11
2 files changed, 9 insertions, 6 deletions
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 0d03361b00..03db8d777a 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -338,6 +338,10 @@ egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy,
nativeWindow(window), buffer(0), previousBuffer(0), module(0),
bits(NULL)
{
+ hw_module_t const* pModule;
+ hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule);
+ module = reinterpret_cast<gralloc_module_t const*>(pModule);
+
pixelFormatTable = gglGetPixelFormatTable();
// keep a reference on the window
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index 2502f159d9..da2622965b 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -179,7 +179,8 @@ void Loader::init_api(void* dso,
__eglMustCastToProperFunctionPointerType* curr,
getProcAddressType getProcAddress)
{
- char scrap[256];
+ const size_t SIZE = 256;
+ char scrap[SIZE];
while (*api) {
char const * name = *api;
__eglMustCastToProperFunctionPointerType f =
@@ -191,7 +192,7 @@ void Loader::init_api(void* dso,
if (f == NULL) {
// Try without the OES postfix
ssize_t index = ssize_t(strlen(name)) - 3;
- if ((index>0 && (index<255)) && (!strcmp(name+index, "OES"))) {
+ if ((index>0 && (index<SIZE-1)) && (!strcmp(name+index, "OES"))) {
strncpy(scrap, name, index);
scrap[index] = 0;
f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
@@ -201,10 +202,8 @@ void Loader::init_api(void* dso,
if (f == NULL) {
// Try with the OES postfix
ssize_t index = ssize_t(strlen(name)) - 3;
- if ((index>0 && (index<252)) && (strcmp(name+index, "OES"))) {
- strncpy(scrap, name, index);
- scrap[index] = 0;
- strcat(scrap, "OES");
+ if (index>0 && strcmp(name+index, "OES")) {
+ snprintf(scrap, SIZE, "%sOES", name);
f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap);
//LOGD_IF(f, "found <%s> instead", scrap);
}