summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorKarl Schultz <[email protected]>2010-02-13 17:31:58 -0700
committerKarl Schultz <[email protected]>2010-02-13 17:34:04 -0700
commitb30898f4ab533085d97a33638ad0a1cf9ddb1d67 (patch)
tree7c27558e2905da625b75060628967d3d52fe6728 /src/mesa/main
parent5fd2b46a20321d8600d6256bff17ec3ebc9cb510 (diff)
mesa: Fix compiler warnings
Add explicit casts, fix constant types, fix variable types. Fixes about 340 warnings in MSFT Visual Studio.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/clear.c18
-rw-r--r--src/mesa/main/image.c8
-rw-r--r--src/mesa/main/macros.h4
-rw-r--r--src/mesa/main/texgetimage.c4
4 files changed, 17 insertions, 17 deletions
diff --git a/src/mesa/main/clear.c b/src/mesa/main/clear.c
index 4a3c1116586..8085bedf1c1 100644
--- a/src/mesa/main/clear.c
+++ b/src/mesa/main/clear.c
@@ -236,7 +236,7 @@ make_color_buffer_mask(GLcontext *ctx, GLint drawbuffer)
mask |= BUFFER_BIT_BACK_RIGHT;
break;
default:
- if (drawbuffer < 0 || drawbuffer >= ctx->Const.MaxDrawBuffers) {
+ if (drawbuffer < 0 || drawbuffer >= (GLint)ctx->Const.MaxDrawBuffers) {
mask = INVALID_MASK;
}
else if (att[BUFFER_COLOR0 + drawbuffer].Renderbuffer) {
@@ -306,11 +306,11 @@ _mesa_ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
* floating point state var. This will not always work. We'll
* need a new ctx->Driver.ClearBuffer() hook....
*/
- GLfloat clearSave[4];
+ GLclampf clearSave[4];
/* save color */
COPY_4V(clearSave, ctx->Color.ClearColor);
/* set color */
- COPY_4V(ctx->Color.ClearColor, value);
+ COPY_4V_CAST(ctx->Color.ClearColor, value, GLclampf);
if (ctx->Driver.ClearColor)
ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
/* clear buffer(s) */
@@ -365,11 +365,11 @@ _mesa_ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
* floating point state var. This will not always work. We'll
* need a new ctx->Driver.ClearBuffer() hook....
*/
- GLfloat clearSave[4];
+ GLclampf clearSave[4];
/* save color */
COPY_4V(clearSave, ctx->Color.ClearColor);
/* set color */
- COPY_4V(ctx->Color.ClearColor, value);
+ COPY_4V_CAST(ctx->Color.ClearColor, value, GLclampf);
if (ctx->Driver.ClearColor)
ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
/* clear buffer(s) */
@@ -423,7 +423,7 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
* XXX in the future we may have a new ctx->Driver.ClearBuffer()
* hook instead.
*/
- const GLfloat clearSave = ctx->Depth.Clear;
+ const GLclampd clearSave = ctx->Depth.Clear;
ctx->Depth.Clear = *value;
if (ctx->Driver.ClearDepth)
ctx->Driver.ClearDepth(ctx, *value);
@@ -443,11 +443,11 @@ _mesa_ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
return;
}
else if (mask) {
- GLfloat clearSave[4];
+ GLclampf clearSave[4];
/* save color */
COPY_4V(clearSave, ctx->Color.ClearColor);
/* set color */
- COPY_4V(ctx->Color.ClearColor, value);
+ COPY_4V_CAST(ctx->Color.ClearColor, value, GLclampf);
if (ctx->Driver.ClearColor)
ctx->Driver.ClearColor(ctx, ctx->Color.ClearColor);
/* clear buffer(s) */
@@ -503,7 +503,7 @@ _mesa_ClearBufferfi(GLenum buffer, GLint drawbuffer,
{
/* save current clear values */
- const GLfloat clearDepthSave = ctx->Depth.Clear;
+ const GLclampd clearDepthSave = ctx->Depth.Clear;
const GLuint clearStencilSave = ctx->Stencil.Clear;
/* set new clear values */
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 81993e7063b..468f2a9b214 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -5662,7 +5662,7 @@ clip_right_or_top(GLint *srcX0, GLint *srcX1,
/* chop off [t, 1] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX1 = maxValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5;
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
*srcX1 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias);
}
else if (*dstX0 > maxValue) {
@@ -5672,7 +5672,7 @@ clip_right_or_top(GLint *srcX0, GLint *srcX1,
/* chop off [t, 1] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX0 = maxValue;
- bias = (*srcX0 < *srcX1) ? -0.5 : 0.5;
+ bias = (*srcX0 < *srcX1) ? -0.5F : 0.5F;
*srcX0 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias);
}
}
@@ -5695,7 +5695,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX0 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5; /* flipped??? */
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F; /* flipped??? */
*srcX0 = *srcX0 + (GLint) (t * (*srcX1 - *srcX0) + bias);
}
else if (*dstX1 < minValue) {
@@ -5705,7 +5705,7 @@ clip_left_or_bottom(GLint *srcX0, GLint *srcX1,
/* chop off [0, t] part */
ASSERT(t >= 0.0 && t <= 1.0);
*dstX1 = minValue;
- bias = (*srcX0 < *srcX1) ? 0.5 : -0.5;
+ bias = (*srcX0 < *srcX1) ? 0.5F : -0.5F;
*srcX1 = *srcX1 + (GLint) (t * (*srcX0 - *srcX1) + bias);
}
}
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 55578adf836..38a97fdb18c 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -83,14 +83,14 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256];
/** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */
-#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0))
+#define UINT_TO_FLOAT(U) ((GLfloat) ((U) * (1.0F / 4294967295.0)))
/** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */
#define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0))
/** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */
-#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0))
+#define INT_TO_FLOAT(I) ((GLfloat) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0)))
/** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */
/* causes overflow:
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 66d01c15d04..6b3355a7ecd 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -590,7 +590,7 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+ const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
GLenum baseFormat;
if (maxLevels == 0) {
@@ -776,7 +776,7 @@ getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level,
{
struct gl_texture_object *texObj;
struct gl_texture_image *texImage;
- const GLuint maxLevels = _mesa_max_texture_levels(ctx, target);
+ const GLint maxLevels = _mesa_max_texture_levels(ctx, target);
if (maxLevels == 0) {
_mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)",