mesa: Fix some signed-unsigned comparison warnings

v2: s/unsigned int/unsigned/ in prog_optimize.c

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: David Heidelberg <david@ixit.cz>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
Jan Vesely 2015-01-15 13:41:04 -05:00 committed by José Fonseca
parent da1f92779d
commit 3cb10cce37
29 changed files with 56 additions and 54 deletions

View File

@ -2887,7 +2887,7 @@ static void
unbind_uniform_buffers(struct gl_context *ctx, GLuint first, GLsizei count)
{
struct gl_buffer_object *bufObj = ctx->Shared->NullBufferObj;
GLuint i;
GLint i;
for (i = 0; i < count; i++)
set_ubo_binding(ctx, &ctx->UniformBufferBindings[first + i],
@ -2898,7 +2898,7 @@ static void
bind_uniform_buffers_base(struct gl_context *ctx, GLuint first, GLsizei count,
const GLuint *buffers)
{
GLuint i;
GLint i;
if (!error_check_bind_uniform_buffers(ctx, first, count, "glBindBuffersBase"))
return;
@ -2965,7 +2965,7 @@ bind_uniform_buffers_range(struct gl_context *ctx, GLuint first, GLsizei count,
const GLuint *buffers,
const GLintptr *offsets, const GLsizeiptr *sizes)
{
GLuint i;
GLint i;
if (!error_check_bind_uniform_buffers(ctx, first, count,
"glBindBuffersRange"))
@ -3122,7 +3122,7 @@ unbind_xfb_buffers(struct gl_context *ctx,
GLuint first, GLsizei count)
{
struct gl_buffer_object * const bufObj = ctx->Shared->NullBufferObj;
GLuint i;
GLint i;
for (i = 0; i < count; i++)
_mesa_set_transform_feedback_binding(ctx, tfObj, first + i,
@ -3136,7 +3136,7 @@ bind_xfb_buffers_base(struct gl_context *ctx,
{
struct gl_transform_feedback_object *tfObj =
ctx->TransformFeedback.CurrentObject;
GLuint i;
GLint i;
if (!error_check_bind_xfb_buffers(ctx, tfObj, first, count,
"glBindBuffersBase"))
@ -3204,7 +3204,7 @@ bind_xfb_buffers_range(struct gl_context *ctx,
{
struct gl_transform_feedback_object *tfObj =
ctx->TransformFeedback.CurrentObject;
GLuint i;
GLint i;
if (!error_check_bind_xfb_buffers(ctx, tfObj, first, count,
"glBindBuffersRange"))
@ -3342,7 +3342,7 @@ static void
unbind_atomic_buffers(struct gl_context *ctx, GLuint first, GLsizei count)
{
struct gl_buffer_object * const bufObj = ctx->Shared->NullBufferObj;
GLuint i;
GLint i;
for (i = 0; i < count; i++)
set_atomic_buffer_binding(ctx, &ctx->AtomicBufferBindings[first + i],
@ -3355,7 +3355,7 @@ bind_atomic_buffers_base(struct gl_context *ctx,
GLsizei count,
const GLuint *buffers)
{
GLuint i;
GLint i;
if (!error_check_bind_atomic_buffers(ctx, first, count,
"glBindBuffersBase"))
@ -3422,7 +3422,7 @@ bind_atomic_buffers_range(struct gl_context *ctx,
const GLintptr *offsets,
const GLsizeiptr *sizes)
{
GLuint i;
GLint i;
if (!error_check_bind_atomic_buffers(ctx, first, count,
"glBindBuffersRange"))

View File

@ -301,7 +301,7 @@ _mesa_DrawBuffer(GLenum buffer)
void GLAPIENTRY
_mesa_DrawBuffers(GLsizei n, const GLenum *buffers)
{
GLint output;
GLuint output;
GLbitfield usedBufferMask, supportedMask;
GLbitfield destMask[MAX_DRAW_BUFFERS];
GET_CURRENT_CONTEXT(ctx);

View File

@ -225,7 +225,7 @@ _mesa_Clear( GLbitfield mask )
/** Returned by make_color_buffer_mask() for errors */
#define INVALID_MASK ~0x0
#define INVALID_MASK ~0x0U
/**

View File

@ -1021,7 +1021,7 @@ dlist_alloc(struct gl_context *ctx, OpCode opcode, GLuint bytes)
const GLuint contNodes = 1 + POINTER_DWORDS; /* size of continue info */
Node *n;
if (opcode < (GLuint) OPCODE_EXT_0) {
if (opcode < OPCODE_EXT_0) {
if (InstSize[opcode] == 0) {
/* save instruction size now */
InstSize[opcode] = numNodes;

View File

@ -134,7 +134,7 @@ static const GLenum debug_severity_enums[] = {
static enum mesa_debug_source
gl_enum_to_debug_source(GLenum e)
{
int i;
unsigned i;
for (i = 0; i < Elements(debug_source_enums); i++) {
if (debug_source_enums[i] == e)
@ -146,7 +146,7 @@ gl_enum_to_debug_source(GLenum e)
static enum mesa_debug_type
gl_enum_to_debug_type(GLenum e)
{
int i;
unsigned i;
for (i = 0; i < Elements(debug_type_enums); i++) {
if (debug_type_enums[i] == e)
@ -158,7 +158,7 @@ gl_enum_to_debug_type(GLenum e)
static enum mesa_debug_severity
gl_enum_to_debug_severity(GLenum e)
{
int i;
unsigned i;
for (i = 0; i < Elements(debug_severity_enums); i++) {
if (debug_severity_enums[i] == e)
@ -633,7 +633,7 @@ debug_fetch_message(const struct gl_debug_state *debug)
* Delete the oldest debug messages out of the log.
*/
static void
debug_delete_messages(struct gl_debug_state *debug, unsigned count)
debug_delete_messages(struct gl_debug_state *debug, int count)
{
struct gl_debug_log *log = &debug->Log;

View File

@ -2347,7 +2347,7 @@ reuse_framebuffer_texture_attachment(struct gl_framebuffer *fb,
static void
framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
GLenum attachment, GLenum textarget, GLuint texture,
GLint level, GLint zoffset, GLboolean layered)
GLint level, GLuint zoffset, GLboolean layered)
{
struct gl_renderbuffer_attachment *att;
struct gl_texture_object *texObj = NULL;
@ -2441,8 +2441,8 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
}
if (texObj->Target == GL_TEXTURE_3D) {
const GLint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
if (zoffset < 0 || zoffset >= maxSize) {
const GLuint maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
if (zoffset >= maxSize) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glFramebufferTexture%s(zoffset)", caller);
return;
@ -2452,8 +2452,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target,
(texObj->Target == GL_TEXTURE_2D_ARRAY_EXT) ||
(texObj->Target == GL_TEXTURE_CUBE_MAP_ARRAY) ||
(texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY)) {
if (zoffset < 0 ||
zoffset >= (GLint) ctx->Const.MaxArrayTextureLayers) {
if (zoffset >= ctx->Const.MaxArrayTextureLayers) {
_mesa_error(ctx, GL_INVALID_VALUE,
"glFramebufferTexture%s(layer)", caller);
return;

View File

@ -302,7 +302,7 @@ struct ureg {
struct tnl_program {
const struct state_key *state;
struct gl_vertex_program *program;
GLint max_inst; /** number of instructions allocated for program */
GLuint max_inst; /** number of instructions allocated for program */
GLboolean mvp_with_dp4;
GLuint temp_in_use;
@ -578,7 +578,7 @@ static void emit_op3fn(struct tnl_program *p,
GLuint nr;
struct prog_instruction *inst;
assert((GLint) p->program->Base.NumInstructions <= p->max_inst);
assert(p->program->Base.NumInstructions <= p->max_inst);
if (p->program->Base.NumInstructions == p->max_inst) {
/* need to extend the program's instruction array */

View File

@ -163,7 +163,7 @@ _mesa_unsigned_to_unsigned(unsigned src, unsigned dst_size)
static inline int
_mesa_unsigned_to_signed(unsigned src, unsigned dst_size)
{
return MIN2(src, MAX_INT(dst_size));
return MIN2(src, (unsigned)MAX_INT(dst_size));
}
static inline int

View File

@ -345,7 +345,7 @@ update_framebuffer_size(struct gl_context *ctx, struct gl_framebuffer *fb)
}
}
if (minWidth != ~0) {
if (minWidth != ~0U) {
fb->Width = minWidth;
fb->Height = minHeight;
}

View File

@ -690,7 +690,7 @@ free_matrix_stack( struct gl_matrix_stack *stack )
*/
void _mesa_init_matrix( struct gl_context * ctx )
{
GLint i;
GLuint i;
/* Initialize matrix stacks */
init_matrix_stack(&ctx->ModelviewMatrixStack, MAX_MODELVIEW_STACK_DEPTH,
@ -701,7 +701,7 @@ void _mesa_init_matrix( struct gl_context * ctx )
init_matrix_stack(&ctx->TextureMatrixStack[i], MAX_TEXTURE_STACK_DEPTH,
_NEW_TEXTURE_MATRIX);
for (i = 0; i < Elements(ctx->ProgramMatrixStack); i++)
init_matrix_stack(&ctx->ProgramMatrixStack[i],
init_matrix_stack(&ctx->ProgramMatrixStack[i],
MAX_PROGRAM_MATRIX_STACK_DEPTH, _NEW_TRACK_MATRIX);
ctx->CurrentStack = &ctx->ModelviewMatrixStack;
@ -720,7 +720,7 @@ void _mesa_init_matrix( struct gl_context * ctx )
*/
void _mesa_free_matrix_data( struct gl_context *ctx )
{
GLint i;
GLuint i;
free_matrix_stack(&ctx->ModelviewMatrixStack);
free_matrix_stack(&ctx->ProjectionMatrixStack);

View File

@ -2093,7 +2093,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
GLint border;
GLboolean nextLevel;
GLuint temp_dst_row_stride, temp_dst_img_stride; /* in bytes */
GLuint i;
GLint i;
/* get src image parameters */
srcImage = _mesa_select_tex_image(texObj, target, level);

View File

@ -490,7 +490,7 @@ void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w )
*/
void _mesa_init_rastpos( struct gl_context * ctx )
{
int i;
unsigned i;
ASSIGN_4V( ctx->Current.RasterPos, 0.0, 0.0, 0.0, 1.0 );
ctx->Current.RasterDistance = 0.0;

View File

@ -596,7 +596,7 @@ get_tex_memcpy(struct gl_context *ctx, GLenum format, GLenum type,
if (memCopy) {
const GLuint bpp = _mesa_get_format_bytes(texImage->TexFormat);
const GLuint bytesPerRow = texImage->Width * bpp;
const GLint bytesPerRow = texImage->Width * bpp;
GLubyte *dst =
_mesa_image_address2d(&ctx->Pack, pixels, texImage->Width,
texImage->Height, format, type, 0, 0);
@ -707,7 +707,7 @@ _mesa_GetCompressedTexImage_sw(struct gl_context *ctx,
const GLuint dimensions =
_mesa_get_texture_dimensions(texImage->TexObject->Target);
struct compressed_pixelstore store;
GLuint i, slice;
GLint slice;
GLubyte *dest;
_mesa_compute_compressed_pixelstore(dimensions, texImage->TexFormat,
@ -745,7 +745,7 @@ _mesa_GetCompressedTexImage_sw(struct gl_context *ctx,
GL_MAP_READ_BIT, &src, &srcRowStride);
if (src) {
GLint i;
for (i = 0; i < store.CopyRowsPerSlice; i++) {
memcpy(dest, src, store.CopyBytesPerRow);
dest += store.TotalBytesPerRow;

View File

@ -255,7 +255,7 @@ update_array_format(struct gl_context *ctx,
{
struct gl_vertex_attrib_array *array;
GLbitfield typeBit;
GLuint elementSize;
GLint elementSize;
GLenum format = GL_RGBA;
if (ctx->Array.LegalTypesMask == 0 || ctx->Array.LegalTypesMaskAPI != ctx->API) {

View File

@ -123,7 +123,7 @@ get_src_register_pointer(const struct prog_src_register *source,
return (GLfloat *) prog->Parameters->ParameterValues[reg];
case PROGRAM_SYSTEM_VALUE:
assert(reg < Elements(machine->SystemValues));
assert(reg < (GLint) Elements(machine->SystemValues));
return machine->SystemValues[reg];
default:

View File

@ -408,7 +408,7 @@ find_next_use(const struct gl_program *prog,
for (j = 0; j < numSrc; j++) {
if (inst->SrcReg[j].RelAddr ||
(inst->SrcReg[j].File == PROGRAM_TEMPORARY &&
inst->SrcReg[j].Index == index &&
inst->SrcReg[j].Index == (GLint)index &&
(get_src_arg_mask(inst,j,NO_MASK) & mask)))
return READ;
}
@ -944,7 +944,7 @@ update_interval(GLint intBegin[], GLint intEnd[],
struct loop_info *loopStack, GLuint loopStackDepth,
GLuint index, GLuint ic)
{
int i;
unsigned i;
GLuint begin = ic;
GLuint end = ic;

View File

@ -82,7 +82,7 @@ _mesa_register_file_name(gl_register_file f)
* Return ARB_v/f_prog-style input attrib string.
*/
static const char *
arb_input_attrib_string(GLint index, GLenum progType)
arb_input_attrib_string(GLuint index, GLenum progType)
{
/*
* These strings should match the VERT_ATTRIB_x and VARYING_SLOT_x tokens.
@ -242,7 +242,7 @@ _mesa_print_fp_inputs(GLbitfield inputs)
* Return ARB_v/f_prog-style output attrib string.
*/
static const char *
arb_output_attrib_string(GLint index, GLenum progType)
arb_output_attrib_string(GLuint index, GLenum progType)
{
/*
* These strings should match the VARYING_SLOT_x and FRAG_RESULT_x tokens.

View File

@ -175,7 +175,7 @@ static GLboolean
blend_per_rt(const struct gl_context *ctx)
{
if (ctx->Color.BlendEnabled &&
(ctx->Color.BlendEnabled != ((1 << ctx->Const.MaxDrawBuffers) - 1))) {
(ctx->Color.BlendEnabled != ((1U << ctx->Const.MaxDrawBuffers) - 1))) {
/* This can only happen if GL_EXT_draw_buffers2 is enabled */
return GL_TRUE;
}

View File

@ -47,7 +47,7 @@ update_scissor( struct st_context *st )
const struct gl_context *ctx = st->ctx;
const struct gl_framebuffer *fb = ctx->DrawBuffer;
GLint miny, maxy;
int i;
unsigned i;
bool changed = false;
for (i = 0 ; i < ctx->Const.MaxViewports; i++) {
scissor[i].minx = 0;

View File

@ -44,7 +44,7 @@ update_viewport( struct st_context *st )
{
struct gl_context *ctx = st->ctx;
GLfloat yScale, yBias;
int i;
unsigned i;
/* _NEW_BUFFERS
*/
if (st_fb_orientation(ctx->DrawBuffer) == Y_0_TOP) {

View File

@ -408,9 +408,9 @@ st_update_renderbuffer_surface(struct st_context *st,
{
struct pipe_context *pipe = st->pipe;
struct pipe_resource *resource = strb->texture;
int rtt_width = strb->Base.Width;
int rtt_height = strb->Base.Height;
int rtt_depth = strb->Base.Depth;
unsigned rtt_width = strb->Base.Width;
unsigned rtt_height = strb->Base.Height;
unsigned rtt_depth = strb->Base.Depth;
/*
* For winsys fbo, it is possible that the renderbuffer is sRGB-capable but
* the format of strb->texture is linear (because we have no control over

View File

@ -226,7 +226,7 @@ st_draw_vbo(struct gl_context *ctx,
}
info.indexed = TRUE;
if (min_index != ~0 && max_index != ~0) {
if (min_index != ~0U && max_index != ~0U) {
info.min_index = min_index;
info.max_index = max_index;
}

View File

@ -411,7 +411,8 @@ void st_init_extensions(struct pipe_screen *screen,
struct st_config_options *options,
boolean has_lib_dxtc)
{
int i, glsl_feature_level;
unsigned i;
int glsl_feature_level;
GLboolean *extension_table = (GLboolean *) extensions;
static const struct st_extension_cap_mapping cap_mapping[] = {
@ -705,7 +706,7 @@ void st_init_extensions(struct pipe_screen *screen,
extensions->EXT_texture_integer = GL_FALSE;
}
consts->UniformBooleanTrue = consts->NativeIntegers ? ~0 : fui(1.0f);
consts->UniformBooleanTrue = consts->NativeIntegers ? ~0U : fui(1.0f);
/* Below are the cases which cannot be moved into tables easily. */

View File

@ -1797,7 +1797,8 @@ st_choose_format(struct st_context *st, GLenum internalFormat,
unsigned bindings, boolean allow_dxt)
{
struct pipe_screen *screen = st->pipe->screen;
int i, j;
unsigned i;
int j;
enum pipe_format pf;
#ifdef DEBUG

View File

@ -685,7 +685,7 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
if (attribs->major > 1 || attribs->minor > 0) {
/* Is the actual version less than the requested version?
*/
if (st->ctx->Version < attribs->major * 10 + attribs->minor) {
if (st->ctx->Version < attribs->major * 10U + attribs->minor) {
*error = ST_CONTEXT_ERROR_BAD_VERSION;
st_destroy_context(st);
return NULL;

View File

@ -1095,7 +1095,7 @@ st_translate_geometry_program(struct st_context *st,
/* find max output slot referenced to compute gs_num_outputs */
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
if (outputMapping[attr] != ~0 && outputMapping[attr] > maxSlot)
if (outputMapping[attr] != ~0U && outputMapping[attr] > maxSlot)
maxSlot = outputMapping[attr];
}
gs_num_outputs = maxSlot + 1;

View File

@ -300,7 +300,8 @@ check_draw_elements_data(struct gl_context *ctx, GLsizei count, GLenum elemType,
{
struct gl_vertex_array_object *vao = ctx->Array.VAO;
const void *elemMap;
GLint i, k;
GLint i;
GLuint k;
if (_mesa_is_bufferobj(ctx->Array.VAO->IndexBufferObj)) {
elemMap = ctx->Driver.MapBufferRange(ctx, 0,

View File

@ -232,7 +232,7 @@ hash_table_insert(struct hash_table *ht, uint32_t hash,
const void *key, void *data);
static void
_mesa_hash_table_rehash(struct hash_table *ht, int new_size_index)
_mesa_hash_table_rehash(struct hash_table *ht, unsigned new_size_index)
{
struct hash_table old_ht;
struct hash_entry *table, *entry;

View File

@ -207,7 +207,7 @@ static struct set_entry *
set_add(struct set *ht, uint32_t hash, const void *key);
static void
set_rehash(struct set *ht, int new_size_index)
set_rehash(struct set *ht, unsigned new_size_index)
{
struct set old_ht;
struct set_entry *table, *entry;