From: Karl Schultz Date: Fri, 18 Oct 2002 17:02:00 +0000 (+0000) Subject: Add casts to quiet compiler warnings. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8eaa2902162e145cd07a9427ec99ab0ca85aa35a;p=mesa.git Add casts to quiet compiler warnings. --- diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 37f4f16f268..4fc93936ac8 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -1,4 +1,4 @@ -/* $Id: macros.h,v 1.29 2002/07/09 01:22:50 brianp Exp $ */ +/* $Id: macros.h,v 1.30 2002/10/18 17:02:00 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -113,6 +113,27 @@ do { \ (DST)[3] = (SRC)[3]; \ } while (0) +#define COPY_2V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ +} while (0) + +#define COPY_3V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ + (DST)[2] = (CAST)(SRC)[2]; \ +} while (0) + +#define COPY_4V_CAST( DST, SRC, CAST ) \ +do { \ + (DST)[0] = (CAST)(SRC)[0]; \ + (DST)[1] = (CAST)(SRC)[1]; \ + (DST)[2] = (CAST)(SRC)[2]; \ + (DST)[3] = (CAST)(SRC)[3]; \ +} while (0) + #if defined(__i386__) #define COPY_4UBV(DST, SRC) \ do { \ diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index 66796dff35b..ddcef4cd57d 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -1,4 +1,4 @@ -/* $Id: s_aatriangle.c,v 1.24 2002/06/15 03:03:11 brianp Exp $ */ +/* $Id: s_aatriangle.c,v 1.25 2002/10/18 17:02:01 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -361,8 +361,8 @@ compute_lambda(const GLfloat sPlane[4], const GLfloat tPlane[4], { const GLfloat s = solve_plane(cx, cy, sPlane); const GLfloat t = solve_plane(cx, cy, tPlane); - const GLfloat invQ_x1 = solve_plane_recip(cx+1.0, cy, qPlane); - const GLfloat invQ_y1 = solve_plane_recip(cx, cy+1.0, qPlane); + const GLfloat invQ_x1 = solve_plane_recip(cx+1.0F, cy, qPlane); + const GLfloat invQ_y1 = solve_plane_recip(cx, cy+1.0F, qPlane); const GLfloat s_x1 = s - sPlane[0] / sPlane[2]; const GLfloat s_y1 = s - sPlane[1] / sPlane[2]; const GLfloat t_x1 = t - tPlane[0] / tPlane[2]; diff --git a/src/mesa/swrast/s_alphabuf.c b/src/mesa/swrast/s_alphabuf.c index 4bf3368cb28..d68e6bf82b2 100644 --- a/src/mesa/swrast/s_alphabuf.c +++ b/src/mesa/swrast/s_alphabuf.c @@ -1,4 +1,4 @@ -/* $Id: s_alphabuf.c,v 1.13 2002/10/11 17:41:06 brianp Exp $ */ +/* $Id: s_alphabuf.c,v 1.14 2002/10/18 17:02:01 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -103,7 +103,7 @@ _mesa_alloc_alpha_buffers( GLframebuffer *buffer ) void _mesa_clear_alpha_buffers( GLcontext *ctx ) { - const GLchan aclear = ctx->Color.ClearColor[3]; + const GLchan aclear = (GLchan) ctx->Color.ClearColor[3]; GLuint bufferBit; ASSERT(ctx->DrawBuffer->UseSoftwareAlphaBuffers); diff --git a/src/mesa/swrast/s_pointtemp.h b/src/mesa/swrast/s_pointtemp.h index cf45dcde825..405e1f49243 100644 --- a/src/mesa/swrast/s_pointtemp.h +++ b/src/mesa/swrast/s_pointtemp.h @@ -1,4 +1,4 @@ -/* $Id: s_pointtemp.h,v 1.19 2002/10/04 17:37:47 brianp Exp $ */ +/* $Id: s_pointtemp.h,v 1.20 2002/10/18 17:02:01 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -117,7 +117,7 @@ NAME ( GLcontext *ctx, const SWvertex *vert ) for (u = 0; u < ctx->Const.MaxTextureUnits; u++) { if (ctx->Texture.Unit[u]._ReallyEnabled) { const GLfloat q = vert->texcoord[u][3]; - const GLfloat invQ = (q == 0.0 || q == 1.0) ? 1.0 : (1.0 / q); + const GLfloat invQ = (q == 0.0F || q == 1.0F) ? 1.0F : (1.0F / q); texcoord[u][0] = vert->texcoord[u][0] * invQ; texcoord[u][1] = vert->texcoord[u][1] * invQ; texcoord[u][2] = vert->texcoord[u][2] * invQ; diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index b415bf92e2e..db2e9e0df92 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -1,4 +1,4 @@ -/* $Id: s_texture.c,v 1.70 2002/10/18 13:40:59 brianp Exp $ */ +/* $Id: s_texture.c,v 1.71 2002/10/18 17:02:01 kschultz Exp $ */ /* * Mesa 3-D graphics library @@ -97,7 +97,7 @@ U = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \ else \ U = S - (GLfloat) flr; /* flr is even */ \ - U = (U * SIZE) - 0.5; \ + U = (U * SIZE) - 0.5F; \ I0 = IFLOOR(U); \ I1 = I0 + 1; \ if (I0 < 0) \ @@ -2154,10 +2154,14 @@ sample_linear_rect(GLcontext *ctx, GLuint texUnit, w11 = a * b ; /* compute weighted average of samples */ - rgba[i][0] = w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]; - rgba[i][1] = w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]; - rgba[i][2] = w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]; - rgba[i][3] = w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]; + rgba[i][0] = + (GLchan) (w00 * t00[0] + w10 * t10[0] + w01 * t01[0] + w11 * t11[0]); + rgba[i][1] = + (GLchan) (w00 * t00[1] + w10 * t10[1] + w01 * t01[1] + w11 * t11[1]); + rgba[i][2] = + (GLchan) (w00 * t00[2] + w10 * t10[2] + w01 * t01[2] + w11 * t11[2]); + rgba[i][3] = + (GLchan) (w00 * t00[3] + w10 * t10[3] + w01 * t01[3] + w11 * t11[3]); } }