diff options
author | Brian <[email protected]> | 2007-01-23 11:46:02 -0700 |
---|---|---|
committer | Brian <[email protected]> | 2007-01-23 11:46:02 -0700 |
commit | 18d1fdebebcb52e7fcf50e62c4c02862d173af51 (patch) | |
tree | 4b1ebe71f1c6e8a45278fcab30dacd4d859896a6 /src | |
parent | d46093b8d56f6d89b341d7437c5185ca6be597af (diff) |
fixes for C++ warnings/errors
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/x11/glxapi.c | 2 | ||||
-rw-r--r-- | src/mesa/main/colortab.c | 4 | ||||
-rw-r--r-- | src/mesa/main/dlist.c | 4 | ||||
-rw-r--r-- | src/mesa/main/texcompress_s3tc.c | 2 | ||||
-rw-r--r-- | src/mesa/main/texenvprogram.c | 5 | ||||
-rw-r--r-- | src/mesa/main/texobj.c | 6 | ||||
-rw-r--r-- | src/mesa/shader/arbprogram.c | 4 | ||||
-rw-r--r-- | src/mesa/shader/program.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_execute.c | 2 | ||||
-rw-r--r-- | src/mesa/swrast/s_copypix.c | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_depth.c | 4 | ||||
-rw-r--r-- | src/mesa/swrast/s_drawpix.c | 16 | ||||
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 23 | ||||
-rw-r--r-- | src/mesa/swrast/s_span.c | 8 | ||||
-rw-r--r-- | src/mesa/tnl/t_array_api.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_vb_arbprogram.c | 3 |
16 files changed, 51 insertions, 40 deletions
diff --git a/src/mesa/drivers/x11/glxapi.c b/src/mesa/drivers/x11/glxapi.c index 7945f1c5b06..973f3940451 100644 --- a/src/mesa/drivers/x11/glxapi.c +++ b/src/mesa/drivers/x11/glxapi.c @@ -241,7 +241,7 @@ glXGetCurrentContext(void) #if defined(GLX_USE_TLS) return CurrentContext; #elif defined(THREADS) - return _glthread_GetTSD(&ContextTSD); + return (GLXContext) _glthread_GetTSD(&ContextTSD); #else return CurrentContext; #endif diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index e9349516eb8..9fb0baf4a7c 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -472,8 +472,8 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, _mesa_free_colortable_data(table); if (width > 0) { - table->TableF = _mesa_malloc(comps * width * sizeof(GLfloat)); - table->TableUB = _mesa_malloc(comps * width * sizeof(GLubyte)); + table->TableF = (GLfloat *) _mesa_malloc(comps * width * sizeof(GLfloat)); + table->TableUB = (GLubyte *) _mesa_malloc(comps * width * sizeof(GLubyte)); if (!table->TableF || !table->TableUB) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable"); diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index dca6ede6cb3..ca484034828 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -4476,7 +4476,7 @@ save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); if (count > 0) { - unsigned i; + GLint i; const GLfloat * p = params; for (i = 0 ; i < count ; i++) { @@ -4710,7 +4710,7 @@ save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); if (count > 0) { - unsigned i; + GLint i; const GLfloat * p = params; for (i = 0 ; i < count ; i++) { diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 99b703de4a5..c823967b7a0 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -91,7 +91,7 @@ _mesa_dlopen(const char *libname, int flags) return dlopen(libname, flags); #endif #else - return (GenericFunc) NULL; + return NULL; #endif /* USE_EXTERNAL_DXTN_LIB */ } diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 5329719cbbb..5038b9b0c36 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1184,13 +1184,14 @@ static void cache_item( struct texenvprog_cache *cache, const struct state_key *key, void *data ) { - struct texenvprog_cache_item *c = MALLOC(sizeof(*c)); + struct texenvprog_cache_item *c + = (struct texenvprog_cache_item *) MALLOC(sizeof(*c)); c->hash = hash; c->key = _mesa_malloc(sizeof(*key)); memcpy(c->key, key, sizeof(*key)); - c->data = data; + c->data = (struct gl_fragment_program *) data; if (cache->n_items > cache->size * 1.5) { if (cache->size < 1000) diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 1d27cd3f7c6..3cfbfa5eb54 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -699,7 +699,7 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) = _mesa_lookup_texture(ctx, textures[i]); if (delObj) { - GLboolean delete; + GLboolean deleted; _mesa_lock_texture(ctx, delObj); @@ -728,14 +728,14 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) * XXX all RefCount accesses should be protected by a mutex. */ delObj->RefCount--; - delete = (delObj->RefCount == 0); + deleted = (delObj->RefCount == 0); _mesa_unlock_texture(ctx, delObj); /* We know that refcount went to zero above, so this is * the only pointer left to delObj, so we don't have to * worry about locking any more: */ - if (delete) { + if (deleted) { ASSERT(delObj->Name != 0); /* Never delete default tex objs */ ASSERT(ctx->Driver.DeleteTexture); (*ctx->Driver.DeleteTexture)(ctx, delObj); diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index bff80d7ee3a..91f3a5e8ee7 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -312,7 +312,7 @@ _mesa_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); - unsigned i; + GLint i; GLfloat * dest; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -464,7 +464,7 @@ _mesa_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, { GET_CURRENT_CONTEXT(ctx); struct gl_program *prog; - unsigned i; + GLint i; ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_VERTICES(ctx, _NEW_PROGRAM); diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 8442ba3248c..d301f19090a 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -1810,7 +1810,7 @@ _mesa_print_program(const struct gl_program *prog) void _mesa_print_program_parameters(GLcontext *ctx, const struct gl_program *prog) { - GLint i; + GLuint i; _mesa_printf("NumInstructions=%d\n", prog->NumInstructions); _mesa_printf("NumTemporaries=%d\n", prog->NumTemporaries); diff --git a/src/mesa/shader/slang/slang_execute.c b/src/mesa/shader/slang/slang_execute.c index e469de02075..3ffa4b88bfc 100644 --- a/src/mesa/shader/slang/slang_execute.c +++ b/src/mesa/shader/slang/slang_execute.c @@ -328,7 +328,7 @@ static GLvoid ensure_infolog_created(slang_info_log ** infolog) { if (*infolog == NULL) { - *infolog = slang_alloc_malloc(sizeof(slang_info_log)); + *infolog = (slang_info_log *) slang_alloc_malloc(sizeof(slang_info_log)); if (*infolog == NULL) return; slang_info_log_construct(*infolog); diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index 761ab724e91..7e8ebb4477c 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -860,8 +860,8 @@ fast_copy_pixels(GLcontext *ctx, } /* clipping not supported */ - if (srcX < 0 || srcX + width > srcFb->Width || - srcY < 0 || srcY + height > srcFb->Height || + if (srcX < 0 || srcX + width > (GLint) srcFb->Width || + srcY < 0 || srcY + height > (GLint) srcFb->Height || dstX < dstFb->_Xmin || dstX + width > dstFb->_Xmax || dstY < dstFb->_Ymin || dstY + height > dstFb->_Ymax) { return GL_FALSE; diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index cb584b5de8f..408174c990f 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -1289,7 +1289,7 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, GLint dx = -x; GLint i; for (i = 0; i < dx; i++) - depth[i] = 0.0; + depth[i] = 0; x = 0; n -= dx; depth += dx; @@ -1298,7 +1298,7 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, GLint dx = x + n - (GLint) rb->Width; GLint i; for (i = 0; i < dx; i++) - depth[n - i - 1] = 0.0; + depth[n - i - 1] = 0; n -= dx; } if (n <= 0) { diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index bdb25583515..d945a871aed 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -110,8 +110,9 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, */ if (format == GL_RGBA && type == rbType) { - const GLubyte *src = _mesa_image_address2d(&unpack, pixels, width, - height, format, type, 0, 0); + const GLubyte *src + = (const GLubyte *) _mesa_image_address2d(&unpack, pixels, width, + height, format, type, 0, 0); const GLint srcStride = _mesa_image_row_stride(&unpack, width, format, type); if (simpleZoom) { @@ -139,8 +140,9 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y, } if (format == GL_RGB && type == rbType) { - const GLubyte *src = _mesa_image_address2d(&unpack, pixels, width, - height, format, type, 0, 0); + const GLubyte *src + = (const GLubyte *) _mesa_image_address2d(&unpack, pixels, width, + height, format, type, 0, 0); const GLint srcStride = _mesa_image_row_stride(&unpack, width, format, type); if (simpleZoom) { @@ -640,8 +642,10 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, /* if the span is wider than MAX_WIDTH we have to do it in chunks */ while (skipPixels < width) { const GLint spanWidth = MIN2(width - skipPixels, MAX_WIDTH); - const GLubyte *source = _mesa_image_address2d(unpack, pixels, - width, height, format, type, 0, skipPixels); + const GLubyte *source + = (const GLubyte *) _mesa_image_address2d(unpack, pixels, + width, height, format, + type, 0, skipPixels); GLint row; for (row = 0; row < height; row++) { diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 128ce0afb33..27f4736c396 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -94,8 +94,8 @@ read_depth_pixels( GLcontext *ctx, /* clipping should have been done already */ ASSERT(x >= 0); ASSERT(y >= 0); - ASSERT(x + width <= rb->Width); - ASSERT(y + height <= rb->Height); + ASSERT(x + width <= (GLint) rb->Width); + ASSERT(y + height <= (GLint) rb->Height); /* width should never be > MAX_WIDTH since we did clipping earlier */ ASSERT(width <= MAX_WIDTH); @@ -210,8 +210,8 @@ fast_read_rgba_pixels( GLcontext *ctx, ASSERT(rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB); /* clipping should have already been done */ - ASSERT(x + width <= rb->Width); - ASSERT(y + height <= rb->Height); + ASSERT(x + width <= (GLint) rb->Width); + ASSERT(y + height <= (GLint) rb->Height); /* check for things we can't handle here */ if (transferOps || @@ -223,8 +223,9 @@ fast_read_rgba_pixels( GLcontext *ctx, if (format == GL_RGBA && rb->DataType == type) { const GLint dstStride = _mesa_image_row_stride(packing, width, format, type); - GLubyte *dest = _mesa_image_address2d(packing, pixels, width, height, - format, type, 0, 0); + GLubyte *dest + = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, + format, type, 0, 0); GLint row; ASSERT(rb->GetRow); for (row = 0; row < height; row++) { @@ -239,8 +240,9 @@ fast_read_rgba_pixels( GLcontext *ctx, type == GL_UNSIGNED_BYTE) { const GLint dstStride = _mesa_image_row_stride(packing, width, format, type); - GLubyte *dest = _mesa_image_address2d(packing, pixels, width, height, - format, type, 0, 0); + GLubyte *dest + = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, + format, type, 0, 0); GLint row; ASSERT(rb->GetRow); for (row = 0; row < height; row++) { @@ -396,8 +398,9 @@ read_rgba_pixels( GLcontext *ctx, = _mesa_image_row_stride(packing, width, format, type); GLfloat (*rgba)[4] = swrast->SpanArrays->color.sz4.rgba; GLint row; - GLubyte *dst = _mesa_image_address2d(packing, pixels, width, height, - format, type, 0, 0); + GLubyte *dst + = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height, + format, type, 0, 0); for (row = 0; row < height; row++, y++) { diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index c74b98facfb..cca1864ea41 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1814,7 +1814,9 @@ _swrast_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint i, inCount = 0, inStart = 0; for (i = 0; i < count; i++) { - if (x[i] >= 0 && y[i] >= 0 && x[i] < rb->Width && y[i] < rb->Height) { + if (x[i] >= 0 && y[i] >= 0 && + x[i] < (GLint) rb->Width && + y[i] < (GLint) rb->Height) { /* inside */ if (inCount == 0) inStart = i; @@ -1848,10 +1850,10 @@ _swrast_put_row(GLcontext *ctx, struct gl_renderbuffer *rb, { GLint skip = 0; - if (y < 0 || y >= rb->Height) + if (y < 0 || (GLint) y >= rb->Height) return; /* above or below */ - if (x + (GLint) count <= 0 || x >= rb->Width) + if (x + (GLint) count <= 0 || x >= (GLint) rb->Width) return; /* entirely left or right */ if (x + count > rb->Width) { diff --git a/src/mesa/tnl/t_array_api.c b/src/mesa/tnl/t_array_api.c index 6826cf7e24c..087f6af08cb 100644 --- a/src/mesa/tnl/t_array_api.c +++ b/src/mesa/tnl/t_array_api.c @@ -298,7 +298,7 @@ _tnl_DrawRangeElements(GLenum mode, #ifdef DEBUG /* check that array indices really fall inside [start, end] range */ { - GLuint i; + GLint i; for (i = 0; i < count; i++) { if (ui_indices[i] < start || ui_indices[i] > end) { _mesa_warning(ctx, "Invalid array index in " diff --git a/src/mesa/tnl/t_vb_arbprogram.c b/src/mesa/tnl/t_vb_arbprogram.c index bf4c1d52237..524472a7772 100644 --- a/src/mesa/tnl/t_vb_arbprogram.c +++ b/src/mesa/tnl/t_vb_arbprogram.c @@ -1056,7 +1056,7 @@ static void compile_vertex_program( struct gl_vertex_program *program, { struct compilation cp; struct tnl_compiled_program *p = CALLOC_STRUCT(tnl_compiled_program); - GLuint i; + GLint i; if (program->TnlData) free_tnl_data( program ); @@ -1290,6 +1290,7 @@ run_arb_vertex_program(GLcontext *ctx, struct tnl_pipeline_stage *stage) call_func( p, m ); } else { + GLint j; for (j = 0; j < p->nr_instructions; j++) { union instruction inst = p->instructions[j]; opcode_func[inst.alu.opcode]( m, inst ); |