Parcourir la source

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.
Susko3 il y a 1 an
Parent
commit
01248a99c8

+ 2 - 0
src/test/SDL_test_common.c

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

+ 2 - 0
test/testcamera.c

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

+ 2 - 0
test/testhittesting.c

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

+ 2 - 0
test/testhotplug.c

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

+ 2 - 0
test/testoffscreen.c

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

+ 2 - 0
test/testoverlay.c

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

+ 2 - 0
test/testrelative.c

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

+ 2 - 0
test/teststreaming.c

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