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