From 1c7454b49d18b51606736df92469f5fe345c7963 Mon Sep 17 00:00:00 2001 From: cjp Date: Tue, 18 Nov 2003 22:09:15 +0000 Subject: [PATCH] Lots of stuff that John F. Fay pointed out. Plus some changes to remove gcc warnings. git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@359 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/src/freeglut_cursor.c | 6 +++--- freeglut/freeglut/src/freeglut_ext.c | 2 ++ freeglut/freeglut/src/freeglut_geometry.c | 2 -- freeglut/freeglut/src/freeglut_init.c | 12 ++++++------ freeglut/freeglut/src/freeglut_internal.h | 1 + freeglut/freeglut/src/freeglut_main.c | 6 +++++- freeglut/freeglut/src/freeglut_menu.c | 2 +- freeglut/freeglut/src/freeglut_state.c | 2 ++ freeglut/freeglut/src/freeglut_structure.c | 22 +++++++++++----------- 9 files changed, 31 insertions(+), 24 deletions(-) diff --git a/freeglut/freeglut/src/freeglut_cursor.c b/freeglut/freeglut/src/freeglut_cursor.c index 0e24a74..bda8083 100644 --- a/freeglut/freeglut/src/freeglut_cursor.c +++ b/freeglut/freeglut/src/freeglut_cursor.c @@ -49,7 +49,7 @@ #if TARGET_HOST_UNIX_X11 -fgGetCursorError( Cursor cursor ) +int fgGetCursorError( Cursor cursor ) { int ret = 0; char buf[ 256 ]; @@ -99,8 +99,8 @@ void FGAPIENTRY glutSetCursor( int cursorID ) * (c) Out-of-range cursor-types generate warnings. Should we abort? */ { - Cursor cursor; - Pixmap no_cursor; /* Used for GLUT_CURSOR_NONE */ + Cursor cursor = None; + Pixmap no_cursor = None ; /* Used for GLUT_CURSOR_NONE */ int error = 0; #define MAP_CURSOR(a,b) \ diff --git a/freeglut/freeglut/src/freeglut_ext.c b/freeglut/freeglut/src/freeglut_ext.c index 414885d..2c98d4b 100644 --- a/freeglut/freeglut/src/freeglut_ext.c +++ b/freeglut/freeglut/src/freeglut_ext.c @@ -29,6 +29,8 @@ #include "config.h" #endif +#define GLX_GLXEXT_PROTOTYPES + #include "../include/GL/freeglut.h" #include "freeglut_internal.h" diff --git a/freeglut/freeglut/src/freeglut_geometry.c b/freeglut/freeglut/src/freeglut_geometry.c index 83715bb..d286b29 100644 --- a/freeglut/freeglut/src/freeglut_geometry.c +++ b/freeglut/freeglut/src/freeglut_geometry.c @@ -426,8 +426,6 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi */ for( j=0; jNode ); free( timer ); @@ -306,7 +306,7 @@ void fgDeinitialize( void ) * Everything inside the following #ifndef is copied from the X sources. */ -#ifndef TARGET_HOST_UNIX_X11 +#if TARGET_HOST_WIN32 /* @@ -382,7 +382,7 @@ ReadInteger(char *string, char **NextString) } static int XParseGeometry ( - _Xconst char *string, + const char *string, int *x, int *y, unsigned int *width, /* RETURN */ @@ -485,7 +485,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) int i, j, argc = *pargc; if( fgState.Initialised ) - fgError( "illegal glutInit() reinitialization attemp" ); + fgError( "illegal glutInit() reinitialization attempt" ); if (pargc && *pargc && argv && *argv && **argv) { diff --git a/freeglut/freeglut/src/freeglut_internal.h b/freeglut/freeglut/src/freeglut_internal.h index 31e7681..3e54839 100644 --- a/freeglut/freeglut/src/freeglut_internal.h +++ b/freeglut/freeglut/src/freeglut_internal.h @@ -77,6 +77,7 @@ #include #include #if TARGET_HOST_UNIX_X11 +#include #include #endif diff --git a/freeglut/freeglut/src/freeglut_main.c b/freeglut/freeglut/src/freeglut_main.c index 85bab79..8cea680 100644 --- a/freeglut/freeglut/src/freeglut_main.c +++ b/freeglut/freeglut/src/freeglut_main.c @@ -320,6 +320,8 @@ long fgElapsedTime( void ) fgState.Time.Value = timeGetTime( ); #endif fgState.Time.Set = GL_TRUE; + + return 0; } } @@ -418,10 +420,12 @@ static int fgHavePendingRedisplays( void ) /* * Indicates whether there are any outstanding timers. */ +#if 0 /* Not used */ static int fgHaveTimers( void ) { return !!fgState.Timers.First; } +#endif /* * Returns the number of GLUT ticks (milliseconds) till the next timer event. */ @@ -1256,7 +1260,7 @@ LRESULT CALLBACK fgWindowProc( HWND hWnd, UINT uMsg, WPARAM wParam, used = TRUE; } - if( used == FALSE ) + if( ! used ) wglDeleteContext( window->Window.Context ); } diff --git a/freeglut/freeglut/src/freeglut_menu.c b/freeglut/freeglut/src/freeglut_menu.c index 9bffdf9..bd945a7 100644 --- a/freeglut/freeglut/src/freeglut_menu.c +++ b/freeglut/freeglut/src/freeglut_menu.c @@ -127,7 +127,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu ) if( menuEntry->SubMenu && menuEntry->IsActive ) { /* - * OK, have the sub-menu checked, too. If it returns TRUE, it + * OK, have the sub-menu checked, too. If it returns GL_TRUE, it * will mean that it caught the mouse cursor and we do not need * to regenerate the activity list, and so our parents do... */ diff --git a/freeglut/freeglut/src/freeglut_state.c b/freeglut/freeglut/src/freeglut_state.c index 8319b5f..5e4ad04 100644 --- a/freeglut/freeglut/src/freeglut_state.c +++ b/freeglut/freeglut/src/freeglut_state.c @@ -124,8 +124,10 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value ) */ int FGAPIENTRY glutGet( GLenum eWhat ) { +#if TARGET_HOST_WIN32 int returnValue ; GLboolean boolValue ; +#endif switch (eWhat) { diff --git a/freeglut/freeglut/src/freeglut_structure.c b/freeglut/freeglut/src/freeglut_structure.c index b5b737c..e7464bc 100644 --- a/freeglut/freeglut/src/freeglut_structure.c +++ b/freeglut/freeglut/src/freeglut_structure.c @@ -93,7 +93,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title, window->ID = ++fgStructure.WindowID; fgListInit( &window->Children ); - if( parent != NULL ) + if( parent ) { fgListAppend( &parent->Children, &window->Node ); window->Parent = parent; @@ -279,7 +279,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) assert( window ); freeglut_assert_ready; - while( subWindow = ( SFG_Window * )window->Children.First ) + while( (subWindow = ( SFG_Window * )window->Children.First) ) fgDestroyWindow( subWindow, needToClose ); /* @@ -304,7 +304,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose ) for ( menu_index = 0; menu_index < 3; menu_index ++ ) { - if ( window->Menu[menu_index] != NULL ) + if ( window->Menu[menu_index] ) window->Menu[menu_index]->ParentWindow = NULL ; } @@ -402,7 +402,7 @@ 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( (entry = ( SFG_MenuEntry * )menu->Entries.First) ) { fgListRemove( &menu->Entries, &entry->Node ); @@ -457,10 +457,10 @@ void fgDestroyStructure( void ) /* * Make sure all windows and menus have been deallocated */ - while( menu = ( SFG_Menu * )fgStructure.Menus.First ) + while( (menu = ( SFG_Menu * )fgStructure.Menus.First) ) fgDestroyMenu( menu ); - while( window = ( SFG_Window * )fgStructure.Windows.First ) + while( (window = ( SFG_Window * )fgStructure.Windows.First) ) fgDestroyWindow( window, GL_TRUE ); } @@ -651,7 +651,7 @@ void fgListAppend(SFG_List *list, SFG_Node *node) { SFG_Node *ln; - if ( (ln = (SFG_Node *)list->Last) != NULL ) + if ( (ln = (SFG_Node *)list->Last) ) { ln->Next = node; node->Prev = ln; @@ -670,13 +670,13 @@ void fgListRemove(SFG_List *list, SFG_Node *node) { SFG_Node *ln; - if( ln = (SFG_Node *)node->Next ) + if( (ln = (SFG_Node *)node->Next) ) ln->Prev = node->Prev; - if( ln = (SFG_Node *)node->Prev ) + if( (ln = (SFG_Node *)node->Prev) ) ln->Next = node->Next; - if( ( ln = (SFG_Node *)list->First ) == node ) + if( (ln = (SFG_Node *)list->First) == node ) list->First = node->Next; - if( ( ln = (SFG_Node *)list->Last ) == node ) + if( (ln = (SFG_Node *)list->Last) == node ) list->Last = node->Prev; }