From: Brian Paul Date: Fri, 12 Jul 2002 15:54:01 +0000 (+0000) Subject: Pedantic compiler fixes (Sven Panne) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f02a5f6cc55fc61229a038ac72edb3ce97cb6950;p=mesa.git Pedantic compiler fixes (Sven Panne) --- 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 #include #include +#include #include #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 +#define GLX_GLXEXT_PROTOTYPES #include #include #include