From 8236a534b7c31b5d3b688323de05cfa5e446f70d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 25 Nov 2003 16:39:31 +0000 Subject: [PATCH] fix assorted g++ warnings --- src/mesa/main/program.c | 2 +- src/mesa/main/program.h | 12 ++++++------ src/mesa/swrast_setup/ss_tritmp.h | 12 ++++++------ src/mesa/swrast_setup/ss_vbtmp.h | 2 +- src/mesa/tnl/t_save_api.c | 36 ++++++++++++++++++------------------ src/mesa/tnl/t_save_loopback.c | 3 ++- src/mesa/tnl/t_save_playback.c | 4 ++-- src/mesa/tnl/t_vb_render.c | 2 +- src/mesa/tnl/t_vtx_api.c | 22 +++++++++++----------- src/mesa/tnl/t_vtx_exec.c | 4 ++-- 10 files changed, 50 insertions(+), 49 deletions(-) diff --git a/src/mesa/main/program.c b/src/mesa/main/program.c index 546c0540032..9a081ece203 100644 --- a/src/mesa/main/program.c +++ b/src/mesa/main/program.c @@ -345,7 +345,7 @@ _mesa_add_state_reference(struct program_parameter_list *paramList, idx = add_parameter(paramList, "Some State", NULL, STATE); for (a=0; a<6; a++) - paramList->Parameters[idx].StateIndexes[a] = stateTokens[a]; + paramList->Parameters[idx].StateIndexes[a] = (enum state_index) stateTokens[a]; return idx; } diff --git a/src/mesa/main/program.h b/src/mesa/main/program.h index 23807746a6a..3c2aa1cdac6 100644 --- a/src/mesa/main/program.h +++ b/src/mesa/main/program.h @@ -116,15 +116,15 @@ enum state_index { STATE_TEXGEN_OBJECT_R, STATE_TEXGEN_OBJECT_Q, - STATE_TEXENV_COLOR, + STATE_TEXENV_COLOR, - STATE_DEPTH_RANGE, + STATE_DEPTH_RANGE, - STATE_VERTEX_PROGRAM, - STATE_FRAGMENT_PROGRAM, + STATE_VERTEX_PROGRAM, + STATE_FRAGMENT_PROGRAM, - STATE_ENV, - STATE_LOCAL + STATE_ENV, + STATE_LOCAL }; diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index 85234ce73e1..f977d7aca94 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -74,9 +74,9 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } } else { GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data; - SS_IND(v[0]->index, vbindex[e0]); - SS_IND(v[1]->index, vbindex[e1]); - SS_IND(v[2]->index, vbindex[e2]); + SS_IND(v[0]->index, (GLuint) vbindex[e0]); + SS_IND(v[1]->index, (GLuint) vbindex[e1]); + SS_IND(v[2]->index, (GLuint) vbindex[e2]); } } } @@ -149,9 +149,9 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } } else { GLfloat *vbindex = (GLfloat *)VB->IndexPtr[0]->data; - SS_IND(v[0]->index, vbindex[e0]); - SS_IND(v[1]->index, vbindex[e1]); - SS_IND(v[2]->index, vbindex[e2]); + SS_IND(v[0]->index, (GLuint) vbindex[e0]); + SS_IND(v[1]->index, (GLuint) vbindex[e1]); + SS_IND(v[2]->index, (GLuint) vbindex[e2]); } } } diff --git a/src/mesa/swrast_setup/ss_vbtmp.h b/src/mesa/swrast_setup/ss_vbtmp.h index 61956f25cee..d72a6693d65 100644 --- a/src/mesa/swrast_setup/ss_vbtmp.h +++ b/src/mesa/swrast_setup/ss_vbtmp.h @@ -137,7 +137,7 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end, } if (IND & INDEX) { - v->index = index[0]; + v->index = (GLuint) index[0]; STRIDE_F(index, index_stride); } diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c index 0a7e31e2ad7..1fe2ff6d442 100644 --- a/src/mesa/tnl/t_save_api.c +++ b/src/mesa/tnl/t_save_api.c @@ -160,7 +160,7 @@ build_normal_lengths( struct tnl_vertex_list *node ) GLuint stride = node->vertex_size; GLuint count = node->count; - len = node->normal_lengths = MALLOC( count * sizeof(GLfloat) ); + len = node->normal_lengths = (GLfloat *) MALLOC( count * sizeof(GLfloat) ); if (!len) return; @@ -177,7 +177,7 @@ build_normal_lengths( struct tnl_vertex_list *node ) static struct tnl_vertex_store *alloc_vertex_store( GLcontext *ctx ) { - struct tnl_vertex_store *store = MALLOC( sizeof(*store) ); + struct tnl_vertex_store *store = MALLOC_STRUCT(tnl_vertex_store); store->used = 0; store->refcount = 1; return store; @@ -185,7 +185,7 @@ static struct tnl_vertex_store *alloc_vertex_store( GLcontext *ctx ) static struct tnl_primitive_store *alloc_prim_store( GLcontext *ctx ) { - struct tnl_primitive_store *store = MALLOC( sizeof(*store) ); + struct tnl_primitive_store *store = MALLOC_STRUCT(tnl_primitive_store); store->used = 0; store->refcount = 1; return store; @@ -307,7 +307,7 @@ static void _save_wrap_buffers( GLcontext *ctx ) GLint i = tnl->save.prim_count - 1; GLenum mode; - assert(i < tnl->save.prim_max); + assert(i < (GLint) tnl->save.prim_max); assert(i >= 0); /* Close off in-progress primitive. @@ -337,7 +337,7 @@ static void _save_wrap_filled_vertex( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLfloat *data = tnl->save.copied.buffer; - int i; + GLuint i; /* Emit a glEnd to close off the last vertex list. */ @@ -467,7 +467,7 @@ static void _save_upgrade_vertex( GLcontext *ctx, { GLfloat *data = tnl->save.copied.buffer; GLfloat *dest = tnl->save.buffer; - GLint j; + GLuint j; /* Need to note this and fix up at runtime (or loopback): */ @@ -578,7 +578,7 @@ static void save_attrib_##ATTR##_##N( const GLfloat *v ) \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ \ if ((ATTR) == 0) { \ - int i; \ + GLuint i; \ \ if (N>0) tnl->save.vbptr[0] = v[0]; \ if (N>1) tnl->save.vbptr[1] = v[1]; \ @@ -905,7 +905,7 @@ static void _save_MultiTexCoord4fv( GLenum target, const GLfloat *v ) static void _save_VertexAttrib1fNV( GLuint index, GLfloat x ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR1F( index, x ); else enum_error(); @@ -913,7 +913,7 @@ static void _save_VertexAttrib1fNV( GLuint index, GLfloat x ) static void _save_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR1FV( index, v ); else enum_error(); @@ -921,7 +921,7 @@ static void _save_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) static void _save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR2F( index, x, y ); else enum_error(); @@ -929,7 +929,7 @@ static void _save_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) static void _save_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR2FV( index, v ); else enum_error(); @@ -938,7 +938,7 @@ static void _save_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) static void _save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR3F( index, x, y, z ); else enum_error(); @@ -946,7 +946,7 @@ static void _save_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, static void _save_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR3FV( index, v ); else enum_error(); @@ -955,7 +955,7 @@ static void _save_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) static void _save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR4F( index, x, y, z, w ); else enum_error(); @@ -963,7 +963,7 @@ static void _save_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, static void _save_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR4FV( index, v ); else enum_error(); @@ -1173,7 +1173,7 @@ static GLboolean _save_NotifyBegin( GLcontext *ctx, GLenum mode ) TNLcontext *tnl = TNL_CONTEXT(ctx); if (1) { - int i = tnl->save.prim_count++; + GLuint i = tnl->save.prim_count++; assert(i < tnl->save.prim_max); tnl->save.prim[i].mode = mode | PRIM_BEGIN; @@ -1194,14 +1194,14 @@ static void _save_End( void ) { GET_CURRENT_CONTEXT( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); - int i = tnl->save.prim_count - 1; + GLint i = tnl->save.prim_count - 1; ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; tnl->save.prim[i].mode |= PRIM_END; tnl->save.prim[i].count = ((tnl->save.initial_counter - tnl->save.counter) - tnl->save.prim[i].start); - if (i == tnl->save.prim_max - 1) { + if (i == (GLint) tnl->save.prim_max - 1) { _save_compile_vertex_list( ctx ); assert(tnl->save.copied.nr == 0); } diff --git a/src/mesa/tnl/t_save_loopback.c b/src/mesa/tnl/t_save_loopback.c index b496a784c35..4e299f6b631 100644 --- a/src/mesa/tnl/t_save_loopback.c +++ b/src/mesa/tnl/t_save_loopback.c @@ -189,7 +189,8 @@ static void loopback_prim( GLcontext *ctx, GLint begin = prim->start; GLint end = begin + prim->count; GLfloat *data; - GLint j, k; + GLint j; + GLuint k; if (prim->mode & PRIM_BEGIN) { glBegin( prim->mode & PRIM_MODE_MASK ); diff --git a/src/mesa/tnl/t_save_playback.c b/src/mesa/tnl/t_save_playback.c index 4669e4b32c9..27fe2fe1626 100644 --- a/src/mesa/tnl/t_save_playback.c +++ b/src/mesa/tnl/t_save_playback.c @@ -179,7 +179,7 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data ) * includes operations such as glBegin or glDrawArrays. */ _mesa_error( ctx, GL_INVALID_OPERATION, "displaylist recursive begin"); - _tnl_loopback_vertex_list( ctx, data ); + _tnl_loopback_vertex_list( ctx, (struct tnl_vertex_list *) data ); return; } else if (tnl->LoopbackDListCassettes || @@ -189,7 +189,7 @@ void _tnl_playback_vertex_list( GLcontext *ctx, void *data ) */ _mesa_debug(ctx, "tnl_playback_vertex_list: loopback dangling attr ref\n"); - _tnl_loopback_vertex_list( ctx, data ); + _tnl_loopback_vertex_list( ctx, (struct tnl_vertex_list *) data ); return; } diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c index ec0d11bf84c..fb3a8f693c2 100644 --- a/src/mesa/tnl/t_vb_render.c +++ b/src/mesa/tnl/t_vb_render.c @@ -304,7 +304,7 @@ static GLboolean run_render( GLcontext *ctx, do { - GLint i; + GLuint i; for (i = 0 ; i < VB->PrimitiveCount ; i++) { diff --git a/src/mesa/tnl/t_vtx_api.c b/src/mesa/tnl/t_vtx_api.c index d834a1407a2..73849a4dc50 100644 --- a/src/mesa/tnl/t_vtx_api.c +++ b/src/mesa/tnl/t_vtx_api.c @@ -80,7 +80,7 @@ static void _tnl_wrap_filled_vertex( GLcontext *ctx ) { TNLcontext *tnl = TNL_CONTEXT(ctx); GLfloat *data = tnl->vtx.copied.buffer; - int i; + GLuint i; /* Run pipeline on current vertices, copy wrapped vertices * to tnl->copied. @@ -167,7 +167,7 @@ static void _tnl_wrap_upgrade_vertex( GLcontext *ctx, { TNLcontext *tnl = TNL_CONTEXT(ctx); GLuint oldsz; - GLint i; + GLuint i; GLfloat *tmp; GLint lastcount = tnl->vtx.initial_counter - tnl->vtx.counter; @@ -344,7 +344,7 @@ static void attrib_##ATTR##_##N( const GLfloat *v ) \ TNLcontext *tnl = TNL_CONTEXT(ctx); \ \ if ((ATTR) == 0) { \ - int i; \ + GLuint i; \ \ if (N>0) tnl->vtx.vbptr[0] = v[0]; \ if (N>1) tnl->vtx.vbptr[1] = v[1]; \ @@ -670,7 +670,7 @@ static void _tnl_MultiTexCoord4fv( GLenum target, const GLfloat *v ) static void _tnl_VertexAttrib1fNV( GLuint index, GLfloat x ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR1F( index, x ); else enum_error(); @@ -678,7 +678,7 @@ static void _tnl_VertexAttrib1fNV( GLuint index, GLfloat x ) static void _tnl_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR1FV( index, v ); else enum_error(); @@ -686,7 +686,7 @@ static void _tnl_VertexAttrib1fvNV( GLuint index, const GLfloat *v ) static void _tnl_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR2F( index, x, y ); else enum_error(); @@ -694,7 +694,7 @@ static void _tnl_VertexAttrib2fNV( GLuint index, GLfloat x, GLfloat y ) static void _tnl_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR2FV( index, v ); else enum_error(); @@ -703,7 +703,7 @@ static void _tnl_VertexAttrib2fvNV( GLuint index, const GLfloat *v ) static void _tnl_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR3F( index, x, y, z ); else enum_error(); @@ -711,7 +711,7 @@ static void _tnl_VertexAttrib3fNV( GLuint index, GLfloat x, GLfloat y, static void _tnl_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR3FV( index, v ); else enum_error(); @@ -720,7 +720,7 @@ static void _tnl_VertexAttrib3fvNV( GLuint index, const GLfloat *v ) static void _tnl_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR4F( index, x, y, z, w ); else enum_error(); @@ -728,7 +728,7 @@ static void _tnl_VertexAttrib4fNV( GLuint index, GLfloat x, GLfloat y, static void _tnl_VertexAttrib4fvNV( GLuint index, const GLfloat *v ) { - if (index >= VERT_ATTRIB_POS && index < VERT_ATTRIB_MAX) + if (index < VERT_ATTRIB_MAX) DISPATCH_ATTR4FV( index, v ); else enum_error(); diff --git a/src/mesa/tnl/t_vtx_exec.c b/src/mesa/tnl/t_vtx_exec.c index 5215e1d6fb3..06879bdc2c8 100644 --- a/src/mesa/tnl/t_vtx_exec.c +++ b/src/mesa/tnl/t_vtx_exec.c @@ -67,7 +67,7 @@ GLboolean *_tnl_translate_edgeflag( GLcontext *ctx, const GLfloat *data, GLuint i; if (!ef) - ef = tnl->vtx.edgeflag_tmp = MALLOC( tnl->vb.Size ); + ef = tnl->vtx.edgeflag_tmp = (GLboolean *) MALLOC( tnl->vb.Size ); for (i = 0 ; i < count ; i++, data += stride) ef[i] = (data[0] == 1.0); @@ -85,7 +85,7 @@ GLboolean *_tnl_import_current_edgeflag( GLcontext *ctx, GLuint i; if (!ef) - ef = tnl->vtx.edgeflag_tmp = MALLOC( tnl->vb.Size ); + ef = tnl->vtx.edgeflag_tmp = (GLboolean *) MALLOC( tnl->vb.Size ); for (i = 0 ; i < count ; i++) ef[i] = tmp; -- 2.11.0