From edf8c06270a0e62f33e3f45e1f0307acfeff3b5d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 14 Sep 2001 21:30:31 +0000 Subject: [PATCH] more warning fixes (Karl Schultz) --- src/mesa/tnl/t_context.h | 6 +++--- src/mesa/tnl/t_imm_dlist.c | 18 +++++++++--------- src/mesa/tnl/t_imm_elt.c | 10 +++++----- src/mesa/tnl/t_imm_eval.c | 4 ++-- src/mesa/tnl/t_vb_fog.c | 14 +++++++------- src/mesa/tnl/t_vb_lighttmp.h | 27 ++++++++++++--------------- 6 files changed, 38 insertions(+), 41 deletions(-) diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index afa7b3fe001..ed8eafe635d 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -1,4 +1,4 @@ -/* $Id: t_context.h,v 1.31 2001/08/01 05:10:42 keithw Exp $ */ +/* $Id: t_context.h,v 1.32 2001/09/14 21:30:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -104,8 +104,8 @@ /* Flags for IM->TexCoordSize. Enough flags for 16 units. */ -#define TEX_0_SIZE_3 0x1 -#define TEX_0_SIZE_4 0x1001 +#define TEX_0_SIZE_3 (GLuint) 0x1 +#define TEX_0_SIZE_4 (GLuint) 0x1001 #define TEX_SIZE_3(unit) (TEX_0_SIZE_3<Start; len = (GLfloat) LEN_3FV( data[0] ); - if (len > 0.0) len = 1.0/len; + if (len > 0.0F) len = 1.0F / len; for (i = 0 ; i < count ; ) { dest[i] = len; if (flags[++i] & VERT_NORM) { len = (GLfloat) LEN_3FV( data[i] ); - if (len > 0.0) len = 1.0/len; + if (len > 0.0F) len = 1.0F / len; } } } @@ -96,14 +96,14 @@ static void build_normal_lengths( struct immediate *IM ) static void fixup_normal_lengths( struct immediate *IM ) { GLuint i; - GLfloat len = 1.0; /* just to silence warnings */ + GLfloat len = 1.0F; /* just to silence warnings */ GLfloat (*data)[3] = IM->Normal; GLfloat *dest = IM->NormalLengthPtr; GLuint *flags = IM->Flag; for (i = IM->CopyStart ; i <= IM->Start ; i++) { len = (GLfloat) LEN_3FV( data[i] ); - if (len > 0.0) len = 1.0/len; + if (len > 0.0F) len = 1.0F / len; dest[i] = len; } @@ -638,13 +638,13 @@ static void loopback_compiled_cassette( GLcontext *ctx, struct immediate *IM ) vertex( IM->Obj[i] ); } else if (flags[i] & VERT_EVAL_C1) - glEvalCoord1f(IM->Obj[i][0]); + glEvalCoord1f( IM->Obj[i][0] ); else if (flags[i] & VERT_EVAL_P1) - glEvalPoint1(IM->Obj[i][0]); + glEvalPoint1( (GLint) IM->Obj[i][0] ); else if (flags[i] & VERT_EVAL_C2) - glEvalCoord2f( IM->Obj[i][0], IM->Obj[i][1]); + glEvalCoord2f( IM->Obj[i][0], IM->Obj[i][1] ); else if (flags[i] & VERT_EVAL_P2) - glEvalPoint2( IM->Obj[i][0], IM->Obj[i][1]); + glEvalPoint2( (GLint) IM->Obj[i][0], (GLint) IM->Obj[i][1] ); } if (prim & PRIM_END) { diff --git a/src/mesa/tnl/t_imm_elt.c b/src/mesa/tnl/t_imm_elt.c index 4a3c25f6430..0a891733e9a 100644 --- a/src/mesa/tnl/t_imm_elt.c +++ b/src/mesa/tnl/t_imm_elt.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_elt.c,v 1.11 2001/05/11 08:11:31 keithw Exp $ */ +/* $Id: t_imm_elt.c,v 1.12 2001/09/14 21:30:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -425,12 +425,12 @@ static trans_elt_4f_func _tnl_trans_elt_4f_tab[5][MAX_TYPES]; */ #define SRC GLdouble #define SRC_IDX TYPE_IDX(GL_DOUBLE) -#define TRX_3F(f,n) PTR_ELT(f,n) -#define TRX_4F(f,n) PTR_ELT(f,n) +#define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n) +#define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) #define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) #define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n)) -#define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) -#define TRX_1F(f,n) PTR_ELT(f,n) +#define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) +#define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n) #define SZ 4 diff --git a/src/mesa/tnl/t_imm_eval.c b/src/mesa/tnl/t_imm_eval.c index c25b03725af..d90884d9426 100644 --- a/src/mesa/tnl/t_imm_eval.c +++ b/src/mesa/tnl/t_imm_eval.c @@ -1,4 +1,4 @@ -/* $Id: t_imm_eval.c,v 1.17 2001/08/14 00:59:08 keithw Exp $ */ +/* $Id: t_imm_eval.c,v 1.18 2001/09/14 21:30:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -353,7 +353,7 @@ static void copy_4f_stride( GLfloat to[][4], GLfloat *from, static void copy_3f( GLfloat to[][3], GLfloat from[][3], GLuint count ) { - int i; + GLuint i; /* MEMCPY( to, from, (count) * sizeof(to[0])); */ for (i = 0 ; i < count ; i++) { /* fprintf(stderr, "copy norm %d from %p: %f %f %f\n", i, */ diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c index a4164f8072e..6fad9528cda 100644 --- a/src/mesa/tnl/t_vb_fog.c +++ b/src/mesa/tnl/t_vb_fog.c @@ -1,4 +1,4 @@ -/* $Id: t_vb_fog.c,v 1.11 2001/05/15 20:52:51 brianp Exp $ */ +/* $Id: t_vb_fog.c,v 1.12 2001/09/14 21:30:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -59,10 +59,10 @@ static GLfloat inited = 0; #if 1 #define NEG_EXP( result, narg ) \ do { \ - float f = (narg * (1.0/FOG_INCR)); \ - int k = (int) f; \ + GLfloat f = (GLfloat) (narg * (1.0/FOG_INCR)); \ + GLint k = (GLint) f; \ if (k > FOG_EXP_TABLE_SIZE-2) \ - result = EXP_FOG_MAX; \ + result = (GLfloat) EXP_FOG_MAX; \ else \ result = exp_table[k] + (f-k)*(exp_table[k+1]-exp_table[k]); \ } while (0) @@ -76,10 +76,10 @@ do { \ static void init_static_data( void ) { - float f = 0; - int i = 0; + GLfloat f = 0.0F; + GLint i = 0; for ( ; i < FOG_EXP_TABLE_SIZE ; i++, f += FOG_INCR) { - exp_table[i] = exp(-f); + exp_table[i] = (GLfloat) exp(-f); } inited = 1; } diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h index a60a140d50f..cb833e245d4 100644 --- a/src/mesa/tnl/t_vb_lighttmp.h +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -1,4 +1,4 @@ -/* $Id: t_vb_lighttmp.h,v 1.17 2001/08/13 22:17:19 keithw Exp $ */ +/* $Id: t_vb_lighttmp.h,v 1.18 2001/09/14 21:30:31 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -215,16 +215,15 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, continue; /* this light makes no contribution */ } else { - double x = PV_dot_dir * (EXP_TABLE_SIZE-1); - int k = (int) x; + GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); + GLint k = (GLint) x; GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] - + (x-k)*light->_SpotExpTable[k][1]); + + (x-k)*light->_SpotExpTable[k][1]); attenuation *= spot; } } } - if (attenuation < 1e-3) continue; /* this light makes no contribution */ @@ -405,7 +404,7 @@ static void TAG(light_rgba)( GLcontext *ctx, SUB_3V(VP, light->_Position, vertex); - d = LEN_3FV( VP ); + d = (GLfloat) LEN_3FV( VP ); if ( d > 1e-6) { GLfloat invd = 1.0F / d; @@ -424,20 +423,18 @@ static void TAG(light_rgba)( GLcontext *ctx, continue; /* this light makes no contribution */ } else { - double x = PV_dot_dir * (EXP_TABLE_SIZE-1); - int k = (int) x; - GLfloat spot = (light->_SpotExpTable[k][0] + GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); + GLint k = (GLint) x; + GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + (x-k)*light->_SpotExpTable[k][1]); attenuation *= spot; } } } - if (attenuation < 1e-3) continue; /* this light makes no contribution */ - /* Compute dot product or normal and vector from V to light pos */ n_dot_VP = DOT3( normal, VP ); @@ -880,7 +877,7 @@ static void TAG(light_ci)( GLcontext *ctx, SUB_3V(VP, light->_Position, vertex); - d = LEN_3FV( VP ); + d = (GLfloat) LEN_3FV( VP ); if ( d > 1e-6) { GLfloat invd = 1.0F / d; SELF_SCALE_SCALAR_3V(VP, invd); @@ -897,9 +894,9 @@ static void TAG(light_ci)( GLcontext *ctx, continue; /* this light makes no contribution */ } else { - double x = PV_dot_dir * (EXP_TABLE_SIZE-1); - int k = (int) x; - GLfloat spot = (light->_SpotExpTable[k][0] + GLdouble x = PV_dot_dir * (EXP_TABLE_SIZE-1); + GLint k = (GLint) x; + GLfloat spot = (GLfloat) (light->_SpotExpTable[k][0] + (x-k)*light->_SpotExpTable[k][1]); attenuation *= spot; } -- 2.30.2