Fix more compiler warnings

git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1258 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
beuc 2012-04-21 18:22:24 +00:00
parent 49922f9a8a
commit 46fd1bbdf5
14 changed files with 32 additions and 18 deletions

View File

@ -46,6 +46,7 @@ SET(FREEGLUT_SRCS
src/fg_gl2.c src/fg_gl2.c
src/fg_gl2.h src/fg_gl2.h
src/fg_init.c src/fg_init.c
src/fg_init.h
src/fg_internal.h src/fg_internal.h
src/fg_input_devices.c src/fg_input_devices.c
src/fg_joystick.c src/fg_joystick.c
@ -139,7 +140,7 @@ ELSE()
src/x11/fg_window_x11.c src/x11/fg_window_x11.c
src/x11/fg_xinput_x11.c src/x11/fg_xinput_x11.c
) )
IF(!(FREEGLUT_GLES2 OR FREEGLUT_GLES1)) IF(NOT(FREEGLUT_GLES2 OR FREEGLUT_GLES1))
LIST(APPEND FREEGLUT_SRCS LIST(APPEND FREEGLUT_SRCS
src/x11/fg_internal_x11_glx.h src/x11/fg_internal_x11_glx.h
src/x11/fg_display_x11_glx.c src/x11/fg_display_x11_glx.c
@ -194,7 +195,7 @@ IF(WIN32)
ENDIF() ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
IF(!ANDROID) IF(!ANDROID)
# not setting -ansi as EGL/KHR headers doesn't support it # not setting -ansi as EGL/KHR headers doesn't support it
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi")

View File

@ -77,4 +77,6 @@ FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer;
# endif # endif
extern void fgInitGL2();
#endif #endif

View File

@ -28,6 +28,7 @@
#define FREEGLUT_BUILDING_LIB #define FREEGLUT_BUILDING_LIB
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "fg_internal.h" #include "fg_internal.h"
#include "fg_gl2.h"
/* /*
* TODO BEFORE THE STABLE RELEASE: * TODO BEFORE THE STABLE RELEASE:
@ -102,8 +103,6 @@ extern void fgPlatformInitialize( const char* displayName );
extern void fgPlatformDeinitialiseInputDevices ( void ); extern void fgPlatformDeinitialiseInputDevices ( void );
extern void fgPlatformCloseDisplay ( void ); extern void fgPlatformCloseDisplay ( void );
extern void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext ); extern void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext );
extern void fgInitGL2();
void fghParseCommandLineArguments ( int* pargc, char** argv, char **pDisplayName, char **pGeometry ) void fghParseCommandLineArguments ( int* pargc, char** argv, char **pDisplayName, char **pGeometry )
{ {

View File

@ -166,7 +166,6 @@ static void poll_dials ( int id )
static int dial_state = DIAL_NEW; static int dial_state = DIAL_NEW;
static int dial_which; static int dial_which;
static int dial_value; static int dial_value;
static int dials[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
if ( !dialbox_port ) return; if ( !dialbox_port ) return;
@ -187,7 +186,6 @@ static void poll_dials ( int id )
case DIAL_VALUE_LOW: case DIAL_VALUE_LOW:
dial_value |= data; dial_value |= data;
if ( dial_value & 0x8000 ) dial_value -= 0x10000; if ( dial_value & 0x8000 ) dial_value -= 0x10000;
dials[dial_which] = dial_value;
send_dial_event ( dial_which + 1, dial_value * 360 / 256 ); send_dial_event ( dial_which + 1, dial_value * 360 / 256 );
dial_state = DIAL_WHICH_DEVICE; dial_state = DIAL_WHICH_DEVICE;
break; break;

View File

@ -166,7 +166,13 @@
typedef unsigned long fg_time_t; typedef unsigned long fg_time_t;
#endif #endif
#ifndef __fg_unused
# ifdef __GNUC__
# define __fg_unused __attribute__((unused))
# else
# define __fg_unused
# endif
#endif
/* Platform-specific includes */ /* Platform-specific includes */
#if TARGET_HOST_POSIX_X11 #if TARGET_HOST_POSIX_X11

View File

@ -137,7 +137,7 @@ GLboolean fgPlatformChangeDisplayMode( GLboolean haveToTest )
/* magic happenings behind my back, its lib for devels at last ;) */ /* magic happenings behind my back, its lib for devels at last ;) */
/* append display mode to error to make things more informative */ /* append display mode to error to make things more informative */
sprintf(displayMode,"%s Problem with requested mode: %ix%i:%i@%i", fggmstr, devMode.dmPelsWidth, devMode.dmPelsHeight, devMode.dmBitsPerPel, devMode.dmDisplayFrequency); sprintf(displayMode,"%s Problem with requested mode: %lux%lu:%lu@%lu", fggmstr, devMode.dmPelsWidth, devMode.dmPelsHeight, devMode.dmBitsPerPel, devMode.dmDisplayFrequency);
fgWarning(displayMode); fgWarning(displayMode);
} }

View File

