diff options
author | Mathias Agopian <mathias@google.com> | 2011-05-11 20:37:47 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-05-11 20:37:47 -0700 |
commit | 0ad71a97c6061e3b12d2308bd43e02dfeeb63db4 (patch) | |
tree | 7bf57adeda6dc0496cc01599d824b79abafe52a9 /opengl/libs/EGL/Loader.cpp | |
parent | 8747ce61e9012b18de46b9be0fc3ff5338dec4f9 (diff) | |
download | frameworks_native-0ad71a97c6061e3b12d2308bd43e02dfeeb63db4.zip frameworks_native-0ad71a97c6061e3b12d2308bd43e02dfeeb63db4.tar.gz frameworks_native-0ad71a97c6061e3b12d2308bd43e02dfeeb63db4.tar.bz2 |
fix (Again) adding OES postfix when looking for gl functions
Change-Id: Ib14723ed5355fdc423226ec20a32e26fe7dd68fe
Diffstat (limited to 'opengl/libs/EGL/Loader.cpp')
-rw-r--r-- | opengl/libs/EGL/Loader.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index 75dec4a..da26229 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); @@ -200,13 +201,9 @@ void Loader::init_api(void* dso, } if (f == NULL) { // Try with the OES postfix - ssize_t size = ssize_t(strlen(name)); - ssize_t index = size - 3; - if ((index>0 && (index<252)) && (strcmp(name+index, "OES"))) { - strncpy(scrap, name, sizeof(scrap) - 1); - scrap[size] = 0; - strncat(scrap, "OES", sizeof(scrap) - 1); - scrap[size + 3] = 0; + ssize_t index = ssize_t(strlen(name)) - 3; + if (index>0 && strcmp(name+index, "OES")) { + snprintf(scrap, SIZE, "%sOES", name); f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, scrap); //LOGD_IF(f, "found <%s> instead", scrap); } |