Vitaliy Margolen : dinput: Count should not be 0-based.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Aug 27 06:07:41 CDT 2007
Module: wine
Branch: master
Commit: c6784cdad329c61264bfdfb0c0848077107ee1d7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c6784cdad329c61264bfdfb0c0848077107ee1d7
Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date: Sat Aug 25 10:44:22 2007 -0600
dinput: Count should not be 0-based.
---
dlls/dinput/joystick_linux.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index ef5b9f3..e15e32e 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -138,6 +138,7 @@ static INT find_joystick_devices(void)
if (joystick_devices_count != -1) return joystick_devices_count;
+ joystick_devices_count = 0;
for (i = 0; i < MAX_JOYSTICKS; i++)
{
CHAR device_name[MAX_PATH], *str;
@@ -154,7 +155,7 @@ static INT find_joystick_devices(void)
if (!(str = HeapAlloc(GetProcessHeap(), 0, len))) break;
memcpy(str, device_name, len);
- joystick_devices[++joystick_devices_count] = str;
+ joystick_devices[joystick_devices_count++] = str;
}
return joystick_devices_count;
@@ -164,7 +165,7 @@ static BOOL joydev_enum_deviceA(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
{
int fd = -1;
- if (id > find_joystick_devices()) return FALSE;
+ if (id >= find_joystick_devices()) return FALSE;
if (dwFlags & DIEDFL_FORCEFEEDBACK) {
WARN("force feedback not supported\n");
@@ -215,7 +216,7 @@ static BOOL joydev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTAN
char name[MAX_PATH];
char friendly[32];
- if (id > find_joystick_devices()) return FALSE;
+ if (id >= find_joystick_devices()) return FALSE;
if (dwFlags & DIEDFL_FORCEFEEDBACK) {
WARN("force feedback not supported\n");
More information about the wine-cvs
mailing list