Commit a948ff8494ba05dd6af5676f36698f2f74d33015

Ozkan Sezer 2021-11-13T11:50:02

SDL_hidapijoystick.c: worked around a bogus 'unreachable code' warning.

diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c
index 87f9108..0f9ad37 100644
--- a/src/joystick/hidapi/SDL_hidapijoystick.c
+++ b/src/joystick/hidapi/SDL_hidapijoystick.c
@@ -201,8 +201,7 @@ static void
 HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device)
 {
     if (device->driver) {
-        /* Already setup */
-        return;
+        return; /* Already setup */
     }
 
     device->driver = HIDAPI_GetDeviceDriver(device);
@@ -224,8 +223,7 @@ static void
 HIDAPI_CleanupDeviceDriver(SDL_HIDAPI_Device *device)
 {
     if (!device->driver) {
-        /* Already cleaned up */
-        return;
+        return; /* Already cleaned up */
     }
 
     /* Disconnect any joysticks */
@@ -395,10 +393,13 @@ HIDAPI_ConvertString(const wchar_t *wide_string)
     if (wide_string) {
         string = SDL_iconv_string("UTF-8", "WCHAR_T", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
         if (!string) {
-            if (sizeof(wchar_t) == sizeof(Uint16)) {
+            switch (sizeof(wchar_t)) {
+            case 2:
                 string = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
-            } else if (sizeof(wchar_t) == sizeof(Uint32)) {
+                break;
+            case 4:
                 string = SDL_iconv_string("UTF-8", "UCS-4-INTERNAL", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
+                break;
             }
         }
     }