Lots of stuff that John F. Fay pointed out.
authorChristopher John Purnell <cjp@lost.org.uk>
Tue, 18 Nov 2003 22:09:15 +0000 (22:09 +0000)
committerChristopher John Purnell <cjp@lost.org.uk>
Tue, 18 Nov 2003 22:09:15 +0000 (22:09 +0000)
Plus some changes to remove gcc warnings.

git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@359 7f0cb862-5218-0410-a997-914c9d46530a

src/freeglut_cursor.c
src/freeglut_ext.c
src/freeglut_geometry.c
src/freeglut_init.c
src/freeglut_internal.h
src/freeglut_main.c
src/freeglut_menu.c
src/freeglut_state.c
src/freeglut_structure.c

index 0e24a74..bda8083 100644 (file)
@@ -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)                                     \
index 414885d..2c98d4b 100644 (file)
@@ -29,6 +29,8 @@
 #include "config.h"
 #endif
 
+#define GLX_GLXEXT_PROTOTYPES
+
 #include "../include/GL/freeglut.h"
 #include "freeglut_internal.h"
 
index 83715bb..d286b29 100644 (file)
@@ -426,8 +426,6 @@ void FGAPIENTRY glutSolidCone( GLdouble base, GLdouble height, GLint slices, GLi
    */
   for( j=0; j<slices; j++ )
   {
-    double scl = height / slope;
-
     glBegin( GL_TRIANGLES );
       glNormal3d( 0.0, 0.0, -1.0 );
       glVertex3d( vertices[ (j+0)*2+0 ] * sBase, vertices[ (j+0)*2+1 ] * sBase, 0 );
index 58388f8..13656fb 100644 (file)
@@ -84,8 +84,8 @@ SFG_State fgState = { { -1, -1, GL_FALSE },  /* Position */
                       16,                     /* GameModeDepth */
                       72,                     /* GameModeRefresh */
                       GLUT_ACTION_EXIT,       /* ActionOnWindowClose */
-                      GLUT_EXEC_STATE_INIT    /* ExecState */
-                      NULL,                   /* ProgramName */
+                      GLUT_EXEC_STATE_INIT,   /* ExecState */
+                      NULL                    /* ProgramName */
 };
 
 
@@ -230,7 +230,7 @@ void fgDeinitialize( void )
 
     fgDestroyStructure( );
 
-    while( timer = ( SFG_Timer * )fgState.Timers.First )
+    while( (timer = ( SFG_Timer * )fgState.Timers.First) )
     {
         fgListRemove ( &fgState.Timers, &timer->Node );
         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)
     {
index 31e7681..3e54839 100644 (file)
@@ -77,6 +77,7 @@
 #include <assert.h>
 #include <stdarg.h>
 #if TARGET_HOST_UNIX_X11
+#include <unistd.h>
 #include <sys/time.h>
 #endif
 
index 85bab79..8cea680 100644 (file)
@@ -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 );
         }
 
index 9bffdf9..bd945a7 100644 (file)
@@ -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...
              */
index 8319b5f..5e4ad04 100644 (file)
@@ -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)
     {
index b5b737c..e7464bc 100644 (file)
@@ -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;
 }