Pedantic compiler fixes (Sven Panne)

This commit is contained in:
Brian Paul
2002-07-12 15:54:01 +00:00
parent 902d2faadf
commit f02a5f6cc5
14 changed files with 44 additions and 36 deletions

View File

@@ -1,4 +1,4 @@
/* $Id: drawpix.c,v 1.7 2002/04/22 16:03:37 brianp Exp $ */
/* $Id: drawpix.c,v 1.8 2002/07/12 15:54:02 brianp Exp $ */
/*
* glDrawPixels demo/test/benchmark
@@ -257,7 +257,7 @@ static void Init( GLboolean ciMode )
if (ciMode) {
/* Convert RGB image to grayscale */
GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];

View File

@@ -752,7 +752,7 @@ main(int ac, char **av)
glFogfv(GL_FOG_COLOR, fogcolor);
glFogf(GL_FOG_DENSITY, 0.1);
p = malloc(sizeof(part) * np);
p = (part *) malloc(sizeof(part) * np);
for (i = 0; i < np; i++)
setnewpart(&p[i]);

View File

@@ -1,4 +1,4 @@
/* $Id: paltex.c,v 1.7 2002/01/16 00:48:43 kschultz Exp $ */
/* $Id: paltex.c,v 1.8 2002/07/12 15:54:02 brianp Exp $ */
/*
* Paletted texture demo. Written by Brian Paul.
@@ -161,7 +161,7 @@ static void Init( void )
0, /* border */
GL_COLOR_INDEX, /* texture format */
GL_UNSIGNED_BYTE, /* texture type */
texture); /* teh texture */
texture); /* the texture */
#endif
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);

View File

