Vitaliy Margolen : dinput: COM cleanup - use helper function instead of direct typecast in OS/ X joystick.

Alexandre Julliard julliard at winehq.org
Mon Jan 10 10:55:20 CST 2011


Module: wine
Branch: master
Commit: 399be3455aefb714864f3f519642df4049f287ac
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=399be3455aefb714864f3f519642df4049f287ac

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Sun Jan  9 15:43:48 2011 -0700

dinput: COM cleanup - use helper function instead of direct typecast in OS/X joystick.

---

 dlls/dinput/joystick_osx.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

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 @@ struct JoystickImpl
     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 get_osx_device_elements_props(JoystickImpl *device)
 
 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;




More information about the wine-cvs mailing list