fgState.FPSInterval is unsigned int (GLuint), environment variable GLUT_FPS can be negative

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@425 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
nigels 2003-12-30 02:14:54 +00:00
parent d07ef326cd
commit 4590373e8d

View File

@ -519,9 +519,13 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
const char *fps = getenv( "GLUT_FPS" ); const char *fps = getenv( "GLUT_FPS" );
if( fps ) if( fps )
{ {
sscanf( fps, "%d", &fgState.FPSInterval ); int interval;
if( fgState.FPSInterval <= 0 ) sscanf( fps, "%d", &interval );
fgState.FPSInterval = 5000; /* 5000 milliseconds */
if( interval <= 0 )
fgState.FPSInterval = 5000; /* 5000 millisecond default */
else
fgState.FPSInterval = interval;
} }
} }