Module: wine Branch: master Commit: dfe8563d92af1528c1f86b6e73f956e8ad59d45f URL: http://source.winehq.org/git/wine.git/?a=commit;h=dfe8563d92af1528c1f86b6e73...
Author: Michael Stefaniuc mstefani@redhat.de Date: Fri Mar 29 16:52:30 2013 +0100
dplayx: Merge the IDirectPlay4_DeletePlayerFromGroup helper.
---
dlls/dplayx/dplay.c | 119 +++++++++++++++++++------------------------------- 1 files changed, 45 insertions(+), 74 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index ffaee2d..ddbba48 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -78,9 +78,6 @@ static BOOL CALLBACK cbRemoveGroupOrPlayer( DPID dpId, DWORD dwPlayerType, static void DP_DeleteGroup( IDirectPlay2Impl* This, DPID dpid );
/* Helper methods for player/group interfaces */ -static HRESULT DP_IF_DeletePlayerFromGroup - ( IDirectPlay2Impl* This, LPVOID lpMsgHdr, DPID idGroup, - DPID idPlayer, BOOL bAnsi ); static HRESULT DP_IF_CreatePlayer ( IDirectPlay2Impl* This, LPVOID lpMsgHdr, LPDPID lpidPlayer, LPDPNAME lpPlayerName, HANDLE hEvent, LPVOID lpData, @@ -1448,76 +1445,60 @@ static DPID DP_GetRemoteNextObjectId(void) return DP_NextObjectId(); }
-static HRESULT DP_IF_DeletePlayerFromGroup - ( IDirectPlay2Impl* This, LPVOID lpMsgHdr, DPID idGroup, - DPID idPlayer, BOOL bAnsi ) +static HRESULT WINAPI IDirectPlay4AImpl_DeletePlayerFromGroup( IDirectPlay4A *iface, DPID group, + DPID player ) { - HRESULT hr = DP_OK; - - lpGroupData lpGData; - lpPlayerList lpPList; - - TRACE( "(%p)->(%p,0x%08x,0x%08x,%u)\n", - This, lpMsgHdr, idGroup, idPlayer, bAnsi ); - - /* Find the group */ - if( ( lpGData = DP_FindAnyGroup( This, idGroup ) ) == NULL ) - { - return DPERR_INVALIDGROUP; - } + IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface ); + return IDirectPlayX_DeletePlayerFromGroup( &This->IDirectPlay4_iface, group, player ); +}
- /* Find the player */ - if( ( lpPList = DP_FindPlayer( This, idPlayer ) ) == NULL ) - { - return DPERR_INVALIDPLAYER; - } +static HRESULT WINAPI IDirectPlay4Impl_DeletePlayerFromGroup( IDirectPlay4 *iface, DPID group, + DPID player ) +{ + IDirectPlayImpl *This = impl_from_IDirectPlay4( iface ); + HRESULT hr = DP_OK;
- /* Remove the player shortcut from the group */ - DPQ_REMOVE_ENTRY( lpGData->players, players, lpPData->dpid, ==, idPlayer, lpPList ); + lpGroupData gdata; + lpPlayerList plist;
- if( lpPList == NULL ) - { - return DPERR_INVALIDPLAYER; - } + TRACE( "(%p)->(0x%08x,0x%08x)\n", This, group, player );
- /* One less reference */ - lpPList->lpPData->uRef--; + /* Find the group */ + if ( ( gdata = DP_FindAnyGroup( This, group ) ) == NULL ) + return DPERR_INVALIDGROUP;
- /* Delete the Player List element */ - HeapFree( GetProcessHeap(), 0, lpPList ); + /* Find the player */ + if ( ( plist = DP_FindPlayer( This, player ) ) == NULL ) + return DPERR_INVALIDPLAYER;
- /* Inform the SP if they care */ - if( This->dp2->spData.lpCB->RemovePlayerFromGroup ) - { - DPSP_REMOVEPLAYERFROMGROUPDATA data; + /* Remove the player shortcut from the group */ + DPQ_REMOVE_ENTRY( gdata->players, players, lpPData->dpid, ==, player, plist );
- TRACE( "Calling SP RemovePlayerFromGroup\n" ); + if ( !plist ) + return DPERR_INVALIDPLAYER;
- data.idPlayer = idPlayer; - data.idGroup = idGroup; - data.lpISP = This->dp2->spData.lpISP; + /* One less reference */ + plist->lpPData->uRef--;
- hr = (*This->dp2->spData.lpCB->RemovePlayerFromGroup)( &data ); - } + /* Delete the Player List element */ + HeapFree( GetProcessHeap(), 0, plist );
- /* Need to send a DELETEPLAYERFROMGROUP message */ - FIXME( "Need to send a message\n" ); + /* Inform the SP if they care */ + if ( This->dp2->spData.lpCB->RemovePlayerFromGroup ) + { + DPSP_REMOVEPLAYERFROMGROUPDATA data;
- return hr; -} + TRACE( "Calling SP RemovePlayerFromGroup\n" ); + data.idPlayer = player; + data.idGroup = group; + data.lpISP = This->dp2->spData.lpISP; + hr = (*This->dp2->spData.lpCB->RemovePlayerFromGroup)( &data ); + }
-static HRESULT WINAPI IDirectPlay4AImpl_DeletePlayerFromGroup( IDirectPlay4A *iface, DPID idGroup, - DPID idPlayer ) -{ - IDirectPlayImpl *This = impl_from_IDirectPlay4A( iface ); - return DP_IF_DeletePlayerFromGroup( This, NULL, idGroup, idPlayer, TRUE ); -} + /* Need to send a DELETEPLAYERFROMGROUP message */ + FIXME( "Need to send a message\n" );
-static HRESULT WINAPI DirectPlay2WImpl_DeletePlayerFromGroup - ( LPDIRECTPLAY2 iface, DPID idGroup, DPID idPlayer ) -{ - IDirectPlay2Impl *This = (IDirectPlay2Impl *)iface; - return DP_IF_DeletePlayerFromGroup( This, NULL, idGroup, idPlayer, FALSE ); + return hr; }
typedef struct _DPRGOPContext @@ -1551,18 +1532,9 @@ cbRemoveGroupOrPlayer( dpId, lpCtxt->idGroup ); } } - else - { - if( FAILED( DP_IF_DeletePlayerFromGroup( (IDirectPlay2Impl*)lpCtxt->This, - NULL, lpCtxt->idGroup, - dpId, lpCtxt->bAnsi ) - ) - ) - { - ERR( "Unable to delete player 0x%08x from grp 0x%08x\n", - dpId, lpCtxt->idGroup ); - } - } + else if ( FAILED( IDirectPlayX_DeletePlayerFromGroup( &lpCtxt->This->IDirectPlay4_iface, + lpCtxt->idGroup, dpId ) ) ) + ERR( "Unable to delete player 0x%08x from grp 0x%08x\n", dpId, lpCtxt->idGroup );
return TRUE; /* Continue enumeration */ } @@ -1708,8 +1680,7 @@ cbDeletePlayerFromAllGroups(
if( dwPlayerType == DPPLAYERTYPE_GROUP ) { - DP_IF_DeletePlayerFromGroup( lpCtxt->This, NULL, dpId, lpCtxt->idPlayer, - lpCtxt->bAnsi ); + IDirectPlayX_DeletePlayerFromGroup( &lpCtxt->This->IDirectPlay4_iface, dpId, lpCtxt->idPlayer );
/* Enumerate all groups in this group since this will normally only * be called for top level groups @@ -4588,7 +4559,7 @@ static const IDirectPlay4Vtbl dp4_vt = IDirectPlay4Impl_Close, XCAST(CreateGroup)DirectPlay2WImpl_CreateGroup, XCAST(CreatePlayer)DirectPlay2WImpl_CreatePlayer, - XCAST(DeletePlayerFromGroup)DirectPlay2WImpl_DeletePlayerFromGroup, + IDirectPlay4Impl_DeletePlayerFromGroup, XCAST(DestroyGroup)DirectPlay2WImpl_DestroyGroup, XCAST(DestroyPlayer)DirectPlay2WImpl_DestroyPlayer, XCAST(EnumGroupPlayers)DirectPlay2WImpl_EnumGroupPlayers,