mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-22 13:55:07 +00:00
Resolve C++ mode warnings about int vs size_t with gcc -Wconversion flag enabled.
https://github.com/nigels-com/glew/issues/6
This commit is contained in:
parent
5f0a96150e
commit
4b78dc4b68
@ -6,6 +6,8 @@
|
|||||||
# include <GL/glxew.h>
|
# include <GL/glxew.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <stddef.h> /* For size_t */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define glewGetContext and related helper macros.
|
* Define glewGetContext and related helper macros.
|
||||||
*/
|
*/
|
||||||
|
@ -10,8 +10,8 @@ const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error)
|
|||||||
(const GLubyte*)"GLX 1.2 and up are not supported",
|
(const GLubyte*)"GLX 1.2 and up are not supported",
|
||||||
(const GLubyte*)"Unknown error"
|
(const GLubyte*)"Unknown error"
|
||||||
};
|
};
|
||||||
const int max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1;
|
const size_t max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1;
|
||||||
return _glewErrorString[(int)error > max_error ? max_error : (int)error];
|
return _glewErrorString[(size_t)error > max_error ? max_error : (size_t)error];
|
||||||
}
|
}
|
||||||
|
|
||||||
const GLubyte * GLEWAPIENTRY glewGetString (GLenum name)
|
const GLubyte * GLEWAPIENTRY glewGetString (GLenum name)
|
||||||
@ -24,8 +24,8 @@ const GLubyte * GLEWAPIENTRY glewGetString (GLenum name)
|
|||||||
(const GLubyte*)"GLEW_VERSION_MINOR_STRING",
|
(const GLubyte*)"GLEW_VERSION_MINOR_STRING",
|
||||||
(const GLubyte*)"GLEW_VERSION_MICRO_STRING"
|
(const GLubyte*)"GLEW_VERSION_MICRO_STRING"
|
||||||
};
|
};
|
||||||
const int max_string = sizeof(_glewString)/sizeof(*_glewString) - 1;
|
const size_t max_string = sizeof(_glewString)/sizeof(*_glewString) - 1;
|
||||||
return _glewString[(int)name > max_string ? 0 : (int)name];
|
return _glewString[(size_t)name > max_string ? 0 : (size_t)name];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
Loading…
Reference in New Issue
Block a user