summaryrefslogtreecommitdiff
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-07-12 15:54:01 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-07-12 15:54:01 +0000
commitf02a5f6cc55fc61229a038ac72edb3ce97cb6950 (patch)
treeb3f3b47105dd5939751262bd880dc7821b435679 /progs
parent902d2faadf37a5627ab2cbcd8993825c8749ec82 (diff)
Pedantic compiler fixes (Sven Panne)
Diffstat (limited to 'progs')
-rw-r--r--progs/demos/drawpix.c4
-rw-r--r--progs/demos/fire.c2
-rw-r--r--progs/demos/paltex.c4
-rw-r--r--progs/demos/readpix.c4
-rw-r--r--progs/demos/shadowtex.c6
-rw-r--r--progs/demos/terrain.c1
-rw-r--r--progs/demos/tessdemo.c22
-rw-r--r--progs/demos/trispd.c4
-rw-r--r--progs/redbook/tess.c2
-rw-r--r--progs/samples/loadppm.c4
-rw-r--r--progs/samples/nurb.c4
-rw-r--r--progs/samples/quad.c4
-rw-r--r--progs/xdemos/glxinfo.c16
-rw-r--r--progs/xdemos/glxpixmap.c3
14 files changed, 44 insertions, 36 deletions
diff --git a/progs/demos/drawpix.c b/progs/demos/drawpix.c
index 222c8209c1c..25d336ece68 100644
--- a/progs/demos/drawpix.c
+++ b/progs/demos/drawpix.c
@@ -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];
diff --git a/progs/demos/fire.c b/progs/demos/fire.c
index e4492cbc161..a648a9d0db9 100644
--- a/progs/demos/fire.c
+++ b/progs/demos/fire.c
@@ -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]);
diff --git a/progs/demos/paltex.c b/progs/demos/paltex.c
index d37538bcf43..67ba27bb8ae 100644
--- a/progs/demos/paltex.c
+++ b/progs/demos/paltex.c
@@ -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);
diff --git a/progs/demos/readpix.c b/progs/demos/readpix.c
index 0277a46a037..ec3665008d2 100644
--- a/progs/demos/readpix.c
+++ b/progs/demos/readpix.c
@@ -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];
diff --git a/progs/demos/shadowtex.c b/progs/demos/shadowtex.c
index c5251727d67..b574f43acd3 100644
--- a/progs/demos/shadowtex.c
+++ b/progs/demos/shadowtex.c
@@ -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,8 +276,8 @@ Display(void)
*/
if (DisplayMode == SHOW_DEPTH_MAPPING) {
/* load depth image as gray-scale luminance texture */
- GLfloat *depth = malloc(ShadowTexWidth * ShadowTexHeight
- * sizeof(GLfloat));
+ GLfloat *depth = (GLfloat *) malloc(ShadowTexWidth * ShadowTexHeight
+ * sizeof(GLfloat));
if (depth) {
glReadPixels(0, 0, ShadowTexWidth, ShadowTexHeight,
GL_DEPTH_COMPONENT, GL_FLOAT, depth);
diff --git a/progs/demos/terrain.c b/progs/demos/terrain.c
index 5b5ad3e1f7a..da5b90d300c 100644
--- a/progs/demos/terrain.c
+++ b/progs/demos/terrain.c
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#ifdef WIN32
diff --git a/progs/demos/tessdemo.c b/progs/demos/tessdemo.c
index 0659b382c7f..abde73054cd 100644
--- a/progs/demos/tessdemo.c
+++ b/progs/demos/tessdemo.c
@@ -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 );
diff --git a/progs/demos/trispd.c b/progs/demos/trispd.c
index 96152d4ced9..61d625526f2 100644
--- a/progs/demos/trispd.c
+++ b/progs/demos/trispd.c
@@ -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));
diff --git a/progs/redbook/tess.c b/progs/redbook/tess.c
index eb94653f252..bf3409eac72 100644
--- a/progs/redbook/tess.c
+++ b/progs/redbook/tess.c
@@ -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
diff --git a/progs/samples/loadppm.c b/progs/samples/loadppm.c
index bf7c8dd1e89..5d3e3ab56f1 100644
--- a/progs/samples/loadppm.c
+++ b/progs/samples/loadppm.c
@@ -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");
diff --git a/progs/samples/nurb.c b/progs/samples/nurb.c
index f90c6ee91f6..dc8991295e8 100644
--- a/progs/samples/nurb.c
+++ b/progs/samples/nurb.c
@@ -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);
diff --git a/progs/samples/quad.c b/progs/samples/quad.c
index 8dec28b6bbd..5b721a44529 100644
--- a/progs/samples/quad.c
+++ b/progs/samples/quad.c
@@ -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;
diff --git a/progs/xdemos/glxinfo.c b/progs/xdemos/glxinfo.c
index 00b4f0458ac..72d0cb737d2 100644
--- a/progs/xdemos/glxinfo.c
+++ b/progs/xdemos/glxinfo.c
@@ -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);
diff --git a/progs/xdemos/glxpixmap.c b/progs/xdemos/glxpixmap.c
index f57b7b9a44b..bde24ebcd04 100644
--- a/progs/xdemos/glxpixmap.c
+++ b/progs/xdemos/glxpixmap.c
@@ -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>