dinput: COM cleanup - use helper function instead of direct typecast in OS/X joystick.
diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c
index 7daccd4..dc15db8 100644
--- a/dlls/dinput/joystick_osx.c
+++ b/dlls/dinput/joystick_osx.c
@@ -135,6 +135,15 @@
     ObjProps               **propmap;
 };
 
+static inline JoystickImpl *impl_from_IDirectInputDevice8A(IDirectInputDevice8A *iface)
+{
+    return (JoystickImpl *) iface;
+}
+static inline JoystickImpl *impl_from_IDirectInputDevice8W(IDirectInputDevice8W *iface)
+{
+    return (JoystickImpl *) iface;
+}
+
 static const GUID DInput_Wine_OsX_Joystick_GUID = { /* 59CAD8F6-E617-41E2-8EB7-47B23EEEDC5A */
   0x59CAD8F6, 0xE617, 0x41E2, {0x8E, 0xB7, 0x47, 0xB2, 0x3E, 0xEE, 0xDC, 0x5A}
 };
@@ -519,7 +528,7 @@
 
 static void poll_osx_device_state(LPDIRECTINPUTDEVICE8A iface)
 {
-    JoystickImpl *device = (JoystickImpl*)iface;
+    JoystickImpl *device = impl_from_IDirectInputDevice8A(iface);
     IOHIDElementRef tIOHIDTopElementRef;
     IOHIDDeviceRef tIOHIDDeviceRef;
     CFArrayRef gElementCFArrayRef = device->elementCFArrayRef;