Michael Stefaniuc : dplayx: Merge the IDirectPlay4_DeleteGroupFromGroup helper.

Alexandre Julliard julliard at winehq.org
Tue Apr 2 13:38:35 CDT 2013


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Fri Mar 29 17:00:34 2013 +0100

dplayx: Merge the IDirectPlay4_DeleteGroupFromGroup helper.

---

 dlls/dplayx/dplay.c |   86 +++++++++++++++++++--------------------------------
 1 files changed, 32 insertions(+), 54 deletions(-)

diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c
index 2236532..8345833 100644
--- a/dlls/dplayx/dplay.c
+++ b/dlls/dplayx/dplay.c
@@ -109,8 +109,6 @@ static HRESULT DP_IF_CreateGroupInGroup
 static HRESULT DP_IF_AddPlayerToGroup
           ( IDirectPlay2Impl* This, LPVOID lpMsgHdr, DPID idGroup,
             DPID idPlayer, BOOL bAnsi );
-static HRESULT DP_IF_DeleteGroupFromGroup
-          ( IDirectPlay3Impl* This, DPID idParentGroup, DPID idGroup );
 static HRESULT DP_SetSessionDesc
           ( IDirectPlay2Impl* This, LPCDPSESSIONDESC2 lpSessDesc,
             DWORD dwFlags, BOOL bInitial, BOOL bAnsi  );
@@ -1500,14 +1498,9 @@ cbRemoveGroupOrPlayer(
 
   if( dwPlayerType == DPPLAYERTYPE_GROUP )
   {
-    if( FAILED( DP_IF_DeleteGroupFromGroup( lpCtxt->This, lpCtxt->idGroup,
-                                            dpId )
-              )
-      )
-    {
-      ERR( "Unable to delete group 0x%08x from group 0x%08x\n",
-             dpId, lpCtxt->idGroup );
-    }
+    if ( FAILED( IDirectPlayX_DeleteGroupFromGroup( &lpCtxt->This->IDirectPlay4_iface,
+                    lpCtxt->idGroup, dpId ) ) )
+      ERR( "Unable to delete group 0x%08x from group 0x%08x\n", dpId, lpCtxt->idGroup );
   }
   else if ( FAILED( IDirectPlayX_DeletePlayerFromGroup( &lpCtxt->This->IDirectPlay4_iface,
                                                         lpCtxt->idGroup, dpId ) ) )
@@ -1544,13 +1537,8 @@ static HRESULT DP_IF_DestroyGroup
                            cbRemoveGroupOrPlayer, (LPVOID)&context, 0, bAnsi );
 
   /* Remove this group from the parent group - if it has one */
-  if( ( idGroup != DPID_SYSTEM_GROUP ) &&
-      ( lpGData->parent != DPID_SYSTEM_GROUP )
-    )
-  {
-    DP_IF_DeleteGroupFromGroup( (IDirectPlay3Impl*)This, lpGData->parent,
-                                idGroup );
-  }
+  if( ( idGroup != DPID_SYSTEM_GROUP ) && ( lpGData->parent != DPID_SYSTEM_GROUP ) )
+    IDirectPlayX_DeleteGroupFromGroup( &This->IDirectPlay4_iface, lpGData->parent, idGroup );
 
   /* Now delete this group data and list from the system group */
   DP_DeleteGroup( This, idGroup );
@@ -3136,52 +3124,42 @@ static HRESULT WINAPI DirectPlay3WImpl_CreateGroupInGroup
                                    dwFlags, FALSE );
 }
 
-static HRESULT DP_IF_DeleteGroupFromGroup
-          ( IDirectPlay3Impl* This, DPID idParentGroup, DPID idGroup )
+static HRESULT WINAPI IDirectPlay4AImpl_DeleteGroupFromGroup( IDirectPlay4A *iface, DPID parent,
+        DPID group )
 {
-  lpGroupList lpGList;
-  lpGroupData lpGParentData;
-
-  TRACE("(%p)->(0x%08x,0x%08x)\n", This, idParentGroup, idGroup );
+    IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
+    return IDirectPlayX_DeleteGroupFromGroup( &This->IDirectPlay4_iface, parent, group );
+}
 
