summaryrefslogtreecommitdiff
path: root/vcl/opengl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2016-12-14 10:30:00 +0100
committerStephan Bergmann <sbergman@redhat.com>2016-12-14 10:30:00 +0100
commit876de03290ce0e9393134d722e5b15025e32a341 (patch)
treec387ef7c6088e88545b837ae457e1699a88acaf9 /vcl/opengl
parent65e17112824967d990536d6a904f0b35a01b5340 (diff)
Simplify GLX11Window::HasGLXExtension, avoiding strtok
Change-Id: If737cf4aaec1e6297db2bc8a80b19720ca9ca189
Diffstat (limited to 'vcl/opengl')
-rw-r--r--vcl/opengl/x11/gdiimpl.cxx45
1 files changed, 6 insertions, 39 deletions
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
index 292dd14e7318..d46b002caf75 100644
--- a/vcl/opengl/x11/gdiimpl.cxx
+++ b/vcl/opengl/x11/gdiimpl.cxx
@@ -525,56 +525,23 @@ bool X11OpenGLContext::initWindow()
return true;
}
-// Copy of gluCheckExtension(), from the Apache-licensed
-// https://code.google.com/p/glues/source/browse/trunk/glues/source/glues_registry.c
-static GLboolean checkExtension(const GLubyte* extName, const GLubyte* extString)
-{
- GLboolean flag=GL_FALSE;
- char* word;
- char* lookHere;
- char* deleteThis;
-
- if (extString==nullptr)
- {
- return GL_FALSE;
- }
-
- deleteThis=lookHere=static_cast<char*>(malloc(strlen(reinterpret_cast<const char*>(extString))+1));
- if (lookHere==nullptr)
- {
- return GL_FALSE;
- }
-
- /* strtok() will modify string, so copy it somewhere */
- strcpy(lookHere, reinterpret_cast<const char*>(extString));
-
- while ((word=strtok(lookHere, " "))!=nullptr)
- {
- if (strcmp(word, reinterpret_cast<const char*>(extName))==0)
- {
- flag=GL_TRUE;
- break;
- }
- lookHere=nullptr; /* get next token */
- }
- free(static_cast<void*>(deleteThis));
-
- return flag;
-}
-
GLX11Window::GLX11Window()
: dpy(nullptr)
, screen(0)
, win(0)
, vi(nullptr)
, ctx(nullptr)
- , GLXExtensions(nullptr)
{
}
bool GLX11Window::HasGLXExtension( const char* name ) const
{
- return checkExtension( reinterpret_cast<const GLubyte*>(name), reinterpret_cast<const GLubyte*>(GLXExtensions) );
+ for (sal_Int32 i = 0; i != -1;) {
+ if (GLXExtensions.getToken(0, ' ', i) == name) {
+ return true;
+ }
+ }
+ return false;
}
GLX11Window::~GLX11Window()