Fixed warning C4245: 'return': conversion from 'int' to 'SDL_JoystickID', signed/unsigned mismatch

This commit is contained in:
Sam Lantinga 2023-12-29 09:25:57 -08:00
parent dce626f469
commit e813c72b3c
1 changed files with 4 additions and 4 deletions

View File

@ -125,7 +125,7 @@ SDL_JoystickID SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *des
hwdata = SDL_calloc(1, sizeof(joystick_hwdata));
if (!hwdata) {
VIRTUAL_FreeHWData(hwdata);
return -1;
return 0;
}
SDL_memcpy(&hwdata->desc, desc, sizeof(*desc));
@ -210,7 +210,7 @@ SDL_JoystickID SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *des
hwdata->axes = SDL_calloc(hwdata->desc.naxes, sizeof(Sint16));
if (!hwdata->axes) {
VIRTUAL_FreeHWData(hwdata);
return -1;
return 0;
}
/* Trigger axes are at minimum value at rest */
@ -225,14 +225,14 @@ SDL_JoystickID SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *des
hwdata->buttons = SDL_calloc(hwdata->desc.nbuttons, sizeof(Uint8));
if (!hwdata->buttons) {
VIRTUAL_FreeHWData(hwdata);
return -1;
return 0;
}
}
if (hwdata->desc.nhats > 0) {
hwdata->hats = SDL_calloc(hwdata->desc.nhats, sizeof(Uint8));
if (!hwdata->hats) {
VIRTUAL_FreeHWData(hwdata);
return -1;
return 0;
}
}