-  /* Is the parent group valid? */
-  if( ( lpGParentData = DP_FindAnyGroup( (IDirectPlay2AImpl*)This, idParentGroup ) ) == NULL )
-  {
-    return DPERR_INVALIDGROUP;
-  }
+static HRESULT WINAPI IDirectPlay4Impl_DeleteGroupFromGroup( IDirectPlay4 *iface, DPID parent,
+        DPID group )
+{
+    IDirectPlayImpl *This = impl_from_IDirectPlay4( iface );
+    lpGroupList glist;
+    lpGroupData parentdata;
 
-  /* Remove the group from the parent group queue */
-  DPQ_REMOVE_ENTRY( lpGParentData->groups, groups, lpGData->dpid, ==, idGroup, lpGList );
+    TRACE("(%p)->(0x%08x,0x%08x)\n", This, parent, group );
 
-  if( lpGList == NULL )
-  {
-    return DPERR_INVALIDGROUP;
-  }
+    /* Is the parent group valid? */
+    if ( ( parentdata = DP_FindAnyGroup(This, parent ) ) == NULL )
+        return DPERR_INVALIDGROUP;
 
-  /* Decrement the ref count */
-  lpGList->lpGData->uRef--;
+    /* Remove the group from the parent group queue */
+    DPQ_REMOVE_ENTRY( parentdata->groups, groups, lpGData->dpid, ==, group, glist );
 
-  /* Free up the list item */
-  HeapFree( GetProcessHeap(), 0, lpGList );
+    if ( glist == NULL )
+        return DPERR_INVALIDGROUP;
 
-  /* Should send a DELETEGROUPFROMGROUP message */
-  FIXME( "message not sent\n" );
+    /* Decrement the ref count */
+    glist->lpGData->uRef--;
 
-  return DP_OK;
-}
+    /* Free up the list item */
+    HeapFree( GetProcessHeap(), 0, glist );
 
-static HRESULT WINAPI IDirectPlay4AImpl_DeleteGroupFromGroup( IDirectPlay4A *iface,
-        DPID idParentGroup, DPID idGroup )
-{
-  IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface );
-  return DP_IF_DeleteGroupFromGroup( This, idParentGroup, idGroup );
-}
+    /* Should send a DELETEGROUPFROMGROUP message */
+    FIXME( "message not sent\n" );
 
-static HRESULT WINAPI DirectPlay3WImpl_DeleteGroupFromGroup
-          ( LPDIRECTPLAY3 iface, DPID idParentGroup, DPID idGroup )
-{
-  IDirectPlay3Impl *This = (IDirectPlay3Impl *)iface;
-  return DP_IF_DeleteGroupFromGroup( This, idParentGroup, idGroup );
+    return DP_OK;
 }
 
 static BOOL DP_BuildSPCompoundAddr( LPGUID lpcSpGuid, LPVOID* lplpAddrBuf,
@@ -4421,7 +4399,7 @@ static const IDirectPlay4Vtbl dp4_vt =
   XCAST(SetSessionDesc)DirectPlay2WImpl_SetSessionDesc,
     IDirectPlay4Impl_AddGroupToGroup,
   XCAST(CreateGroupInGroup)DirectPlay3WImpl_CreateGroupInGroup,
-  XCAST(DeleteGroupFromGroup)DirectPlay3WImpl_DeleteGroupFromGroup,
+    IDirectPlay4Impl_DeleteGroupFromGroup,
     IDirectPlay4Impl_EnumConnections,
   XCAST(EnumGroupsInGroup)DirectPlay3WImpl_EnumGroupsInGroup,
     IDirectPlay4Impl_GetGroupConnectionSettings,




More information about the wine-cvs mailing list