From 8f7014249e5f2b352569c7b22aa190125aeef9ab Mon Sep 17 00:00:00 2001 From: Diederick Niehorster Date: Mon, 1 Apr 2013 15:40:51 +0000 Subject: [PATCH] cleaned up a bunch of warnings git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1573 7f0cb862-5218-0410-a997-914c9d46530a --- progs/demos/CallbackMaker/CallbackMaker.c | 9 +++++++-- progs/demos/Fractals/fractals.c | 4 +--- progs/demos/Fractals_random/fractals_random.c | 4 +--- progs/demos/Lorenz/lorenz.c | 3 +-- progs/demos/shapes/shapes.c | 2 ++ src/fg_structure.c | 4 ++-- 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/progs/demos/CallbackMaker/CallbackMaker.c b/progs/demos/CallbackMaker/CallbackMaker.c index 0d4dbb7..e280148 100644 --- a/progs/demos/CallbackMaker/CallbackMaker.c +++ b/progs/demos/CallbackMaker/CallbackMaker.c @@ -8,6 +8,7 @@ #include #include #include +#include static int sequence_number = 0 ; @@ -80,15 +81,19 @@ Mod2Text(int mods, char *text) if (mods&GLUT_ACTIVE_CTRL) strcat(text,"CTRL"); if (mods&GLUT_ACTIVE_SHIFT) + { if (text[0]) strcat(text,"+SHIFT"); else strcat(text,"SHIFT"); + } if (mods&GLUT_ACTIVE_ALT) + { if (text[0]) strcat(text,"+ALT"); else strcat(text,"ALT"); + } if (!text[0]) strcat(text,"none"); @@ -213,7 +218,7 @@ Display(void) static void Warning(const char *fmt, va_list ap) { - printf("%6d Warning callback:\n"); + printf("%6d Warning callback:\n",++sequence_number); /* print warning message */ vprintf(fmt, ap); @@ -223,7 +228,7 @@ static void Error(const char *fmt, va_list ap) { char dummy_string[STRING_LENGTH]; - printf("%6d Error callback:\n"); + printf("%6d Error callback:\n",++sequence_number); /* print warning message */ vprintf(fmt, ap); diff --git a/progs/demos/Fractals/fractals.c b/progs/demos/Fractals/fractals.c index ec49552..2c7fcce 100644 --- a/progs/demos/Fractals/fractals.c +++ b/progs/demos/Fractals/fractals.c @@ -311,8 +311,6 @@ void readConfigFile ( char *fnme ) int main(int argc, char *argv[]) { - int fractal_window ; - glutInitWindowSize(500, 250); glutInitWindowPosition ( 140, 140 ); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE ); @@ -323,7 +321,7 @@ main(int argc, char *argv[]) else readConfigFile ( "fractals.dat" ) ; - fractal_window = glutCreateWindow( window_title ); + glutCreateWindow( window_title ); glClearColor(1.0, 1.0, 1.0, 1.0); diff --git a/progs/demos/Fractals_random/fractals_random.c b/progs/demos/Fractals_random/fractals_random.c index 0cf6d0d..aa10641 100644 --- a/progs/demos/Fractals_random/fractals_random.c +++ b/progs/demos/Fractals_random/fractals_random.c @@ -355,8 +355,6 @@ void readConfigFile ( char *fnme ) int main(int argc, char *argv[]) { - int fractal_window ; - glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE ); glutInitWindowSize(500, 250); @@ -368,7 +366,7 @@ main(int argc, char *argv[]) else readConfigFile ( "fractals.dat" ) ; - fractal_window = glutCreateWindow( window_title ); + glutCreateWindow( window_title ); glClearColor(1.0, 1.0, 1.0, 1.0); diff --git a/progs/demos/Lorenz/lorenz.c b/progs/demos/Lorenz/lorenz.c index 6a816b2..a3a61db 100644 --- a/progs/demos/Lorenz/lorenz.c +++ b/progs/demos/Lorenz/lorenz.c @@ -220,8 +220,7 @@ void mouse_cb ( int button, int updown, int x, int y ) { if ( updown == GLUT_DOWN ) { - double dist = 1.0e20 ; /* A very large number */ - dist = 0.0 ; /* so we don't get "unused variable" compiler warning */ + /*double dist = 1.0e20 ; A very large number */ /* The idea here is that we go into "pick" mode and pick the nearest point to the mouse click position. Unfortunately I don't have the time to implement it at the moment. */ diff --git a/progs/demos/shapes/shapes.c b/progs/demos/shapes/shapes.c index 2fe6bb4..ebac795 100644 --- a/progs/demos/shapes/shapes.c +++ b/progs/demos/shapes/shapes.c @@ -852,10 +852,12 @@ static void special (int key, int x, int y) /* Cuboctahedron can't be shown when in shader mode, skip it */ if (useShader && NUMBEROF (table)-1 == ( unsigned )function_index) + { if (key==GLUT_KEY_PAGE_UP) function_index = 0; else function_index -= 1; + } } diff --git a/src/fg_structure.c b/src/fg_structure.c index be9d1ce..d50063f 100644 --- a/src/fg_structure.c +++ b/src/fg_structure.c @@ -533,7 +533,7 @@ static void fghcbMenuByID( SFG_Menu *menu, return; /* Check the menu's ID. */ - if( menu->ID == (int)(enumerator->data) ) + if( menu->ID == *( int *)(enumerator->data) ) { enumerator->found = GL_TRUE; enumerator->data = menu; @@ -552,7 +552,7 @@ SFG_Menu* fgMenuByID( int menuID ) /* This is easy and makes use of the menus enumeration defined above */ enumerator.found = GL_FALSE; - enumerator.data = (void *)menuID; + enumerator.data = (void *)&menuID; fgEnumMenus( fghcbMenuByID, &enumerator ); if( enumerator.found ) -- 1.7.10.4