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
This commit is contained in:
cjp 2003-11-18 22:09:15 +00:00
parent 6d21d76b1a
commit 1c7454b49d
9 changed files with 31 additions and 24 deletions

View File

@ -49,7 +49,7 @@
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_UNIX_X11
fgGetCursorError( Cursor cursor ) int fgGetCursorError( Cursor cursor )
{ {
int ret = 0; int ret = 0;
char buf[ 256 ]; char buf[ 256 ];
@ -99,8 +99,8 @@ void FGAPIENTRY glutSetCursor( int cursorID )
* (c) Out-of-range cursor-types generate warnings. Should we abort? * (c) Out-of-range cursor-types generate warnings. Should we abort?
*/ */
{ {
Cursor cursor; Cursor cursor = None;
Pixmap no_cursor; /* Used for GLUT_CURSOR_NONE */ Pixmap no_cursor = None ; /* Used for GLUT_CURSOR_NONE */
int error = 0; int error = 0;
#define MAP_CURSOR(a,b) \ #define MAP_CURSOR(a,b) \

View File

@ -29,6 +29,8 @@
#include "config.h" #include "config.h"
#endif #endif
#define GLX_GLXEXT_PROTOTYPES
#include "../include/GL/freeglut.h" #include "../include/GL/freeglut.h"
#include "freeglut_internal.h" #include "freeglut_internal.h"

View File

@ -426,8 +426,6 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
*/ */
for( j=0; j<slices; j++ ) for( j=0; j<slices; j++ )
{ {
double scl = height / slope;
glBegin( GL_TRIANGLES ); glBegin( GL_TRIANGLES );
glNormal3d( 0.0, 0.0, -1.0 ); glNormal3d( 0.0, 0.0, -1.0 );
glVertex3d( vertices[ (j+0)*2+0 ] * sBase, vertices[ (j+0)*2+1 ] * sBase, 0 ); glVertex3d( vertices[ (j+0)*2+0 ] * sBase, vertices[ (j+0)*2+1 ] * sBase, 0 );

View File

@ -84,8 +84,8 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */
16, /* GameModeDepth */ 16, /* GameModeDepth */
72, /* GameModeRefresh */ 72, /* GameModeRefresh */
GLUT_ACTION_EXIT, /* ActionOnWindowClose */ GLUT_ACTION_EXIT, /* ActionOnWindowClose */
GLUT_EXEC_STATE_INIT /* ExecState */ GLUT_EXEC_STATE_INIT, /* ExecState */
NULL, /* ProgramName */ NULL /* ProgramName */
}; };
@ -230,7 +230,7 @@ void fgDeinitialize( void )
fgDestroyStructure( ); fgDestroyStructure( );
while( timer = ( SFG_Timer * )fgState.Timers.First ) while( (timer = ( SFG_Timer * )fgState.Timers.First) )
{ {
fgListRemove ( &fgState.Timers, &timer->Node ); fgListRemove ( &fgState.Timers, &timer->Node );
free( timer ); free( timer );
@ -306,7 +306,7 @@ void fgDeinitialize( void )
* Everything inside the following #ifndef is copied from the X sources. * 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 ( static int XParseGeometry (
_Xconst char *string, const char *string,
int *x, int *x,
int *y, int *y,
unsigned int *width, /* RETURN */ unsigned int *width, /* RETURN */
@ -485,7 +485,7 @@ void FGAPIENTRY glutInit( int* pargc, char** argv )
int i, j, argc = *pargc; int i, j, argc = *pargc;
if( fgState.Initialised ) if( fgState.Initialised )
fgError( "illegal glutInit() reinitialization attemp" ); fgError( "illegal glutInit() reinitialization attempt" );
if (pargc && *pargc && argv && *argv && **argv) if (pargc && *pargc && argv && *argv && **argv)
{ {

View File

@ -77,6 +77,7 @@
#include <assert.h> #include <assert.h>
#include <stdarg.h> #include <stdarg.h>
#if TARGET_HOST_UNIX_X11 #if TARGET_HOST_UNIX_X11
#include <unistd.h>
#include <sys/time.h> #include <sys/time.h>
#endif #endif

View File

@ -320,6 +320,8 @@ long fgElapsedTime( void )
fgState.Time.Value = timeGetTime( ); fgState.Time.Value = timeGetTime( );
#endif #endif
fgState.Time.Set = GL_TRUE; fgState.Time.Set = GL_TRUE;
return 0;
} }
} }
@ -418,10 +420,12 @@ static int fgHavePendingRedisplays( void )
/* /*
* Indicates whether there are any outstanding timers. * Indicates whether there are any outstanding timers.
*/ */
#if 0 /* Not used */
static int fgHaveTimers( void ) static int fgHaveTimers( void )
{ {
return !!fgState.Timers.First; return !!fgState.Timers.First;
} }
#endif
/* /*
* Returns the number of GLUT ticks (milliseconds) till the next timer event. * 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; used = TRUE;
} }
if( used == FALSE ) if( ! used )
wglDeleteContext( window->Window.Context ); wglDeleteContext( window->Window.Context );
} }

View File

@ -127,7 +127,7 @@ static GLboolean fghCheckMenuStatus( SFG_Window* window, SFG_Menu* menu )
if( menuEntry->SubMenu && menuEntry->IsActive ) 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 * will mean that it caught the mouse cursor and we do not need
* to regenerate the activity list, and so our parents do... * to regenerate the activity list, and so our parents do...
*/ */

View File

@ -124,8 +124,10 @@ void FGAPIENTRY glutSetOption( GLenum eWhat, int value )
*/ */
int FGAPIENTRY glutGet( GLenum eWhat ) int FGAPIENTRY glutGet( GLenum eWhat )
{ {
#if TARGET_HOST_WIN32
int returnValue ; int returnValue ;
GLboolean boolValue ; GLboolean boolValue ;
#endif
switch (eWhat) switch (eWhat)
{ {

View File

@ -93,7 +93,7 @@ SFG_Window* fgCreateWindow( SFG_Window* parent, const char* title,
window->ID = ++fgStructure.WindowID; window->ID = ++fgStructure.WindowID;
fgListInit( &window->Children ); fgListInit( &window->Children );
if( parent != NULL ) if( parent )
{ {
fgListAppend( &parent->Children, &window->Node ); fgListAppend( &parent->Children, &window->Node );
window->Parent = parent; window->Parent = parent;
@ -279,7 +279,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
assert( window ); assert( window );
freeglut_assert_ready; freeglut_assert_ready;
while( subWindow = ( SFG_Window * )window->Children.First ) while( (subWindow = ( SFG_Window * )window->Children.First) )
fgDestroyWindow( subWindow, needToClose ); fgDestroyWindow( subWindow, needToClose );
/* /*
@ -304,7 +304,7 @@ void fgDestroyWindow( SFG_Window* window, GLboolean needToClose )
for ( menu_index = 0; menu_index < 3; menu_index ++ ) 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 ; 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 * 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 = ( SFG_MenuEntry * )menu->Entries.First ) while( (entry = ( SFG_MenuEntry * )menu->Entries.First) )
{ {
fgListRemove( &menu->Entries, &entry->Node ); fgListRemove( &menu->Entries, &entry->Node );
@ -457,10 +457,10 @@ void fgDestroyStructure( void )
/* /*
* Make sure all windows and menus have been deallocated * 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 ); fgDestroyMenu( menu );
while( window = ( SFG_Window * )fgStructure.Windows.First ) while( (window = ( SFG_Window * )fgStructure.Windows.First) )
fgDestroyWindow( window, GL_TRUE ); fgDestroyWindow( window, GL_TRUE );
} }
@ -651,7 +651,7 @@ void fgListAppend(SFG_List *list, SFG_Node *node)
{ {
SFG_Node *ln; SFG_Node *ln;
if ( (ln = (SFG_Node *)list->Last) != NULL ) if ( (ln = (SFG_Node *)list->Last) )
{ {
ln->Next = node; ln->Next = node;
node->Prev = ln; node->Prev = ln;
@ -670,9 +670,9 @@ void fgListRemove(SFG_List *list, SFG_Node *node)
{ {
SFG_Node *ln; SFG_Node *ln;
if( ln = (SFG_Node *)node->Next ) if( (ln = (SFG_Node *)node->Next) )
ln->Prev = node->Prev; ln->Prev = node->Prev;
if( ln = (SFG_Node *)node->Prev ) if( (ln = (SFG_Node *)node->Prev) )
ln->Next = node->Next; ln->Next = node->Next;
if( (ln = (SFG_Node *)list->First) == node ) if( (ln = (SFG_Node *)list->First) == node )
list->First = node->Next; list->First = node->Next;