fix compare w/ zero warnings (bug #988766)
authorBrian Paul <brian.paul@tungstengraphics.com>
Tue, 20 Jul 2004 21:12:56 +0000 (21:12 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Tue, 20 Jul 2004 21:12:56 +0000 (21:12 +0000)
src/mesa/shader/arbprogparse.c
src/mesa/shader/grammar.c

index de449fe..718162f 100644 (file)
@@ -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 {
index 98ccbb1..af824f3 100644 (file)
@@ -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';