Commit e4fcea2e authored by Brian Paul's avatar Brian Paul

Assorted casts to silence g++ warnings.

parent 74c33393
......@@ -48,7 +48,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_NORMAL];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
......@@ -60,7 +60,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
......@@ -72,7 +72,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_COLOR1];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
......@@ -84,7 +84,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) &ctx->Current.Attrib[VERT_ATTRIB_FOG];
cl->Ptr = (GLubyte *) &ctx->Current.Attrib[VERT_ATTRIB_FOG];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
......@@ -96,7 +96,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Type = GL_UNSIGNED_INT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) &ctx->Current.Index;
cl->Ptr = (GLubyte *) &ctx->Current.Index;
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
......@@ -109,7 +109,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i];
cl->Ptr = (GLubyte *) ctx->Current.Attrib[VERT_ATTRIB_TEX0 + i];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
......@@ -122,7 +122,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Type = GL_UNSIGNED_BYTE;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) &ctx->Current.EdgeFlag;
cl->Ptr = (GLubyte *) &ctx->Current.EdgeFlag;
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
......@@ -135,7 +135,7 @@ static void _ac_fallbacks_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 0;
cl->Ptr = (void *) ctx->Current.Attrib[i];
cl->Ptr = (GLubyte *) ctx->Current.Attrib[i];
cl->Enabled = 1;
cl->Flags = CA_CLIENT_DATA; /* hack */
#if FEATURE_ARB_vertex_buffer_object
......@@ -160,7 +160,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
......@@ -172,7 +172,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 3 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
......@@ -184,7 +184,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
......@@ -196,7 +196,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
......@@ -208,7 +208,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
......@@ -220,7 +220,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Type = GL_UNSIGNED_INT;
cl->Stride = 0;
cl->StrideB = sizeof(GLuint);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
......@@ -233,7 +233,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
......@@ -246,7 +246,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Type = GL_UNSIGNED_BYTE;
cl->Stride = 0;
cl->StrideB = sizeof(GLubyte);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
......@@ -259,7 +259,7 @@ static void _ac_cache_init( GLcontext *ctx )
cl->Type = GL_FLOAT;
cl->Stride = 0;
cl->StrideB = 4 * sizeof(GLfloat);
cl->Ptr = MALLOC( cl->StrideB * size );
cl->Ptr = (GLubyte *) MALLOC( cl->StrideB * size );
cl->Enabled = 1;
cl->Flags = 0;
#if FEATURE_ARB_vertex_buffer_object
......
......@@ -673,10 +673,10 @@ _glapi_add_entrypoint(const char *funcName, GLuint offset)
if (ExtEntryTable[i].Offset == offset) {
return GL_TRUE; /* offsets match */
}
else if (ExtEntryTable[i].Offset == ~0
else if (ExtEntryTable[i].Offset == (GLuint) ~0
&& offset < DISPATCH_TABLE_SIZE) {
/* need to patch-up the dispatch code */
if (offset != ~0) {
if (offset != (GLuint) ~0) {
fill_in_entrypoint_offset(ExtEntryTable[i].Address, offset);
ExtEntryTable[i].Offset = offset;
}
......
......@@ -196,7 +196,8 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)");
return;
}
_mesa_parse_arb_vertex_program(ctx, target, string, len, prog);
_mesa_parse_arb_vertex_program(ctx, target, (const GLubyte *) string,
len, prog);
}
else if (target == GL_FRAGMENT_PROGRAM_ARB
&& ctx->Extensions.ARB_fragment_program) {
......@@ -205,7 +206,8 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)");
return;
}
_mesa_parse_arb_fragment_program(ctx, target, string, len, prog);
_mesa_parse_arb_fragment_program(ctx, target, (const GLubyte *) string,
len, prog);
}
else {
_mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)");
......
......@@ -226,7 +226,7 @@ _mesa_buffer_data( GLcontext *ctx, GLenum target, GLsizeiptrARB size,
new_data = _mesa_realloc( bufObj->Data, bufObj->Size, size );
if ( new_data != NULL ) {
bufObj->Data = new_data;
bufObj->Data = (GLubyte *) new_data;
bufObj->Size = size;
bufObj->Usage = usage;
......
......@@ -4219,8 +4219,7 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint *ids)
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
GLuint *idCopy;
idCopy = _mesa_malloc(num * sizeof(GLuint));
GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint));
if (!idCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
return;
......@@ -4357,9 +4356,7 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte *name,
{
GET_CURRENT_CONTEXT(ctx);
Node *n;
GLubyte *nameCopy;
nameCopy = _mesa_malloc(len);
GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len);
if (!nameCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
return;
......@@ -5251,10 +5248,12 @@ execute_list( GLcontext *ctx, GLuint list )
}
break;
case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
(*ctx->Exec->RequestResidentProgramsNV)(n[1].ui, n[2].data);
(*ctx->Exec->RequestResidentProgramsNV)(n[1].ui,
(GLuint *) n[2].data);
break;
case OPCODE_LOAD_PROGRAM_NV:
(*ctx->Exec->LoadProgramNV)(n[1].e, n[2].ui, n[3].i, n[4].data);
(*ctx->Exec->LoadProgramNV)(n[1].e, n[2].ui, n[3].i,
(const GLubyte *) n[4].data);
break;
case OPCODE_PROGRAM_PARAMETER4F_NV:
(*ctx->Exec->ProgramParameter4fNV)(n[1].e, n[2].ui, n[3].f,
......@@ -5271,7 +5270,8 @@ execute_list( GLcontext *ctx, GLuint list )
n[4].f, n[5].f, n[6].f);
break;
case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
(*ctx->Exec->ProgramNamedParameter4fNV)(n[1].ui, n[2].i, n[3].data,
(*ctx->Exec->ProgramNamedParameter4fNV)(n[1].ui, n[2].i,
(const GLubyte *) n[3].data,
n[4].f, n[5].f, n[6].f, n[7].f);
break;
#endif
......
......@@ -423,7 +423,7 @@ _mesa_make_extension_string( GLcontext *ctx )
extStrLen += _mesa_strlen(default_extensions[i].name) + 1;
}
}
s = _mesa_malloc(extStrLen);
s = (GLubyte *) _mesa_malloc(extStrLen);
/* second, build the extension string */
extStrLen = 0;
......
......@@ -260,9 +260,10 @@ add_parameter(struct program_parameter_list *paramList,
{
const GLuint n = paramList->NumParameters;
paramList->Parameters = _mesa_realloc(paramList->Parameters,
n * sizeof(struct program_parameter),
(n + 1) * sizeof(struct program_parameter));
paramList->Parameters = (struct program_parameter *)
_mesa_realloc(paramList->Parameters,
n * sizeof(struct program_parameter),
(n + 1) * sizeof(struct program_parameter));
if (!paramList->Parameters) {
/* out of memory */
paramList->NumParameters = 0;
......@@ -1011,7 +1012,7 @@ _mesa_GetProgramRegisterfvMESA(GLenum target,
#endif
/* make null-terminated copy of registerName */
len = MIN2(len, sizeof(reg) - 1);
len = MIN2((unsigned int) len, sizeof(reg) - 1);
_mesa_memcpy(reg, registerName, len);
reg[len] = 0;
......
......@@ -31,6 +31,7 @@
#include "glheader.h"
#include "context.h"
#include "colormac.h"
#include "context.h"
#include "macros.h"
#include "imports.h"
#include "s_aatriangle.h"
......
......@@ -121,7 +121,7 @@ get_register_pointer( GLcontext *ctx,
src = ctx->FragmentProgram.Parameters[source->Index];
break;
case PROGRAM_NAMED_PARAM:
ASSERT(source->Index < program->Parameters->NumParameters);
ASSERT(source->Index < (GLint) program->Parameters->NumParameters);
src = program->Parameters->Parameters[source->Index].Values;
break;
case PROGRAM_STATE_VAR:
......
......@@ -46,7 +46,7 @@ static void do_import( struct vertex_buffer *VB,
GLuint count = VB->Count;
if (!to->Ptr) {
to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLchan), 32 );
to->Ptr = (GLubyte *) ALIGN_MALLOC( VB->Size * 4 * sizeof(GLchan), 32 );
to->Type = CHAN_TYPE;
}
......
......@@ -59,14 +59,14 @@ real_alloc_immediate( GLcontext *ctx )
/* Only allocate space for vertex positions right now. Color, texcoord,
* etc storage will be allocated as needed.
*/
immed->Attrib[VERT_ATTRIB_POS] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
immed->Attrib[VERT_ATTRIB_POS] = (GLfloat (*)[4]) _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
/* Enable this to allocate all attribute arrays up front */
if (0)
{
int i;
for (i = 1; i < VERT_ATTRIB_MAX; i++) {
immed->Attrib[i] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
immed->Attrib[i] = (GLfloat (*)[4]) _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
}
}
......
......@@ -619,7 +619,7 @@ void _tnl_translate_array_elts( GLcontext *ctx, struct immediate *IM,
ASSERT(IM->Attrib[VERT_ATTRIB_POS]);
for (attr = 1; attr < VERT_ATTRIB_MAX; attr++) {
if ((translate & (1 << attr)) && !IM->Attrib[attr]) {
IM->Attrib[attr] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
IM->Attrib[attr] = (GLfloat (*)[4]) _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
if (!IM->Attrib[attr]) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "vertex processing2");
return;
......
......@@ -507,7 +507,7 @@ void _tnl_eval_immediate( GLcontext *ctx, struct immediate *IM )
/* Allocate vertex attribute storage now */
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if ((req & (1 << attr)) && !store->Attrib[attr]) {
store->Attrib[attr] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
store->Attrib[attr] = (GLfloat (*)[4]) _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
if (!store->Attrib[attr]) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "evaluator processing");
return;
......
......@@ -155,7 +155,7 @@ copy_from_current( GLcontext *ctx, struct immediate *IM,
for (attrib = 0, attribBit = 1; attrib < 16; attrib++, attribBit <<= 1) {
if (copyMask & attribBit) {
if (!IM->Attrib[attrib]) {
IM->Attrib[attrib] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
IM->Attrib[attrib] = (GLfloat (*)[4]) _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
if (!IM->Attrib[attrib]) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "vertex processing3");
return;
......@@ -229,7 +229,7 @@ _tnl_fixup_input( GLcontext *ctx, struct immediate *IM )
const GLuint attrBit = 1 << attr;
if (fixup & attrBit) {
if (!IM->Attrib[attr]) {
IM->Attrib[attr] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
IM->Attrib[attr] = (GLfloat (*)[4]) _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
if (!IM->Attrib[attr]) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "vertex processing");
return;
......@@ -409,7 +409,7 @@ _tnl_copy_immediate_vertices( GLcontext *ctx, struct immediate *next )
/* Allocate attribute arrays in the destination immediate struct */
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
if ((copy & (1 << attr)) && !next->Attrib[attr]) {
next->Attrib[attr] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
next->Attrib[attr] = (GLfloat (*)[4]) _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
if (!next->Attrib[attr]) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "vertex processing");
return;
......@@ -546,7 +546,7 @@ _tnl_fixup_compiled_cassette( GLcontext *ctx, struct immediate *IM )
const GLuint attrBit = 1 << attr;
if (fixup & attrBit) {
if (!IM->Attrib[attr]) {
IM->Attrib[attr] = _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
IM->Attrib[attr] = (GLfloat (*)[4]) _mesa_malloc(IMM_SIZE * 4 * sizeof(GLfloat));
if (!IM->Attrib[attr]) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "vertex processing");
}
......
......@@ -69,7 +69,7 @@ static void import_color_material( GLcontext *ctx,
GLuint count = VB->Count;
if (!to->Ptr) {
to->Ptr = ALIGN_MALLOC( VB->Size * 4 * sizeof(GLfloat), 32 );
to->Ptr = (GLubyte *) ALIGN_MALLOC( VB->Size * 4 * sizeof(GLfloat), 32 );
to->Type = GL_FLOAT;
}
......@@ -248,7 +248,7 @@ static GLboolean run_validate_lighting( GLcontext *ctx,
static void alloc_4chan( struct gl_client_array *a, GLuint sz )
{
a->Ptr = ALIGN_MALLOC( sz * sizeof(GLchan) * 4, 32 );
a->Ptr = (GLubyte *) ALIGN_MALLOC( sz * sizeof(GLchan) * 4, 32 );
a->Size = 4;
a->Type = CHAN_TYPE;
a->Stride = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment