/*
* 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
/*
* Allocate the vertices array
*/
- vertex = calloc( sizeof(double), 3 * slices * (stacks - 1) );
+ vertex = (double *)calloc( sizeof(double), 3 * slices * (stacks - 1) );
glPushMatrix();
glScaled( radius, radius, radius );
glPushMatrix();
/* glScalef( radius, radius, radius ); */
- row = calloc( sizeof(double), slices * 3 );
- next = calloc( sizeof(double), slices * 3 );
+ row = (double *)calloc( sizeof(double), slices * 3 );
+ next = (double *)calloc( sizeof(double), slices * 3 );
dpsi = M_PI / (stacks + 1);
dphi = 2 * M_PI / slices;
/*
* 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++ )
{
/*
* 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++ )
{
/*
* Allocate the vertices array
*/
- vertex = calloc( sizeof(double), 3 * nSides * nRings );
- normal = calloc( sizeof(double), 3 * nSides * nRings );
+ vertex = (double *)calloc( sizeof(double), 3 * nSides * nRings );
+ normal = (double *)calloc( sizeof(double), 3 * nSides * nRings );
glPushMatrix();
/*
* Allocate the vertices array
*/
- vertex = calloc( sizeof(double), 3 * nSides * nRings );
- normal = calloc( sizeof(double), 3 * nSides * nRings );
+ vertex = (double *)calloc( sizeof(double), 3 * nSides * nRings );
+ normal = (double *)calloc( sizeof(double), 3 * nSides * nRings );
glPushMatrix();
/*
* 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 ) ;
free ( timer ) ;
*/
char *token ;
int len = strlen ( displayMode ) ;
- char *buffer = malloc ( (len+1) * sizeof(char) ) ;
+ char *buffer = (char *)malloc ( (len+1) * sizeof(char) ) ;
memcpy ( buffer, displayMode, len ) ;
buffer[len] = '\0' ;
/*
* Have the global joystick structure created
*/
- fgJoystick = calloc( sizeof(SFG_Joystick), 1 );
+ fgJoystick = (SFG_Joystick *)calloc( sizeof(SFG_Joystick), 1 );
#ifdef WIN32
switch( ident )
/*
* 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:
* Now feel free to execute all the hooked and timed out timer callbacks
* And delete the timed out timers...
*/
- while ( (timer = timedOut.First) )
+ while ( (timer = (SFG_Timer *)timedOut.First) )
{
if( timer->Callback != NULL )
timer->Callback( timer->ID );
if ( fgStructure.Windows.First != NULL )
{
- SFG_Window *win = fgStructure.Windows.First ;
+ SFG_Window *win = (SFG_Window *)fgStructure.Windows.First ;
glEnd();
glFinish();
glFlush();
while ( win != NULL )
{
- SFG_Window *temp_win = win->Node.Next ;
+ SFG_Window *temp_win = (SFG_Window *)win->Node.Next ;
fgDestroyWindow ( win, FALSE ) ;
win = temp_win ;
}
void FGAPIENTRY glutMainLoop( void )
{
#if TARGET_HOST_WIN32
- SFG_Window *window = fgStructure.Windows.First ;
+ SFG_Window *window = (SFG_Window *)fgStructure.Windows.First ;
#endif
/*
if ( window->Callbacks.Visibility != NULL )
window->Callbacks.Visibility ( window->State.Visible ) ;
- window = window->Node.Next ;
+ window = (SFG_Window *)window->Node.Next ;
}
#endif
/* Step through the list of windows. If the rendering context is notbeing used
* 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 ) )
used = TRUE ;
SFG_MenuEntry *entry;
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)
break;
/*
* 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 that an active sub menu by any case?
/*
* Mark all menu entries inactive...
*/
- for( menuEntry = menu->Entries.First; menuEntry;
- menuEntry = menuEntry->Node.Next )
+ for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry;
+ menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
{
menuEntry->IsActive = FALSE;
}
/*
* Check if any of the submenus is currently active...
*/
- for( menuEntry = menu->Entries.First; menuEntry;
- menuEntry = menuEntry->Node.Next )
+ for( menuEntry = (SFG_MenuEntry *)menu->Entries.First; menuEntry;
+ menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next )
{
/*
* Has the menu been marked as active, maybe?
*/
glColor4f( 1, 1, 1, 1 );
- for( menuEntry = menu->Entries.First, i=0; menuEntry;
- menuEntry = menuEntry->Node.Next, ++i )
+ for( menuEntry = (SFG_MenuEntry *)menu->Entries.First, i=0; menuEntry;
+ menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next, ++i )
{
/*
* Move the raster into position...
/*
* Now we are ready to check if any of our children needs to be redrawn:
*/
- 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 that an active sub menu by any case?
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 )
fghSetSubmenuParentWindow ( window, menuEntry->SubMenu ) ;
/*
* 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?
/*
* Hide all submenu windows, and the root menu's 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 )
{
/*
* Is that an active submenu by any case?
/*
* Hide all submenu windows, and the root menu's window.
*/
- for ( subMenuIter = menuEntry->SubMenu->Entries.First; subMenuIter;
- subMenuIter = subMenuIter->Node.Next )
+ for ( subMenuIter = (SFG_MenuEntry *)menuEntry->SubMenu->Entries.First; subMenuIter;
+ subMenuIter = (SFG_MenuEntry *)subMenuIter->Node.Next )
{
/*
* Is that an active submenu by any case?
/*
* The menu's box size depends on the menu entries:
*/
- for( menuEntry = fgStructure.Menu->Entries.First; menuEntry;
- menuEntry = menuEntry->Node.Next)
+ for( menuEntry = (SFG_MenuEntry *)fgStructure.Menu->Entries.First; menuEntry;
+ menuEntry = (SFG_MenuEntry *)menuEntry->Node.Next)
{
/*
* Update the menu entry's width 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
*/
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 );
/*
/*
* 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;
/*
/*
* 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;
/*
/*
* 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
/*
* Call this function for all of the window's children recursively:
*/
- for( subWindow = window->Children.First; subWindow;
- subWindow = subWindow->Node.Next)
+ for( subWindow = (SFG_Window *)window->Children.First; subWindow;
+ subWindow = (SFG_Window *)subWindow->Node.Next)
{
fghRemoveMenuFromWindow( subWindow, menu );
}
{
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)
{
/*
* 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 );
}
/*
* 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 );
}
* Now we are pretty sure the menu is not used anywhere
* 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);
/*
* 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 );
- while( (menu = fgStructure.Menus.First) != NULL )
+ while( (menu = (SFG_Menu *)fgStructure.Menus.First) != NULL )
fgDestroyMenu( menu );
}
/*
* Check every of the top-level 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 )
{
/*
* Execute the callback...
/*
* 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...
/*
* 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?
{
SFG_Node *ln;
- if ( (ln = list->Last) != NULL )
+ if ( (ln = (SFG_Node *)list->Last) != NULL )
{
ln->Next = node;
node->Prev = ln;
{
SFG_Node *ln;
- if ( (ln = node->Next) != NULL )
+ if ( (ln = (SFG_Node *)node->Next) != NULL )
ln->Prev = node->Prev;
- if ( (ln = node->Prev) != NULL )
+ if ( (ln = (SFG_Node *)node->Prev) != NULL )
ln->Next = node->Next;
- if ( (ln = list->First) == node )
+ if ( (ln = (SFG_Node *)list->First) == node )
list->First = node->Next;
- if ( (ln = list->Last) == node )
+ if ( (ln = (SFG_Node *)list->Last) == node )
list->Last = node->Prev;
}
SFG_Node *node;
int length = 0;
- for( node = list->First; node; node = node->Next )
+ for( node = (SFG_Node *)list->First; node; node = (SFG_Node *)node->Next )
++length;
return( length );