Module: wine Branch: master Commit: 82b51258eae9ab4dc1e6e2e2d5b7c61980d12037 URL: http://source.winehq.org/git/wine.git/?a=commit;h=82b51258eae9ab4dc1e6e2e2d5...
Author: Michael Stefaniuc mstefani@redhat.de Date: Fri Mar 29 16:39:26 2013 +0100
dplayx: Remove the duplicated IDirectPlayXImpl structs.
---
dlls/dplayx/dplay.c | 29 +++++------------------------ dlls/dplayx/dplay_global.h | 44 +++++++++++++------------------------------- 2 files changed, 18 insertions(+), 55 deletions(-)
diff --git a/dlls/dplayx/dplay.c b/dlls/dplayx/dplay.c index 0ddde38..c7ab380 100644 --- a/dlls/dplayx/dplay.c +++ b/dlls/dplayx/dplay.c @@ -396,46 +396,26 @@ static BOOL DP_DestroyDirectPlay2( LPVOID lpDP ) HRESULT DP_CreateInterface ( REFIID riid, LPVOID* ppvObj ) { - TRACE( " for %s\n", debugstr_guid( riid ) ); + IDirectPlayImpl *This;
- *ppvObj = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof( IDirectPlay2Impl ) ); + TRACE( " for %s\n", debugstr_guid( riid ) );
- if( *ppvObj == NULL ) - { + This = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( IDirectPlayImpl ) ); + if( !This ) return DPERR_OUTOFMEMORY; - }
if( IsEqualGUID( &IID_IDirectPlay2, riid ) ) - { - IDirectPlay2Impl *This = *ppvObj; This->lpVtbl = &directPlay2WVT; - } else if( IsEqualGUID( &IID_IUnknown, riid ) || IsEqualGUID( &IID_IDirectPlay2A, riid ) ) - { - IDirectPlay2AImpl *This = *ppvObj; This->lpVtbl = &directPlay2AVT; - } else if( IsEqualGUID( &IID_IDirectPlay3, riid ) ) - { - IDirectPlay3Impl *This = *ppvObj; This->lpVtbl = &directPlay3WVT; - } else if( IsEqualGUID( &IID_IDirectPlay3A, riid ) ) - { - IDirectPlay3AImpl *This = *ppvObj; This->lpVtbl = &directPlay3AVT; - } else if( IsEqualGUID( &IID_IDirectPlay4, riid ) ) - { - IDirectPlay4Impl *This = *ppvObj; This->lpVtbl = &directPlay4WVT; - } else if( IsEqualGUID( &IID_IDirectPlay4A, riid ) ) - { - IDirectPlay4AImpl *This = *ppvObj; This->lpVtbl = &directPlay4AVT; - } else { /* Unsupported interface */ @@ -446,6 +426,7 @@ HRESULT DP_CreateInterface }
/* Initialize it */ + *ppvObj = This; if ( DP_CreateIUnknown( *ppvObj ) && DP_CreateDirectPlay2( *ppvObj ) ) { IDirectPlayX_AddRef( (LPDIRECTPLAY2A)*ppvObj ); diff --git a/dlls/dplayx/dplay_global.h b/dlls/dplayx/dplay_global.h index 7578e04..94b8f9a 100644 --- a/dlls/dplayx/dplay_global.h +++ b/dlls/dplayx/dplay_global.h @@ -31,16 +31,6 @@ extern HRESULT DPL_EnumAddress( LPDPENUMADDRESSCALLBACK lpEnumAddressCallback, LPCVOID lpAddress, DWORD dwAddressSize, LPVOID lpContext ) DECLSPEC_HIDDEN;
-/***************************************************************************** - * Predeclare the interface implementation structures - */ -typedef struct IDirectPlay2Impl IDirectPlay2AImpl; -typedef struct IDirectPlay2Impl IDirectPlay2Impl; -typedef struct IDirectPlay3Impl IDirectPlay3AImpl; -typedef struct IDirectPlay3Impl IDirectPlay3Impl; -typedef struct IDirectPlay4Impl IDirectPlay4AImpl; -typedef struct IDirectPlay4Impl IDirectPlay4Impl; - typedef struct tagDirectPlayIUnknownData { LONG ulObjRef; @@ -196,28 +186,20 @@ typedef struct tagDirectPlay2Data DPQ_HEAD( tagDP_MSG_REPLY_STRUCT_LIST ) repliesExpected; } DirectPlay2Data;
-#define DP_IMPL_FIELDS \ - LONG ulInterfaceRef; \ - DirectPlayIUnknownData* unk; \ - DirectPlay2Data* dp2; - -struct IDirectPlay2Impl -{ - const IDirectPlay2Vtbl *lpVtbl; - DP_IMPL_FIELDS -}; - -struct IDirectPlay3Impl +typedef struct IDirectPlayImpl { - const IDirectPlay3Vtbl *lpVtbl; - DP_IMPL_FIELDS -}; - -struct IDirectPlay4Impl -{ - const IDirectPlay4Vtbl *lpVtbl; - DP_IMPL_FIELDS -}; + const void *lpVtbl; + LONG ulInterfaceRef; + DirectPlayIUnknownData *unk; + DirectPlay2Data *dp2; +} IDirectPlayImpl; + +typedef struct IDirectPlayImpl IDirectPlay2Impl; +typedef struct IDirectPlayImpl IDirectPlay2AImpl; +typedef struct IDirectPlayImpl IDirectPlay3Impl; +typedef struct IDirectPlayImpl IDirectPlay3AImpl; +typedef struct IDirectPlayImpl IDirectPlay4Impl; +typedef struct IDirectPlayImpl IDirectPlay4AImpl;
HRESULT DP_HandleMessage( IDirectPlay2Impl* This, LPCVOID lpMessageBody, DWORD dwMessageBodySize, LPCVOID lpMessageHeader,