Commit 354ccf3f authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dmime: Split the segment object creation into a separate helper.

parent 2b1cfcd0
......@@ -826,28 +826,38 @@ static const IPersistStreamVtbl persiststream_vtbl = {
unimpl_IPersistStream_GetSizeMax
};
IDirectMusicSegment8Impl *create_segment(void)
{
IDirectMusicSegment8Impl *obj;
if (!(obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj))))
return NULL;
obj->IDirectMusicSegment8_iface.lpVtbl = &dmsegment8_vtbl;
obj->ref = 1;
dmobject_init(&obj->dmobj, &CLSID_DirectMusicSegment, (IUnknown *)&obj->IDirectMusicSegment8_iface);
obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl;
obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
list_init (&obj->Tracks);
DMIME_LockModule();
return obj;
}
/* for ClassFactory */
HRESULT create_dmsegment(REFIID lpcGUID, void **ppobj)
HRESULT create_dmsegment(REFIID guid, void **ret_iface)
{
IDirectMusicSegment8Impl* obj;
HRESULT hr;
IDirectMusicSegment8Impl *obj;
HRESULT hr;
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegment8Impl));
if (NULL == obj) {
*ppobj = NULL;
return E_OUTOFMEMORY;
}
obj->IDirectMusicSegment8_iface.lpVtbl = &dmsegment8_vtbl;
obj->ref = 1;
dmobject_init(&obj->dmobj, &CLSID_DirectMusicSegment,
(IUnknown *)&obj->IDirectMusicSegment8_iface);
obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl;
obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
list_init (&obj->Tracks);
DMIME_LockModule();
hr = IDirectMusicSegment8_QueryInterface(&obj->IDirectMusicSegment8_iface, lpcGUID, ppobj);
IDirectMusicSegment8_Release(&obj->IDirectMusicSegment8_iface);
return hr;
if (!(obj = create_segment())) {
*ret_iface = NULL;
return E_OUTOFMEMORY;
}
hr = IDirectMusicSegment8_QueryInterface(&obj->IDirectMusicSegment8_iface, guid, ret_iface);
IDirectMusicSegment8_Release(&obj->IDirectMusicSegment8_iface);
return hr;
}
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