Make "gcc -Wall -pedantic -Werror" happy.
git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@537 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
207d5dc3c9
commit
a38edbb898
@ -722,3 +722,5 @@ distribution.
|
|||||||
|
|
||||||
(191) Renamed "configure.in" to the officially preferred
|
(191) Renamed "configure.in" to the officially preferred
|
||||||
"configure.ac".
|
"configure.ac".
|
||||||
|
|
||||||
|
(192) Make "gcc -Wall -pedantic -Werror" happy.
|
||||||
|
@ -89,7 +89,7 @@
|
|||||||
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
|
# pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */
|
||||||
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
|
# pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */
|
||||||
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
|
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
|
||||||
# endif //_WIN32_WCE
|
# endif /* _WIN32_WCE */
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -47,67 +47,67 @@ Display(void)
|
|||||||
if ( reshape_called )
|
if ( reshape_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Reshape %d: %d %d\n", reshape_seq, reshape_width, reshape_height );
|
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 )
|
if ( key_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Key %d: %d(%c) %d %d\n", key_seq, key_key, key_key, key_x, key_y );
|
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 )
|
if ( special_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Special %d: %d(%c) %d %d\n", special_seq, special_key, special_key, special_x, special_y );
|
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 )
|
if ( visibility_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Visibility %d: %d\n", visibility_seq, visibility_vis );
|
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 )
|
if ( keyup_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Key Up %d: %d(%c) %d %d\n", keyup_seq, keyup_key, keyup_key, keyup_x, keyup_y );
|
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 )
|
if ( specialup_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Special Up %d: %d(%c) %d %d\n", specialup_seq, specialup_key, specialup_key, specialup_x, specialup_y );
|
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 )
|
if ( joystick_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Joystick %d: %d %d %d %d\n", joystick_seq, joystick_a, joystick_b, joystick_c, joystick_d );
|
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 )
|
if ( mouse_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Mouse %d: %d %d %d %d\n", mouse_seq, mouse_button, mouse_updown, mouse_x, mouse_y );
|
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 )
|
if ( mousewheel_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Mouse Wheel %d: %d %d %d %d\n", mousewheel_seq, mousewheel_number, mousewheel_direction, mousewheel_x, mousewheel_y );
|
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 )
|
if ( motion_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Motion %d: %d %d\n", motion_seq, motion_x, motion_y );
|
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 )
|
if ( passivemotion_called )
|
||||||
{
|
{
|
||||||
sprintf ( line, "Passive Motion %d: %d %d\n", passivemotion_seq, passivemotion_x, passivemotion_y );
|
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 );
|
glMatrixMode ( GL_PROJECTION );
|
||||||
@ -336,7 +336,7 @@ main(int argc, char *argv[])
|
|||||||
glutVisibilityFunc( Visibility );
|
glutVisibilityFunc( Visibility );
|
||||||
glutKeyboardUpFunc( KeyUp );
|
glutKeyboardUpFunc( KeyUp );
|
||||||
glutSpecialUpFunc( SpecialUp );
|
glutSpecialUpFunc( SpecialUp );
|
||||||
// glutJoystickFunc( Joystick, 100 );
|
/* glutJoystickFunc( Joystick, 100 ); */
|
||||||
glutMouseFunc ( Mouse ) ;
|
glutMouseFunc ( Mouse ) ;
|
||||||
glutMouseWheelFunc ( MouseWheel ) ;
|
glutMouseWheelFunc ( MouseWheel ) ;
|
||||||
glutMotionFunc ( Motion ) ;
|
glutMotionFunc ( Motion ) ;
|
||||||
|
@ -26,7 +26,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <crtdbg.h> // DUMP MEMORY LEAKS
|
/* DUMP MEMORY LEAKS */
|
||||||
|
#include <crtdbg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -368,7 +369,8 @@ main(int argc, char *argv[])
|
|||||||
free ( affine ) ;
|
free ( affine ) ;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
_CrtDumpMemoryLeaks () ; // DUMP MEMORY LEAK INFORMATION
|
/* DUMP MEMORY LEAK INFORMATION */
|
||||||
|
_CrtDumpMemoryLeaks () ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0; /* ANSI C requires main to return int. */
|
return 0; /* ANSI C requires main to return int. */
|
||||||
|
@ -34,7 +34,8 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <GL/freeglut.h>
|
#include <GL/freeglut.h>
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#include <crtdbg.h> // DUMP MEMORY LEAKS
|
/* DUMP MEMORY LEAKS */
|
||||||
|
#include <crtdbg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -141,15 +142,15 @@ void key_cb ( unsigned char key, int x, int y )
|
|||||||
break ;
|
break ;
|
||||||
|
|
||||||
case 'm' : case 'M' : /* Modify the Lorenz parameters */
|
case 'm' : case 'M' : /* Modify the Lorenz parameters */
|
||||||
printf ( "Please enter new value for <sigma> (default %lf, currently %lf): ", s0, sigma ) ;
|
printf ( "Please enter new value for <sigma> (default %f, currently %f): ", s0, sigma ) ;
|
||||||
fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ;
|
fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ;
|
||||||
sscanf ( inputline, "%lf", &sigma ) ;
|
sscanf ( inputline, "%lf", &sigma ) ;
|
||||||
|
|
||||||
printf ( "Please enter new value for <b> (default %lf, currently %lf): ", b0, b ) ;
|
printf ( "Please enter new value for <b> (default %f, currently %f): ", b0, b ) ;
|
||||||
fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ;
|
fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ;
|
||||||
sscanf ( inputline, "%lf", &b ) ;
|
sscanf ( inputline, "%lf", &b ) ;
|
||||||
|
|
||||||
printf ( "Please enter new value for <r> (default %lf, currently %lf): ", r0, r ) ;
|
printf ( "Please enter new value for <r> (default %f, currently %f): ", r0, r ) ;
|
||||||
fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ;
|
fgets ( inputline, INPUT_LINE_LENGTH-1, stdin ) ;
|
||||||
sscanf ( inputline, "%lf", &r ) ;
|
sscanf ( inputline, "%lf", &r ) ;
|
||||||
|
|
||||||
@ -257,9 +258,9 @@ void display_cb ( void )
|
|||||||
|
|
||||||
/* Print the distance between the two points */
|
/* Print the distance between the two points */
|
||||||
glColor3d ( 1.0, 1.0, 1.0 ) ; /* White */
|
glColor3d ( 1.0, 1.0, 1.0 ) ; /* White */
|
||||||
sprintf ( string, "Distance: %10.6lf", distance ) ;
|
sprintf ( string, "Distance: %10.6f", distance ) ;
|
||||||
glRasterPos2i ( 10, 10 ) ;
|
glRasterPos2i ( 10, 10 ) ;
|
||||||
glutBitmapString ( GLUT_BITMAP_HELVETICA_12, string ) ;
|
glutBitmapString ( GLUT_BITMAP_HELVETICA_12, (unsigned char*)string ) ;
|
||||||
|
|
||||||
glutSwapBuffers();
|
glutSwapBuffers();
|
||||||
}
|
}
|
||||||
@ -347,7 +348,8 @@ int main ( int argc, char *argv[] )
|
|||||||
glutMainLoop () ;
|
glutMainLoop () ;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
_CrtDumpMemoryLeaks () ; // DUMP MEMORY LEAK INFORMATION
|
/* DUMP MEMORY LEAK INFORMATION */
|
||||||
|
_CrtDumpMemoryLeaks () ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0 ;
|
return 0 ;
|
||||||
|
@ -117,12 +117,12 @@ void SampleDisplay( void )
|
|||||||
* And then drawn...
|
* And then drawn...
|
||||||
*/
|
*/
|
||||||
glColor3f( 1, 1, 0 );
|
glColor3f( 1, 1, 0 );
|
||||||
//glutWireCube( 20.0 );
|
/* glutWireCube( 20.0 ); */
|
||||||
glutWireTeapot( 20.0 );
|
glutWireTeapot( 20.0 );
|
||||||
//glutWireSpher( 15.0, 15, 15 );
|
/* glutWireSpher( 15.0, 15, 15 ); */
|
||||||
//glColor3f( 0, 1, 0 );
|
/* glColor3f( 0, 1, 0 ); */
|
||||||
//glutWireCube( 30.0 );
|
/* glutWireCube( 30.0 ); */
|
||||||
//glutSolidCone( 10, 20, 10, 2 );
|
/* glutSolidCone( 10, 20, 10, 2 ); */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Don't forget about the model-view matrix
|
* Don't forget about the model-view matrix
|
||||||
|
@ -144,7 +144,7 @@ void FGAPIENTRY glutSetCursor( int cursorID )
|
|||||||
* need to pick a color for foreground/background---but what
|
* need to pick a color for foreground/background---but what
|
||||||
* one we pick doesn't matter for GLUT_CURSOR_NONE.
|
* 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;
|
XColor black;
|
||||||
no_cursor = XCreatePixmapFromBitmapData( fgDisplay.Display,
|
no_cursor = XCreatePixmapFromBitmapData( fgDisplay.Display,
|
||||||
fgDisplay.RootWindow,
|
fgDisplay.RootWindow,
|
||||||
|
@ -154,7 +154,7 @@ void FGAPIENTRY glutBitmapString( void* fontID, const unsigned char *string )
|
|||||||
* A newline will simply translate the next character's insertion
|
* A newline will simply translate the next character's insertion
|
||||||
* point back to the start of the line and down one line.
|
* point back to the start of the line and down one line.
|
||||||
*/
|
*/
|
||||||
while( c = *string++ )
|
while( ( c = *string++ ) )
|
||||||
if( c == '\n' )
|
if( c == '\n' )
|
||||||
{
|
{
|
||||||
glBitmap ( 0, 0, 0, 0, -x, (float) -font->Height, NULL );
|
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 )
|
if ( !string || ! *string )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while( c = *string++ )
|
while( ( c = *string++) )
|
||||||
{
|
{
|
||||||
if( c != '\n' )/* Not an EOL, increment length of line */
|
if( c != '\n' )/* Not an EOL, increment length of line */
|
||||||
this_line_length += *( font->Characters[ c ]);
|
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
|
* A newline will simply translate the next character's insertion
|
||||||
* point back to the start of the line and down one line.
|
* point back to the start of the line and down one line.
|
||||||
*/
|
*/
|
||||||
while( c = *string++ )
|
while( ( c = *string++) )
|
||||||
if( c < font->Quantity )
|
if( c < font->Quantity )
|
||||||
{
|
{
|
||||||
if( c == '\n' )
|
if( c == '\n' )
|
||||||
@ -338,7 +338,7 @@ int FGAPIENTRY glutStrokeLength( void* fontID, const unsigned char* string )
|
|||||||
if ( !string || ! *string )
|
if ( !string || ! *string )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
while( c = *string++ )
|
while( ( c = *string++ ) )
|
||||||
if( c < font->Quantity )
|
if( c < font->Quantity )
|
||||||
{
|
{
|
||||||
if( c == '\n' ) /* EOL; reset the length of this line */
|
if( c == '\n' ) /* EOL; reset the length of this line */
|
||||||
|
@ -230,13 +230,13 @@ void fgDeinitialize( void )
|
|||||||
|
|
||||||
fgDestroyStructure( );
|
fgDestroyStructure( );
|
||||||
|
|
||||||
while( timer = fgState.Timers.First )
|
while( ( timer = fgState.Timers.First ) )
|
||||||
{
|
{
|
||||||
fgListRemove( &fgState.Timers, &timer->Node );
|
fgListRemove( &fgState.Timers, &timer->Node );
|
||||||
free( timer );
|
free( timer );
|
||||||
}
|
}
|
||||||
|
|
||||||
while( timer = fgState.FreeTimers.First )
|
while( ( timer = fgState.FreeTimers.First) )
|
||||||
{
|
{
|
||||||
fgListRemove( &fgState.FreeTimers, &timer->Node );
|
fgListRemove( &fgState.FreeTimers, &timer->Node );
|
||||||
free( timer );
|
free( timer );
|
||||||
@ -618,11 +618,15 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
|
|||||||
* size.
|
* size.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (geometry )
|
if( geometry )
|
||||||
{
|
{
|
||||||
|
unsigned int parsedWidth, parsedHeight;
|
||||||
int mask = XParseGeometry( geometry,
|
int mask = XParseGeometry( geometry,
|
||||||
&fgState.Position.X, &fgState.Position.Y,
|
&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) )
|
if( (mask & (WidthValue|HeightValue)) == (WidthValue|HeightValue) )
|
||||||
fgState.Size.Use = GL_TRUE;
|
fgState.Size.Use = GL_TRUE;
|
||||||
|
Reference in New Issue
Block a user