mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-03 16:36:25 +00:00
re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory
This commit is contained in:
@@ -309,8 +309,7 @@ HIDAPI_JoystickInit(void)
|
||||
#endif
|
||||
|
||||
if (SDL_hid_init() < 0) {
|
||||
SDL_SetError("Couldn't initialize hidapi");
|
||||
return -1;
|
||||
return SDL_SetError("Couldn't initialize hidapi");
|
||||
}
|
||||
|
||||
for (i = 0; i < SDL_arraysize(SDL_HIDAPI_drivers); ++i) {
|
||||
@@ -871,8 +870,7 @@ HIDAPI_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint1
|
||||
|
||||
result = device->driver->RumbleJoystick(device, joystick, low_frequency_rumble, high_frequency_rumble);
|
||||
} else {
|
||||
SDL_SetError("Rumble failed, device disconnected");
|
||||
result = -1;
|
||||
result = SDL_SetError("Rumble failed, device disconnected");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -888,8 +886,7 @@ HIDAPI_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16
|
||||
|
||||
result = device->driver->RumbleJoystickTriggers(device, joystick, left_rumble, right_rumble);
|
||||
} else {
|
||||
SDL_SetError("Rumble failed, device disconnected");
|
||||
result = -1;
|
||||
result = SDL_SetError("Rumble failed, device disconnected");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -919,8 +916,7 @@ HIDAPI_JoystickSetLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue
|
||||
|
||||
result = device->driver->SetJoystickLED(device, joystick, red, green, blue);
|
||||
} else {
|
||||
SDL_SetError("SetLED failed, device disconnected");
|
||||
result = -1;
|
||||
result = SDL_SetError("SetLED failed, device disconnected");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -936,8 +932,7 @@ HIDAPI_JoystickSendEffect(SDL_Joystick *joystick, const void *data, int size)
|
||||
|
||||
result = device->driver->SendJoystickEffect(device, joystick, data, size);
|
||||
} else {
|
||||
SDL_SetError("SendEffect failed, device disconnected");
|
||||
result = -1;
|
||||
result = SDL_SetError("SendEffect failed, device disconnected");
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -953,8 +948,7 @@ HIDAPI_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled)
|
||||
|
||||
result = device->driver->SetJoystickSensorsEnabled(device, joystick, enabled);
|
||||
} else {
|
||||
SDL_SetError("SetSensorsEnabled failed, device disconnected");
|
||||
result = -1;
|
||||
result = SDL_SetError("SetSensorsEnabled failed, device disconnected");
|
||||
}
|
||||
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user