Vitaliy Margolen : dinput: [joystick_linux] Reuse the same properties
array .
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Jan 11 05:34:03 CST 2007
Module: wine
Branch: master
Commit: 60948ab1f07127431bc9a02f54736ecffaa4e686
URL: http://source.winehq.org/git/wine.git/?a=commit;h=60948ab1f07127431bc9a02f54736ecffaa4e686
Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date: Tue Jan 9 13:43:59 2007 -0700
dinput: [joystick_linux] Reuse the same properties array.
---
dlls/dinput/joystick_linux.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index e4a891d..c297f70 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -654,7 +654,6 @@ static HRESULT WINAPI JoystickAImpl_SetD
{
JoystickImpl *This = (JoystickImpl *)iface;
unsigned int i;
- ObjProps * new_props = 0;
HRESULT hr;
TRACE("(%p,%p)\n",This,df);
@@ -662,13 +661,8 @@ static HRESULT WINAPI JoystickAImpl_SetD
hr = IDirectInputDevice2AImpl_SetDataFormat(iface, df);
if (FAILED(hr)) return hr;
- new_props = HeapAlloc(GetProcessHeap(),0,df->dwNumObjs*sizeof(ObjProps));
- if (!new_props) return DIERR_OUTOFMEMORY;
-
- HeapFree(GetProcessHeap(),0,This->props);
-
- This->props = new_props;
- for (i = 0; i < df->dwNumObjs; i++) {
+ for (i = 0; i < This->base.data_format.wine_df->dwNumObjs; i++)
+ {
This->props[i].lMin = 0;
This->props[i].lMax = 0xffff;
This->props[i].lDeadZone = 1000;
@@ -925,10 +919,10 @@ static HRESULT WINAPI JoystickAImpl_SetP
if (!HIWORD(rguid)) {
switch (LOWORD(rguid)) {
case (DWORD)DIPROP_RANGE: {
- LPCDIPROPRANGE pr = (LPCDIPROPRANGE)ph;
+ LPCDIPROPRANGE pr = (LPCDIPROPRANGE)ph;
if (ph->dwHow == DIPH_DEVICE) {
TRACE("proprange(%d,%d) all\n", pr->lMin, pr->lMax);
- for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++) {
+ for (i = 0; i < This->base.data_format.wine_df->dwNumObjs; i++) {
This->props[i].lMin = pr->lMin;
This->props[i].lMax = pr->lMax;
}
@@ -945,10 +939,10 @@ static HRESULT WINAPI JoystickAImpl_SetP
break;
}
case (DWORD)DIPROP_DEADZONE: {
- LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
+ LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
if (ph->dwHow == DIPH_DEVICE) {
TRACE("deadzone(%d) all\n", pd->dwData);
- for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++)
+ for (i = 0; i < This->base.data_format.wine_df->dwNumObjs; i++)
This->props[i].lDeadZone = pd->dwData;
} else {
int obj = find_property(&This->base.data_format, ph);
@@ -962,10 +956,10 @@ static HRESULT WINAPI JoystickAImpl_SetP
break;
}
case (DWORD)DIPROP_SATURATION: {
- LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
+ LPCDIPROPDWORD pd = (LPCDIPROPDWORD)ph;
if (ph->dwHow == DIPH_DEVICE) {
TRACE("saturation(%d) all\n", pd->dwData);
- for (i = 0; i < This->base.data_format.user_df->dwNumObjs; i++)
+ for (i = 0; i < This->base.data_format.wine_df->dwNumObjs; i++)
This->props[i].lSaturation = pd->dwData;
} else {
int obj = find_property(&This->base.data_format, ph);
More information about the wine-cvs
mailing list