Vitaliy Margolen : dinput: No need to copy default constant format. Use already defined static instead.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Dec 11 10:34:48 CST 2006


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

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Sun Dec 10 14:15:08 2006 -0700

dinput: No need to copy default constant format. Use already defined static instead.

---

 dlls/dinput/joystick_linuxinput.c |   21 ++-------------------
 1 files changed, 2 insertions(+), 19 deletions(-)

diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index c5a35a1..369c26d 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -136,7 +136,6 @@ struct JoystickImpl
 
 	int				joyfd;
 
-	LPDIDATAFORMAT			internal_df;
 	LPDIDATAFORMAT			df;
 	DataFormat			*transform;	/* wine to user format converter */
 	int				*offsets;	/* object offsets */
@@ -408,27 +407,13 @@ static JoystickImpl *alloc_device(REFGUI
     goto FAILED;
   CopyMemory(newDevice->df->rgodf,c_dfDIJoystick2.rgodf,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize);
 
-  /* no do the same for the internal df */
-  newDevice->internal_df = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwSize);
-  if (newDevice->internal_df == 0)
-    goto FAILED;
-  CopyMemory(newDevice->internal_df, &c_dfDIJoystick2, c_dfDIJoystick2.dwSize);
-
-  /* copy default objects */
-  newDevice->internal_df->rgodf = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize);
-  if (newDevice->internal_df->rgodf == 0)
-    goto FAILED;
-  CopyMemory(newDevice->internal_df->rgodf,c_dfDIJoystick2.rgodf,c_dfDIJoystick2.dwNumObjs*c_dfDIJoystick2.dwObjSize);
-
   /* create an offsets array */
   newDevice->offsets = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,c_dfDIJoystick2.dwNumObjs*sizeof(int));
   if (newDevice->offsets == 0)
     goto FAILED;
 
-  calculate_ids(newDevice->internal_df);
-
   /* create the default transform filter */
-  newDevice->transform = create_DataFormat(newDevice->internal_df, newDevice->df, newDevice->offsets);
+  newDevice->transform = create_DataFormat(&c_dfDIJoystick2, newDevice->df, newDevice->offsets);
   calculate_ids(newDevice->df);
 
   return newDevice;
@@ -436,8 +421,6 @@ static JoystickImpl *alloc_device(REFGUI
 FAILED:
   HeapFree(GetProcessHeap(),0,newDevice->df->rgodf);
   HeapFree(GetProcessHeap(),0,newDevice->df);
-  HeapFree(GetProcessHeap(),0,newDevice->internal_df->rgodf);
-  HeapFree(GetProcessHeap(),0,newDevice->internal_df);
   HeapFree(GetProcessHeap(),0,newDevice);
   return NULL;
 }
@@ -593,7 +576,7 @@ static HRESULT WINAPI JoystickAImpl_SetD
   }
   memcpy(This->df->rgodf,df->rgodf,df->dwNumObjs*df->dwObjSize);
 
-  This->transform = create_DataFormat(This->internal_df, This->df, This->offsets);
+  This->transform = create_DataFormat(&c_dfDIJoystick2, This->df, This->offsets);
   calculate_ids(This->df);
 
   return DI_OK;




More information about the wine-cvs mailing list