Commit ac25d099 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

dmusic: Simplify and cleanup IDirectMusicDownload constructor.

parent abc6ecc8
......@@ -97,10 +97,11 @@ extern HRESULT DMUSIC_CreateDirectMusicCollectionImpl(REFIID riid, void **ppobj,
/* Internal */
extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface);
extern HRESULT DMUSIC_CreateDirectMusicDownloadImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT download_create(IDirectMusicDownload **ret_iface);
/*****************************************************************************
* IDirectMusic8Impl implementation structure
*/
......
......@@ -85,21 +85,16 @@ static const IDirectMusicDownloadVtbl DirectMusicDownload_Vtbl = {
IDirectMusicDownloadImpl_GetBuffer
};
/* for ClassFactory */
HRESULT DMUSIC_CreateDirectMusicDownloadImpl(const GUID *guid, void **ret_iface, IUnknown *unk_outer)
HRESULT download_create(IDirectMusicDownload **ret_iface)
{
IDirectMusicDownloadImpl *download;
download = malloc(sizeof(*download));
if (!download)
{
*ret_iface = NULL;
return E_OUTOFMEMORY;
}
*ret_iface = NULL;
if (!(download = calloc(1, sizeof(*download)))) return E_OUTOFMEMORY;
download->IDirectMusicDownload_iface.lpVtbl = &DirectMusicDownload_Vtbl;
download->ref = 1;
*ret_iface = download;
TRACE("Created DirectMusicDownload %p\n", download);
*ret_iface = &download->IDirectMusicDownload_iface;
return S_OK;
}
......@@ -582,7 +582,7 @@ static HRESULT WINAPI synth_port_download_GetBuffer(IDirectMusicPortDownload *if
if (!IDMDownload)
return E_POINTER;
return DMUSIC_CreateDirectMusicDownloadImpl(&IID_IDirectMusicDownload, (LPVOID*)IDMDownload, NULL);
return download_create(IDMDownload);
}
static HRESULT WINAPI synth_port_download_AllocateBuffer(IDirectMusicPortDownload *iface, DWORD size,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment