Fixed the buglet about failing to report the program's name on error-
messages. Please test. (Modified glutInit(), the state structure, and the warn/err functions.) git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@238 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
parent
fb3db77b9a
commit
04c6d13777
@ -379,6 +379,10 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
|
|||||||
char* displayName = NULL;
|
char* displayName = NULL;
|
||||||
int i, j, argc = *pargc;
|
int i, j, argc = *pargc;
|
||||||
|
|
||||||
|
if (pargc && *pargc && argv && *argv && **argv)
|
||||||
|
fgState.ProgramName = strdup (*argv);
|
||||||
|
else
|
||||||
|
fgState.ProgramName = strdup ("");
|
||||||
/*
|
/*
|
||||||
* Do not allow multiple initialization of the library
|
* Do not allow multiple initialization of the library
|
||||||
*/
|
*/
|
||||||
|
@ -245,8 +245,8 @@ struct tagSFG_State
|
|||||||
int GameModeRefresh; /* The refresh rate for game mode */
|
int GameModeRefresh; /* The refresh rate for game mode */
|
||||||
|
|
||||||
int ActionOnWindowClose; /* Action when user clicks "x" on window header bar */
|
int ActionOnWindowClose; /* Action when user clicks "x" on window header bar */
|
||||||
|
|
||||||
fgExecutionState ExecState; /* Current state of the GLUT execution */
|
fgExecutionState ExecState; /* Current state of the GLUT execution */
|
||||||
|
char *ProgramName;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -396,7 +396,7 @@ void fgError( const char *fmt, ... )
|
|||||||
|
|
||||||
va_start( ap, fmt );
|
va_start( ap, fmt );
|
||||||
|
|
||||||
fprintf( stderr, "freeglut: ");
|
fprintf( stderr, "freeglut (%s): ", fgState.ProgramName || "");
|
||||||
vfprintf( stderr, fmt, ap );
|
vfprintf( stderr, fmt, ap );
|
||||||
fprintf( stderr, "\n" );
|
fprintf( stderr, "\n" );
|
||||||
|
|
||||||
@ -411,7 +411,7 @@ void fgWarning( const char *fmt, ... )
|
|||||||
|
|
||||||
va_start( ap, fmt );
|
va_start( ap, fmt );
|
||||||
|
|
||||||
fprintf( stderr, "freeglut: ");
|
fprintf( stderr, "freeglut (%s): ", fgState.ProgramName || "");
|
||||||
vfprintf( stderr, fmt, ap );
|
vfprintf( stderr, fmt, ap );
|
||||||
fprintf( stderr, "\n" );
|
fprintf( stderr, "\n" );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user