From 37aa4dc4f8439bfe097ca7c5157d79623d193081 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 21 Aug 2014 17:27:14 -0700 Subject: [PATCH] fix more warnings, implement missing X11 function for dynamic loading --- btgui/OpenGLWindow/GLPrimitiveRenderer.cpp | 3 ++- btgui/OpenGLWindow/LoadShader.cpp | 3 ++- btgui/OpenGLWindow/X11OpenGLWindow.cpp | 12 ++++++----- src/LinearMath/btScalar.h | 23 ++++++++++++++++------ 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/btgui/OpenGLWindow/GLPrimitiveRenderer.cpp b/btgui/OpenGLWindow/GLPrimitiveRenderer.cpp index e1c424659..f6c3cb47d 100644 --- a/btgui/OpenGLWindow/GLPrimitiveRenderer.cpp +++ b/btgui/OpenGLWindow/GLPrimitiveRenderer.cpp @@ -131,7 +131,8 @@ void GLPrimitiveRenderer::loadBufferData() glGenBuffers(1, &m_data->m_vertexBuffer); glBindBuffer(GL_ARRAY_BUFFER, m_data->m_vertexBuffer); glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(Vertex), vertexData, GL_DYNAMIC_DRAW); - GLuint err = glGetError(); + GLuint err; + err = glGetError(); assert(err==GL_NO_ERROR); diff --git a/btgui/OpenGLWindow/LoadShader.cpp b/btgui/OpenGLWindow/LoadShader.cpp index efef4550a..4726504fc 100644 --- a/btgui/OpenGLWindow/LoadShader.cpp +++ b/btgui/OpenGLWindow/LoadShader.cpp @@ -18,7 +18,8 @@ void gltLoadShaderSrc(const char *szShaderSrc, GLuint shader) GLuint gltLoadShaderPair(const char *szVertexProg, const char *szFragmentProg) { - GLuint err = glGetError(); + GLuint err; + err = glGetError(); assert(err==GL_NO_ERROR); // Temporary Shader objects diff --git a/btgui/OpenGLWindow/X11OpenGLWindow.cpp b/btgui/OpenGLWindow/X11OpenGLWindow.cpp index 924344b55..bd27b6851 100644 --- a/btgui/OpenGLWindow/X11OpenGLWindow.cpp +++ b/btgui/OpenGLWindow/X11OpenGLWindow.cpp @@ -48,9 +48,11 @@ typedef int (*PFNXSTORENAME) (Display* a,Window b,_Xconst char* c); typedef int (*PFNXCLOSEDISPLAY) (Display* a); typedef int (*PFNXDESTROYWINDOW) (Display* a,Window b); #if NeedWidePrototypes -typedef KeySym (*PFNXKEYCODETOKEYSYM) (Display* a,unsigned int b,int c); + typedef KeySym* (*PFNXGETKEYBOARDMAPPING) (Display*,unsigned int,int,int*); + typedef KeySym (*PFNXKEYCODETOKEYSYM) (Display* a,unsigned int b,int c); #else -typedef KeySym (*PFNXKEYCODETOKEYSYM) (Display* a,KeyCode b,int c); + typedef KeySym* (*PFNXGETKEYBOARDMAPPING) (Display*,KeyCode,int,int*); + typedef KeySym (*PFNXKEYCODETOKEYSYM) (Display* a,KeyCode b,int c); #endif typedef void (*PFNXCONVERTCASE) (KeySym /* sym */,KeySym * /* lower */,KeySym * /* upper */); typedef int (*PFNXPENDING) (Display* a); @@ -139,6 +141,7 @@ struct InternalData2 PFNXCLOSEDISPLAY m_x11_XCloseDisplay; PFNXDESTROYWINDOW m_x11_XDestroyWindow; PFNXKEYCODETOKEYSYM m_x11_XKeycodeToKeysym; + PFNXGETKEYBOARDMAPPING m_x11_XGetKeyboardMapping; PFNXCONVERTCASE m_x11_XConvertCase; PFNXPENDING m_x11_XPending; PFNXNEXTEVENT m_x11_XNextEvent; @@ -192,13 +195,12 @@ struct InternalData2 if (missingFunc) { printf("Error: missing func XMapWindow in %s, exiting!\n", X11_LIBRARY); exit(0);} missingFunc = ((m_x11_XStoreName = (PFNXSTORENAME) dlsym(m_x11_library,"XStoreName"))==NULL) | missingFunc; if (missingFunc) { printf("Error: missing func XStoreName in %s, exiting!\n", X11_LIBRARY); exit(0);} - missingFunc = ((m_x11_XCloseDisplay = (PFNXCLOSEDISPLAY) dlsym(m_x11_library,"XCloseDisplay"))==NULL) | missingFunc; if (missingFunc) { printf("Error: missing func XCloseDisplay in %s, exiting!\n", X11_LIBRARY); exit(0);} - missingFunc = ((m_x11_XDestroyWindow = (PFNXDESTROYWINDOW) dlsym(m_x11_library,"XDestroyWindow"))==NULL) | missingFunc; if (missingFunc) { printf("Error: missing func XMapWindow in %s, exiting!\n", X11_LIBRARY); exit(0);} - + missingFunc = ((m_x11_XGetKeyboardMapping = (PFNXGETKEYBOARDMAPPING) dlsym(m_x11_library,"XGetKeyboardMapping"))==NULL) | missingFunc; + if (missingFunc) { printf("Error: missing func XGetKeyboardMapping in %s, exiting!\n", X11_LIBRARY); exit(0);} missingFunc = ((m_x11_XKeycodeToKeysym = (PFNXKEYCODETOKEYSYM) dlsym(m_x11_library,"XKeycodeToKeysym"))==NULL) | missingFunc; if (missingFunc) { printf("Error: missing func XKeycodeToKeysym in %s, exiting!\n", X11_LIBRARY); exit(0);} missingFunc = ((m_x11_XConvertCase = (PFNXCONVERTCASE) dlsym(m_x11_library,"XConvertCase"))==NULL) | missingFunc; diff --git a/src/LinearMath/btScalar.h b/src/LinearMath/btScalar.h index 2a0f71d70..3e54536c2 100644 --- a/src/LinearMath/btScalar.h +++ b/src/LinearMath/btScalar.h @@ -343,12 +343,23 @@ inline __m128 operator * (const __m128 A, const __m128 B) #else//BT_USE_NEON #ifndef BT_INFINITY - static int btInfinityMask = 0x7F800000; - #define BT_INFINITY (*(float*)&btInfinityMask) - inline int btGetInfinityMask()//suppress stupid compiler warning - { - return btInfinityMask; - } + struct btInfMaskConverter + { + union { + float mask; + int intmask; + }; + btInfMaskConverter(int mask=0x7F800000) + :intmask(mask) + { + } + }; + static btInfMaskConverter btInfinityMask = 0x7F800000; + #define BT_INFINITY (btInfinityMask.mask) + inline int btGetInfinityMask()//suppress stupid compiler warning + { + return btInfinityMask.mask; + } #endif #endif//BT_USE_NEON