dinput: Remove superfluous pointer casts.

This commit is contained in:
Michael Stefaniuc 2009-01-28 10:24:42 +01:00 committed by Alexandre Julliard
parent 7111ca5506
commit c0d2a21dd1
5 changed files with 17 additions and 17 deletions

View File

@ -269,7 +269,7 @@ void fill_DataFormat(void *out, DWORD size, const void *in, const DataFormat *df
{ {
int i; int i;
const char *in_c = in; const char *in_c = in;
char *out_c = (char *) out; char *out_c = out;
memset(out, 0, size); memset(out, 0, size);
if (df->dt == NULL) { if (df->dt == NULL) {

View File

@ -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); TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) { if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) {
*ppv = (LPVOID)&DINPUT_CF; *ppv = &DINPUT_CF;
IClassFactory_AddRef((IClassFactory*)*ppv); IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK; return S_OK;
} }

View File

@ -423,19 +423,19 @@ static HRESULT WINAPI LinuxInputEffectImpl_GetParameters(
return diErr; return diErr;
else { else {
if (This->effect.type == FF_PERIODIC) { 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->dwMagnitude = (This->effect.u.periodic.magnitude / 33) * 10;
tsp->lOffset = (This->effect.u.periodic.offset / 33) * 10; tsp->lOffset = (This->effect.u.periodic.offset / 33) * 10;
tsp->dwPhase = (This->effect.u.periodic.phase / 33) * 36; tsp->dwPhase = (This->effect.u.periodic.phase / 33) * 36;
tsp->dwPeriod = (This->effect.u.periodic.period * 1000); tsp->dwPeriod = (This->effect.u.periodic.period * 1000);
} else if (This->effect.type == FF_CONSTANT) { } 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; tsp->lMagnitude = (This->effect.u.constant.level / 33) * 10;
} else if (This->effect.type == FF_SPRING } else if (This->effect.type == FF_SPRING
|| This->effect.type == FF_FRICTION || This->effect.type == FF_FRICTION
|| This->effect.type == FF_INERTIA || This->effect.type == FF_INERTIA
|| This->effect.type == FF_DAMPER) { || This->effect.type == FF_DAMPER) {
LPDICONDITION tsp = (LPDICONDITION)(peff->lpvTypeSpecificParams); LPDICONDITION tsp = peff->lpvTypeSpecificParams;
int i; int i;
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
tsp[i].lOffset = (This->effect.u.condition[i].center / 33) * 10; 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; tsp[i].lDeadBand = (This->effect.u.condition[i].deadband / 33) * 10;
} }
} else if (This->effect.type == FF_RAMP) { } 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->lStart = (This->effect.u.ramp.start_level / 33) * 10;
tsp->lEnd = (This->effect.u.ramp.end_level / 33) * 10; tsp->lEnd = (This->effect.u.ramp.end_level / 33) * 10;
} }
@ -654,7 +654,7 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
LPCDIPERIODIC tsp; LPCDIPERIODIC tsp;
if (peff->cbTypeSpecificParams != sizeof(DIPERIODIC)) if (peff->cbTypeSpecificParams != sizeof(DIPERIODIC))
return DIERR_INVALIDPARAM; return DIERR_INVALIDPARAM;
tsp = (LPCDIPERIODIC)(peff->lpvTypeSpecificParams); tsp = peff->lpvTypeSpecificParams;
This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32; This->effect.u.periodic.magnitude = (tsp->dwMagnitude / 10) * 32;
This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32; This->effect.u.periodic.offset = (tsp->lOffset / 10) * 32;
This->effect.u.periodic.phase = (tsp->dwPhase / 9) * 8; /* == (/ 36 * 32) */ This->effect.u.periodic.phase = (tsp->dwPhase / 9) * 8; /* == (/ 36 * 32) */
@ -663,17 +663,17 @@ static HRESULT WINAPI LinuxInputEffectImpl_SetParameters(
LPCDICONSTANTFORCE tsp; LPCDICONSTANTFORCE tsp;
if (peff->cbTypeSpecificParams != sizeof(DICONSTANTFORCE)) if (peff->cbTypeSpecificParams != sizeof(DICONSTANTFORCE))
return DIERR_INVALIDPARAM; return DIERR_INVALIDPARAM;
tsp = (LPCDICONSTANTFORCE)(peff->lpvTypeSpecificParams); tsp = peff->lpvTypeSpecificParams;
This->effect.u.constant.level = (max(min(tsp->lMagnitude, 10000), -10000) / 10) * 32; This->effect.u.constant.level = (max(min(tsp->lMagnitude, 10000), -10000) / 10) * 32;
} else if (type == DIEFT_RAMPFORCE) { } else if (type == DIEFT_RAMPFORCE) {
LPCDIRAMPFORCE tsp; LPCDIRAMPFORCE tsp;
if (peff->cbTypeSpecificParams != sizeof(DIRAMPFORCE)) if (peff->cbTypeSpecificParams != sizeof(DIRAMPFORCE))
return DIERR_INVALIDPARAM; return DIERR_INVALIDPARAM;
tsp = (LPCDIRAMPFORCE)(peff->lpvTypeSpecificParams); tsp = peff->lpvTypeSpecificParams;
This->effect.u.ramp.start_level = (tsp->lStart / 10) * 32; This->effect.u.ramp.start_level = (tsp->lStart / 10) * 32;
This->effect.u.ramp.end_level = (tsp->lStart / 10) * 32; This->effect.u.ramp.end_level = (tsp->lStart / 10) * 32;
} else if (type == DIEFT_CONDITION) { } else if (type == DIEFT_CONDITION) {
LPCDICONDITION tsp = (LPCDICONDITION)(peff->lpvTypeSpecificParams); LPCDICONDITION tsp = peff->lpvTypeSpecificParams;
if (peff->cbTypeSpecificParams == sizeof(DICONDITION)) { if (peff->cbTypeSpecificParams == sizeof(DICONDITION)) {
/* One condition block. This needs to be rotated to direction, /* One condition block. This needs to be rotated to direction,
* and expanded to separate x and y conditions. */ * and expanded to separate x and y conditions. */
@ -879,7 +879,7 @@ HRESULT linuxinput_get_info_A(
info->dwDynamicParams = info->dwStaticParams; info->dwDynamicParams = info->dwStaticParams;
/* yes, this is windows behavior (print the GUID_Name for name) */ /* 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; return DI_OK;
} }
@ -914,7 +914,7 @@ HRESULT linuxinput_get_info_W(
/* yes, this is windows behavior (print the GUID_Name for name) */ /* yes, this is windows behavior (print the GUID_Name for name) */
MultiByteToWideChar(CP_ACP, 0, _dump_dinput_GUID(rguid), -1, MultiByteToWideChar(CP_ACP, 0, _dump_dinput_GUID(rguid), -1,
(WCHAR*)info->tszName, MAX_PATH); info->tszName, MAX_PATH);
return DI_OK; return DI_OK;
} }

View File

@ -120,7 +120,7 @@ struct enum_data
static BOOL CALLBACK enum_devices(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef) static BOOL CALLBACK enum_devices(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRef)
{ {
struct enum_data *data = (struct enum_data*)pvRef; struct enum_data *data = pvRef;
LPDIRECTINPUTDEVICE device; LPDIRECTINPUTDEVICE device;
HRESULT hr; HRESULT hr;

View File

@ -96,7 +96,7 @@ static BOOL CALLBACK EnumAxes(
VOID* pContext) VOID* pContext)
{ {
HRESULT hr; HRESULT hr;
JoystickInfo * info = (JoystickInfo *)pContext; JoystickInfo * info = pContext;
if (IsEqualIID(&pdidoi->guidType, &GUID_XAxis) || if (IsEqualIID(&pdidoi->guidType, &GUID_XAxis) ||
IsEqualIID(&pdidoi->guidType, &GUID_YAxis) || IsEqualIID(&pdidoi->guidType, &GUID_YAxis) ||
@ -171,7 +171,7 @@ static BOOL CALLBACK EnumJoysticks(
LPVOID pvRef) LPVOID pvRef)
{ {
HRESULT hr; HRESULT hr;
UserData * data = (UserData *)pvRef; UserData * data = pvRef;
LPDIRECTINPUTDEVICE pJoystick; LPDIRECTINPUTDEVICE pJoystick;
DIDATAFORMAT format; DIDATAFORMAT format;
DIDEVCAPS caps; DIDEVCAPS caps;
@ -267,7 +267,7 @@ static BOOL CALLBACK EnumJoysticks(
info.lMin = 0; info.lMin = 0;
info.lMax = 0xffff; info.lMax = 0xffff;
/* enumerate objects */ /* 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(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); 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.lMin = -2000;
info.lMax = +2000; info.lMax = +2000;
info.dZone= 123; 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); ok(hr==DI_OK,"IDirectInputDevice_EnumObjects() failed: %08x\n", hr);
hr = IDirectInputDevice_GetDeviceInfo(pJoystick, 0); hr = IDirectInputDevice_GetDeviceInfo(pJoystick, 0);