mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-25 23:31:56 +00:00
const correctness change
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@498 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
parent
4eac405113
commit
c9a40e3cee
@ -43,16 +43,16 @@ if (@ARGV)
|
||||
#my $pextvar = prefix_varname($extvar);
|
||||
|
||||
print "#ifdef $extname\n";
|
||||
print " " . $extvar . " = " . $extpre . "GetExtension(\"$extname\");\n";
|
||||
print " CONST_CAST(" . $extvar . ") = " . $extpre . "GetExtension(\"$extname\");\n";
|
||||
if (keys %$functions)
|
||||
{
|
||||
if ($extname =~ /WGL_.*/)
|
||||
{
|
||||
print " if (glewExperimental || " . $extvar . "|| crippled) " . $extvar . "= !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||
print " if (glewExperimental || " . $extvar . "|| crippled) CONST_CAST(" . $extvar . ")= !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
print " if (glewExperimental || " . $extvar . ") " . $extvar . " = !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||
print " if (glewExperimental || " . $extvar . ") CONST_CAST(" . $extvar . ") = !_glewInit_$extname(GLEW_CONTEXT_ARG_VAR_INIT);\n";
|
||||
}
|
||||
}
|
||||
print "#endif /* $extname */\n";
|
||||
|
@ -101,11 +101,15 @@ void* dlGetProcAddress (const GLubyte* name)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define GLboolean const cast.
|
||||
*/
|
||||
#define CONST_CAST(x) (*(GLboolean*)&x)
|
||||
|
||||
/*
|
||||
* GLEW, just like OpenGL or GLU, does not rely on the standard C library.
|
||||
* These functions implement the functionality required in this file.
|
||||
*/
|
||||
|
||||
static GLuint _glewStrLen (const GLubyte* s)
|
||||
{
|
||||
GLuint i=0;
|
||||
|
@ -45,65 +45,65 @@ GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
|
||||
}
|
||||
else
|
||||
{
|
||||
GLEW_VERSION_1_1 = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_1) = GL_TRUE;
|
||||
if (s[major] >= '2')
|
||||
{
|
||||
GLEW_VERSION_1_2 = GL_TRUE;
|
||||
GLEW_VERSION_1_3 = GL_TRUE;
|
||||
GLEW_VERSION_1_4 = GL_TRUE;
|
||||
GLEW_VERSION_1_5 = GL_TRUE;
|
||||
GLEW_VERSION_2_0 = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_4) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_5) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_2_0) = GL_TRUE;
|
||||
if (s[minor] >= '1')
|
||||
{
|
||||
GLEW_VERSION_2_1 = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_2_1) = GL_TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s[minor] >= '5')
|
||||
{
|
||||
GLEW_VERSION_1_2 = GL_TRUE;
|
||||
GLEW_VERSION_1_3 = GL_TRUE;
|
||||
GLEW_VERSION_1_4 = GL_TRUE;
|
||||
GLEW_VERSION_1_5 = GL_TRUE;
|
||||
GLEW_VERSION_2_0 = GL_FALSE;
|
||||
GLEW_VERSION_2_1 = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_4) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_5) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||
}
|
||||
if (s[minor] == '4')
|
||||
{
|
||||
GLEW_VERSION_1_2 = GL_TRUE;
|
||||
GLEW_VERSION_1_3 = GL_TRUE;
|
||||
GLEW_VERSION_1_4 = GL_TRUE;
|
||||
GLEW_VERSION_1_5 = GL_FALSE;
|
||||
GLEW_VERSION_2_0 = GL_FALSE;
|
||||
GLEW_VERSION_2_1 = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_4) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||
}
|
||||
if (s[minor] == '3')
|
||||
{
|
||||
GLEW_VERSION_1_2 = GL_TRUE;
|
||||
GLEW_VERSION_1_3 = GL_TRUE;
|
||||
GLEW_VERSION_1_4 = GL_FALSE;
|
||||
GLEW_VERSION_1_5 = GL_FALSE;
|
||||
GLEW_VERSION_2_0 = GL_FALSE;
|
||||
GLEW_VERSION_2_1 = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_3) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_4) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||
}
|
||||
if (s[minor] == '2')
|
||||
{
|
||||
GLEW_VERSION_1_2 = GL_TRUE;
|
||||
GLEW_VERSION_1_3 = GL_FALSE;
|
||||
GLEW_VERSION_1_4 = GL_FALSE;
|
||||
GLEW_VERSION_1_5 = GL_FALSE;
|
||||
GLEW_VERSION_2_0 = GL_FALSE;
|
||||
GLEW_VERSION_2_1 = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_2) = GL_TRUE;
|
||||
CONST_CAST(GLEW_VERSION_1_3) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_4) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||
}
|
||||
if (s[minor] < '2')
|
||||
{
|
||||
GLEW_VERSION_1_2 = GL_FALSE;
|
||||
GLEW_VERSION_1_3 = GL_FALSE;
|
||||
GLEW_VERSION_1_4 = GL_FALSE;
|
||||
GLEW_VERSION_1_5 = GL_FALSE;
|
||||
GLEW_VERSION_2_0 = GL_FALSE;
|
||||
GLEW_VERSION_2_1 = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_2) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_3) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_4) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_1_5) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_0) = GL_FALSE;
|
||||
CONST_CAST(GLEW_VERSION_2_1) = GL_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,11 @@ GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
|
||||
/* initialize core GLX 1.2 */
|
||||
if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||
/* initialize flags */
|
||||
GLXEW_VERSION_1_0 = GL_TRUE;
|
||||
GLXEW_VERSION_1_1 = GL_TRUE;
|
||||
GLXEW_VERSION_1_2 = GL_TRUE;
|
||||
GLXEW_VERSION_1_3 = GL_TRUE;
|
||||
GLXEW_VERSION_1_4 = GL_TRUE;
|
||||
CONST_CAST(GLXEW_VERSION_1_0) = GL_TRUE;
|
||||
CONST_CAST(GLXEW_VERSION_1_1) = GL_TRUE;
|
||||
CONST_CAST(GLXEW_VERSION_1_2) = GL_TRUE;
|
||||
CONST_CAST(GLXEW_VERSION_1_3) = GL_TRUE;
|
||||
CONST_CAST(GLXEW_VERSION_1_4) = GL_TRUE;
|
||||
/* query GLX version */
|
||||
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
|
||||
if (major == 1 && minor <= 3)
|
||||
@ -38,11 +38,11 @@ GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
|
||||
switch (minor)
|
||||
{
|
||||
case 3:
|
||||
GLXEW_VERSION_1_4 = GL_FALSE;
|
||||
CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
|
||||
break;
|
||||
case 2:
|
||||
GLXEW_VERSION_1_4 = GL_FALSE;
|
||||
GLXEW_VERSION_1_3 = GL_FALSE;
|
||||
CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
|
||||
CONST_CAST(GLXEW_VERSION_1_3) = GL_FALSE;
|
||||
break;
|
||||
default:
|
||||
return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||
|
@ -21,11 +21,10 @@ GLEWAPI GLboolean glewContextIsSupported (GLEWContext* ctx, const char* name);
|
||||
#define glewIsSupported(x) glewContextIsSupported(glewGetContext(), x)
|
||||
#define glewIsExtensionSupported(x) glewIsSupported(x)
|
||||
|
||||
#define GLEW_GET_VAR(x) (*(const GLboolean*)&(glewGetContext()->x))
|
||||
#ifdef _WIN32
|
||||
# define GLEW_GET_VAR(x) glewGetContext()->x
|
||||
# define GLEW_GET_FUN(x) glewGetContext()->x
|
||||
#else
|
||||
# define GLEW_GET_VAR(x) glewGetContext()->x
|
||||
# define GLEW_GET_FUN(x) x
|
||||
#endif
|
||||
|
||||
@ -35,7 +34,7 @@ GLEWAPI GLenum glewInit ();
|
||||
GLEWAPI GLboolean glewIsSupported (const char* name);
|
||||
#define glewIsExtensionSupported(x) glewIsSupported(x)
|
||||
|
||||
#define GLEW_GET_VAR(x) x
|
||||
#define GLEW_GET_VAR(x) (*(const GLboolean*)&x)
|
||||
#define GLEW_GET_FUN(x) x
|
||||
|
||||
#endif /* GLEW_MX */
|
||||
|
Loading…
Reference in New Issue
Block a user