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