#87 wglewGetExtension fails on last entry

1.10.0
closed
nobody
API (59)
5
2014-08-12
2008-05-18
Kayamon
No

Hi,

The wglewGetExtension function does not correctly parse the last extension in the list, as there is no space following it.

Here's an example string that shows the error.

"WGL_EXT_extensions_string WGL_ARB_extensions_string WGL_EXT_pixel_format WGL_ARB_pixel_format WGL_EXT_swap_control"

The WGL_EXT_swap_control extension will not get correctly detected.
This might also happen for the non-WGL extensions, I didn't check.

Discussion

  • Nigel Stewart

    Nigel Stewart - 2008-10-22

    Yes, it appears that wglewGetExtension depends on there being a space at the end of each entry in the extension string:

    while (p < end)
    {
    GLuint n = _glewStrCLen(p, ' ');
    if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE;
    p += n+1;
    }

    One way to fix this would be to modify the implementation of _glewStrCLen:

    static GLuint _glewStrCLen (const GLubyte* s, GLubyte c)
    {
    GLuint i=0;
    if (s == NULL) return 0;
    while (s[i] != '\0' && s[i] != c) i++;
    return s[i] == c ? i : 0;
    }

    Replacing the last line with: return ( s[i] == '\0' || s[i] == c ) ? i : 0;

    _glewStrCLen is used in following places:

    glewGetExtension
    glewContextInit
    wglewGetExtension
    glxewGetExtension

     
  • Milan Ikits

    Milan Ikits - 2008-10-27

    Hi,

    This is now fixed in the repository using Nigel's patch and will be
    included in the 1.5.1 release.

    Thanks!

    • Milan
     
  • Nigel Stewart

    Nigel Stewart - 2014-08-12
    • Group: v1.0_(example) --> 1.10.0
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks