From bd997cd11fd30908fe35bacd5bfb0c2dd5fdde30 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 20 Jul 2004 21:12:56 +0000 Subject: fix compare w/ zero warnings (bug #988766) --- src/mesa/shader/arbprogparse.c | 20 ++++++++++++-------- src/mesa/shader/grammar.c | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index de449fe0980..718162fd23d 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -801,9 +801,9 @@ static GLuint parse_generic_attrib_num(GLcontext *ctx, GLubyte ** inst, struct arb_program *Program, GLuint *attrib) { - *attrib = parse_integer(inst, Program); + GLint i = parse_integer(inst, Program); - if ((*attrib < 0) || (*attrib > MAX_VERTEX_PROGRAM_ATTRIBS)) + if ((i < 0) || (i > MAX_VERTEX_PROGRAM_ATTRIBS)) { _mesa_set_program_error (ctx, Program->Position, "Invalid generic vertex attribute index"); @@ -812,6 +812,8 @@ parse_generic_attrib_num(GLcontext *ctx, GLubyte ** inst, return 1; } + *attrib = (GLuint) i; + return 0; } @@ -824,15 +826,16 @@ static GLuint parse_texcoord_num (GLcontext * ctx, GLubyte ** inst, struct arb_program *Program, GLuint * coord) { - *coord = parse_integer (inst, Program); + GLint i = parse_integer (inst, Program); - if ((*coord < 0) || (*coord >= ctx->Const.MaxTextureUnits)) { + if ((i < 0) || (i >= ctx->Const.MaxTextureUnits)) { _mesa_set_program_error (ctx, Program->Position, "Invalid texture unit index"); _mesa_error (ctx, GL_INVALID_OPERATION, "Invalid texture unit index"); return 1; } + *coord = (GLuint) i; return 0; } @@ -1833,7 +1836,8 @@ static GLuint parse_param (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, struct arb_program *Program) { - GLuint found, specified_length, err; + GLuint found, err; + GLint specified_length; char *error_msg; struct var_cache *param_var; @@ -2435,7 +2439,8 @@ parse_src_reg (GLcontext * ctx, GLubyte ** inst, struct var_cache **vc_head, GLboolean *IsRelOffset ) { struct var_cache *src; - GLuint binding_state, binding_idx, is_generic, found, offset; + GLuint binding_state, binding_idx, is_generic, found; + GLint offset; /* And the binding for the src */ switch (*(*inst)++) { @@ -3861,7 +3866,6 @@ _mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len, grammar_get_last_error ((GLubyte *) error_msg, 300, &error_pos); _mesa_set_program_error (ctx, error_pos, error_msg); _mesa_error (ctx, GL_INVALID_OPERATION, "Parse Error"); - grammar_destroy (arbprogram_syn_id); return 1; } @@ -3903,7 +3907,7 @@ _mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len, /* Check the grammer rev */ if (*inst++ != REVISION) { _mesa_set_program_error (ctx, 0, "Grammar version mismatch"); - _mesa_error (ctx, GL_INVALID_OPERATION, "Grammar verison mismatch"); + _mesa_error (ctx, GL_INVALID_OPERATION, "Grammar version mismatch"); err = 1; } else { diff --git a/src/mesa/shader/grammar.c b/src/mesa/shader/grammar.c index 98ccbb1a332..af824f33843 100644 --- a/src/mesa/shader/grammar.c +++ b/src/mesa/shader/grammar.c @@ -2754,7 +2754,7 @@ int grammar_destroy (grammar id) void grammar_get_last_error (byte *text, unsigned int size, int *pos) { - unsigned int len = 0, dots_made = 0; + int len = 0, dots_made = 0; const byte *p = error_message; *text = '\0'; -- cgit v1.2.3