Browse Source

Fixed warning C6001: Using uninitialized memory 'rdi'.

Sam Lantinga 1 year ago
parent
commit
163de8e697
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/joystick/windows/SDL_rawinputjoystick.c

+ 2 - 1
src/joystick/windows/SDL_rawinputjoystick.c

@@ -852,7 +852,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice)
     SDL_RAWINPUT_Device *curr, *last;
     SDL_RAWINPUT_Device *curr, *last;
     RID_DEVICE_INFO rdi;
     RID_DEVICE_INFO rdi;
     UINT size;
     UINT size;
-    char dev_name[MAX_PATH];
+    char dev_name[MAX_PATH] = { 0 };
     HANDLE hFile = INVALID_HANDLE_VALUE;
     HANDLE hFile = INVALID_HANDLE_VALUE;
 
 
     /* Make sure we're not trying to add the same device twice */
     /* Make sure we're not trying to add the same device twice */
@@ -862,6 +862,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice)
 
 
     /* Figure out what kind of device it is */
     /* Figure out what kind of device it is */
     size = sizeof(rdi);
     size = sizeof(rdi);
+    SDL_zero(rdi);
     CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICEINFO, &rdi, &size) != (UINT)-1);
     CHECK(GetRawInputDeviceInfoA(hDevice, RIDI_DEVICEINFO, &rdi, &size) != (UINT)-1);
     CHECK(rdi.dwType == RIM_TYPEHID);
     CHECK(rdi.dwType == RIM_TYPEHID);