@ -394,10 +394,12 @@ void fghComputeWindowRectFromClientArea_UseStyle( const DWORD windowStyle, RECT
/* If window has title bar, correct rect for it */ /* If window has title bar, correct rect for it */
if (windowStyle & WS_MAXIMIZEBOX) /* Need to query for WS_MAXIMIZEBOX to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */ if (windowStyle & WS_MAXIMIZEBOX) /* Need to query for WS_MAXIMIZEBOX to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */
{
if (posIsOutside) if (posIsOutside)
clientRect->bottom += GetSystemMetrics( SM_CYCAPTION ); clientRect->bottom += GetSystemMetrics( SM_CYCAPTION );
else else
clientRect->top -= GetSystemMetrics( SM_CYCAPTION ); clientRect->top -= GetSystemMetrics( SM_CYCAPTION );
}
/* get width of window's borders (frame), correct rect for it. /* get width of window's borders (frame), correct rect for it.
* Note, borders can be of zero width if style does not specify borders * Note, borders can be of zero width if style does not specify borders
@ -462,10 +464,12 @@ void fghComputeClientAreaFromWindowRect( const SFG_Window *window, RECT *windowR
/* If window has title bar, correct rect for it */ /* If window has title bar, correct rect for it */
if (windowStyle & WS_MAXIMIZEBOX) /* Need to query for WS_MAXIMIZEBOX to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */ if (windowStyle & WS_MAXIMIZEBOX) /* Need to query for WS_MAXIMIZEBOX to see if we have a title bar, the WS_CAPTION query is also true for a WS_DLGFRAME only... */
{
if (wantPosOutside) if (wantPosOutside)
windowRect->bottom -= GetSystemMetrics( SM_CYCAPTION ); windowRect->bottom -= GetSystemMetrics( SM_CYCAPTION );
else else
windowRect->top += GetSystemMetrics( SM_CYCAPTION ); windowRect->top += GetSystemMetrics( SM_CYCAPTION );
}
/* get width of window's borders (frame), correct rect for it. /* get width of window's borders (frame), correct rect for it.
* Note, borders can be of zero width if style does not specify borders * Note, borders can be of zero width if style does not specify borders

View File

@ -29,7 +29,9 @@
#define FREEGLUT_BUILDING_LIB #define FREEGLUT_BUILDING_LIB
#include <limits.h> /* LONG_MAX */ #include <limits.h> /* LONG_MAX */
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "../fg_internal.h" #include "fg_internal.h"
#include "fg_init.h"
#include "egl/fg_init_egl.h"
/* Return the atom associated with "name". */ /* Return the atom associated with "name". */
static Atom fghGetAtom(const char * name) static Atom fghGetAtom(const char * name)

View File

@ -56,9 +56,6 @@ typedef struct _serialport SERIALPORT;
void serial_flush ( SERIALPORT *port ); void serial_flush ( SERIALPORT *port );
/* local variables */
static SERIALPORT *dialbox_port=NULL;
/*****************************************************************/ /*****************************************************************/
/* /*

View File

@ -48,8 +48,6 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes )
{ {
int status; int status;
int i;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
int len; int len;

View File

@ -40,6 +40,8 @@
# define VFPRINTF(s,f,a) # define VFPRINTF(s,f,a)
#endif #endif
#include "fg_main.h"
/* /*
* Try to get the maximum value allowed for ints, falling back to the minimum * Try to get the maximum value allowed for ints, falling back to the minimum
* guaranteed by ISO C99 if there is no suitable header. * guaranteed by ISO C99 if there is no suitable header.
@ -298,7 +300,7 @@ static const char* fghColormapStateToString( int state )
} }
} }
static void fghPrintEvent( XEvent *event ) __fg_unused static void fghPrintEvent( XEvent *event )
{ {
switch( event->type ) { switch( event->type ) {

View File

@ -26,7 +26,10 @@
*/ */
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "../fg_internal.h" #include "fg_internal.h"
#ifdef EGL_VERSION_1_0
#include "egl/fg_state_egl.h"
#endif
int fgPlatformGlutDeviceGet ( GLenum eWhat ) int fgPlatformGlutDeviceGet ( GLenum eWhat )
{ {

View File

@ -27,7 +27,10 @@
*/ */
#include <GL/freeglut.h> #include <GL/freeglut.h>
#include "../fg_internal.h" #include "fg_internal.h"
#ifdef EGL_VERSION_1_0
#include "egl/fg_structure_egl.h"
#endif
extern SFG_Structure fgStructure; extern SFG_Structure fgStructure;

View File

@ -132,7 +132,6 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title,
XWMHints wmHints; XWMHints wmHints;
XEvent eventReturnBuffer; /* return buffer required for a call */ XEvent eventReturnBuffer; /* return buffer required for a call */
unsigned long mask; unsigned long mask;
int num_FBConfigs, i;
unsigned int current_DisplayMode = fgState.DisplayMode ; unsigned int current_DisplayMode = fgState.DisplayMode ;
/* Save the display mode if we are creating a menu window */ /* Save the display mode if we are creating a menu window */