Vitaliy Margolen : dinput: Make props array a part of the generic joystick struct.
Alexandre Julliard
julliard at winehq.org
Mon Apr 20 11:33:08 CDT 2009
Module: wine
Branch: master
Commit: 3223798d30d7ff81b57ec3a598ab7270be87c599
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3223798d30d7ff81b57ec3a598ab7270be87c599
Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date: Sun Apr 19 20:33:27 2009 -0600
dinput: Make props array a part of the generic joystick struct.
It's much easier to free it on release.
---
dlls/dinput/joystick_linux.c | 6 ------
dlls/dinput/joystick_osx.c | 6 ------
dlls/dinput/joystick_private.h | 4 +++-
3 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index c7facab..3a8487b 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -462,11 +462,6 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
}
newDevice->generic.base.data_format.wine_df = df;
- /* create default properties */
- newDevice->generic.props = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*sizeof(ObjProps));
- if (newDevice->generic.props == 0)
- goto FAILED;
-
/* initialize default properties */
for (i = 0; i < c_dfDIJoystick2.dwNumObjs; i++) {
newDevice->generic.props[i].lDevMin = -32767;
@@ -510,7 +505,6 @@ FAILED1:
release_DataFormat(&newDevice->generic.base.data_format);
HeapFree(GetProcessHeap(),0,newDevice->axis_map);
HeapFree(GetProcessHeap(),0,newDevice->generic.name);
- HeapFree(GetProcessHeap(),0,newDevice->generic.props);
HeapFree(GetProcessHeap(),0,newDevice);
*pdev = 0;
diff --git a/dlls/dinput/joystick_osx.c b/dlls/dinput/joystick_osx.c
index 1446b6e..8d7f209 100644
--- a/dlls/dinput/joystick_osx.c
+++ b/dlls/dinput/joystick_osx.c
@@ -724,11 +724,6 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
}
newDevice->generic.base.data_format.wine_df = df;
- /* create default properties */
- newDevice->generic.props = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*sizeof(ObjProps));
- if (newDevice->generic.props == 0)
- goto FAILED;
-
/* initialize default properties */
get_osx_device_elements_props(newDevice);
@@ -761,7 +756,6 @@ FAILED:
HeapFree(GetProcessHeap(), 0, df);
release_DataFormat(&newDevice->generic.base.data_format);
HeapFree(GetProcessHeap(),0,newDevice->generic.name);
- HeapFree(GetProcessHeap(),0,newDevice->generic.props);
HeapFree(GetProcessHeap(),0,newDevice);
*pdev = 0;
diff --git a/dlls/dinput/joystick_private.h b/dlls/dinput/joystick_private.h
index d1f1666..265c7f0 100644
--- a/dlls/dinput/joystick_private.h
+++ b/dlls/dinput/joystick_private.h
@@ -29,6 +29,8 @@
#include "dinput_private.h"
#include "device_private.h"
+/* Number of objects in the default data format */
+#define MAX_PROPS 164
struct JoystickGenericImpl;
typedef void joy_polldev_handler(struct JoystickGenericImpl *This);
@@ -37,7 +39,7 @@ typedef struct JoystickGenericImpl
{
struct IDirectInputDevice2AImpl base;
- ObjProps *props;
+ ObjProps props[MAX_PROPS];
DIDEVCAPS devcaps;
DIJOYSTATE2 js; /* wine data */
GUID guidProduct;
More information about the wine-cvs
mailing list