Casting changes, John Fay

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@168 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
puggles 2003-08-28 15:15:25 +00:00
parent 355b9327a9
commit 59c4c38bbc
7 changed files with 63 additions and 63 deletions

View File

@ -106,7 +106,7 @@ void FGAPIENTRY glutTimerFunc( unsigned int timeOut, void (* callback)( int ), i
/* /*
* Create a new freeglut timer hook structure * Create a new freeglut timer hook structure
*/ */
timer = calloc( sizeof(SFG_Timer), 1 ); timer = (SFG_Timer *)calloc( sizeof(SFG_Timer), 1 );
/* /*
* Remember the callback address and timer hook's ID * Remember the callback address and timer hook's ID

View File

@ -129,7 +129,7 @@ void FGAPIENTRY glutWireSphere( GLdouble dRadius, GLint slices, GLint stacks )
/* /*
* Allocate the vertices array * Allocate the vertices array
*/ */
vertex = calloc( sizeof(double), 3 * slices * (stacks - 1) ); vertex = (double *)calloc( sizeof(double), 3 * slices * (stacks - 1) );
glPushMatrix(); glPushMatrix();
glScaled( radius, radius, radius ); glScaled( radius, radius, radius );
@ -207,8 +207,8 @@ void FGAPIENTRY glutSolidSphere( GLdouble dRadius, GLint slices, GLint stacks )
glPushMatrix(); glPushMatrix();
/* glScalef( radius, radius, radius ); */ /* glScalef( radius, radius, radius ); */
row = calloc( sizeof(double), slices * 3 ); row = (double *)calloc( sizeof(double), slices * 3 );
next = calloc( sizeof(double), slices * 3 ); next = (double *)calloc( sizeof(double), slices * 3 );
dpsi = M_PI / (stacks + 1); dpsi = M_PI / (stacks + 1);
dphi = 2 * M_PI / slices; dphi = 2 * M_PI / slices;
@ -329,7 +329,7 @@ void FGAPIENTRY glutWireCone( GLdouble base, GLdouble height, GLint slices, GLin
/* /*
* We need 'slices' points on a circle * We need 'slices' points on a circle
*/ */
vertices = calloc( sizeof(double), 2 * (slices + 1) ); vertices = (double *)calloc( sizeof(double), 2 * (slices + 1) );
for( j=0; j<slices+1; j++ ) for( j=0; j<slices+1; j++ )
{ {
@ -415,7 +415,7 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
/* /*
* We need 'slices' points on a circle * We need 'slices' points on a circle
*/ */
vertices = calloc( sizeof(double), 2 * (slices + 1) ); vertices = (double *)calloc( sizeof(double), 2 * (slices + 1) );
for( j=0; j<slices+1; j++ ) for( j=0; j<slices+1; j++ )
{ {
@ -498,8 +498,8 @@ void FGAPIENTRY glutWireTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GLi
/* /*
* Allocate the vertices array * Allocate the vertices array
*/ */
vertex = calloc( sizeof(double), 3 * nSides * nRings ); vertex = (double *)calloc( sizeof(double), 3 * nSides * nRings );
normal = calloc( sizeof(double), 3 * nSides * nRings ); normal = (double *)calloc( sizeof(double), 3 * nSides * nRings );
glPushMatrix(); glPushMatrix();
@ -582,8 +582,8 @@ void FGAPIENTRY glutSolidTorus( GLdouble dInnerRadius, GLdouble dOuterRadius, GL
/* /*
* Allocate the vertices array * Allocate the vertices array
*/ */
vertex = calloc( sizeof(double), 3 * nSides * nRings ); vertex = (double *)calloc( sizeof(double), 3 * nSides * nRings );
normal = calloc( sizeof(double), 3 * nSides * nRings ); normal = (double *)calloc( sizeof(double), 3 * nSides * nRings );
glPushMatrix(); glPushMatrix();

View File

@ -287,7 +287,7 @@ void fgDeinitialize( void )
/* /*
* Delete all the timers and their storage list * Delete all the timers and their storage list
*/ */
while ( (timer = fgState.Timers.First) != NULL ) while ( (timer = (SFG_Timer *)fgState.Timers.First) != NULL )
{ {
fgListRemove ( &fgState.Timers, &timer->Node ) ; fgListRemove ( &fgState.Timers, &timer->Node ) ;
free ( timer ) ; free ( timer ) ;
@ -985,7 +985,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode )
*/ */
char *token ; char *token ;
int len = strlen ( displayMode ) ; int len = strlen ( displayMode ) ;
char *buffer = malloc ( (len+1) * sizeof(char) ) ; char *buffer = (char *)malloc ( (len+1) * sizeof(char) ) ;
memcpy ( buffer, displayMode, len ) ; memcpy ( buffer, displayMode, len ) ;
buffer[len] = '\0' ; buffer[len] = '\0' ;

View File

@ -501,7 +501,7 @@ void fgJoystickInit( int ident )
/* /*
* Have the global joystick structure created * Have the global joystick structure created
*/ */
fgJoystick = calloc( sizeof(SFG_Joystick), 1 ); fgJoystick = (SFG_Joystick *)calloc( sizeof(SFG_Joystick), 1 );
#ifdef WIN32 #ifdef WIN32
switch( ident ) switch( ident )

View File

@ -301,9 +301,9 @@ static void fghCheckTimers( void )
/* /*
* For every timer that is waiting for triggering * For every timer that is waiting for triggering
*/ */
for( timer = fgState.Timers.First; timer; timer = next ) for( timer = (SFG_Timer *)fgState.Timers.First; timer; timer = next )
{ {
next = timer->Node.Next; next = (SFG_Timer *)timer->Node.Next;
/* /*
* Check for the timeout: * Check for the timeout:
@ -322,7 +322,7 @@ static void fghCheckTimers( void )
* Now feel free to execute all the hooked and timed out timer callbacks * Now feel free to execute all the hooked and timed out timer callbacks
* And delete the timed out timers... * And delete the timed out timers...
*/ */
while ( (timer = timedOut.First) ) while ( (timer = (SFG_Timer *)timedOut.First) )
{ {
if( timer->Callback != NULL ) if( timer->Callback != NULL )
timer->Callback( timer->ID ); timer->Callback( timer->ID );
@ -394,13 +394,13 @@ static void fgCleanUpGlutsMess( void )
if ( fgStructure.Windows.First != NULL ) if ( fgStructure.Windows.First != NULL )
{ {
SFG_Window *win = fgStructure.Windows.First ; SFG_Window *win = (SFG_Window *)fgStructure.Windows.First ;
glEnd(); glEnd();
glFinish(); glFinish();
glFlush(); glFlush();
while ( win != NULL ) while ( win != NULL )
{ {
SFG_Window *temp_win = win->Node.Next ; SFG_Window *temp_win = (SFG_Window *)win->Node.Next ;
fgDestroyWindow ( win, FALSE ) ; fgDestroyWindow ( win, FALSE ) ;
win = temp_win ; win = temp_win ;
} }
@ -1076,7 +1076,7 @@ void FGAPIENTRY glutMainLoopEvent( void )
void FGAPIENTRY glutMainLoop( void ) void FGAPIENTRY glutMainLoop( void )
{ {
#if TARGET_HOST_WIN32 #if TARGET_HOST_WIN32
SFG_Window *window = fgStructure.Windows.First ; SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ;
#endif #endif
/* /*
@ -1098,7 +1098,7 @@ void FGAPIENTRY glutMainLoop( void )
if ( window->Callbacks.Visibility != NULL ) if ( window->Callbacks.Visibility != NULL )
window->Callbacks.Visibility ( window->State.Visible ) ; window->Callbacks.Visibility ( window->State.Visible ) ;
window = window->Node.Next ; window = (SFG_Window *)window->Node.Next ;
} }
#endif #endif
@ -1343,7 +1343,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
/* Step through the list of windows. If the rendering context is notbeing used /* Step through the list of windows. If the rendering context is notbeing used
* by another window, then we delete it. * by another window, then we delete it.
*/ */
for ( iter = fgStructure.Windows.First; iter; iter = iter->Node.Next ) for ( iter = (SFG_Window *)fgStructure.Windows.First; iter; iter = (SFG_Window *)iter->Node.Next )
{ {
if ( ( iter->Window.Context == window->Window.Context ) && ( iter != window ) ) if ( ( iter->Window.Context == window->Window.Context ) && ( iter != window ) )
used = TRUE ; used = TRUE ;

View File

@ -62,7 +62,7 @@ static SFG_MenuEntry *fghFindMenuEntry( SFG_Menu* menu, int index )
SFG_MenuEntry *entry; SFG_MenuEntry *entry;
int i = 1; int i = 1;
for( entry = menu->Entries.First; entry; entry = entry->Node.Next) for( entry = (SFG_MenuEntry *)menu->Entries.First; entry; entry = (SFG_MenuEntry *)entry->Node.Next)
{ {
if (i == index) if (i == index)
break; break;
@ -83,8 +83,8 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
/* /*
* First of all check any of the active sub menus... * First of all check any of the active sub menus...
*/ */
for( menuEntry = menu->Entries.First; menuEntry; for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry;
menuEntry = menuEntry->Node.Next ) menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
{ {
/* /*
* Is that an active sub menu by any case? * Is that an active sub menu by any case?
@ -117,8 +117,8 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
/* /*
* Mark all menu entries inactive... * Mark all menu entries inactive...
*/ */
for( menuEntry = menu->Entries.First; menuEntry; for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry;
menuEntry = menuEntry->Node.Next ) menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
{ {
menuEntry->IsActive = FALSE; menuEntry->IsActive = FALSE;
} }
@ -255,8 +255,8 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
/* /*
* Check if any of the submenus is currently active... * Check if any of the submenus is currently active...
*/ */
for( menuEntry = menu->Entries.First; menuEntry; for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry;
menuEntry = menuEntry->Node.Next ) menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
{ {
/* /*
* Has the menu been marked as active, maybe? * Has the menu been marked as active, maybe?
@ -288,8 +288,8 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
*/ */
glColor4f( 1, 1, 1, 1 ); glColor4f( 1, 1, 1, 1 );
for( menuEntry = menu->Entries.First, i=0; menuEntry; for( menuEntry = (SFG_MenuEntry *)menu->Entries.First, i=0; menuEntry;
menuEntry = menuEntry->Node.Next, ++i ) menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next, ++i )
{ {
/* /*
* Move the raster into position... * Move the raster into position...
@ -334,8 +334,8 @@ static void fghDisplayMenuBox( SFG_Menu* menu )
/* /*
* Now we are ready to check if any of our children needs to be redrawn: * Now we are ready to check if any of our children needs to be redrawn:
*/ */
for( menuEntry = menu->Entries.First; menuEntry; for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry;
menuEntry = menuEntry->Node.Next ) menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
{ {
/* /*
* Is that an active sub menu by any case? * Is that an active sub menu by any case?
@ -361,7 +361,7 @@ static void fghSetSubmenuParentWindow ( SFG_Window *window, SFG_Menu *menu )
menu->ParentWindow = window ; menu->ParentWindow = window ;
for ( menuEntry = menu->Entries.First; menuEntry; menuEntry = menuEntry->Node.Next ) for ( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry; menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
{ {
if ( menuEntry->SubMenu != NULL ) if ( menuEntry->SubMenu != NULL )
fghSetSubmenuParentWindow ( window, menuEntry->SubMenu ) ; fghSetSubmenuParentWindow ( window, menuEntry->SubMenu ) ;
@ -514,7 +514,7 @@ void fgExecuteMenuCallback( SFG_Menu* menu )
/* /*
* First of all check any of the active sub menus... * First of all check any of the active sub menus...
*/ */
for( menuEntry = menu->Entries.First; menuEntry; menuEntry = menuEntry->Node.Next) for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry; menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next)
{ {
/* /*
* Is this menu entry active? * Is this menu entry active?
@ -584,8 +584,8 @@ void fgDeactivateMenu( SFG_Window *window )
/* /*
* Hide all submenu windows, and the root menu's window. * Hide all submenu windows, and the root menu's window.
*/ */
for ( menuEntry = menu->Entries.First; menuEntry; for ( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry;
menuEntry = menuEntry->Node.Next ) menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
{ {
/* /*
* Is that an active submenu by any case? * Is that an active submenu by any case?
@ -619,8 +619,8 @@ void fgDeactivateSubMenu( SFG_MenuEntry *menuEntry )
/* /*
* Hide all submenu windows, and the root menu's window. * Hide all submenu windows, and the root menu's window.
*/ */
for ( subMenuIter = menuEntry->SubMenu->Entries.First; subMenuIter; for ( subMenuIter = (SFG_MenuEntry *)menuEntry->SubMenu->Entries.First; subMenuIter;
subMenuIter = subMenuIter->Node.Next ) subMenuIter = (SFG_MenuEntry *)subMenuIter->Node.Next )
{ {
/* /*
* Is that an active submenu by any case? * Is that an active submenu by any case?
@ -648,8 +648,8 @@ void fghCalculateMenuBoxSize( void )
/* /*
* The menu's box size depends on the menu entries: * The menu's box size depends on the menu entries:
*/ */
for( menuEntry = fgStructure.Menu->Entries.First; menuEntry; for( menuEntry = (SFG_MenuEntry *)fgStructure.Menu->Entries.First; menuEntry;
menuEntry = menuEntry->Node.Next) menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next)
{ {
/* /*
* Update the menu entry's width value * Update the menu entry's width value
@ -752,7 +752,7 @@ void FGAPIENTRY glutSetMenu( int menuID )
*/ */
void FGAPIENTRY glutAddMenuEntry( const char* label, int value ) void FGAPIENTRY glutAddMenuEntry( const char* label, int value )
{ {
SFG_MenuEntry* menuEntry = calloc( sizeof(SFG_MenuEntry), 1 ); SFG_MenuEntry* menuEntry = (SFG_MenuEntry *)calloc( sizeof(SFG_MenuEntry), 1 );
/* /*
* Make sure there is a current menu set * Make sure there is a current menu set
@ -781,7 +781,7 @@ void FGAPIENTRY glutAddMenuEntry( const char* label, int value )
*/ */
void FGAPIENTRY glutAddSubMenu( const char* label, int subMenuID ) void FGAPIENTRY glutAddSubMenu( const char* label, int subMenuID )
{ {
SFG_MenuEntry* menuEntry = calloc( sizeof(SFG_MenuEntry), 1 ); SFG_MenuEntry* menuEntry = (SFG_MenuEntry *)calloc( sizeof(SFG_MenuEntry), 1 );
SFG_Menu* subMenu = fgMenuByID( subMenuID ); SFG_Menu* subMenu = fgMenuByID( subMenuID );
/* /*

View File

@ -65,7 +65,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, int x, int y,
/* /*
* Have the window object created * Have the window object created
*/ */
SFG_Window* window = calloc( sizeof(SFG_Window), 1 ); SFG_Window *window = (SFG_Window *)calloc( sizeof(SFG_Window), 1 );
int fakeArgc = 0; int fakeArgc = 0;
/* /*
@ -138,7 +138,7 @@ SFG_Menu* fgCreateMenu( FGCBmenu menuCallback )
/* /*
* Have the menu object created * Have the menu object created
*/ */
SFG_Menu* menu = calloc( sizeof(SFG_Menu), 1 ); SFG_Menu* menu = (SFG_Menu *)calloc( sizeof(SFG_Menu), 1 );
int fakeArgc = 0; int fakeArgc = 0;
/* /*
@ -280,7 +280,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
/* /*
* Does this window have any subwindows? * Does this window have any subwindows?
*/ */
while ( (subWindow = window->Children.First) != NULL ) while ( (subWindow = (SFG_Window *)window->Children.First) != NULL )
{ {
/* /*
* Destroy the first window in the list (possibly destroying * Destroy the first window in the list (possibly destroying
@ -345,8 +345,8 @@ static void fghRemoveMenuFromWindow( SFG_Window* window, SFG_Menu* menu )
/* /*
* Call this function for all of the window's children recursively: * Call this function for all of the window's children recursively:
*/ */
for( subWindow = window->Children.First; subWindow; for( subWindow = (SFG_Window *)window->Children.First; subWindow;
subWindow = subWindow->Node.Next) subWindow = (SFG_Window *)subWindow->Node.Next)
{ {
fghRemoveMenuFromWindow( subWindow, menu ); fghRemoveMenuFromWindow( subWindow, menu );
} }
@ -360,7 +360,7 @@ static void fghRemoveMenuFromMenu( SFG_Menu* from, SFG_Menu* menu )
{ {
SFG_MenuEntry *entry; SFG_MenuEntry *entry;
for( entry = from->Entries.First; entry; entry = entry->Node.Next ) for( entry = (SFG_MenuEntry *)from->Entries.First; entry; entry = (SFG_MenuEntry *)entry->Node.Next )
{ {
if (entry->SubMenu == menu) if (entry->SubMenu == menu)
{ {
@ -385,7 +385,7 @@ void fgDestroyMenu( SFG_Menu* menu )
/* /*
* First of all, have all references to this menu removed from all windows: * First of all, have all references to this menu removed from all windows:
*/ */
for( window = fgStructure.Windows.First; window; window = window->Node.Next ) for( window = (SFG_Window *)fgStructure.Windows.First; window; window = (SFG_Window *)window->Node.Next )
{ {
fghRemoveMenuFromWindow( window, menu ); fghRemoveMenuFromWindow( window, menu );
} }
@ -393,7 +393,7 @@ void fgDestroyMenu( SFG_Menu* menu )
/* /*
* Now proceed with removing menu entries that lead to this menu * Now proceed with removing menu entries that lead to this menu
*/ */
for( from = fgStructure.Menus.First; from; from = from->Node.Next ) for( from = (SFG_Menu *)fgStructure.Menus.First; from; from = (SFG_Menu *)from->Node.Next )
{ {
fghRemoveMenuFromMenu( from, menu ); fghRemoveMenuFromMenu( from, menu );
} }
@ -414,7 +414,7 @@ void fgDestroyMenu( SFG_Menu* menu )
* Now we are pretty sure the menu is not used anywhere * Now we are pretty sure the menu is not used anywhere
* and that we can remove all of its entries * and that we can remove all of its entries
*/ */
while( (entry = menu->Entries.First) != NULL ) while( (entry = (SFG_MenuEntry *)menu->Entries.First) != NULL )
{ {
fgListRemove(&menu->Entries, &entry->Node); fgListRemove(&menu->Entries, &entry->Node);
@ -486,10 +486,10 @@ void fgDestroyStructure( void )
/* /*
* Make sure all windows and menus have been deallocated * Make sure all windows and menus have been deallocated
*/ */
while( (window = fgStructure.Windows.First) != NULL ) while( (window = (SFG_Window *)fgStructure.Windows.First) != NULL )
fgDestroyWindow( window, TRUE ); fgDestroyWindow( window, TRUE );
while( (menu = fgStructure.Menus.First) != NULL ) while( (menu = (SFG_Menu *)fgStructure.Menus.First) != NULL )
fgDestroyMenu( menu ); fgDestroyMenu( menu );
} }
@ -506,8 +506,8 @@ void fgEnumWindows( FGCBenumerator enumCallback, SFG_Enumerator* enumerator )
/* /*
* Check every of the top-level windows * Check every of the top-level windows
*/ */
for( window = fgStructure.Windows.First; window; for( window = (SFG_Window *)fgStructure.Windows.First; window;
window = window->Node.Next ) window = (SFG_Window *)window->Node.Next )
{ {
/* /*
* Execute the callback... * Execute the callback...
@ -535,7 +535,7 @@ void fgEnumSubWindows( SFG_Window* window, FGCBenumerator enumCallback, SFG_Enum
/* /*
* Check every of the window's children: * Check every of the window's children:
*/ */
for( child = window->Children.First; child; child = child->Node.Next ) for( child = (SFG_Window *)window->Children.First; child; child = (SFG_Window *)child->Node.Next )
{ {
/* /*
* Execute the callback... * Execute the callback...
@ -694,7 +694,7 @@ SFG_Menu* fgMenuByID( int menuID )
/* /*
* It's enough to check all entries in fgStructure.Menus... * It's enough to check all entries in fgStructure.Menus...
*/ */
for( menu = fgStructure.Menus.First; menu; menu = menu->Node.Next ) for( menu = (SFG_Menu *)fgStructure.Menus.First; menu; menu = (SFG_Menu *)menu->Node.Next )
{ {
/* /*
* Does the ID number match? * Does the ID number match?
@ -722,7 +722,7 @@ void fgListAppend(SFG_List *list, SFG_Node *node)
{ {
SFG_Node *ln; SFG_Node *ln;
if ( (ln = list->Last) != NULL ) if ( (ln = (SFG_Node *)list->Last) != NULL )
{ {
ln->Next = node; ln->Next = node;
node->Prev = ln; node->Prev = ln;
@ -741,13 +741,13 @@ void fgListRemove(SFG_List *list, SFG_Node *node)
{ {
SFG_Node *ln; SFG_Node *ln;
if ( (ln = node->Next) != NULL ) if ( (ln = (SFG_Node *)node->Next) != NULL )
ln->Prev = node->Prev; ln->Prev = node->Prev;
if ( (ln = node->Prev) != NULL ) if ( (ln = (SFG_Node *)node->Prev) != NULL )
ln->Next = node->Next; ln->Next = node->Next;
if ( (ln = list->First) == node ) if ( (ln = (SFG_Node *)list->First) == node )
list->First = node->Next; list->First = node->Next;
if ( (ln = list->Last) == node ) if ( (ln = (SFG_Node *)list->Last) == node )
list->Last = node->Prev; list->Last = node->Prev;
} }
@ -756,7 +756,7 @@ int fgListLength(SFG_List *list)
SFG_Node *node; SFG_Node *node;
int length = 0; int length = 0;
for( node = list->First; node; node = node->Next ) for( node = (SFG_Node *)list->First; node; node = (SFG_Node *)node->Next )
++length; ++length;
return( length ); return( length );