From a948ff8494ba05dd6af5676f36698f2f74d33015 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 13 Nov 2021 11:50:02 +0300 Subject: [PATCH] SDL_hidapijoystick.c: worked around a bogus 'unreachable code' warning. --- src/joystick/hidapi/SDL_hidapijoystick.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/joystick/hidapi/SDL_hidapijoystick.c b/src/joystick/hidapi/SDL_hidapijoystick.c index 87f91083c..0f9ad3764 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; } } }