[PATCH v2] winejoystick.drv: Gracefully handle polling an unplugged device
Ken Thomases
ken at codeweavers.com
Wed Mar 2 14:33:09 CST 2016
On Mar 2, 2016, at 1:46 PM, Aric Stewart <aric at codeweavers.com> wrote:
>
> v2: Use a Helper function instead of duplicated code
I should have caught this the first time, but:
> +static LRESULT driver_getElementValue(IOHIDDeviceRef device, IOHIDElementRef element, IOHIDValueRef *pValueRef)
> +{
> + IOReturn ret;
> + ret = IOHIDDeviceGetValue(device, element, pValueRef);
> + if (ret != kIOReturnSuccess)
> + {
> + switch (ret)
> + {
> + case kIOReturnNotAttached:
> + return JOYERR_UNPLUGGED;
> + default:
> + ERR("IOHIDDeviceGetValue returned 0x%x\n",ret);
> + return JOYERR_NOCANDO;
> + }
> + }
> + return JOYERR_NOERROR;
> +}
It's a bit strange to use an "if" based on ret and then a "switch" based on it, too. You could just use the switch, right?
-Ken
More information about the wine-devel
mailing list