vcl/inc/unx/saldisp.hxx | 3 ++- vcl/opengl/x11/gdiimpl.cxx | 45 ++++++--------------------------------------- 2 files changed, 8 insertions(+), 40 deletions(-)
New commits: commit 876de03290ce0e9393134d722e5b15025e32a341 Author: Stephan Bergmann <sberg...@redhat.com> Date: Wed Dec 14 10:30:00 2016 +0100 Simplify GLX11Window::HasGLXExtension, avoiding strtok Change-Id: If737cf4aaec1e6297db2bc8a80b19720ca9ca189 diff --git a/vcl/inc/unx/saldisp.hxx b/vcl/inc/unx/saldisp.hxx index 339ba80..d64b67e 100644 --- a/vcl/inc/unx/saldisp.hxx +++ b/vcl/inc/unx/saldisp.hxx @@ -30,6 +30,7 @@ class SalXLib; #include <X11/extensions/Xrender.h> #include <epoxy/glx.h> +#include <rtl/string.hxx> #include <unx/salunx.h> #include <unx/saltype.h> #include <vcl/opengl/OpenGLContext.hxx> @@ -200,7 +201,7 @@ public: Window win; XVisualInfo* vi; GLXContext ctx; - const char* GLXExtensions; + OString GLXExtensions; bool HasGLXExtension(const char* name) const; diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index 292dd14..d46b002 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() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits