Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed gcc pedantic warnings in public headers
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Feb 27, 2013
1 parent c034927 commit e62ea4f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
23 changes: 10 additions & 13 deletions include/SDL_gamecontroller.h
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 11 additions & 11 deletions src/joystick/SDL_gamecontroller.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit e62ea4f

Please sign in to comment.