fix (Again) adding OES postfix when looking for gl functions
Change-Id: Ib14723ed5355fdc423226ec20a32e26fe7dd68fe
This commit is contained in:
parent
8747ce61e9
commit
0ad71a97c6
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue