Fix minor warnings found with g++.

This commit is contained in:
Brian Paul
2004-05-04 15:11:06 +00:00
parent 33ffbd1c58
commit bdd15b5749
13 changed files with 41 additions and 45 deletions

View File

@@ -1066,7 +1066,7 @@ struct gl_texture_format {
GLubyte IndexBits; GLubyte IndexBits;
GLubyte DepthBits; GLubyte DepthBits;
GLint TexelBytes; /**< Bytes per texel, 0 if compressed format */ GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */
StoreTexImageFunc StoreImage; StoreTexImageFunc StoreImage;

View File

@@ -106,7 +106,7 @@ texstore_rgb_fxt1(STORE_PARAMS)
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
GL_COMPRESSED_RGB_FXT1_3DFX, GL_COMPRESSED_RGB_FXT1_3DFX,
texWidth, dstAddr); texWidth, (GLubyte *) dstAddr);
compress_fxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, compress_fxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride,
dst, dstRowStride); dst, dstRowStride);
@@ -161,7 +161,7 @@ texstore_rgba_fxt1(STORE_PARAMS)
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
GL_COMPRESSED_RGBA_FXT1_3DFX, GL_COMPRESSED_RGBA_FXT1_3DFX,
texWidth, dstAddr); texWidth, (GLubyte *) dstAddr);
compress_fxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, compress_fxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride,
dst, dstRowStride); dst, dstRowStride);
@@ -274,5 +274,5 @@ compress_fxt1 (GLcontext *ctx,
GLint dstRowStride) GLint dstRowStride)
{ {
/* here be dragons */ /* here be dragons */
return -1; return 0;
} }

View File

@@ -91,7 +91,7 @@ texstore_rgb_dxt1(STORE_PARAMS)
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
texWidth, dstAddr); texWidth, (GLubyte *) dstAddr);
#if 0 #if 0
compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, 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, dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
texWidth, dstAddr); texWidth, (GLubyte *) dstAddr);
#if 0 #if 0
compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride, compress_dxt1(ctx, srcWidth, srcHeight, srcFormat, pixels, srcRowStride,
dst, dstRowStride); dst, dstRowStride);
@@ -202,7 +202,7 @@ texstore_rgba_dxt3(STORE_PARAMS)
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
texWidth, dstAddr); texWidth, (GLubyte *) dstAddr);
#if 0 #if 0
compress_rgba_dxt3(ctx, srcWidth, srcHeight, pixels, compress_rgba_dxt3(ctx, srcWidth, srcHeight, pixels,
srcRowStride, dst, dstRowStride); srcRowStride, dst, dstRowStride);
@@ -256,7 +256,7 @@ texstore_rgba_dxt5(STORE_PARAMS)
dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0,
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
texWidth, dstAddr); texWidth, (GLubyte *) dstAddr);
#if 0 #if 0
compress_rgba_dxt5(ctx, srcWidth, srcHeight, pixels, compress_rgba_dxt5(ctx, srcWidth, srcHeight, pixels,
srcRowStride, dst, dstRowStride); srcRowStride, dst, dstRowStride);

View File

@@ -618,9 +618,8 @@ _mesa_texstore_rgba(GLcontext *ctx, GLuint dims,
for (img = 0; img < srcDepth; img++) { for (img = 0; img < srcDepth; img++) {
const GLint srcRowStride = _mesa_image_row_stride(srcPacking, const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
srcWidth, srcFormat, srcType); srcWidth, srcFormat, srcType);
GLchan *srcRow = _mesa_image_address(srcPacking, srcAddr, srcWidth, GLchan *srcRow = (GLchan *) _mesa_image_address(srcPacking, srcAddr,
srcHeight, srcFormat, srcType, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
img, 0, 0);
GLchan *dstRow = dstImage; GLchan *dstRow = dstImage;
for (row = 0; row < srcHeight; row++) { for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) { for (col = 0; col < srcWidth; col++) {
@@ -1044,9 +1043,8 @@ _mesa_texstore_rgb888(STORE_PARAMS)
for (img = 0; img < srcDepth; img++) { for (img = 0; img < srcDepth; img++) {
const GLint srcRowStride = _mesa_image_row_stride(srcPacking, const GLint srcRowStride = _mesa_image_row_stride(srcPacking,
srcWidth, srcFormat, srcType); srcWidth, srcFormat, srcType);
GLubyte *srcRow = _mesa_image_address(srcPacking, srcAddr, srcWidth, GLubyte *srcRow = (GLubyte *) _mesa_image_address(srcPacking, srcAddr,
srcHeight, srcFormat, srcType, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0);
img, 0, 0);
GLubyte *dstRow = dstImage; GLubyte *dstRow = dstImage;
for (row = 0; row < srcHeight; row++) { for (row = 0; row < srcHeight; row++) {
for (col = 0; col < srcWidth; col++) { for (col = 0; col < srcWidth; col++) {

View File

@@ -3863,7 +3863,7 @@ _mesa_parse_arb_program (GLcontext * ctx, const GLubyte * str, GLsizei len,
/* copy the program string to a null-terminated string */ /* copy the program string to a null-terminated string */
/* XXX should I check for NULL from malloc()? */ /* XXX should I check for NULL from malloc()? */
strz = _mesa_malloc (len + 1); strz = (GLubyte *) _mesa_malloc (len + 1);
_mesa_memcpy (strz, str, len); _mesa_memcpy (strz, str, len);
strz[len] = '\0'; strz[len] = '\0';

View File

@@ -381,7 +381,7 @@ typedef struct map_byte_
static void map_byte_create (map_byte **ma) static void map_byte_create (map_byte **ma)
{ {
*ma = mem_alloc (sizeof (map_byte)); *ma = (map_byte *) mem_alloc (sizeof (map_byte));
if (*ma) if (*ma)
{ {
(**ma).key = NULL; (**ma).key = NULL;
@@ -469,7 +469,7 @@ typedef struct regbyte_ctx_
static void regbyte_ctx_create (regbyte_ctx **re) static void regbyte_ctx_create (regbyte_ctx **re)
{ {
*re = mem_alloc (sizeof (regbyte_ctx)); *re = (regbyte_ctx *) mem_alloc (sizeof (regbyte_ctx));
if (*re) if (*re)
{ {
(**re).m_regbyte = NULL; (**re).m_regbyte = NULL;
@@ -534,7 +534,7 @@ typedef struct emit_
static void emit_create (emit **em) static void emit_create (emit **em)
{ {
*em = mem_alloc (sizeof (emit)); *em = (emit *) mem_alloc (sizeof (emit));
if (*em) if (*em)
{ {
(**em).m_emit_dest = ed_output; (**em).m_emit_dest = ed_output;
@@ -568,7 +568,7 @@ typedef struct error_
static void error_create (error **er) static void error_create (error **er)
{ {
*er = mem_alloc (sizeof (error)); *er = (error *) mem_alloc (sizeof (error));
if (*er) if (*er)
{ {
(**er).m_text = NULL; (**er).m_text = NULL;
@@ -630,7 +630,7 @@ typedef struct cond_
static void cond_create (cond **co) static void cond_create (cond **co)
{ {
*co = mem_alloc (sizeof (cond)); *co = (cond *) mem_alloc (sizeof (cond));
if (*co) if (*co)
{ {
(**co).m_operands[0].m_regname = NULL; (**co).m_operands[0].m_regname = NULL;
@@ -680,7 +680,7 @@ typedef struct spec_
static void spec_create (spec **sp) static void spec_create (spec **sp)
{ {
*sp = mem_alloc (sizeof (spec)); *sp = (spec *) mem_alloc (sizeof (spec));
if (*sp) if (*sp)
{ {
(**sp).m_spec_type = st_false; (**sp).m_spec_type = st_false;
@@ -738,7 +738,7 @@ typedef struct rule_
static void rule_create (rule **ru) static void rule_create (rule **ru)
{ {
*ru = mem_alloc (sizeof (rule)); *ru = (rule *) mem_alloc (sizeof (rule));
if (*ru) if (*ru)
{ {
(**ru).m_oper = op_none; (**ru).m_oper = op_none;
@@ -790,7 +790,7 @@ typedef struct dict_
static void dict_create (dict **di) static void dict_create (dict **di)
{ {
*di = mem_alloc (sizeof (dict)); *di = (dict *) mem_alloc (sizeof (dict));
if (*di) if (*di)
{ {
(**di).m_rulez = NULL; (**di).m_rulez = NULL;
@@ -850,7 +850,7 @@ typedef struct barray_
static void barray_create (barray **ba) static void barray_create (barray **ba)
{ {
*ba = mem_alloc (sizeof (barray)); *ba = (barray *) mem_alloc (sizeof (barray));
if (*ba) if (*ba)
{ {
(**ba).data = NULL; (**ba).data = NULL;
@@ -886,7 +886,7 @@ static int barray_resize (barray **ba, unsigned int nlen)
} }
else 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) if (new_pointer)
{ {
(**ba).data = new_pointer; (**ba).data = new_pointer;
@@ -989,7 +989,7 @@ typedef struct map_str_
static void map_str_create (map_str **ma) static void map_str_create (map_str **ma)
{ {
*ma = mem_alloc (sizeof (map_str)); *ma = (map_str *) mem_alloc (sizeof (map_str));
if (*ma) if (*ma)
{ {
(**ma).key = NULL; (**ma).key = NULL;
@@ -1054,7 +1054,7 @@ typedef struct map_rule_
static void map_rule_create (map_rule **ma) static void map_rule_create (map_rule **ma)
{ {
*ma = mem_alloc (sizeof (map_rule)); *ma = (map_rule *) mem_alloc (sizeof (map_rule));
if (*ma) if (*ma)
{ {
(**ma).key = NULL; (**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 */ /* reallocate the string in 16-byte increments */
if ((*len & 0x0F) == 0x0F || *ptr == NULL) 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)); ((*len + 1 + 0x10) & ~0x0F) * sizeof (byte));
if (tmp == NULL) if (tmp == NULL)
return 1; 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 && if (match (di, text + ind, &filter_index, er->m_token, &ba, 0, &ctx) == mr_matched &&
filter_index) filter_index)
{ {
str = mem_alloc (filter_index + 1); str = (byte *) mem_alloc (filter_index + 1);
if (str != NULL) if (str != NULL)
{ {
str_copy_n (str, text + ind, filter_index); 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) 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) if (*gr)
{ {
(**gr).di = NULL; (**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); free_regbyte_ctx_stack (rbc, NULL);
*prod = mem_alloc (ba->len * sizeof (byte)); *prod = (byte *) mem_alloc (ba->len * sizeof (byte));
if (*prod == NULL) if (*prod == NULL)
{ {
barray_destroy (&ba); barray_destroy (&ba);

View File

@@ -34,7 +34,7 @@
void void
_swrast_alloc_aux_buffers( GLframebuffer *buffer ) _swrast_alloc_aux_buffers( GLframebuffer *buffer )
{ {
GLuint i; GLint i;
for (i = 0; i < buffer->Visual.numAuxBuffers; i++) { for (i = 0; i < buffer->Visual.numAuxBuffers; i++) {
if (buffer->AuxBuffers[i]) { if (buffer->AuxBuffers[i]) {
@@ -42,8 +42,8 @@ _swrast_alloc_aux_buffers( GLframebuffer *buffer )
buffer->AuxBuffers[i] = NULL; buffer->AuxBuffers[i] = NULL;
} }
buffer->AuxBuffers[i] = _mesa_malloc(buffer->Width * buffer->Height buffer->AuxBuffers[i] = (GLchan *) _mesa_malloc(buffer->Width
* 4 * sizeof(GLchan)); * buffer->Height * 4 * sizeof(GLchan));
} }
} }

View File

@@ -54,7 +54,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
ASSERT(ctx->RenderMode == GL_RENDER); 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, GL_COLOR_INDEX, GL_BITMAP,
(GLvoid *) bitmap); (GLvoid *) bitmap);
if (!bitmap) { if (!bitmap) {

View File

@@ -51,7 +51,6 @@ static void feedback_vertex( GLcontext *ctx,
GLfloat win[4]; GLfloat win[4];
GLfloat color[4]; GLfloat color[4];
GLfloat tc[4]; GLfloat tc[4];
GLuint index;
win[0] = v->win[0]; win[0] = v->win[0];
win[1] = v->win[1]; win[1] = v->win[1];
@@ -75,9 +74,7 @@ static void feedback_vertex( GLcontext *ctx,
COPY_4V(tc, v->texcoord[texUnit]); COPY_4V(tc, v->texcoord[texUnit]);
} }
index = v->index; _mesa_feedback_vertex( ctx, win, color, (GLfloat) v->index, tc );
_mesa_feedback_vertex( ctx, win, color, (GLfloat)index, tc );
} }

View File

@@ -58,7 +58,7 @@ static void _swsetup_render_line_tri( GLcontext *ctx,
SWvertex *v2 = &verts[e2]; SWvertex *v2 = &verts[e2];
GLchan c[2][4]; GLchan c[2][4];
GLchan s[2][4]; GLchan s[2][4];
GLuint i[2]; GLfloat i[2];
/* cull testing */ /* cull testing */
if (ctx->Polygon.CullFlag) { if (ctx->Polygon.CullFlag) {
@@ -117,7 +117,7 @@ static void _swsetup_render_point_tri( GLcontext *ctx,
SWvertex *v2 = &verts[e2]; SWvertex *v2 = &verts[e2];
GLchan c[2][4]; GLchan c[2][4];
GLchan s[2][4]; GLchan s[2][4];
GLuint i[2]; GLfloat i[2];
/* cull testing */ /* cull testing */
if (ctx->Polygon.CullFlag) { if (ctx->Polygon.CullFlag) {

View File

@@ -37,7 +37,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 )
GLuint facing = 0; GLuint facing = 0;
GLchan saved_color[3][4]; GLchan saved_color[3][4];
GLchan saved_spec[3][4]; GLchan saved_spec[3][4];
GLuint saved_index[3]; GLfloat saved_index[3];
v[0] = &verts[e0]; v[0] = &verts[e0];
v[1] = &verts[e1]; v[1] = &verts[e1];

View File

@@ -253,7 +253,7 @@ typedef void (*attrfv_func)( const GLfloat * );
struct _tnl_dynfn { struct _tnl_dynfn {
struct _tnl_dynfn *next, *prev; struct _tnl_dynfn *next, *prev;
int key; GLuint key;
char *code; char *code;
}; };

View File

@@ -940,7 +940,7 @@ void _tnl_get_attr( GLcontext *ctx, const void *vin,
GLuint j; GLuint j;
for (j = 0; j < attr_count; 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 ); a[j].extract( &a[j], dest, (GLubyte *)vin + a[j].vertoffset );
return; return;
} }
@@ -963,7 +963,7 @@ void _tnl_set_attr( GLcontext *ctx, void *vout,
GLuint j; GLuint j;
for (j = 0; j < attr_count; 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 ); a[j].insert[4-1]( &a[j], (GLubyte *)vout + a[j].vertoffset, src );
return; return;
} }