Vitaliy Margolen : dinput: Remove redundant parameter.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Dec 12 14:29:52 CST 2006


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

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Tue Dec 12 08:58:40 2006 -0700

dinput: Remove redundant parameter.

---

 dlls/dinput/device.c              |   38 +++++++++++++++++++-----------------
 dlls/dinput/device_private.h      |    2 +-
 dlls/dinput/joystick_linux.c      |    2 +-
 dlls/dinput/joystick_linuxinput.c |    2 +-
 dlls/dinput/keyboard.c            |    2 +-
 dlls/dinput/mouse.c               |    2 +-
 6 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/dlls/dinput/device.c b/dlls/dinput/device.c
index 269fc06..7586530 100644
--- a/dlls/dinput/device.c
+++ b/dlls/dinput/device.c
@@ -336,7 +336,7 @@ static void calculate_ids(LPDIDATAFORMAT
     }
 }
 
-HRESULT create_DataFormat(LPCDIDATAFORMAT wine_format, LPCDIDATAFORMAT asked_format, DataFormat *format)
+HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format)
 {
     DataTransform *dt;
     unsigned int i, j;
@@ -344,12 +344,13 @@ HRESULT create_DataFormat(LPCDIDATAFORMA
     int *done;
     int index = 0;
     DWORD next = 0;
-    
+
+    if (!format->wine_df) return DIERR_INVALIDPARAM;
     done = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, asked_format->dwNumObjs * sizeof(int));
     dt = HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
     if (!dt || !done) goto failed;
 
-    if (!(format->offsets = HeapAlloc(GetProcessHeap(), 0, wine_format->dwNumObjs * sizeof(int))))
+    if (!(format->offsets = HeapAlloc(GetProcessHeap(), 0, format->wine_df->dwNumObjs * sizeof(int))))
         goto failed;
 
     if (!(format->user_df = HeapAlloc(GetProcessHeap(), 0, asked_format->dwSize)))
@@ -362,7 +363,8 @@ HRESULT create_DataFormat(LPCDIDATAFORMA
 
     TRACE("Creating DataTransform :\n");
     
-    for (i = 0; i < wine_format->dwNumObjs; i++) {
+    for (i = 0; i < format->wine_df->dwNumObjs; i++)
+    {
         format->offsets[i] = -1;
 
 	for (j = 0; j < asked_format->dwNumObjs; j++) {
@@ -373,18 +375,18 @@ HRESULT create_DataFormat(LPCDIDATAFORMA
 		 * the GUID of the Wine object.
 		 */
 		((asked_format->rgodf[j].pguid == NULL) ||
-		 (wine_format->rgodf[i].pguid == NULL) ||
-		 (IsEqualGUID(wine_format->rgodf[i].pguid, asked_format->rgodf[j].pguid)))
+		 (format->wine_df->rgodf[i].pguid == NULL) ||
+		 (IsEqualGUID(format->wine_df->rgodf[i].pguid, asked_format->rgodf[j].pguid)))
 		&&
 		(/* Then check if it accepts any instance id, and if not, if it matches Wine's
 		  * instance id.
 		  */
 		 (DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == 0xFFFF) ||
 		 (DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == 0x00FF) || /* This is mentionned in no DX docs, but it works fine - tested on WinXP */
-		 (DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == DIDFT_GETINSTANCE(wine_format->rgodf[i].dwType)))
+		 (DIDFT_GETINSTANCE(asked_format->rgodf[j].dwType) == DIDFT_GETINSTANCE(format->wine_df->rgodf[i].dwType)))
 		&&
 		( /* Then if the asked type matches the one Wine provides */
-                 DIDFT_GETTYPE(asked_format->rgodf[j].dwType) & wine_format->rgodf[i].dwType))
+                 DIDFT_GETTYPE(asked_format->rgodf[j].dwType) & format->wine_df->rgodf[i].dwType))
             {
 		done[j] = 1;
 		
@@ -399,23 +401,23 @@ HRESULT create_DataFormat(LPCDIDATAFORMA
 		
 		TRACE("   - Wine  (%d) :\n", i);
 		TRACE("       * GUID: %s ('%s')\n",
-		      debugstr_guid(wine_format->rgodf[i].pguid),
-		      _dump_dinput_GUID(wine_format->rgodf[i].pguid));
-                TRACE("       * Offset: %3d\n", wine_format->rgodf[i].dwOfs);
-                TRACE("       * dwType: %08x\n", wine_format->rgodf[i].dwType);
-		TRACE("         "); _dump_EnumObjects_flags(wine_format->rgodf[i].dwType); TRACE("\n");
+                      debugstr_guid(format->wine_df->rgodf[i].pguid),
+                      _dump_dinput_GUID(format->wine_df->rgodf[i].pguid));
+                TRACE("       * Offset: %3d\n", format->wine_df->rgodf[i].dwOfs);
+                TRACE("       * dwType: %08x\n", format->wine_df->rgodf[i].dwType);
+                TRACE("         "); _dump_EnumObjects_flags(format->wine_df->rgodf[i].dwType); TRACE("\n");
 		
-		if (wine_format->rgodf[i].dwType & DIDFT_BUTTON)
+                if (format->wine_df->rgodf[i].dwType & DIDFT_BUTTON)
 		    dt[index].size = sizeof(BYTE);
 		else
 		    dt[index].size = sizeof(DWORD);
-		dt[index].offset_in = wine_format->rgodf[i].dwOfs;
+                dt[index].offset_in = format->wine_df->rgodf[i].dwOfs;
                 dt[index].offset_out = asked_format->rgodf[j].dwOfs;
                 format->offsets[i]   = asked_format->rgodf[j].dwOfs;
 		dt[index].value = 0;
                 next = next + dt[index].size;
 		
-		if (wine_format->rgodf[i].dwOfs != dt[index].offset_out)
+                if (format->wine_df->rgodf[i].dwOfs != dt[index].offset_out)
 		    same = 0;
 		
 		index++;
@@ -451,7 +453,7 @@ HRESULT create_DataFormat(LPCDIDATAFORMA
 	}
     }
     
-    format->internal_format_size = wine_format->dwDataSize;
+    format->internal_format_size = format->wine_df->dwDataSize;
     format->size = index;
     if (same) {
 	HeapFree(GetProcessHeap(), 0, dt);
@@ -635,7 +637,7 @@ HRESULT WINAPI IDirectInputDevice2AImpl_
     EnterCriticalSection(&This->crit);
 
     release_DataFormat(&This->data_format);
-    res = create_DataFormat(This->data_format.wine_df, df, &This->data_format);
+    res = create_DataFormat(df, &This->data_format);
 
     LeaveCriticalSection(&This->crit);
     return res;
diff --git a/dlls/dinput/device_private.h b/dlls/dinput/device_private.h
index eb6aa8e..e35c9f4 100644
--- a/dlls/dinput/device_private.h
+++ b/dlls/dinput/device_private.h
@@ -69,7 +69,7 @@ struct IDirectInputDevice2AImpl
 
 /* Routines to do DataFormat / WineFormat conversions */
 extern void fill_DataFormat(void *out, const void *in, DataFormat *df) ;
-extern HRESULT create_DataFormat(LPCDIDATAFORMAT wine_format, LPCDIDATAFORMAT asked_format, DataFormat *format);
+extern HRESULT create_DataFormat(LPCDIDATAFORMAT asked_format, DataFormat *format);
 extern void release_DataFormat(DataFormat *df) ;
 extern void queue_event(LPDIRECTINPUTDEVICE8A iface, int ofs, DWORD data, DWORD time, DWORD seq);
 /* Helper functions to work with data format */
diff --git a/dlls/dinput/joystick_linux.c b/dlls/dinput/joystick_linux.c
index 7f80f72..745fd5c 100644
--- a/dlls/dinput/joystick_linux.c
+++ b/dlls/dinput/joystick_linux.c
@@ -481,7 +481,7 @@ static HRESULT alloc_device(REFGUID rgui
     newDevice->base.data_format.wine_df = &c_dfDIJoystick2;
 
     /* create the default transform filter */
-    hr = create_DataFormat(&c_dfDIJoystick2, &c_dfDIJoystick2, &newDevice->base.data_format);
+    hr = create_DataFormat(&c_dfDIJoystick2, &newDevice->base.data_format);
     if (hr != DI_OK) goto FAILED;
 
     IDirectInputDevice_AddRef((LPDIRECTINPUTDEVICE8A)newDevice->dinput);
diff --git a/dlls/dinput/joystick_linuxinput.c b/dlls/dinput/joystick_linuxinput.c
index c1ce5ab..82b8d07 100644
--- a/dlls/dinput/joystick_linuxinput.c
+++ b/dlls/dinput/joystick_linuxinput.c
@@ -392,7 +392,7 @@ static JoystickImpl *alloc_device(REFGUI
   newDevice->base.data_format.wine_df = &c_dfDIJoystick2;
 
   /* create the default transform filter */
-  if (create_DataFormat(&c_dfDIJoystick2, &c_dfDIJoystick2, &newDevice->base.data_format) == DI_OK)
+  if (create_DataFormat(&c_dfDIJoystick2, &newDevice->base.data_format) == DI_OK)
     return newDevice;
 
   HeapFree(GetProcessHeap(),0,newDevice);
diff --git a/dlls/dinput/keyboard.c b/dlls/dinput/keyboard.c
index dd19f35..cbf06ab 100644
--- a/dlls/dinput/keyboard.c
+++ b/dlls/dinput/keyboard.c
@@ -197,7 +197,7 @@ static SysKeyboardImpl *alloc_device(REF
     InitializeCriticalSection(&newDevice->base.crit);
 
     newDevice->base.data_format.wine_df = &c_dfDIKeyboard;
-    if (create_DataFormat(&c_dfDIKeyboard, &c_dfDIKeyboard, &newDevice->base.data_format) == DI_OK)
+    if (create_DataFormat(&c_dfDIKeyboard, &newDevice->base.data_format) == DI_OK)
         return newDevice;
     return NULL;
 }
diff --git a/dlls/dinput/mouse.c b/dlls/dinput/mouse.c
index 2a2c394..2707121 100644
--- a/dlls/dinput/mouse.c
+++ b/dlls/dinput/mouse.c
@@ -237,7 +237,7 @@ static SysMouseImpl *alloc_device(REFGUI
     newDevice->dinput = dinput;
 
     newDevice->base.data_format.wine_df = &Wine_InternalMouseFormat;
-    if (create_DataFormat(&Wine_InternalMouseFormat, &Wine_InternalMouseFormat, &newDevice->base.data_format) == DI_OK)
+    if (create_DataFormat(&Wine_InternalMouseFormat, &newDevice->base.data_format) == DI_OK)
         return newDevice;
 
     return NULL;




More information about the wine-cvs mailing list