cleaned up a bunch of warnings

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1573 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
dcnieho 2013-04-01 15:40:51 +00:00
parent b7bbf6277e
commit 2811836c94
6 changed files with 14 additions and 12 deletions

View File

@ -8,6 +8,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h>
static int sequence_number = 0 ; static int sequence_number = 0 ;
@ -80,15 +81,19 @@ Mod2Text(int mods, char *text)
if (mods&GLUT_ACTIVE_CTRL) if (mods&GLUT_ACTIVE_CTRL)
strcat(text,"CTRL"); strcat(text,"CTRL");
if (mods&GLUT_ACTIVE_SHIFT) if (mods&GLUT_ACTIVE_SHIFT)
{
if (text[0]) if (text[0])
strcat(text,"+SHIFT"); strcat(text,"+SHIFT");
else else
strcat(text,"SHIFT"); strcat(text,"SHIFT");
}
if (mods&GLUT_ACTIVE_ALT) if (mods&GLUT_ACTIVE_ALT)
{
if (text[0]) if (text[0])
strcat(text,"+ALT"); strcat(text,"+ALT");
else else
strcat(text,"ALT"); strcat(text,"ALT");
}
if (!text[0]) if (!text[0])
strcat(text,"none"); strcat(text,"none");
@ -213,7 +218,7 @@ Display(void)
static void static void
Warning(const char *fmt, va_list ap) Warning(const char *fmt, va_list ap)
{ {
printf("%6d Warning callback:\n"); printf("%6d Warning callback:\n",++sequence_number);
/* print warning message */ /* print warning message */
vprintf(fmt, ap); vprintf(fmt, ap);
@ -223,7 +228,7 @@ static void
Error(const char *fmt, va_list ap) Error(const char *fmt, va_list ap)
{ {
char dummy_string[STRING_LENGTH]; char dummy_string[STRING_LENGTH];
printf("%6d Error callback:\n"); printf("%6d Error callback:\n",++sequence_number);
/* print warning message */ /* print warning message */
vprintf(fmt, ap); vprintf(fmt, ap);

View File

@ -311,8 +311,6 @@ void readConfigFile ( char *fnme )
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int fractal_window ;
glutInitWindowSize(500, 250); glutInitWindowSize(500, 250);
glutInitWindowPosition ( 140, 140 ); glutInitWindowPosition ( 140, 140 );
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE ); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE );
@ -323,7 +321,7 @@ main(int argc, char *argv[])
else else
readConfigFile ( "fractals.dat" ) ; readConfigFile ( "fractals.dat" ) ;
fractal_window = glutCreateWindow( window_title ); glutCreateWindow( window_title );
glClearColor(1.0, 1.0, 1.0, 1.0); glClearColor(1.0, 1.0, 1.0, 1.0);

View File

@ -355,8 +355,6 @@ void readConfigFile ( char *fnme )
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int fractal_window ;
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE ); glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE );
glutInitWindowSize(500, 250); glutInitWindowSize(500, 250);
@ -368,7 +366,7 @@ main(int argc, char *argv[])
else else
readConfigFile ( "fractals.dat" ) ; readConfigFile ( "fractals.dat" ) ;
fractal_window = glutCreateWindow( window_title ); glutCreateWindow( window_title );
glClearColor(1.0, 1.0, 1.0, 1.0); glClearColor(1.0, 1.0, 1.0, 1.0);

View File

@ -220,8 +220,7 @@ void mouse_cb ( int button, int updown, int x, int y )
{ {
if ( updown == GLUT_DOWN ) if ( updown == GLUT_DOWN )
{ {
double dist = 1.0e20 ; /* A very large number */ /*double dist = 1.0e20 ; A very large number */
dist = 0.0 ; /* so we don't get "unused variable" compiler warning */
/* The idea here is that we go into "pick" mode and pick the nearest point /* 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 to the mouse click position. Unfortunately I don't have the time to implement
it at the moment. */ it at the moment. */

View File

@ -852,10 +852,12 @@ static void special (int key, int x, int y)
/* Cuboctahedron can't be shown when in shader mode, skip it */ /* Cuboctahedron can't be shown when in shader mode, skip it */
if (useShader && NUMBEROF (table)-1 == ( unsigned )function_index) if (useShader && NUMBEROF (table)-1 == ( unsigned )function_index)
{
if (key==GLUT_KEY_PAGE_UP) if (key==GLUT_KEY_PAGE_UP)
function_index = 0; function_index = 0;
else else
function_index -= 1; function_index -= 1;
}
} }

View File

@ -533,7 +533,7 @@ static void fghcbMenuByID( SFG_Menu *menu,
return; return;
/* Check the menu's ID. */ /* Check the menu's ID. */
if( menu->ID == (int)(enumerator->data) ) if( menu->ID == *( int *)(enumerator->data) )
{ {
enumerator->found = GL_TRUE; enumerator->found = GL_TRUE;
enumerator->data = menu; enumerator->data = menu;
@ -552,7 +552,7 @@ SFG_Menu* fgMenuByID( int menuID )
/* This is easy and makes use of the menus enumeration defined above */ /* This is easy and makes use of the menus enumeration defined above */
enumerator.found = GL_FALSE; enumerator.found = GL_FALSE;
enumerator.data = (void *)menuID; enumerator.data = (void *)&menuID;
fgEnumMenus( fghcbMenuByID, &enumerator ); fgEnumMenus( fghcbMenuByID, &enumerator );
if( enumerator.found ) if( enumerator.found )