dplayx: Merge the extra struct into IDPLobbySPImpl.
This commit is contained in:
parent
a966f9740f
commit
02ce71edee
@ -26,28 +26,12 @@
|
|||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dplay);
|
WINE_DEFAULT_DEBUG_CHANNEL(dplay);
|
||||||
|
|
||||||
/* Prototypes */
|
typedef struct IDPLobbySPImpl
|
||||||
static BOOL DPLSP_CreateDPLobbySP( void *lpSP, IDirectPlayImpl *dp );
|
|
||||||
static BOOL DPLSP_DestroyDPLobbySP( LPVOID lpSP );
|
|
||||||
|
|
||||||
|
|
||||||
/* Predefine the interface */
|
|
||||||
typedef struct IDPLobbySPImpl IDPLobbySPImpl;
|
|
||||||
|
|
||||||
typedef struct tagDPLobbySPData
|
|
||||||
{
|
|
||||||
IDirectPlayImpl *dplay;
|
|
||||||
} DPLobbySPData;
|
|
||||||
|
|
||||||
#define DPLSP_IMPL_FIELDS \
|
|
||||||
DPLobbySPData* sp;
|
|
||||||
|
|
||||||
struct IDPLobbySPImpl
|
|
||||||
{
|
{
|
||||||
const IDPLobbySPVtbl *lpVtbl;
|
const IDPLobbySPVtbl *lpVtbl;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
DPLSP_IMPL_FIELDS
|
IDirectPlayImpl *dplay;
|
||||||
};
|
} IDPLobbySPImpl;
|
||||||
|
|
||||||
static inline IDPLobbySPImpl *impl_from_IDPLobbySP(IDPLobbySP *iface)
|
static inline IDPLobbySPImpl *impl_from_IDPLobbySP(IDPLobbySP *iface)
|
||||||
{
|
{
|
||||||
@ -73,6 +57,7 @@ HRESULT DPLSP_CreateInterface( REFIID riid, void **ppvObj, IDirectPlayImpl *dp )
|
|||||||
{
|
{
|
||||||
IDPLobbySPImpl *This = *ppvObj;
|
IDPLobbySPImpl *This = *ppvObj;
|
||||||
This->lpVtbl = &dpLobbySPVT;
|
This->lpVtbl = &dpLobbySPVT;
|
||||||
|
This->dplay = dp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -83,45 +68,8 @@ HRESULT DPLSP_CreateInterface( REFIID riid, void **ppvObj, IDirectPlayImpl *dp )
|
|||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize it */
|
IDPLobbySP_AddRef( (LPDPLOBBYSP)*ppvObj );
|
||||||
if( DPLSP_CreateDPLobbySP( *ppvObj, dp ) )
|
return S_OK;
|
||||||
{
|
|
||||||
IDPLobbySP_AddRef( (LPDPLOBBYSP)*ppvObj );
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize failed, destroy it */
|
|
||||||
DPLSP_DestroyDPLobbySP( *ppvObj );
|
|
||||||
|
|
||||||
HeapFree( GetProcessHeap(), 0, *ppvObj );
|
|
||||||
*ppvObj = NULL;
|
|
||||||
|
|
||||||
return DPERR_NOMEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL DPLSP_CreateDPLobbySP( void *lpSP, IDirectPlayImpl *dp )
|
|
||||||
{
|
|
||||||
IDPLobbySPImpl *This = lpSP;
|
|
||||||
|
|
||||||
This->sp = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof( *(This->sp) ) );
|
|
||||||
|
|
||||||
if ( This->sp == NULL )
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
This->sp->dplay = dp;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static BOOL DPLSP_DestroyDPLobbySP( LPVOID lpSP )
|
|
||||||
{
|
|
||||||
IDPLobbySPImpl *This = lpSP;
|
|
||||||
|
|
||||||
HeapFree( GetProcessHeap(), 0, This->sp );
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDPLobbySPImpl_QueryInterface( IDPLobbySP *iface, REFIID riid,
|
static HRESULT WINAPI IDPLobbySPImpl_QueryInterface( IDPLobbySP *iface, REFIID riid,
|
||||||
@ -159,10 +107,7 @@ static ULONG WINAPI IDPLobbySPImpl_Release( IDPLobbySP *iface )
|
|||||||
TRACE( "(%p) ref=%d\n", This, ref );
|
TRACE( "(%p) ref=%d\n", This, ref );
|
||||||
|
|
||||||
if( !ref )
|
if( !ref )
|
||||||
{
|
|
||||||
DPLSP_DestroyDPLobbySP( This );
|
|
||||||
HeapFree( GetProcessHeap(), 0, This );
|
HeapFree( GetProcessHeap(), 0, This );
|
||||||
}
|
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user