Extension string type cleanup.

This commit is contained in:
Camilla Berglund 2015-07-28 14:12:16 +02:00
parent 24e4e674a5
commit 1f95fac699
5 changed files with 17 additions and 21 deletions

View File

@ -490,16 +490,16 @@ GLboolean _glfwIsValidContext(const _GLFWctxconfig* ctxconfig)
return GL_TRUE;
}
int _glfwStringInExtensionString(const char* string, const GLubyte* extensions)
int _glfwStringInExtensionString(const char* string, const char* extensions)
{
const GLubyte* start = extensions;
const char* start = extensions;
for (;;)
{
GLubyte* where;
GLubyte* terminator;
const char* where;
const char* terminator;
where = (GLubyte*) strstr((const char*) start, string);
where = strstr(start, string);
if (!where)
return GL_FALSE;
@ -602,7 +602,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
{
// Check if extension is in the old style OpenGL extensions string
const GLubyte* extensions = glGetString(GL_EXTENSIONS);
const char* extensions = (const char*) glGetString(GL_EXTENSIONS);
if (!extensions)
{
_glfwInputError(GLFW_PLATFORM_ERROR,

View File

@ -476,12 +476,10 @@ void _glfwPlatformSwapInterval(int interval)
int _glfwPlatformExtensionSupported(const char* extension)
{
const char* extensions;
extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS);
if (extensions != NULL)
const char* extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS);
if (extensions)
{
if (_glfwStringInExtensionString(extension, (unsigned char*) extensions))
if (_glfwStringInExtensionString(extension, extensions))
return GL_TRUE;
}

View File

@ -509,10 +509,8 @@ void _glfwPlatformSwapInterval(int interval)
int _glfwPlatformExtensionSupported(const char* extension)
{
const GLubyte* extensions =
(const GLubyte*) glXQueryExtensionsString(_glfw.x11.display,
_glfw.x11.screen);
const char* extensions = glXQueryExtensionsString(_glfw.x11.display,
_glfw.x11.screen);
if (extensions)
{
if (_glfwStringInExtensionString(extension, extensions))

View File

@ -799,7 +799,7 @@ void _glfwSplitBPP(int bpp, int* red, int* green, int* blue);
* @return `GL_TRUE` if the extension was found, or `GL_FALSE` otherwise.
* @ingroup utility
*/
int _glfwStringInExtensionString(const char* string, const GLubyte* extensions);
int _glfwStringInExtensionString(const char* string, const char* extensions);
/*! @brief Chooses the framebuffer config that best matches the desired one.
* @param[in] desired The desired framebuffer config.

View File

@ -605,14 +605,14 @@ void _glfwPlatformSwapInterval(int interval)
int _glfwPlatformExtensionSupported(const char* extension)
{
const GLubyte* extensions;
const char* extensions;
_GLFWwindow* window = _glfwPlatformGetCurrentContext();
if (window->wgl.GetExtensionsStringEXT != NULL)
{
extensions = (GLubyte*) window->wgl.GetExtensionsStringEXT();
if (extensions != NULL)
extensions = window->wgl.GetExtensionsStringEXT();
if (extensions)
{
if (_glfwStringInExtensionString(extension, extensions))
return GL_TRUE;
@ -621,8 +621,8 @@ int _glfwPlatformExtensionSupported(const char* extension)
if (window->wgl.GetExtensionsStringARB != NULL)
{
extensions = (GLubyte*) window->wgl.GetExtensionsStringARB(window->wgl.dc);
if (extensions != NULL)
extensions = window->wgl.GetExtensionsStringARB(window->wgl.dc);
if (extensions)
{
if (_glfwStringInExtensionString(extension, extensions))
return GL_TRUE;