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
|
||||
"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, "opengl32.lib") /* link Microsoft OpenGL lib */
|
||||
# pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */
|
||||
# endif //_WIN32_WCE
|
||||
# endif /* _WIN32_WCE */
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
@ -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 ) ;
|
||||
|
@ -26,7 +26,8 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#ifdef WIN32
|
||||
#include <crtdbg.h> // DUMP MEMORY LEAKS
|
||||
/* DUMP MEMORY LEAKS */
|
||||
#include <crtdbg.h>
|
||||
#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. */
|
||||
|
@ -34,7 +34,8 @@
|
||||
#include <time.h>
|
||||
#include <GL/freeglut.h>
|
||||
#ifdef WIN32
|
||||
#include <crtdbg.h> // DUMP MEMORY LEAKS
|
||||
/* DUMP MEMORY LEAKS */
|
||||
#include <crtdbg.h>
|
||||
#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 <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 ) ;
|
||||
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 ) ;
|
||||
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 ) ;
|
||||
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 ;
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
|
@ -2425,4 +2425,4 @@ static double tex[2][2][2] =
|
||||
#endif /* TARGET_HOST_WINCE */
|
||||
|
||||
|
||||
#endif /* FREEGLUT_TEAPOT_DATA_H */
|
||||
#endif /* FREEGLUT_TEAPOT_DATA_H */
|
||||
|
Reference in New Issue
Block a user