From 0bd8456a65a8fb9afe9dd157754f9596eafed9b8 Mon Sep 17 00:00:00 2001 From: fayjf Date: Tue, 26 Apr 2005 17:44:57 +0000 Subject: [PATCH] Fixing the typecasts on the callback fetches and invocations to allow \"freeglut\" to compile with GCC 4.0 git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@584 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/freeglut_internal.h | 21 +++++++++++++++++---- freeglut/freeglut/src/freeglut_structure.c | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/freeglut/freeglut/src/freeglut_internal.h b/freeglut/freeglut/src/freeglut_internal.h index cddae4e..0226214 100644 --- a/freeglut/freeglut/src/freeglut_internal.h +++ b/freeglut/freeglut/src/freeglut_internal.h @@ -403,7 +403,7 @@ do \ * type. */ #define FETCH_WCB(window,cbname) \ - ((FGCB ## cbname)((window).CallBacks[CB_ ## cbname])) + ((window).CallBacks[CB_ ## cbname]) /* * INVOKE_WCB() is used as: @@ -424,15 +424,28 @@ do \ * current window. * */ +#if TARGET_HOST_WIN32 +#define INVOKE_WCB(window,cbname,arg_list) \ +do \ +{ \ + if( FETCH_WCB( window, cbname ) ) \ + { \ + FGCB ## cbname func = (FGCB ## cbname)(FETCH_WCB( window, cbname )); \ + fgSetWindow( &window ); \ + func arg_list; \ + } \ +} while( 0 ) +#else #define INVOKE_WCB(window,cbname,arg_list) \ do \ { \ if( FETCH_WCB( window, cbname ) ) \ { \ fgSetWindow( &window ); \ - FETCH_WCB( window, cbname ) arg_list; \ + ((FGCB ## cbname)FETCH_WCB( window, cbname )) arg_list; \ } \ } while( 0 ) +#endif /* * The window callbacks the user can supply us with. Should be kept portable. @@ -570,7 +583,7 @@ struct tagSFG_Structure SFG_List WindowsToDestroy; SFG_Window* CurrentWindow; /* The currently set window */ - SFG_Menu* CurrentMenu; /* Same, but menu... */ + SFG_Menu* CurrentMenu; /* Same, but menu... */ SFG_MenuContext* MenuContext; /* OpenGL rendering context for menus */ @@ -693,7 +706,7 @@ extern SFG_State fgState; * window set, respectively: */ #define FREEGLUT_EXIT_IF_NO_WINDOW( string ) \ - if ( ! fgStructure.CurrentWindow ) \ + if ( ! fgStructure.CurrentWindow ) \ { \ fgError ( " ERROR: Function <%s> called" \ " with no current window defined.", (string) ) ; \ diff --git a/freeglut/freeglut/src/freeglut_structure.c b/freeglut/freeglut/src/freeglut_structure.c index d3f9f05..ecb4f10 100644 --- a/freeglut/freeglut/src/freeglut_structure.c +++ b/freeglut/freeglut/src/freeglut_structure.c @@ -165,7 +165,7 @@ void fgAddToWindowDestroyList( SFG_Window* window ) * to ensure that they are no longer called after this point. */ { - FGCBDestroy destroy = FETCH_WCB( *window, Destroy ); + FGCBDestroy destroy = (FGCBDestroy)FETCH_WCB( *window, Destroy ); fghClearCallBacks( window ); SET_WCB( *window, Destroy, destroy ); }