Paul Vriens wrote:
> Vitaliy Margolen wrote:
>> Fixes bug 9439.
>> ---
>> dlls/dinput/joystick_linux.c | 7 ++++---
>> 1 files changed, 4 insertions(+), 3 deletions(-)
>>
>>
>> ------------------------------------------------------------------------
>>
>>
> Hi Vitaliy,
>
> doesn't this patch leave it 0-based?
>
> 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;
> }
>
> AFAIK this doesn't change anything. Before it was:
>
> joystick_devices_count = -1
> ++joystick_devices_count -> 0 (for the first entry)
>
> now:
>
> joystick_devices_count = 0
> joystick_devices_count++ -> 0 (for the first entry)
>
I didn't say "index", I said "count" <g>. Count should never be "0-based" as
in "0" means "count of one". Index should be 0-based, as in "0" means first.
If the count is -1 then it haven't been initialized yet. If it's 0, then
there are no devices found. 1+ one or more devices have been found.
Where it does mater is in joydev_create_device[A|W], where I assumed that
count was 1 based.
Vitaliy.