From 46fd1bbdf507005c2a598636c751d6c30600a79b Mon Sep 17 00:00:00 2001 From: beuc Date: Sat, 21 Apr 2012 18:22:24 +0000 Subject: [PATCH] Fix more compiler warnings git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@1258 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/CMakeLists.txt | 5 +++-- freeglut/freeglut/src/fg_gl2.h | 2 ++ freeglut/freeglut/src/fg_init.c | 3 +-- freeglut/freeglut/src/fg_input_devices.c | 2 -- freeglut/freeglut/src/fg_internal.h | 8 +++++++- freeglut/freeglut/src/mswin/fg_gamemode_mswin.c | 2 +- freeglut/freeglut/src/mswin/fg_window_mswin.c | 4 ++++ freeglut/freeglut/src/x11/fg_init_x11.c | 4 +++- freeglut/freeglut/src/x11/fg_input_devices_x11.c | 3 --- freeglut/freeglut/src/x11/fg_joystick_x11.c | 2 -- freeglut/freeglut/src/x11/fg_main_x11.c | 4 +++- freeglut/freeglut/src/x11/fg_state_x11.c | 5 ++++- freeglut/freeglut/src/x11/fg_structure_x11.c | 5 ++++- freeglut/freeglut/src/x11/fg_window_x11.c | 1 - 14 files changed, 32 insertions(+), 18 deletions(-) diff --git a/freeglut/freeglut/CMakeLists.txt b/freeglut/freeglut/CMakeLists.txt index d3f083a..39febb2 100644 --- a/freeglut/freeglut/CMakeLists.txt +++ b/freeglut/freeglut/CMakeLists.txt @@ -46,6 +46,7 @@ SET(FREEGLUT_SRCS src/fg_gl2.c src/fg_gl2.h src/fg_init.c + src/fg_init.h src/fg_internal.h src/fg_input_devices.c src/fg_joystick.c @@ -139,7 +140,7 @@ ELSE() src/x11/fg_window_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 src/x11/fg_internal_x11_glx.h src/x11/fg_display_x11_glx.c @@ -194,7 +195,7 @@ IF(WIN32) ENDIF() IF(CMAKE_COMPILER_IS_GNUCC) - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") IF(!ANDROID) # not setting -ansi as EGL/KHR headers doesn't support it SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi") diff --git a/freeglut/freeglut/src/fg_gl2.h b/freeglut/freeglut/src/fg_gl2.h index d32f012..ab8ba5c 100644 --- a/freeglut/freeglut/src/fg_gl2.h +++ b/freeglut/freeglut/src/fg_gl2.h @@ -77,4 +77,6 @@ FGH_PFNGLVERTEXATTRIBPOINTERPROC fghVertexAttribPointer; # endif +extern void fgInitGL2(); + #endif diff --git a/freeglut/freeglut/src/fg_init.c b/freeglut/freeglut/src/fg_init.c index 68b69ca..1e71931 100644 --- a/freeglut/freeglut/src/fg_init.c +++ b/freeglut/freeglut/src/fg_init.c @@ -28,6 +28,7 @@ #define FREEGLUT_BUILDING_LIB #include #include "fg_internal.h" +#include "fg_gl2.h" /* * TODO BEFORE THE STABLE RELEASE: @@ -102,8 +103,6 @@ extern void fgPlatformInitialize( const char* displayName ); extern void fgPlatformDeinitialiseInputDevices ( void ); extern void fgPlatformCloseDisplay ( void ); extern void fgPlatformDestroyContext ( SFG_PlatformDisplay pDisplay, SFG_WindowContextType MContext ); -extern void fgInitGL2(); - void fghParseCommandLineArguments ( int* pargc, char** argv, char **pDisplayName, char **pGeometry ) { diff --git a/freeglut/freeglut/src/fg_input_devices.c b/freeglut/freeglut/src/fg_input_devices.c index 8cac504..1c7ba29 100644 --- a/freeglut/freeglut/src/fg_input_devices.c +++ b/freeglut/freeglut/src/fg_input_devices.c @@ -166,7 +166,6 @@ static void poll_dials ( int id ) static int dial_state = DIAL_NEW; static int dial_which; static int dial_value; - static int dials[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; if ( !dialbox_port ) return; @@ -187,7 +186,6 @@ static void poll_dials ( int id ) case DIAL_VALUE_LOW: dial_value |= data; if ( dial_value & 0x8000 ) dial_value -= 0x10000; - dials[dial_which] = dial_value; send_dial_event ( dial_which + 1, dial_value * 360 / 256 ); dial_state = DIAL_WHICH_DEVICE; break; diff --git a/freeglut/freeglut/src/fg_internal.h b/freeglut/freeglut/src/fg_internal.h index b3d892d..1c7429e 100644 --- a/freeglut/freeglut/src/fg_internal.h +++ b/freeglut/freeglut/src/fg_internal.h @@ -166,7 +166,13 @@ typedef unsigned long fg_time_t; #endif - +#ifndef __fg_unused +# ifdef __GNUC__ +# define __fg_unused __attribute__((unused)) +# else +# define __fg_unused +# endif +#endif /* Platform-specific includes */ #if TARGET_HOST_POSIX_X11 diff --git a/freeglut/freeglut/src/mswin/fg_gamemode_mswin.c b/freeglut/freeglut/src/mswin/fg_gamemode_mswin.c index 3e5228d..807b2ec 100644 --- a/freeglut/freeglut/src/mswin/fg_gamemode_mswin.c +++ b/freeglut/freeglut/src/mswin/fg_gamemode_mswin.c @@ -137,7 +137,7 @@ GLboolean fgPlatformChangeDisplayMode( GLboolean haveToTest ) /* magic happenings behind my back, its lib for devels at last ;) */ /* 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); } diff --git a/freeglut/freeglut/src/mswin/fg_window_mswin.c b/freeglut/freeglut/src/mswin/fg_window_mswin.c index 0698349..bc6b886 100644 --- a/freeglut/freeglut/src/mswin/fg_window_mswin.c +++ b/freeglut/freeglut/src/mswin/fg_window_mswin.c @@ -394,10 +394,12 @@ void fghComputeWindowRectFromClientArea_UseStyle( const DWORD windowStyle, RECT /* 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 (posIsOutside) clientRect->bottom += GetSystemMetrics( SM_CYCAPTION ); else clientRect->top -= GetSystemMetrics( SM_CYCAPTION ); + } /* get width of window's borders (frame), correct rect for it. * 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 (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) windowRect->bottom -= GetSystemMetrics( SM_CYCAPTION ); else windowRect->top += GetSystemMetrics( SM_CYCAPTION ); + } /* get width of window's borders (frame), correct rect for it. * Note, borders can be of zero width if style does not specify borders diff --git a/freeglut/freeglut/src/x11/fg_init_x11.c b/freeglut/freeglut/src/x11/fg_init_x11.c index 45ac0d1..6cd6048 100644 --- a/freeglut/freeglut/src/x11/fg_init_x11.c +++ b/freeglut/freeglut/src/x11/fg_init_x11.c @@ -29,7 +29,9 @@ #define FREEGLUT_BUILDING_LIB #include /* LONG_MAX */ #include -#include "../fg_internal.h" +#include "fg_internal.h" +#include "fg_init.h" +#include "egl/fg_init_egl.h" /* Return the atom associated with "name". */ static Atom fghGetAtom(const char * name) diff --git a/freeglut/freeglut/src/x11/fg_input_devices_x11.c b/freeglut/freeglut/src/x11/fg_input_devices_x11.c index a94e52a..aa5da77 100644 --- a/freeglut/freeglut/src/x11/fg_input_devices_x11.c +++ b/freeglut/freeglut/src/x11/fg_input_devices_x11.c @@ -56,9 +56,6 @@ typedef struct _serialport SERIALPORT; void serial_flush ( SERIALPORT *port ); -/* local variables */ -static SERIALPORT *dialbox_port=NULL; - /*****************************************************************/ /* diff --git a/freeglut/freeglut/src/x11/fg_joystick_x11.c b/freeglut/freeglut/src/x11/fg_joystick_x11.c index 5d686b5..1815577 100644 --- a/freeglut/freeglut/src/x11/fg_joystick_x11.c +++ b/freeglut/freeglut/src/x11/fg_joystick_x11.c @@ -48,8 +48,6 @@ void fgPlatformJoystickRawRead( SFG_Joystick* joy, int* buttons, float* axes ) { int status; - int i; - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) int len; diff --git a/freeglut/freeglut/src/x11/fg_main_x11.c b/freeglut/freeglut/src/x11/fg_main_x11.c index 3ecb811..8a8514e 100644 --- a/freeglut/freeglut/src/x11/fg_main_x11.c +++ b/freeglut/freeglut/src/x11/fg_main_x11.c @@ -40,6 +40,8 @@ # define VFPRINTF(s,f,a) #endif +#include "fg_main.h" + /* * Try to get the maximum value allowed for ints, falling back to the minimum * 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 ) { diff --git a/freeglut/freeglut/src/x11/fg_state_x11.c b/freeglut/freeglut/src/x11/fg_state_x11.c index 9765319..cb55109 100644 --- a/freeglut/freeglut/src/x11/fg_state_x11.c +++ b/freeglut/freeglut/src/x11/fg_state_x11.c @@ -26,7 +26,10 @@ */ #include -#include "../fg_internal.h" +#include "fg_internal.h" +#ifdef EGL_VERSION_1_0 +#include "egl/fg_state_egl.h" +#endif int fgPlatformGlutDeviceGet ( GLenum eWhat ) { diff --git a/freeglut/freeglut/src/x11/fg_structure_x11.c b/freeglut/freeglut/src/x11/fg_structure_x11.c index e1d5eb4..3e22350 100644 --- a/freeglut/freeglut/src/x11/fg_structure_x11.c +++ b/freeglut/freeglut/src/x11/fg_structure_x11.c @@ -27,7 +27,10 @@ */ #include -#include "../fg_internal.h" +#include "fg_internal.h" +#ifdef EGL_VERSION_1_0 +#include "egl/fg_structure_egl.h" +#endif extern SFG_Structure fgStructure; diff --git a/freeglut/freeglut/src/x11/fg_window_x11.c b/freeglut/freeglut/src/x11/fg_window_x11.c index 2b9012c..1b90bf5 100644 --- a/freeglut/freeglut/src/x11/fg_window_x11.c +++ b/freeglut/freeglut/src/x11/fg_window_x11.c @@ -132,7 +132,6 @@ void fgPlatformOpenWindow( SFG_Window* window, const char* title, XWMHints wmHints; XEvent eventReturnBuffer; /* return buffer required for a call */ unsigned long mask; - int num_FBConfigs, i; unsigned int current_DisplayMode = fgState.DisplayMode ; /* Save the display mode if we are creating a menu window */