From a760ccf6d8a1f94d505b4c211ff4c30bc1d325a8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 3 Dec 2004 15:24:34 +0000 Subject: silence a variety of warnings found with g++ 3.4.2 --- src/mesa/main/blend.c | 6 ++++-- src/mesa/main/buffers.c | 10 +++++----- src/mesa/main/context.c | 2 +- src/mesa/main/image.c | 4 ++-- src/mesa/main/texcompress_fxt1.c | 18 ++++++++++-------- src/mesa/main/texstore.c | 8 ++++---- 6 files changed, 26 insertions(+), 22 deletions(-) (limited to 'src/mesa/main') diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 0257528581..8fadef61b4 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -219,7 +219,7 @@ static GLboolean _mesa_validate_blend_equation( GLcontext *ctx, GLenum mode, GLboolean is_separate ) { - switch (mode) { + switch (mode) { case GL_FUNC_ADD: break; case GL_MIN: @@ -286,6 +286,7 @@ _mesa_BlendEquation( GLenum mode ) (*ctx->Driver.BlendEquationSeparate)( ctx, mode, mode ); } + void GLAPIENTRY _mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ) { @@ -527,6 +528,7 @@ _mesa_ColorMask( GLboolean red, GLboolean green, ctx->Driver.ColorMask( ctx, red, green, blue, alpha ); } + /**********************************************************************/ /** \name Initialization */ /*@{*/ @@ -542,7 +544,7 @@ _mesa_ColorMask( GLboolean red, GLboolean green, void _mesa_init_color( GLcontext * ctx ) { /* Color buffer group */ - ctx->Color.IndexMask = 0xffffffff; + ctx->Color.IndexMask = ~0u; ctx->Color.ColorMask[0] = 0xff; ctx->Color.ColorMask[1] = 0xff; ctx->Color.ColorMask[2] = 0xff; diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 35e03d7eb5..3415a2b9b5 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -173,7 +173,7 @@ static GLuint supported_buffer_bitmask(const GLcontext *ctx) { GLuint mask = DD_FRONT_LEFT_BIT; /* always have this */ - GLuint i; + GLint i; if (ctx->Visual.stereoMode) { mask |= DD_FRONT_RIGHT_BIT; @@ -305,7 +305,7 @@ _mesa_DrawBuffer( GLenum mode ) * Do error checking and compute the _DrawDestMask bitfield. */ destMask = draw_buffer_enum_to_bitmask(mode); - if (destMask == ~0) { + if (destMask == ~0u) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffer(mode)"); return; } @@ -342,7 +342,7 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - if (n < 1 || n > ctx->Const.MaxDrawBuffers) { + if (n < 1 || n > (GLsizei) ctx->Const.MaxDrawBuffers) { _mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)" ); return; } @@ -351,7 +351,7 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) usedBufferMask = 0; for (i = 0; i < n; i++) { GLuint destMask = draw_buffer_enum_to_bitmask(buffers[i]); - if (destMask == ~0) { + if (destMask == ~0u ) { _mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffersARB(buffer)"); return; } @@ -406,7 +406,7 @@ _mesa_ReadBuffer( GLenum mode ) _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(mode)); srcMask = read_buffer_enum_to_bitmask(mode); - if (srcMask == ~0) { + if (srcMask == ~0u) { _mesa_error(ctx, GL_INVALID_ENUM, "glReadBuffer(mode)"); return; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 2423b68ddc..3116cb95a1 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1424,7 +1424,7 @@ alloc_dispatch_table(void) (struct _glapi_table *) _mesa_malloc(numEntries * sizeof(_glapi_proc)); if (table) { _glapi_proc *entry = (_glapi_proc *) table; - GLuint i; + GLint i; for (i = 0; i < numEntries; i++) { entry[i] = (_glapi_proc) generic_nop; } diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 5e65bf6f8e..12f8352c2d 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -4177,7 +4177,7 @@ _mesa_clip_readpixels(const GLcontext *ctx, *srcX = 0; } /* right clipping */ - if (*srcX + *width > buffer->Width) + if (*srcX + *width > (GLsizei) buffer->Width) *width -= (*srcX + *width - buffer->Width); if (*width <= 0) @@ -4190,7 +4190,7 @@ _mesa_clip_readpixels(const GLcontext *ctx, *srcY = 0; } /* top clipping */ - if (*srcY + *height > buffer->Height) + if (*srcY + *height > (GLsizei) buffer->Height) *height -= (*srcY + *height - buffer->Height); if (*height <= 0) diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index b3707fcffc..2939251407 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -287,7 +287,7 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { #define ISTBLACK(v) (*((unsigned long *)(v)) == 0) -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__cplusplus) #define FX64_NATIVE 1 @@ -1007,7 +1007,7 @@ fxt1_quantize_MIXED1 (unsigned long *cc, /* left microtile */ if (maxColL == -1) { /* all transparent black */ - cc[0] = -1; + cc[0] = ~0ul; for (i = 0; i < n_comp; i++) { vec[0][i] = 0; vec[1][i] = 0; @@ -1041,7 +1041,7 @@ fxt1_quantize_MIXED1 (unsigned long *cc, /* right microtile */ if (maxColR == -1) { /* all transparent black */ - cc[1] = -1; + cc[1] = ~0ul; for (i = 0; i < n_comp; i++) { vec[2][i] = 0; vec[3][i] = 0; @@ -1328,7 +1328,7 @@ fxt1_quantize (unsigned long *cc, const unsigned char *lines[], int comps) if (trualpha) { fxt1_quantize_ALPHA1(cc, input); } else if (l == 0) { - cc[0] = cc[1] = cc[2] = -1; + cc[0] = cc[1] = cc[2] = ~0ul; cc[3] = 0; } else if (l < N_TEXELS) { fxt1_quantize_MIXED1(cc, input); @@ -1349,23 +1349,25 @@ fxt1_encode (unsigned int width, unsigned int height, int comps, { unsigned int x, y; const unsigned char *data; - unsigned long *encoded = dest; + unsigned long *encoded = (unsigned long *) dest; unsigned char *newSource = NULL; /* Replicate image if width is not M8 or height is not M4 */ if ((width & 7) | (height & 3)) { int newWidth = (width + 7) & ~7; int newHeight = (height + 3) & ~3; - newSource = malloc(comps * newWidth * newHeight * sizeof(unsigned char *)); + newSource = (unsigned char *) + _mesa_malloc(comps * newWidth * newHeight * sizeof(unsigned char *)); _mesa_upscale_teximage2d(width, height, newWidth, newHeight, - comps, source, srcRowStride, newSource); + comps, (const GLchan *) source, + srcRowStride, newSource); source = newSource; width = newWidth; height = newHeight; srcRowStride = comps * newWidth; } - data = source; + data = (const unsigned char *) source; destRowStride = (destRowStride - width * 2) / 4; for (y = 0; y < height; y += 4) { unsigned int offs = 0 + (y + 0) * srcRowStride; diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index ef0a14e578..dd1fcef059 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1832,8 +1832,8 @@ validate_pbo_teximage(GLcontext *ctx, GLuint dimensions, return NULL; } - buf = ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, unpack->BufferObj); + buf = (GLubyte *) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, unpack->BufferObj); if (!buf) { _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped"); return NULL; @@ -1869,8 +1869,8 @@ validate_pbo_compressed_teximage(GLcontext *ctx, return NULL; } - buf = ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, - GL_READ_ONLY_ARB, packing->BufferObj); + buf = (GLubyte*) ctx->Driver.MapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, + GL_READ_ONLY_ARB, packing->BufferObj); if (!buf) { _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped"); return NULL; -- cgit v1.2.3