From ffe8db538f9d190c84bf56f024b876de518affa5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 17 Jun 2016 14:51:29 -0700 Subject: [PATCH] Fix ICC warning about comparing pointers of different types error #3781: comparing a pointer to void and a pointer to a function is nonstandard Change-Id: Ib57b52598e2f452985e9fffd1458fd651d3985d2 Reviewed-by: Lars Knoll --- .../platforms/windows/qwindowsglcontext.cpp | 16 ++++++++-------- .../platforms/windows/qwindowsglcontext.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index cc2f05b6d17..0a2d30319e1 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -149,12 +149,12 @@ QT_BEGIN_NAMESPACE QWindowsOpengl32DLL QOpenGLStaticContext::opengl32; -void *QWindowsOpengl32DLL::resolve(const char *name) +PROC QWindowsOpengl32DLL::resolve(const char *name) { #ifndef Q_OS_WINCE - void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, name) : 0; + PROC proc = m_lib ? ::GetProcAddress(m_lib, name) : 0; #else - void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, (const wchar_t *) QString::fromLatin1(name).utf16()) : 0; + PROC proc = m_lib ? ::GetProcAddress(m_lib, (const wchar_t *) QString::fromLatin1(name).utf16()) : 0; #endif return proc; @@ -1339,21 +1339,21 @@ QFunctionPointer QWindowsGLContext::getProcAddress(const char *procName) // Even though we use QFunctionPointer, it does not mean the function can be called. // It will need to be cast to the proper function type with the correct calling // convention. QFunctionPointer is nothing more than a glorified void* here. - QFunctionPointer procAddress = reinterpret_cast(QOpenGLStaticContext::opengl32.wglGetProcAddress(procName)); + PROC procAddress = QOpenGLStaticContext::opengl32.wglGetProcAddress(procName); // We support AllGLFunctionsQueryable, which means this function must be able to // return a function pointer even for functions that are in GL.h and exported // normally from opengl32.dll. wglGetProcAddress() is not guaranteed to work for such // functions, however in QT_OPENGL_DYNAMIC builds QOpenGLFunctions will just blindly // call into here for _any_ OpenGL function. - if (!procAddress || procAddress == reinterpret_cast(0x1) || procAddress == reinterpret_cast(0x2) - || procAddress == reinterpret_cast(0x3) || procAddress == reinterpret_cast(-1)) - procAddress = reinterpret_cast(QOpenGLStaticContext::opengl32.resolve(procName)); + if (!procAddress || procAddress == reinterpret_cast(0x1) || procAddress == reinterpret_cast(0x2) + || procAddress == reinterpret_cast(0x3) || procAddress == reinterpret_cast(-1)) + procAddress = QOpenGLStaticContext::opengl32.resolve(procName); if (QWindowsContext::verbose > 1) qCDebug(lcQpaGl) << __FUNCTION__ << procName << QOpenGLStaticContext::opengl32.wglGetCurrentContext() << "returns" << procAddress; - return procAddress; + return reinterpret_cast(procAddress); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h index e8c78860f2d..2944ab71928 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.h +++ b/src/plugins/platforms/windows/qwindowsglcontext.h @@ -122,7 +122,7 @@ struct QWindowsOpengl32DLL void (APIENTRY * glGetIntegerv)(GLenum pname, GLint* params); const GLubyte * (APIENTRY * glGetString)(GLenum name); - void *resolve(const char *name); + PROC resolve(const char *name); private: HMODULE m_lib; bool m_nonOpengl32;