mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Fix zero-size calloc when enumerating a joystick with no hats in Windows.
git-svn-id: https://svn.eduke32.com/eduke32@2323 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
75436815c3
commit
dbada3c947
1 changed files with 4 additions and 2 deletions
|
@ -1155,10 +1155,12 @@ static BOOL InitDirectInput(void)
|
||||||
|
|
||||||
axisdefs = (struct _joydef *)Bcalloc(didc.dwAxes, sizeof(struct _joydef));
|
axisdefs = (struct _joydef *)Bcalloc(didc.dwAxes, sizeof(struct _joydef));
|
||||||
buttondefs = (struct _joydef *)Bcalloc(didc.dwButtons, sizeof(struct _joydef));
|
buttondefs = (struct _joydef *)Bcalloc(didc.dwButtons, sizeof(struct _joydef));
|
||||||
hatdefs = (struct _joydef *)Bcalloc(didc.dwPOVs, sizeof(struct _joydef));
|
if (didc.dwPOVs)
|
||||||
|
hatdefs = (struct _joydef *)Bcalloc(didc.dwPOVs, sizeof(struct _joydef));
|
||||||
|
|
||||||
joyaxis = (int32_t *)Bcalloc(didc.dwAxes, sizeof(int32_t));
|
joyaxis = (int32_t *)Bcalloc(didc.dwAxes, sizeof(int32_t));
|
||||||
joyhat = (int32_t *)Bcalloc(didc.dwPOVs, sizeof(int32_t));
|
if (didc.dwPOVs)
|
||||||
|
joyhat = (int32_t *)Bcalloc(didc.dwPOVs, sizeof(int32_t));
|
||||||
|
|
||||||
result = IDirectInputDevice7_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL);
|
result = IDirectInputDevice7_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL);
|
||||||
if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller features", result); }
|
if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller features", result); }
|
||||||
|
|
Loading…
Reference in a new issue