From e62ea4f4c3c7fcec13fcc4edb82a22ae44db48f2 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 26 Feb 2013 20:41:28 -0800 Subject: [PATCH] Fixed gcc pedantic warnings in public headers --- include/SDL_gamecontroller.h | 23 ++++++++++------------- src/joystick/SDL_gamecontroller.c | 22 +++++++++++----------- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/include/SDL_gamecontroller.h b/include/SDL_gamecontroller.h index 7cb9ed1f4..b379d7eec 100644 --- a/include/SDL_gamecontroller.h +++ b/include/SDL_gamecontroller.h @@ -62,23 +62,20 @@ typedef enum } SDL_GameControllerBindType; /** - * get the sdl joystick layer binding for this controller button/axis mapping + * Get the SDL joystick layer binding for this controller button/axis mapping */ -struct _SDL_GameControllerHatBind +typedef struct SDL_GameControllerButtonBind { - int hat; - int hat_mask; -}; - -typedef struct _SDL_GameControllerButtonBind -{ - SDL_GameControllerBindType m_eBindType; + SDL_GameControllerBindType bindType; union { int button; int axis; - struct _SDL_GameControllerHatBind hat; - }; + struct { + int hat; + int hat_mask; + } hat; + } value; } SDL_GameControllerButtonBind; @@ -190,7 +187,7 @@ typedef enum extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromString(const char *pchString); /** - * get the sdl joystick layer binding for this controller button mapping + * Get the SDL joystick layer binding for this controller button mapping */ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller, @@ -238,7 +235,7 @@ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFrom /** - * get the sdl joystick layer binding for this controller button mapping + * Get the SDL joystick layer binding for this controller button mapping */ extern DECLSPEC SDL_GameControllerButtonBind SDLCALL SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, diff --git a/src/joystick/SDL_gamecontroller.c b/src/joystick/SDL_gamecontroller.c index 24bf07a00..34c239a0e 100644 --- a/src/joystick/SDL_gamecontroller.c +++ b/src/joystick/SDL_gamecontroller.c @@ -945,13 +945,13 @@ SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController if (gamecontroller->mapping.axes[axis] >= 0 ) { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.button = gamecontroller->mapping.axes[axis]; + bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; + bind.value.button = gamecontroller->mapping.axes[axis]; } else if (gamecontroller->mapping.buttonasaxis[axis] >= 0 ) { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.button = gamecontroller->mapping.buttonasaxis[axis]; + bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; + bind.value.button = gamecontroller->mapping.buttonasaxis[axis]; } return bind; @@ -971,19 +971,19 @@ SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameControll if ( gamecontroller->mapping.buttons[button] >= 0 ) { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.button = gamecontroller->mapping.buttons[button]; + bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; + bind.value.button = gamecontroller->mapping.buttons[button]; } else if ( gamecontroller->mapping.axesasbutton[button] >= 0 ) { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.axis = gamecontroller->mapping.axesasbutton[button]; + bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; + bind.value.axis = gamecontroller->mapping.axesasbutton[button]; } else if ( gamecontroller->mapping.hatasbutton[button].hat >= 0 ) { - bind.m_eBindType = SDL_CONTROLLER_BINDTYPE_HAT; - bind.hat.hat = gamecontroller->mapping.hatasbutton[button].hat; - bind.hat.hat_mask = gamecontroller->mapping.hatasbutton[button].mask; + bind.bindType = SDL_CONTROLLER_BINDTYPE_HAT; + bind.value.hat.hat = gamecontroller->mapping.hatasbutton[button].hat; + bind.value.hat.hat_mask = gamecontroller->mapping.hatasbutton[button].mask; } return bind;