Add `default: break;` to switches on SDL_Event::type

This is just a nice-to-have, as `SDL_Event::type` in an `Uint32`, so there are no
compiler errors about not handling all `SDL_EventType` enum values.
main
Susko3 2024-03-06 20:37:39 +01:00 committed by Sam Lantinga
parent 722f4104bf
commit 01248a99c8
8 changed files with 16 additions and 0 deletions

View File

@ -2422,6 +2422,8 @@ int SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event
} }
case SDL_EVENT_QUIT: case SDL_EVENT_QUIT:
return 1; return 1;
default:
break;
} }
return 0; /* keep going */ return 0; /* keep going */

View File

@ -202,6 +202,8 @@ int SDL_AppEvent(const SDL_Event *event)
SDL_Log("Camera denied!"); SDL_Log("Camera denied!");
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Camera permission denied!", "User denied access to the camera!", window); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Camera permission denied!", "User denied access to the camera!", window);
return -1; return -1;
default:
break;
} }
return SDLTest_CommonEventMainCallbacks(state, event); return SDLTest_CommonEventMainCallbacks(state, event);

View File

@ -153,6 +153,8 @@ int main(int argc, char **argv)
case SDL_EVENT_QUIT: case SDL_EVENT_QUIT:
done = 1; done = 1;
break; break;
default:
break;
} }
} }

View File

@ -155,6 +155,8 @@ int main(int argc, char *argv[])
case SDL_EVENT_JOYSTICK_BUTTON_UP: case SDL_EVENT_JOYSTICK_BUTTON_UP:
SDL_Log("Button Release: %d\n", event.jbutton.button); SDL_Log("Button Release: %d\n", event.jbutton.button);
break; break;
default:
break;
} }
} }
} }

View File

@ -74,6 +74,8 @@ static void loop(void)
case SDL_EVENT_QUIT: case SDL_EVENT_QUIT:
done = SDL_TRUE; done = SDL_TRUE;
break; break;
default:
break;
} }
} }

View File

@ -282,6 +282,8 @@ static void loop(void)
if (event.key.keysym.sym != SDLK_ESCAPE) { if (event.key.keysym.sym != SDLK_ESCAPE) {
break; break;
} }
default:
break;
} }
} }

View File

@ -47,6 +47,8 @@ static void loop(void)
mouseX += event.motion.xrel; mouseX += event.motion.xrel;
mouseY += event.motion.yrel; mouseY += event.motion.yrel;
} break; } break;
default:
break;
} }
} }
for (i = 0; i < state->num_windows; ++i) { for (i = 0; i < state->num_windows; ++i) {

View File

@ -114,6 +114,8 @@ static void loop(void)
case SDL_EVENT_QUIT: case SDL_EVENT_QUIT:
done = SDL_TRUE; done = SDL_TRUE;
break; break;
default:
break;
} }
} }