From a38edbb898a34c794d502724263c11a319f363e2 Mon Sep 17 00:00:00 2001 From: spanne Date: Sat, 1 Jan 2005 16:09:55 +0000 Subject: [PATCH] Make "gcc -Wall -pedantic -Werror" happy. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@537 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/ChangeLog | 2 ++ freeglut/freeglut/include/GL/freeglut_std.h | 2 +- .../progs/demos/CallbackMaker/CallbackMaker.c | 24 +++++++++---------- .../demos/Fractals_random/fractals_random.c | 6 +++-- freeglut/freeglut/progs/demos/Lorenz/lorenz.c | 16 +++++++------ freeglut/freeglut/progs/demos/One/one.c | 10 ++++---- freeglut/freeglut/src/freeglut_cursor.c | 2 +- freeglut/freeglut/src/freeglut_font.c | 8 +++---- freeglut/freeglut/src/freeglut_init.c | 12 ++++++---- freeglut/freeglut/src/freeglut_teapot_data.h | 2 +- 10 files changed, 47 insertions(+), 37 deletions(-) diff --git a/freeglut/freeglut/ChangeLog b/freeglut/freeglut/ChangeLog index 3ce0350..797ca5c 100644 --- a/freeglut/freeglut/ChangeLog +++ b/freeglut/freeglut/ChangeLog @@ -722,3 +722,5 @@ distribution. (191) Renamed "configure.in" to the officially preferred "configure.ac". + +(192) Make "gcc -Wall -pedantic -Werror" happy. diff --git a/freeglut/freeglut/include/GL/freeglut_std.h b/freeglut/freeglut/include/GL/freeglut_std.h index eb22e0b..f5723e0 100644 --- a/freeglut/freeglut/include/GL/freeglut_std.h +++ b/freeglut/freeglut/include/GL/freeglut_std.h @@ -89,7 +89,7 @@ # pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */ # pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */ # pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */ -# endif //_WIN32_WCE +# endif /* _WIN32_WCE */ # endif #else diff --git a/freeglut/freeglut/progs/demos/CallbackMaker/CallbackMaker.c b/freeglut/freeglut/progs/demos/CallbackMaker/CallbackMaker.c index 9d5613d..5b93044 100644 --- a/freeglut/freeglut/progs/demos/CallbackMaker/CallbackMaker.c +++ b/freeglut/freeglut/progs/demos/CallbackMaker/CallbackMaker.c @@ -47,67 +47,67 @@ Display(void) if ( reshape_called ) { sprintf ( line, "Reshape %d: %d %d\n", reshape_seq, reshape_width, reshape_height ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( key_called ) { sprintf ( line, "Key %d: %d(%c) %d %d\n", key_seq, key_key, key_key, key_x, key_y ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( special_called ) { sprintf ( line, "Special %d: %d(%c) %d %d\n", special_seq, special_key, special_key, special_x, special_y ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( visibility_called ) { sprintf ( line, "Visibility %d: %d\n", visibility_seq, visibility_vis ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( keyup_called ) { sprintf ( line, "Key Up %d: %d(%c) %d %d\n", keyup_seq, keyup_key, keyup_key, keyup_x, keyup_y ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( specialup_called ) { sprintf ( line, "Special Up %d: %d(%c) %d %d\n", specialup_seq, specialup_key, specialup_key, specialup_x, specialup_y ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( joystick_called ) { sprintf ( line, "Joystick %d: %d %d %d %d\n", joystick_seq, joystick_a, joystick_b, joystick_c, joystick_d ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( mouse_called ) { sprintf ( line, "Mouse %d: %d %d %d %d\n", mouse_seq, mouse_button, mouse_updown, mouse_x, mouse_y ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( mousewheel_called ) { sprintf ( line, "Mouse Wheel %d: %d %d %d %d\n", mousewheel_seq, mousewheel_number, mousewheel_direction, mousewheel_x, mousewheel_y ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( motion_called ) { sprintf ( line, "Motion %d: %d %d\n", motion_seq, motion_x, motion_y ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } if ( passivemotion_called ) { sprintf ( line, "Passive Motion %d: %d %d\n", passivemotion_seq, passivemotion_x, passivemotion_y ); - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, line ); + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)line ); } glMatrixMode ( GL_PROJECTION ); @@ -336,7 +336,7 @@ main(int argc, char *argv[]) glutVisibilityFunc( Visibility ); glutKeyboardUpFunc( KeyUp ); glutSpecialUpFunc( SpecialUp ); -// glutJoystickFunc( Joystick, 100 ); + /* glutJoystickFunc( Joystick, 100 ); */ glutMouseFunc ( Mouse ) ; glutMouseWheelFunc ( MouseWheel ) ; glutMotionFunc ( Motion ) ; diff --git a/freeglut/freeglut/progs/demos/Fractals_random/fractals_random.c b/freeglut/freeglut/progs/demos/Fractals_random/fractals_random.c index 3799ba0..bf290bc 100644 --- a/freeglut/freeglut/progs/demos/Fractals_random/fractals_random.c +++ b/freeglut/freeglut/progs/demos/Fractals_random/fractals_random.c @@ -26,7 +26,8 @@ #include #include #ifdef WIN32 -#include // DUMP MEMORY LEAKS +/* DUMP MEMORY LEAKS */ +#include #endif typedef struct @@ -368,7 +369,8 @@ main(int argc, char *argv[]) free ( affine ) ; #ifdef WIN32 - _CrtDumpMemoryLeaks () ; // DUMP MEMORY LEAK INFORMATION + /* DUMP MEMORY LEAK INFORMATION */ + _CrtDumpMemoryLeaks () ; #endif return 0; /* ANSI C requires main to return int. */ diff --git a/freeglut/freeglut/progs/demos/Lorenz/lorenz.c b/freeglut/freeglut/progs/demos/Lorenz/lorenz.c index 61ae694..be32c77 100644 --- a/freeglut/freeglut/progs/demos/Lorenz/lorenz.c +++ b/freeglut/freeglut/progs/demos/Lorenz/lorenz.c @@ -34,7 +34,8 @@ #include #include #ifdef WIN32 -#include // DUMP MEMORY LEAKS +/* DUMP MEMORY LEAKS */ +#include #endif @@ -141,15 +142,15 @@ void key_cb ( unsigned char key, int x, int y ) break ; case 'm' : case 'M' : /* Modify the Lorenz parameters */ - printf ( "Please enter new value for (default %lf, currently %lf): ", s0, sigma ) ; + printf ( "Please enter new value for (default %f, currently %f): ", s0, sigma ) ; fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ; sscanf ( inputline, "%lf", &sigma ) ; - printf ( "Please enter new value for (default %lf, currently %lf): ", b0, b ) ; + printf ( "Please enter new value for (default %f, currently %f): ", b0, b ) ; fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ; sscanf ( inputline, "%lf", &b ) ; - printf ( "Please enter new value for (default %lf, currently %lf): ", r0, r ) ; + printf ( "Please enter new value for (default %f, currently %f): ", r0, r ) ; fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ; sscanf ( inputline, "%lf", &r ) ; @@ -257,9 +258,9 @@ void display_cb ( void ) /* Print the distance between the two points */ glColor3d ( 1.0, 1.0, 1.0 ) ; /* White */ - sprintf ( string, "Distance: %10.6lf", distance ) ; + sprintf ( string, "Distance: %10.6f", distance ) ; glRasterPos2i ( 10, 10 ) ; - glutBitmapString ( GLUT_BITMAP_HELVETICA_12, string ) ; + glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)string ) ; glutSwapBuffers(); } @@ -347,7 +348,8 @@ int main ( int argc, char *argv[] ) glutMainLoop () ; #ifdef WIN32 - _CrtDumpMemoryLeaks () ; // DUMP MEMORY LEAK INFORMATION + /* DUMP MEMORY LEAK INFORMATION */ + _CrtDumpMemoryLeaks () ; #endif return 0 ; diff --git a/freeglut/freeglut/progs/demos/One/one.c b/freeglut/freeglut/progs/demos/One/one.c index 93e5144..c0f3017 100644 --- a/freeglut/freeglut/progs/demos/One/one.c +++ b/freeglut/freeglut/progs/demos/One/one.c @@ -117,12 +117,12 @@ void SampleDisplay( void ) * And then drawn... */ glColor3f( 1, 1, 0 ); - //glutWireCube( 20.0 ); + /* glutWireCube( 20.0 ); */ glutWireTeapot( 20.0 ); - //glutWireSpher( 15.0, 15, 15 ); - //glColor3f( 0, 1, 0 ); - //glutWireCube( 30.0 ); - //glutSolidCone( 10, 20, 10, 2 ); + /* glutWireSpher( 15.0, 15, 15 ); */ + /* glColor3f( 0, 1, 0 ); */ + /* glutWireCube( 30.0 ); */ + /* glutSolidCone( 10, 20, 10, 2 ); */ /* * Don't forget about the model-view matrix diff --git a/freeglut/freeglut/src/freeglut_cursor.c b/freeglut/freeglut/src/freeglut_cursor.c index 0d30c32..0c4debb 100644 --- a/freeglut/freeglut/src/freeglut_cursor.c +++ b/freeglut/freeglut/src/freeglut_cursor.c @@ -144,7 +144,7 @@ void FGAPIENTRY glutSetCursor( int cursorID ) * need to pick a color for foreground/background---but what * one we pick doesn't matter for GLUT_CURSOR_NONE. */ - static unsigned char no_cursor_bits[ 32 ]; + static char no_cursor_bits[ 32 ]; XColor black; no_cursor = XCreatePixmapFromBitmapData( fgDisplay.Display, fgDisplay.RootWindow, diff --git a/freeglut/freeglut/src/freeglut_font.c b/freeglut/freeglut/src/freeglut_font.c index f45a511..8026396 100644 --- a/freeglut/freeglut/src/freeglut_font.c +++ b/freeglut/freeglut/src/freeglut_font.c @@ -154,7 +154,7 @@ void FGAPIENTRY glutBitmapString( void* fontID, const unsigned char *string ) * A newline will simply translate the next character's insertion * point back to the start of the line and down one line. */ - while( c = *string++ ) + while( ( c = *string++ ) ) if( c == '\n' ) { glBitmap ( 0, 0, 0, 0, -x, (float) -font->Height, NULL ); @@ -202,7 +202,7 @@ int FGAPIENTRY glutBitmapLength( void* fontID, const unsigned char* string ) if ( !string || ! *string ) return 0; - while( c = *string++ ) + while( ( c = *string++) ) { if( c != '\n' )/* Not an EOL, increment length of line */ this_line_length += *( font->Characters[ c ]); @@ -273,7 +273,7 @@ void FGAPIENTRY glutStrokeString( void* fontID, const unsigned char *string ) * A newline will simply translate the next character's insertion * point back to the start of the line and down one line. */ - while( c = *string++ ) + while( ( c = *string++) ) if( c < font->Quantity ) { if( c == '\n' ) @@ -338,7 +338,7 @@ int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string ) if ( !string || ! *string ) return 0; - while( c = *string++ ) + while( ( c = *string++ ) ) if( c < font->Quantity ) { if( c == '\n' ) /* EOL; reset the length of this line */ diff --git a/freeglut/freeglut/src/freeglut_init.c b/freeglut/freeglut/src/freeglut_init.c index 75908c9..6b6f3d5 100644 --- a/freeglut/freeglut/src/freeglut_init.c +++ b/freeglut/freeglut/src/freeglut_init.c @@ -230,13 +230,13 @@ void fgDeinitialize( void ) fgDestroyStructure( ); - while( timer = fgState.Timers.First ) + while( ( timer = fgState.Timers.First ) ) { fgListRemove( &fgState.Timers, &timer->Node ); free( timer ); } - while( timer = fgState.FreeTimers.First ) + while( ( timer = fgState.FreeTimers.First) ) { fgListRemove( &fgState.FreeTimers, &timer->Node ); free( timer ); @@ -618,11 +618,15 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) * size. */ - if (geometry ) + if( geometry ) { + unsigned int parsedWidth, parsedHeight; int mask = XParseGeometry( geometry, &fgState.Position.X, &fgState.Position.Y, - &fgState.Size.X, &fgState.Size.Y ); + &parsedWidth, &parsedHeight ); + /* TODO: Check for overflow? */ + fgState.Size.X = parsedWidth; + fgState.Size.Y = parsedHeight; if( (mask & (WidthValue|HeightValue)) == (WidthValue|HeightValue) ) fgState.Size.Use = GL_TRUE; diff --git a/freeglut/freeglut/src/freeglut_teapot_data.h b/freeglut/freeglut/src/freeglut_teapot_data.h index eaee2b1..5c9829f 100644 --- a/freeglut/freeglut/src/freeglut_teapot_data.h +++ b/freeglut/freeglut/src/freeglut_teapot_data.h @@ -2425,4 +2425,4 @@ static double tex[2][2][2] = #endif /* TARGET_HOST_WINCE */ -#endif /* FREEGLUT_TEAPOT_DATA_H */ \ No newline at end of file +#endif /* FREEGLUT_TEAPOT_DATA_H */