X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_structure.c;h=42eb578f3856340fbd4cab6ca1887229710773f2;hb=427572de3a4312492506b29306ab7ca80a4816b5;hp=71f9e45ebac2ef8b09f5d6925b47aa1986207b0c;hpb=a97d853592b0a77cbcf5525158a5e836ad10d924;p=freeglut diff --git a/src/freeglut_structure.c b/src/freeglut_structure.c index 71f9e45..42eb578 100644 --- a/src/freeglut_structure.c +++ b/src/freeglut_structure.c @@ -199,7 +199,7 @@ void fgAddToWindowDestroyList( SFG_Window* window ) * to ensure that they are no longer called after this point. */ { - void *destroy = FETCH_WCB( *window, Destroy ); + FGCBDestroy destroy = FETCH_WCB( *window, Destroy ); fgClearCallBacks( window ); SET_WCB( *window, Destroy, destroy ); } @@ -308,7 +308,6 @@ void fgDestroyMenu( SFG_Menu* menu ) { SFG_Window *window; SFG_Menu *from; - SFG_MenuEntry *entry; assert( menu ); freeglut_assert_ready; @@ -345,8 +344,10 @@ void fgDestroyMenu( SFG_Menu* menu ) * Now we are pretty sure the menu is not used anywhere * and that we can remove all of its entries */ - while( entry = ( SFG_MenuEntry * )menu->Entries.First ) + while( menu->Entries.First ) { + SFG_MenuEntry *entry = ( SFG_MenuEntry * ) menu->Entries.First; + fgListRemove( &menu->Entries, &entry->Node ); if( entry->Text ) @@ -354,7 +355,6 @@ void fgDestroyMenu( SFG_Menu* menu ) entry->Text = NULL; free( entry ); - entry = NULL; } if( fgStructure.Window == menu->Window ) @@ -516,7 +516,7 @@ static void fghcbWindowByID( SFG_Window *window, SFG_Enumerator *enumerator ) /* * Check the window's handle. Hope this works. Looks ugly. That's for sure. */ - if( window->ID == ( int )(enumerator->data) ) /* XXX int/ptr conversion! */ + if( window->ID == *( int *)(enumerator->data) ) { enumerator->found = GL_TRUE; enumerator->data = window; @@ -543,7 +543,7 @@ SFG_Window* fgWindowByID( int windowID ) * Uses a method very similiar for fgWindowByHandle... */ enumerator.found = GL_FALSE; - enumerator.data = ( void * )windowID; /* XXX int/pointer conversion! */ + enumerator.data = ( void * )&windowID; fgEnumWindows( fghcbWindowByID, &enumerator ); if( enumerator.found ) return ( SFG_Window * )enumerator.data; @@ -582,10 +582,9 @@ void fgListInit(SFG_List *list) void fgListAppend(SFG_List *list, SFG_Node *node) { - SFG_Node *ln; - - if ( ln = (SFG_Node *)list->Last ) + if ( list->Last ) { + SFG_Node *ln = (SFG_Node *) list->Last; ln->Next = node; node->Prev = ln; } @@ -601,15 +600,13 @@ void fgListAppend(SFG_List *list, SFG_Node *node) void fgListRemove(SFG_List *list, SFG_Node *node) { - SFG_Node *ln; - - if( ln = (SFG_Node *)node->Next ) - ln->Prev = node->Prev; - if( ln = (SFG_Node *)node->Prev ) - ln->Next = node->Next; - if( (ln = (SFG_Node *)list->First) == node ) + if( node->Next ) + ( ( SFG_Node * )node->Next )->Prev = node->Prev; + if( node->Prev ) + ( ( SFG_Node * )node->Prev )->Next = node->Next; + if( ( ( SFG_Node * )list->First ) == node ) list->First = node->Next; - if( (ln = (SFG_Node *)list->Last) == node ) + if( ( ( SFG_Node * )list->Last ) == node ) list->Last = node->Prev; }