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; 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 (;;) for (;;)
{ {
GLubyte* where; const char* where;
GLubyte* terminator; const char* terminator;
where = (GLubyte*) strstr((const char*) start, string); where = strstr(start, string);
if (!where) if (!where)
return GL_FALSE; return GL_FALSE;
@ -602,7 +602,7 @@ GLFWAPI int glfwExtensionSupported(const char* extension)
{ {
// Check if extension is in the old style OpenGL extensions string // 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) if (!extensions)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,

View File

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

View File

@ -509,10 +509,8 @@ void _glfwPlatformSwapInterval(int interval)
int _glfwPlatformExtensionSupported(const char* extension) int _glfwPlatformExtensionSupported(const char* extension)
{ {
const GLubyte* extensions = const char* extensions = glXQueryExtensionsString(_glfw.x11.display,
(const GLubyte*) glXQueryExtensionsString(_glfw.x11.display,
_glfw.x11.screen); _glfw.x11.screen);
if (extensions) if (extensions)
{ {
if (_glfwStringInExtensionString(extension, 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. * @return `GL_TRUE` if the extension was found, or `GL_FALSE` otherwise.
* @ingroup utility * @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. /*! @brief Chooses the framebuffer config that best matches the desired one.
* @param[in] desired The desired framebuffer config. * @param[in] desired The desired framebuffer config.

View File

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