BJoystick: Fix fJoystickInfo initialization.

joystick_info contains BLists which initialize themselves upon new(),
and Clang warned (correctly) that using memset() overwites that, as well as
RTTI and other data that they contain. So instead, only memset the first
part of the struct, and then manually initialize the other members.

Fixes #14217.
This commit is contained in:
Augustin Cavalier 2018-06-21 17:52:39 -04:00
parent 09c7b1526f
commit 9b83a2a043
1 changed files with 5 additions and 2 deletions

View File

@ -62,8 +62,11 @@ BJoystick::BJoystick()
sLogFile = fopen("/var/log/joystick.log", "a");
#endif
if (fJoystickInfo != NULL)
memset(fJoystickInfo, 0, sizeof(joystick_info));
if (fJoystickInfo != NULL) {
memset(&fJoystickInfo->module_info, 0, sizeof(joystick_module_info));
fJoystickInfo->calibration_enable = false;
fJoystickInfo->max_latency = 0;
}
RescanDevices();
}