Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ad71a97 authored by Mathias Agopian's avatar Mathias Agopian
Browse files

fix (Again) adding OES postfix when looking for gl functions

Change-Id: Ib14723ed5355fdc423226ec20a32e26fe7dd68fe
parent 8747ce61
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -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);
            }