diff options
author | Chris Robinson <[email protected]> | 2008-01-14 16:26:22 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2008-01-14 16:26:22 -0800 |
commit | a2e25226125ff12b5294055dd01e247197270265 (patch) | |
tree | d92ca2dd663bbf206bd74f9eb0a137c7e37ad60c /OpenAL32 | |
parent | df07e8a65ba2436eff2ff94db24e71069ad73a09 (diff) |
Let alIsExtensionPresent work with mixed-case extension names
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/alExtension.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/OpenAL32/alExtension.c b/OpenAL32/alExtension.c index 703bd140..dacb9218 100644 --- a/OpenAL32/alExtension.c +++ b/OpenAL32/alExtension.c @@ -303,7 +303,8 @@ ALAPI ALboolean ALAPIENTRY alIsExtensionPresent(const ALchar *extName) { ALboolean bIsSupported = AL_FALSE; ALCcontext *pContext; - char *ptr, *ext; + const char *ptr; + size_t len; if (!extName) { @@ -318,32 +319,28 @@ ALAPI ALboolean ALAPIENTRY alIsExtensionPresent(const ALchar *extName) return AL_FALSE; } - ext = strdup(extName); - ptr = ext; - do { - *ptr = (char)toupper(*ptr); - } while(*(ptr++)); - SuspendContext(pContext); + len = strlen(extName); ptr = pContext->ExtensionList; - while((ptr=strstr(ptr, ext)) != NULL) + while(ptr && *ptr) { - if(ptr == pContext->ExtensionList || ptr[-1] == ' ') + if(strncasecmp(ptr, extName, len) == 0 && + (ptr[len] == '\0' || isspace(ptr[len]))) + { + bIsSupported = AL_TRUE; + break; + } + if((ptr=strchr(ptr, ' ')) != NULL) { - char e = ptr[strlen(ext)]; - if(e == ' ' || e == 0) - { - bIsSupported = AL_TRUE; - break; - } + do { + ++ptr; + } while(isspace(*ptr)); } - ptr++; } ProcessContext(pContext); - free(ext); return bIsSupported; } |