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_GameControllerButton eButton = (SDL_GameControllerButton)iIndex;
SDL_strlcat(mapping, SDL_GameControllerGetStringForButton(eButton), SDL_arraysize(mapping)); SDL_strlcat(mapping, SDL_GameControllerGetStringForButton(eButton), SDL_arraysize(mapping));
} else { } else {
const char *pszAxisName; const char *pszAxisName = NULL;
switch (iIndex - SDL_CONTROLLER_BUTTON_MAX) { switch (iIndex - SDL_CONTROLLER_BUTTON_MAX) {
case SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE: case SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE:
if (!BMergeAxisBindings(iIndex)) { if (!BMergeAxisBindings(iIndex)) {
@ -660,7 +660,9 @@ WatchJoystick(SDL_Joystick * joystick)
pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT); pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT);
break; break;
} }
SDL_strlcat(mapping, pszAxisName, SDL_arraysize(mapping)); if (pszAxisName) {
SDL_strlcat(mapping, pszAxisName, SDL_arraysize(mapping));
}
} }
SDL_strlcat(mapping, ":", 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++) { for (variation = 1; variation <= 3; variation++) {
switch (variation) { switch (variation) {
/* Just one color */ /* Just one color */
default:
case 1: case 1:
ncolors = 1; ncolors = 1;
break; break;
@ -426,6 +427,7 @@ pixels_calcGammaRamp(void *arg)
for (variation = 0; variation < 4; variation++) { for (variation = 0; variation < 4; variation++) {
switch (variation) { switch (variation) {
/* gamma = 0 all black */ /* gamma = 0 all black */
default:
case 0: case 0:
gamma = 0.0f; gamma = 0.0f;
break; break;

View File

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

View File

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