Silence `-Wmaybe-uninitialized` warnings in tests.

This commit is contained in:
Pierre Wendling 2022-11-14 17:56:48 -05:00 committed by Sam Lantinga
parent a40b7cde10
commit d080e3bf3a
4 changed files with 14 additions and 2 deletions

View File

@ -611,7 +611,7 @@ WatchJoystick(SDL_Joystick * joystick)
SDL_GameControllerButton eButton = (SDL_GameControllerButton)iIndex;
SDL_strlcat(mapping, SDL_GameControllerGetStringForButton(eButton), SDL_arraysize(mapping));
} else {
const char *pszAxisName;
const char *pszAxisName = NULL;
switch (iIndex - SDL_CONTROLLER_BUTTON_MAX) {
case SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE:
if (!BMergeAxisBindings(iIndex)) {
@ -660,7 +660,9 @@ WatchJoystick(SDL_Joystick * joystick)
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT);
break;
}
SDL_strlcat(mapping, pszAxisName, SDL_arraysize(mapping));
if (pszAxisName) {
SDL_strlcat(mapping, pszAxisName, SDL_arraysize(mapping));
}
}
SDL_strlcat(mapping, ":", SDL_arraysize(mapping));

View File

@ -330,6 +330,7 @@ pixels_allocFreePalette(void *arg)
for (variation = 1; variation <= 3; variation++) {
switch (variation) {
/* Just one color */
default:
case 1:
ncolors = 1;
break;
@ -426,6 +427,7 @@ pixels_calcGammaRamp(void *arg)
for (variation = 0; variation < 4; variation++) {
switch (variation) {
/* gamma = 0 all black */
default:
case 0:
gamma = 0.0f;
break;

View File

@ -616,6 +616,7 @@ rwops_testFileWriteReadEndian(void)
/* Create test data */
switch (mode) {
default:
case 0:
SDLTest_Log("All 0 values");
BE16value = 0;

View File

@ -123,6 +123,7 @@ video_createWindowVariousPositions(void *arg)
for (xVariation = 0; xVariation < 6; xVariation++) {
for (yVariation = 0; yVariation < 6; yVariation++) {
switch(xVariation) {
default:
case 0:
/* Zero X Position */
x = 0;
@ -150,6 +151,7 @@ video_createWindowVariousPositions(void *arg)
}
switch(yVariation) {
default:
case 0:
/* Zero X Position */
y = 0;
@ -267,6 +269,7 @@ video_createWindowVariousFlags(void *arg)
for (fVariation = 0; fVariation < 14; fVariation++) {
switch(fVariation) {
default:
case 0:
flags = SDL_WINDOW_FULLSCREEN;
/* Skip - blanks screen; comment out next line to run test */
@ -1074,6 +1077,7 @@ video_getSetWindowPosition(void *arg)
for (xVariation = 0; xVariation < 4; xVariation++) {
for (yVariation = 0; yVariation < 4; yVariation++) {
switch(xVariation) {
default:
case 0:
/* Zero X Position */
desiredX = 0;
@ -1093,6 +1097,7 @@ video_getSetWindowPosition(void *arg)
}
switch(yVariation) {
default:
case 0:
/* Zero X Position */
desiredY = 0;
@ -1236,6 +1241,7 @@ video_getSetWindowSize(void *arg)
for (wVariation = 0; wVariation < maxwVariation; wVariation++) {
for (hVariation = 0; hVariation < maxhVariation; hVariation++) {
switch(wVariation) {
default:
case 0:
/* 1 Pixel Wide */
desiredW = 1;
@ -1259,6 +1265,7 @@ video_getSetWindowSize(void *arg)
}
switch(hVariation) {
default:
case 0:
/* 1 Pixel High */
desiredH = 1;