@@ -1,4 +1,4 @@
/* $Id: readpix.c,v 1.7 2002/05/02 09:17:59 alanh Exp $ */
/* $Id: readpix.c,v 1.8 2002/07/12 15:54:02 brianp Exp $ */
/*
* glReadPixels and glCopyPixels test
@@ -219,7 +219,7 @@ Init( GLboolean ciMode )
if (ciMode) {
/* Convert RGB image to grayscale */
GLubyte *indexImage = malloc( ImgWidth * ImgHeight );
GLubyte *indexImage = (GLubyte *) malloc( ImgWidth * ImgHeight );
GLint i;
for (i=0; i<ImgWidth*ImgHeight; i++) {
int gray = Image[i*3] + Image[i*3+1] + Image[i*3+2];

View File

@@ -1,4 +1,4 @@
/* $Id: shadowtex.c,v 1.6 2002/03/23 16:34:18 brianp Exp $ */
/* $Id: shadowtex.c,v 1.7 2002/07/12 15:54:02 brianp Exp $ */
/*
* Shadow demo using the GL_ARB_depth_texture, GL_ARB_shadow and
@@ -276,7 +276,7 @@ Display(void)
*/
if (DisplayMode == SHOW_DEPTH_MAPPING) {
/* load depth image as gray-scale luminance texture */
GLfloat *depth = malloc(ShadowTexWidth * ShadowTexHeight
GLfloat *depth = (GLfloat *) malloc(ShadowTexWidth * ShadowTexHeight
* sizeof(GLfloat));
if (depth) {
glReadPixels(0, 0, ShadowTexWidth, ShadowTexHeight,

View File

@@ -11,6 +11,7 @@
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef WIN32

View File

@@ -1,4 +1,4 @@
/* $Id: tessdemo.c,v 1.11 2001/03/21 02:47:32 gareth Exp $ */
/* $Id: tessdemo.c,v 1.12 2002/07/12 15:54:02 brianp Exp $ */
/*
* A demo of the GLU polygon tesselation functions written by Bogdan Sikorski.
@@ -165,6 +165,8 @@ static void set_screen_wh( GLsizei w, GLsizei h )
height = h;
}
typedef void (GLAPIENTRY *callback_t)();
static void tesse( void )
{
GLUtesselator *tobj;
@@ -177,11 +179,11 @@ static void tesse( void )
if ( tobj != NULL ) {
gluTessNormal( tobj, 0.0, 0.0, 1.0 );
gluTessCallback( tobj, GLU_TESS_BEGIN, glBegin );
gluTessCallback( tobj, GLU_TESS_VERTEX, glVertex2fv );
gluTessCallback( tobj, GLU_TESS_END, glEnd );
gluTessCallback( tobj, GLU_TESS_ERROR, error_callback );
gluTessCallback( tobj, GLU_TESS_COMBINE, combine_callback );
gluTessCallback( tobj, GLU_TESS_BEGIN, (callback_t) glBegin );
gluTessCallback( tobj, GLU_TESS_VERTEX, (callback_t) glVertex2fv );
gluTessCallback( tobj, GLU_TESS_END, (callback_t) glEnd );
gluTessCallback( tobj, GLU_TESS_ERROR, (callback_t) error_callback );
gluTessCallback( tobj, GLU_TESS_COMBINE, (callback_t) combine_callback );
glNewList( list_start, GL_COMPILE );
gluBeginPolygon( tobj );
@@ -201,10 +203,10 @@ static void tesse( void )
gluEndPolygon( tobj );
glEndList();
gluTessCallback( tobj, GLU_TESS_BEGIN, begin_callback );
gluTessCallback( tobj, GLU_TESS_VERTEX, vertex_callback );
gluTessCallback( tobj, GLU_TESS_END, end_callback );
gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, edge_callback );
gluTessCallback( tobj, GLU_TESS_BEGIN, (callback_t) begin_callback );
gluTessCallback( tobj, GLU_TESS_VERTEX, (callback_t) vertex_callback );
gluTessCallback( tobj, GLU_TESS_END, (callback_t) end_callback );
gluTessCallback( tobj, GLU_TESS_EDGE_FLAG, (callback_t) edge_callback );
glNewList( list_start + 1, GL_COMPILE );
gluBeginPolygon( tobj );

View File

@@ -1,4 +1,4 @@
/* $Id: trispd.c,v 1.3 2002/04/22 16:03:37 brianp Exp $ */
/* $Id: trispd.c,v 1.4 2002/07/12 15:54:02 brianp Exp $ */
/*
* Simple GLUT program to measure triangle strip rendering speed.
@@ -131,7 +131,7 @@ static void LoadTex(int comp, int filter)
{
GLubyte *pixels;
int x, y;
pixels = malloc(4*256*256);
pixels = (GLubyte *) malloc(4*256*256);
for (y = 0; y < 256; ++y)
for (x = 0; x < 256; ++x) {
pixels[(y*256+x)*4+0] = (int)(128.5 + 127.0 * cos(0.024544 * x));

View File

@@ -94,7 +94,7 @@ void CALLBACK vertexCallback(GLvoid *vertex)
pointer = (GLdouble *) vertex;
glColor3dv(pointer+3);
glVertex3dv(vertex);
glVertex3dv(pointer);
}
/* combineCallback is used to create a new vertex when edges

View File

@@ -30,7 +30,7 @@ static PPMImage *LoadPPM(const char *filename)
exit(1);
}
result = malloc(sizeof(PPMImage));
result = (PPMImage *) malloc(sizeof(PPMImage));
if (!result)
{
fprintf(stderr, "Unable to allocate memory\n");
@@ -52,7 +52,7 @@ static PPMImage *LoadPPM(const char *filename)
while (fgetc(fp) != '\n')
;
result->data = malloc(3 * result->sizeX * result->sizeY);
result->data = (GLubyte *) malloc(3 * result->sizeX * result->sizeY);
if (!result)
{
fprintf(stderr, "Unable to allocate memory\n");

View File

@@ -216,11 +216,13 @@ static void CALLBACK ErrorCallback(GLenum which)
}
}
typedef void (GLAPIENTRY *callback_t)();
static void Init(void)
{
theNurbs = gluNewNurbsRenderer();
gluNurbsCallback(theNurbs, GLU_ERROR, ErrorCallback);
gluNurbsCallback(theNurbs, GLU_ERROR, (callback_t) ErrorCallback);
gluNurbsProperty(theNurbs, GLU_SAMPLING_TOLERANCE, 15.0);
gluNurbsProperty(theNurbs, GLU_DISPLAY_MODE, GLU_OUTLINE_PATCH);

View File

@@ -102,6 +102,8 @@ static void CALLBACK ErrorHandler(GLenum which)
fprintf(stderr, "Quad Error: %s\n", gluErrorString(which));
}
typedef void (GLAPIENTRY *callback_t)();
static void Init(void)
{
static GLint colorIndexes[3] = {0, 200, 255};
@@ -163,7 +165,7 @@ static void Init(void)
}
quadObj = gluNewQuadric();
gluQuadricCallback(quadObj, GLU_ERROR, ErrorHandler);
gluQuadricCallback(quadObj, GLU_ERROR, (callback_t) ErrorHandler);
radius1 = 10;
radius2 = 5;

View File

@@ -1,4 +1,4 @@
/* $Id: glxinfo.c,v 1.15 2002/03/08 19:44:28 brianp Exp $ */
/* $Id: glxinfo.c,v 1.16 2002/07/12 15:54:02 brianp Exp $ */
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
@@ -218,7 +218,7 @@ print_screen_info(Display *dpy, int scrnum, Bool allowDirect)
const char *gluExtensions = (const char *) gluGetString(GLU_EXTENSIONS);
#endif
/* Strip the screen number from the display name, if present. */
if (!(displayName = malloc(strlen(DisplayString(dpy)) + 1))) {
if (!(displayName = (char *) malloc(strlen(DisplayString(dpy)) + 1))) {
fprintf(stderr, "Error: malloc() failed\n");
exit(1);
}
@@ -486,16 +486,16 @@ print_visual_attribs_long(const struct visual_attribs *attribs)
static void
print_visual_info(Display *dpy, int scrnum, InfoMode mode)
{
XVisualInfo template;
XVisualInfo theTemplate;
XVisualInfo *visuals;
int numVisuals;
long mask;
int i;
/* get list of all visuals on this screen */
template.screen = scrnum;
theTemplate.screen = scrnum;
mask = VisualScreenMask;
visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals);
visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
if (mode == Verbose) {
for (i = 0; i < numVisuals; i++) {
@@ -569,7 +569,7 @@ mesa_hack(Display *dpy, int scrnum)
static int
find_best_visual(Display *dpy, int scrnum)
{
XVisualInfo template;
XVisualInfo theTemplate;
XVisualInfo *visuals;
int numVisuals;
long mask;
@@ -577,9 +577,9 @@ find_best_visual(Display *dpy, int scrnum)
struct visual_attribs bestVis;
/* get list of all visuals on this screen */
template.screen = scrnum;
theTemplate.screen = scrnum;
mask = VisualScreenMask;
visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals);
visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
/* init bestVis with first visual info */
get_visual_attribs(dpy, &visuals[0], &bestVis);

View File

@@ -1,4 +1,4 @@
/* $Id: glxpixmap.c,v 1.2 2000/07/11 16:05:29 brianp Exp $ */
/* $Id: glxpixmap.c,v 1.3 2002/07/12 15:54:02 brianp Exp $ */
/*
@@ -10,6 +10,7 @@
#include <GL/gl.h>
#define GLX_GLXEXT_PROTOTYPES
#include <GL/glx.h>
#include <stdio.h>
#include <stdlib.h>