diff options
author | José Fonseca <jose.r.fonseca@gmail.com> | 2011-09-28 09:04:56 +0100 |
---|---|---|
committer | José Fonseca <jose.r.fonseca@gmail.com> | 2011-09-28 09:04:56 +0100 |
commit | 7525e6fa4a4095ed2dbb58f841fc859571ca9f96 (patch) | |
tree | 2ee19aafb3d92540de9451b2f925a9541df3b5d5 | |
parent | 0bbc2873535169bd6ddcda0f6c929e37ad455669 (diff) |
More signed/unsigned comparison fixes.
-rw-r--r-- | glcaps.cpp | 6 | ||||
-rw-r--r-- | glsize.hpp | 8 | ||||
-rw-r--r-- | glsnapshot.cpp | 4 | ||||
-rw-r--r-- | glstate.cpp | 8 | ||||
-rw-r--r-- | gltrace.py | 6 |
5 files changed, 16 insertions, 16 deletions
@@ -65,7 +65,7 @@ static const char *extra_extensions[] = { static const char * overrideExtensionsString(const char *extensions) { - int i; + size_t i; ExtensionsMap::const_iterator it = extensionsMap.find(extensions); if (it != extensionsMap.end()) { @@ -154,8 +154,8 @@ __glGetStringi_override(GLenum name, GLuint index) { GLint num_extensions = 0; __glGetIntegerv(GL_NUM_EXTENSIONS, &num_extensions); - if (num_extensions <= index && index < num_extensions + NUM_EXTRA_EXTENSIONS) { - return (const GLubyte *)extra_extensions[index - num_extensions]; + if ((GLuint)num_extensions <= index && index < (GLuint)num_extensions + NUM_EXTRA_EXTENSIONS) { + return (const GLubyte *)extra_extensions[index - (GLuint)num_extensions]; } } break; @@ -594,7 +594,7 @@ __glMap2d_size(GLenum target, GLint ustride, GLint uorder, GLint vstride, GLint #define __glGetFramebufferAttachmentParameteriv_size __gl_param_size #define __glGetFramebufferAttachmentParameterivEXT_size __gl_param_size -static inline size_t +static inline unsigned __gl_format_channels(GLenum format) { switch (format) { case GL_COLOR_INDEX: @@ -645,9 +645,9 @@ _align(X x, Y y) { static inline size_t __gl_image_size(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth) { - size_t num_channels = __gl_format_channels(format); + unsigned num_channels = __gl_format_channels(format); - size_t bits_per_pixel; + unsigned bits_per_pixel; switch (type) { case GL_BITMAP: bits_per_pixel = 1; @@ -720,7 +720,7 @@ __gl_image_size(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsiz size_t row_stride = (row_length*bits_per_pixel + 7)/8; - if (bits_per_pixel < alignment*8 && + if ((GLint)bits_per_pixel < alignment*8 && (bits_per_pixel & 7) == 0 && _is_pot(bits_per_pixel)) { row_stride = _align(row_stride, alignment); diff --git a/glsnapshot.cpp b/glsnapshot.cpp index 6385fcc..f06818b 100644 --- a/glsnapshot.cpp +++ b/glsnapshot.cpp @@ -146,8 +146,8 @@ getDrawableImage(void) { if (image) { const uint32_t *src = (const uint32_t *)ximage->data; uint32_t *dst = (uint32_t*) image->start(); - for (int y = 0; y < h; ++y) { - for (int x = 0; x < w; ++x) { + for (unsigned y = 0; y < h; ++y) { + for (unsigned x = 0; x < w; ++x) { uint32_t bgra = src[x]; uint32_t rgba = (bgra & 0xff00ff00) | ((bgra >> 16) & 0xff) diff --git a/glstate.cpp b/glstate.cpp index ac63a78..bbf8adc 100644 --- a/glstate.cpp +++ b/glstate.cpp @@ -455,7 +455,7 @@ dumpArbProgramUniforms(JSONWriter &json, GLenum target, const char *prefix) GLint max_program_local_parameters = 0; glGetProgramivARB(target, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &max_program_local_parameters); - for (GLuint index = 0; index < max_program_local_parameters; ++index) { + for (GLint index = 0; index < max_program_local_parameters; ++index) { GLdouble params[4] = {0, 0, 0, 0}; glGetProgramLocalParameterdvARB(target, index, params); @@ -464,7 +464,7 @@ dumpArbProgramUniforms(JSONWriter &json, GLenum target, const char *prefix) } char name[256]; - snprintf(name, sizeof name, "%sprogram.local[%u]", prefix, index); + snprintf(name, sizeof name, "%sprogram.local[%i]", prefix, index); json.beginMember(name); json.beginArray(); @@ -478,7 +478,7 @@ dumpArbProgramUniforms(JSONWriter &json, GLenum target, const char *prefix) GLint max_program_env_parameters = 0; glGetProgramivARB(target, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &max_program_env_parameters); - for (GLuint index = 0; index < max_program_env_parameters; ++index) { + for (GLint index = 0; index < max_program_env_parameters; ++index) { GLdouble params[4] = {0, 0, 0, 0}; glGetProgramEnvParameterdvARB(target, index, params); @@ -487,7 +487,7 @@ dumpArbProgramUniforms(JSONWriter &json, GLenum target, const char *prefix) } char name[256]; - snprintf(name, sizeof name, "%sprogram.env[%u]", prefix, index); + snprintf(name, sizeof name, "%sprogram.env[%i]", prefix, index); json.beginMember(name); json.beginArray(); @@ -459,7 +459,7 @@ class GlTracer(Tracer): Tracer.dispatch_function(self, function) print ' GLint active_attributes = 0;' print ' __glGetProgramiv(program, GL_ACTIVE_ATTRIBUTES, &active_attributes);' - print ' for (GLuint attrib = 0; attrib < active_attributes; ++attrib) {' + print ' for (GLint attrib = 0; attrib < active_attributes; ++attrib) {' print ' GLint size = 0;' print ' GLenum type = 0;' print ' GLchar name[256];' @@ -477,7 +477,7 @@ class GlTracer(Tracer): Tracer.dispatch_function(self, function) print ' GLint active_attributes = 0;' print ' __glGetObjectParameterivARB(programObj, GL_OBJECT_ACTIVE_ATTRIBUTES_ARB, &active_attributes);' - print ' for (GLuint attrib = 0; attrib < active_attributes; ++attrib) {' + print ' for (GLint attrib = 0; attrib < active_attributes; ++attrib) {' print ' GLint size = 0;' print ' GLenum type = 0;' print ' GLcharARB name[256];' @@ -820,7 +820,7 @@ class GlTracer(Tracer): print ' GLint max_texture_coords = 0;' print ' __glGetIntegerv(GL_MAX_TEXTURE_COORDS, &max_texture_coords);' print ' for (GLint unit = 0; unit < max_texture_coords; ++unit) {' - print ' GLenum texture = GL_TEXTURE0 + unit;' + print ' GLint texture = GL_TEXTURE0 + unit;' print ' __glClientActiveTexture(texture);' def array_trace_prolog(self, api, uppercase_name): |