fixes for C++ warnings/errors
This commit is contained in:
@@ -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
|
||||
|
@@ -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");
|
||||
|
@@ -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++) {
|
||||
|
@@ -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 */
|
||||
}
|
||||
|
||||
|
@@ -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)
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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++) {
|
||||
|
@@ -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++) {
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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 "
|
||||
|
@@ -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 );
|
||||
|
Reference in New Issue
Block a user