From bdd15b5749b45929fa642c3e47997f52eb07fbe5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 4 May 2004 15:11:06 +0000 Subject: Fix minor warnings found with g++. --- src/mesa/main/mtypes.h | 2 +- src/mesa/main/texcompress_fxt1.c | 6 +++--- src/mesa/main/texcompress_s3tc.c | 8 ++++---- src/mesa/main/texstore.c | 10 ++++------ src/mesa/shader/arbprogparse.c | 2 +- src/mesa/shader/grammar.c | 32 ++++++++++++++++---------------- src/mesa/swrast/s_auxbuffer.c | 6 +++--- src/mesa/swrast/s_bitmap.c | 3 ++- src/mesa/swrast/s_feedback.c | 5 +---- src/mesa/swrast_setup/ss_triangle.c | 4 ++-- src/mesa/swrast_setup/ss_tritmp.h | 2 +- src/mesa/tnl/t_context.h | 2 +- src/mesa/tnl/t_vertex.c | 4 ++-- 13 files changed, 41 insertions(+), 45 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d021ffc4ff..e045c1f35b 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1066,7 +1066,7 @@ struct gl_texture_format { GLubyte IndexBits; GLubyte DepthBits; - GLint TexelBytes; /**< Bytes per texel, 0 if compressed format */ + GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */ StoreTexImageFunc StoreImage; diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index e654512371..5a37a259c7 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -106,7 +106,7 @@ texstore_rgb_fxt1(STORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGB_FXT1_3DFX, - texWidth, dstAddr); + texWidth, (GLubyte *) dstAddr); compress_fxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, dst, dstRowStride); @@ -161,7 +161,7 @@ texstore_rgba_fxt1(STORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGBA_FXT1_3DFX, - texWidth, dstAddr); + texWidth, (GLubyte *) dstAddr); compress_fxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, dst, dstRowStride); @@ -274,5 +274,5 @@ compress_fxt1 (GLcontext *ctx, GLint dstRowStride) { /* here be dragons */ - return -1; + return 0; } diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 07ca6b0f01..08697f46c4 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -91,7 +91,7 @@ texstore_rgb_dxt1(STORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, - texWidth, dstAddr); + texWidth, (GLubyte *) dstAddr); #if 0 compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, @@ -148,7 +148,7 @@ texstore_rgba_dxt1(STORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, - texWidth, dstAddr); + texWidth, (GLubyte *) dstAddr); #if 0 compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, dst, dstRowStride); @@ -202,7 +202,7 @@ texstore_rgba_dxt3(STORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, - texWidth, dstAddr); + texWidth, (GLubyte *) dstAddr); #if 0 compress_rgba_dxt3(ctx, srcWidth, srcHeight, pixels, srcRowStride, dst, dstRowStride); @@ -256,7 +256,7 @@ texstore_rgba_dxt5(STORE_PARAMS) dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, - texWidth, dstAddr); + texWidth, (GLubyte *) dstAddr); #if 0 compress_rgba_dxt5(ctx, srcWidth, srcHeight, pixels, srcRowStride, dst, dstRowStride); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index ea7d7cebb1..73126ef949 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -618,9 +618,8 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims, for (img = 0; img < srcDepth; img++) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); - GLchan *srcRow = _mesa_image_address(srcPacking, srcAddr, srcWidth, - srcHeight, srcFormat, srcType, - img, 0, 0); + GLchan *srcRow = (GLchan *) _mesa_image_address(srcPacking, srcAddr, + srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLchan *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { @@ -1044,9 +1043,8 @@ _mesa_texstore_rgb888(STORE_PARAMS) for (img = 0; img < srcDepth; img++) { const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); - GLubyte *srcRow = _mesa_image_address(srcPacking, srcAddr, srcWidth, - srcHeight, srcFormat, srcType, - img, 0, 0); + GLubyte *srcRow = (GLubyte *) _mesa_image_address(srcPacking, srcAddr, + srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = dstImage; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index fb311f9f7f..ae06444372 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -3863,7 +3863,7 @@ _mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len, /* copy the program string to a null-terminated string */ /* XXX should I check for NULL from malloc()? */ - strz = _mesa_malloc (len + 1); + strz = (GLubyte *) _mesa_malloc (len + 1); _mesa_memcpy (strz, str, len); strz[len] = '\0'; diff --git a/src/mesa/shader/grammar.c b/src/mesa/shader/grammar.c index 3bf67ccc83..98ccbb1a33 100644 --- a/src/mesa/shader/grammar.c +++ b/src/mesa/shader/grammar.c @@ -381,7 +381,7 @@ typedef struct map_byte_ static void map_byte_create (map_byte **ma) { - *ma = mem_alloc (sizeof (map_byte)); + *ma = (map_byte *) mem_alloc (sizeof (map_byte)); if (*ma) { (**ma).key = NULL; @@ -469,7 +469,7 @@ typedef struct regbyte_ctx_ static void regbyte_ctx_create (regbyte_ctx **re) { - *re = mem_alloc (sizeof (regbyte_ctx)); + *re = (regbyte_ctx *) mem_alloc (sizeof (regbyte_ctx)); if (*re) { (**re).m_regbyte = NULL; @@ -534,7 +534,7 @@ typedef struct emit_ static void emit_create (emit **em) { - *em = mem_alloc (sizeof (emit)); + *em = (emit *) mem_alloc (sizeof (emit)); if (*em) { (**em).m_emit_dest = ed_output; @@ -568,7 +568,7 @@ typedef struct error_ static void error_create (error **er) { - *er = mem_alloc (sizeof (error)); + *er = (error *) mem_alloc (sizeof (error)); if (*er) { (**er).m_text = NULL; @@ -630,7 +630,7 @@ typedef struct cond_ static void cond_create (cond **co) { - *co = mem_alloc (sizeof (cond)); + *co = (cond *) mem_alloc (sizeof (cond)); if (*co) { (**co).m_operands[0].m_regname = NULL; @@ -680,7 +680,7 @@ typedef struct spec_ static void spec_create (spec **sp) { - *sp = mem_alloc (sizeof (spec)); + *sp = (spec *) mem_alloc (sizeof (spec)); if (*sp) { (**sp).m_spec_type = st_false; @@ -738,7 +738,7 @@ typedef struct rule_ static void rule_create (rule **ru) { - *ru = mem_alloc (sizeof (rule)); + *ru = (rule *) mem_alloc (sizeof (rule)); if (*ru) { (**ru).m_oper = op_none; @@ -790,7 +790,7 @@ typedef struct dict_ static void dict_create (dict **di) { - *di = mem_alloc (sizeof (dict)); + *di = (dict *) mem_alloc (sizeof (dict)); if (*di) { (**di).m_rulez = NULL; @@ -850,7 +850,7 @@ typedef struct barray_ static void barray_create (barray **ba) { - *ba = mem_alloc (sizeof (barray)); + *ba = (barray *) mem_alloc (sizeof (barray)); if (*ba) { (**ba).data = NULL; @@ -886,7 +886,7 @@ static int barray_resize (barray **ba, unsigned int nlen) } else { - new_pointer = mem_realloc ((**ba).data, (**ba).len * sizeof (byte), nlen * sizeof (byte)); + new_pointer = (byte *) mem_realloc ((**ba).data, (**ba).len * sizeof (byte), nlen * sizeof (byte)); if (new_pointer) { (**ba).data = new_pointer; @@ -989,7 +989,7 @@ typedef struct map_str_ static void map_str_create (map_str **ma) { - *ma = mem_alloc (sizeof (map_str)); + *ma = (map_str *) mem_alloc (sizeof (map_str)); if (*ma) { (**ma).key = NULL; @@ -1054,7 +1054,7 @@ typedef struct map_rule_ static void map_rule_create (map_rule **ma) { - *ma = mem_alloc (sizeof (map_rule)); + *ma = (map_rule *) mem_alloc (sizeof (map_rule)); if (*ma) { (**ma).key = NULL; @@ -1181,7 +1181,7 @@ static int string_grow (byte **ptr, unsigned int *len, byte c) /* reallocate the string in 16-byte increments */ if ((*len & 0x0F) == 0x0F || *ptr == NULL) { - byte *tmp = mem_realloc (*ptr, ((*len + 1) & ~0x0F) * sizeof (byte), + byte *tmp = (byte *) mem_realloc (*ptr, ((*len + 1) & ~0x0F) * sizeof (byte), ((*len + 1 + 0x10) & ~0x0F) * sizeof (byte)); if (tmp == NULL) return 1; @@ -2438,7 +2438,7 @@ static byte *error_get_token (error *er, dict *di, const byte *text, unsigned in if (match (di, text + ind, &filter_index, er->m_token, &ba, 0, &ctx) == mr_matched && filter_index) { - str = mem_alloc (filter_index + 1); + str = (byte *) mem_alloc (filter_index + 1); if (str != NULL) { str_copy_n (str, text + ind, filter_index); @@ -2464,7 +2464,7 @@ typedef struct grammar_load_state_ static void grammar_load_state_create (grammar_load_state **gr) { - *gr = mem_alloc (sizeof (grammar_load_state)); + *gr = (grammar_load_state *) mem_alloc (sizeof (grammar_load_state)); if (*gr) { (**gr).di = NULL; @@ -2715,7 +2715,7 @@ int grammar_check (grammar id, const byte *text, byte **prod, unsigned int *size free_regbyte_ctx_stack (rbc, NULL); - *prod = mem_alloc (ba->len * sizeof (byte)); + *prod = (byte *) mem_alloc (ba->len * sizeof (byte)); if (*prod == NULL) { barray_destroy (&ba); diff --git a/src/mesa/swrast/s_auxbuffer.c b/src/mesa/swrast/s_auxbuffer.c index ca36d90ded..859bc3197b 100644 --- a/src/mesa/swrast/s_auxbuffer.c +++ b/src/mesa/swrast/s_auxbuffer.c @@ -34,7 +34,7 @@ void _swrast_alloc_aux_buffers( GLframebuffer *buffer ) { - GLuint i; + GLint i; for (i = 0; i < buffer->Visual.numAuxBuffers; i++) { if (buffer->AuxBuffers[i]) { @@ -42,8 +42,8 @@ _swrast_alloc_aux_buffers( GLframebuffer *buffer ) buffer->AuxBuffers[i] = NULL; } - buffer->AuxBuffers[i] = _mesa_malloc(buffer->Width * buffer->Height - * 4 * sizeof(GLchan)); + buffer->AuxBuffers[i] = (GLchan *) _mesa_malloc(buffer->Width + * buffer->Height * 4 * sizeof(GLchan)); } } diff --git a/src/mesa/swrast/s_bitmap.c b/src/mesa/swrast/s_bitmap.c index 6c8f515b62..8bd9854f0c 100644 --- a/src/mesa/swrast/s_bitmap.c +++ b/src/mesa/swrast/s_bitmap.c @@ -54,7 +54,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py, ASSERT(ctx->RenderMode == GL_RENDER); - bitmap = _swrast_validate_pbo_access(unpack, width, height, 1, + bitmap = (const GLubyte *) _swrast_validate_pbo_access(unpack, width, + height, 1, GL_COLOR_INDEX, GL_BITMAP, (GLvoid *) bitmap); if (!bitmap) { diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index 2ebaaff3c1..892c40db6a 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -51,7 +51,6 @@ static void feedback_vertex( GLcontext *ctx, GLfloat win[4]; GLfloat color[4]; GLfloat tc[4]; - GLuint index; win[0] = v->win[0]; win[1] = v->win[1]; @@ -75,9 +74,7 @@ static void feedback_vertex( GLcontext *ctx, COPY_4V(tc, v->texcoord[texUnit]); } - index = v->index; - - _mesa_feedback_vertex( ctx, win, color, (GLfloat)index, tc ); + _mesa_feedback_vertex( ctx, win, color, (GLfloat) v->index, tc ); } diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c index 00876fe68d..1f46331be3 100644 --- a/src/mesa/swrast_setup/ss_triangle.c +++ b/src/mesa/swrast_setup/ss_triangle.c @@ -58,7 +58,7 @@ static void _swsetup_render_line_tri( GLcontext *ctx, SWvertex *v2 = &verts[e2]; GLchan c[2][4]; GLchan s[2][4]; - GLuint i[2]; + GLfloat i[2]; /* cull testing */ if (ctx->Polygon.CullFlag) { @@ -117,7 +117,7 @@ static void _swsetup_render_point_tri( GLcontext *ctx, SWvertex *v2 = &verts[e2]; GLchan c[2][4]; GLchan s[2][4]; - GLuint i[2]; + GLfloat i[2]; /* cull testing */ if (ctx->Polygon.CullFlag) { diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index e1c2565c73..3465ad3912 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -37,7 +37,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) GLuint facing = 0; GLchan saved_color[3][4]; GLchan saved_spec[3][4]; - GLuint saved_index[3]; + GLfloat saved_index[3]; v[0] = &verts[e0]; v[1] = &verts[e1]; diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index d20f126c5d..b9fc7b8ea0 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -253,7 +253,7 @@ typedef void (*attrfv_func)( const GLfloat * ); struct _tnl_dynfn { struct _tnl_dynfn *next, *prev; - int key; + GLuint key; char *code; }; diff --git a/src/mesa/tnl/t_vertex.c b/src/mesa/tnl/t_vertex.c index fc076190e4..dcb6aef16b 100644 --- a/src/mesa/tnl/t_vertex.c +++ b/src/mesa/tnl/t_vertex.c @@ -940,7 +940,7 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin, GLuint j; for (j = 0; j < attr_count; j++) { - if (a[j].attrib == (int)attr) { + if (a[j].attrib == attr) { a[j].extract( &a[j], dest, (GLubyte *)vin + a[j].vertoffset ); return; } @@ -963,7 +963,7 @@ void _tnl_set_attr( GLcontext *ctx, void *vout, GLuint j; for (j = 0; j < attr_count; j++) { - if (a[j].attrib == (int)attr) { + if (a[j].attrib == attr) { a[j].insert[4-1]( &a[j], (GLubyte *)vout + a[j].vertoffset, src ); return; } -- cgit v1.2.3