mirror of https://github.com/encounter/SDL.git
controllermap: use enum to avoid '-Wmaybe-uninitialized'
Emitted by MinGW: In function 'WatchJoystick', inlined from 'SDL_main' at D:/a/SDL/SDL/test/controllermap.c:802:9: D:/a/SDL/SDL/test/controllermap.c:437:9: warning: 'marker' may be used uninitialized [-Wmaybe-uninitialized] 437 | SDL_SetTextureAlphaMod(marker, alpha); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ D:/a/SDL/SDL/test/controllermap.c: In function 'SDL_main': D:/a/SDL/SDL/test/controllermap.c:355:71: note: 'marker' was declared here 355 | SDL_Texture *background_front, *background_back, *button, *axis, *marker;
This commit is contained in:
parent
a905db9d65
commit
d04fa0ef76
|
@ -28,8 +28,10 @@
|
|||
#define SCREEN_WIDTH 512
|
||||
#define SCREEN_HEIGHT 320
|
||||
|
||||
#define MARKER_BUTTON 1
|
||||
#define MARKER_AXIS 2
|
||||
enum marker_type {
|
||||
MARKER_BUTTON,
|
||||
MARKER_AXIS,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -52,7 +54,7 @@ static struct
|
|||
{
|
||||
int x, y;
|
||||
double angle;
|
||||
int marker;
|
||||
enum marker_type marker;
|
||||
|
||||
} s_arrBindingDisplay[] = {
|
||||
{ 387, 167, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_A */
|
||||
|
@ -352,7 +354,7 @@ BMergeAxisBindings(int iIndex)
|
|||
static void
|
||||
WatchJoystick(SDL_Joystick * joystick)
|
||||
{
|
||||
SDL_Texture *background_front, *background_back, *button, *axis, *marker;
|
||||
SDL_Texture *background_front, *background_back, *button, *axis, *marker=NULL;
|
||||
const char *name = NULL;
|
||||
SDL_Event event;
|
||||
SDL_Rect dst;
|
||||
|
@ -407,8 +409,6 @@ WatchJoystick(SDL_Joystick * joystick)
|
|||
case MARKER_BUTTON:
|
||||
marker = button;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
dst.x = s_arrBindingDisplay[iElement].x;
|
||||
|
|
Loading…
Reference in New Issue