Michael Stefaniuc : dinput: Remove superfluous pointer casts.

Alexandre Julliard julliard at winehq.org
Wed Jan 28 08:03:10 CST 2009


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Wed Jan 28 10:24:42 2009 +0100

dinput: Remove superfluous pointer casts.

---

 dlls/dinput/device.c            |    2 +-
 dlls/dinput/dinput_main.c       |    2 +-
 dlls/dinput/effect_linuxinput.c |   20 ++++++++++----------
 dlls/dinput/tests/device.c      |    2 +-
 dlls/dinput/tests/joystick.c    |    8 ++++----
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 8e226cc..941206c 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -269,7 +269,7 @@ void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df
 {
     int i;
     const char *in_c = in;
-    char *out_c = (char *) out;
+    char *out_c = out;
 
     memset(out, 0, size);
     if (df->dt == NULL) {
diff --git a/dlls/dinput/dinput_main.c b/dlls/dinput/dinput_main.c
index 6c2a9ed..46e4e28 100644
--- a/dlls/dinput/dinput_main.c
+++ b/dlls/dinput/dinput_main.c
@@ -869,7 +869,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 {
     TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
     if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
-    	*ppv = (LPVOID)&DINPUT_CF;
+        *ppv = &DINPUT_CF;
 	IClassFactory_AddRef((IClassFactory*)*ppv);
     return S_OK;
     }
diff --git a/dlls/dinput/effect_linuxinput.c b/dlls/dinput/effect_linuxinput.c
index 2854b34..155d800 100644
--- a/dlls/dinput/effect_linuxinput.c
+++ b/dlls/dinput/effect_linuxinput.c
@@ -423,19 +423,19 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetParameters(
 	    return diErr;
 	else {
 	    if (This->effect.type == FF_PERIODIC) {
-                LPDIPERIODIC tsp = (LPDIPERIODIC)(peff->lpvTypeSpecificParams);
+                LPDIPERIODIC tsp = peff->lpvTypeSpecificParams;
 		tsp->dwMagnitude = (This->effect.u.periodic.magnitude / 33) * 10;
 		tsp->lOffset = (This->effect.u.periodic.offset / 33) * 10;
 		tsp->dwPhase = (This->effect.u.periodic.phase / 33) * 36;
 		tsp->dwPeriod = (This->effect.u.periodic.period * 1000);
 	    } else if (This->effect.type == FF_CONSTANT) {
-                LPDICONSTANTFORCE tsp = (LPDICONSTANTFORCE)(peff->lpvTypeSpecificParams);
+                LPDICONSTANTFORCE tsp = peff->lpvTypeSpecificParams;
 		tsp->lMagnitude = (This->effect.u.constant.level / 33) * 10;
 	    } else if (This->effect.type == FF_SPRING 
 		    || This->effect.type == FF_FRICTION 
 		    || This->effect.type == FF_INERTIA 
 		    || This->effect.type == FF_DAMPER) {
-                LPDICONDITION tsp = (LPDICONDITION)(peff->lpvTypeSpecificParams);
+                LPDICONDITION tsp = peff->lpvTypeSpecificParams;
 		int i;
 		for (i = 0; i < 2; ++i) {
 		    tsp[i].lOffset = (This->effect.u.condition[i].center / 33) * 10; 
@@ -446,7 +446,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetParameters(
 		    tsp[i].lDeadBand = (This->effect.u.condition[i].deadband / 33) * 10;
 		}
 	    } else if (This->effect.type == FF_RAMP) {
-                LPDIRAMPFORCE tsp = (LPDIRAMPFORCE)(peff->lpvTypeSpecificParams);
+                LPDIRAMPFORCE tsp = peff->lpvTypeSpecificParams;
 		tsp->lStart = (This->effect.u.ramp.start_level / 33) * 10;
 		tsp->lEnd = (This->effect.u.ramp.end_level / 33) * 10;
 	    }
@@ -654,7 +654,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
             LPCDIPERIODIC tsp;
             if (peff->cbTypeSpecificParams != sizeof(DIPERIODIC))
                 return DIERR_INVALIDPARAM;
-            tsp = (LPCDIPERIODIC)(peff->lpvTypeSpecificParams);
+            tsp = peff->lpvTypeSpecificParams;
 	    This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32;
 	    This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32;
 	    This->effect.u.periodic.phase = (tsp->dwPhase / 9) * 8; /* == (/ 36 * 32) */
@@ -663,17 +663,17 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
             LPCDICONSTANTFORCE tsp;
             if (peff->cbTypeSpecificParams != sizeof(DICONSTANTFORCE))
                 return DIERR_INVALIDPARAM;
-            tsp = (LPCDICONSTANTFORCE)(peff->lpvTypeSpecificParams);
+            tsp = peff->lpvTypeSpecificParams;
 	    This->effect.u.constant.level = (max(min(tsp->lMagnitude, 10000), -10000) / 10) * 32;
 	} else if (type == DIEFT_RAMPFORCE) {
             LPCDIRAMPFORCE tsp;
             if (peff->cbTypeSpecificParams != sizeof(DIRAMPFORCE))
                 return DIERR_INVALIDPARAM;
-            tsp = (LPCDIRAMPFORCE)(peff->lpvTypeSpecificParams);
+            tsp = peff->lpvTypeSpecificParams;
 	    This->effect.u.ramp.start_level = (tsp->lStart / 10) * 32;
 	    This->effect.u.ramp.end_level = (tsp->lStart / 10) * 32;
 	} else if (type == DIEFT_CONDITION) {
-            LPCDICONDITION tsp = (LPCDICONDITION)(peff->lpvTypeSpecificParams);
+            LPCDICONDITION tsp = peff->lpvTypeSpecificParams;
             if (peff->cbTypeSpecificParams == sizeof(DICONDITION)) {
 		/* One condition block.  This needs to be rotated to direction,
 		 * and expanded to separate x and y conditions. */
@@ -879,7 +879,7 @@ HRESULT linuxinput_get_info_A(
     info->dwDynamicParams = info->dwStaticParams;
 
     /* yes, this is windows behavior (print the GUID_Name for name) */
-    strcpy((char*)info->tszName, _dump_dinput_GUID(rguid));
+    strcpy(info->tszName, _dump_dinput_GUID(rguid));
 
     return DI_OK;
 }
@@ -914,7 +914,7 @@ HRESULT linuxinput_get_info_W(
 
     /* yes, this is windows behavior (print the GUID_Name for name) */
     MultiByteToWideChar(CP_ACP, 0, _dump_dinput_GUID(rguid), -1, 
-		        (WCHAR*)info->tszName, MAX_PATH);
+                        info->tszName, MAX_PATH);
 
     return DI_OK;
 }
diff --git a/dlls/dinput/tests/device.c b/dlls/dinput/tests/device.c
index e59d8c3..83c18f1 100644
--- a/dlls/dinput/tests/device.c
+++ b/dlls/dinput/tests/device.c
@@ -120,7 +120,7 @@ struct enum_data
 
 static BOOL CALLBACK enum_devices(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
 {
-    struct enum_data *data = (struct enum_data*)pvRef;
+    struct enum_data *data = pvRef;
     LPDIRECTINPUTDEVICE device;
     HRESULT hr;
 
diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c
index 789317e..371f7ee 100644
--- a/dlls/dinput/tests/joystick.c
+++ b/dlls/dinput/tests/joystick.c
@@ -96,7 +96,7 @@ static BOOL CALLBACK EnumAxes(
     VOID* pContext)
 {
     HRESULT hr;
-    JoystickInfo * info = (JoystickInfo *)pContext;
+    JoystickInfo * info = pContext;
 
     if (IsEqualIID(&pdidoi->guidType, &GUID_XAxis) ||
         IsEqualIID(&pdidoi->guidType, &GUID_YAxis) ||
@@ -171,7 +171,7 @@ static BOOL CALLBACK EnumJoysticks(
     LPVOID pvRef)
 {
     HRESULT hr;
-    UserData * data = (UserData *)pvRef;
+    UserData * data = pvRef;
     LPDIRECTINPUTDEVICE pJoystick;
     DIDATAFORMAT format;
     DIDEVCAPS caps;
@@ -267,7 +267,7 @@ static BOOL CALLBACK EnumJoysticks(
     info.lMin = 0;
     info.lMax = 0xffff;
     /* enumerate objects */
-    hr = IDirectInputDevice_EnumObjects(pJoystick, EnumAxes, (VOID*)&info, DIDFT_ALL);
+    hr = IDirectInputDevice_EnumObjects(pJoystick, EnumAxes, &info, DIDFT_ALL);
     ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %08x\n", hr);
 
     ok(caps.dwAxes == info.axis, "Number of enumerated axes (%d) doesn't match capabilities (%d)\n", info.axis, caps.dwAxes);
@@ -280,7 +280,7 @@ static BOOL CALLBACK EnumJoysticks(
     info.lMin = -2000;
     info.lMax = +2000;
     info.dZone= 123;
-    hr = IDirectInputDevice_EnumObjects(pJoystick, EnumAxes, (VOID*)&info, DIDFT_ALL);
+    hr = IDirectInputDevice_EnumObjects(pJoystick, EnumAxes, &info, DIDFT_ALL);
     ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %08x\n", hr);
 
     hr = IDirectInputDevice_GetDeviceInfo(pJoystick, 0);




More information about the wine-cvs mailing list