-- v2: dmusic: Get rid of the IDirectMusicInstrumentImpl typedef. dmusic: Rename IDirectMusicInstrumentImpl method prefix to instrument. dmusic: Simplify and cleanup IDirectMusicInstrument constructor. dmusic: Get rid of struct collection liWavePoolTablePosition member. dmusic: Get rid of struct collection liCollectionPosition member. dmusic: Get rid of the IDirectMusicCollectionImpl typedef. dmusic: Rename IDirectMusicCollectionImpl method prefix to collection. dmusic: Move constructor parameter checks to class factory.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmusic/collection.c | 41 ++++++++++++++---------------------- dlls/dmusic/dmusic.c | 20 ++++++------------ dlls/dmusic/dmusic_main.c | 26 +++++++++++++++-------- dlls/dmusic/dmusic_private.h | 4 ++-- 4 files changed, 41 insertions(+), 50 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 3f1c70b01e3..46939aad65f 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -520,31 +520,22 @@ static const IPersistStreamVtbl persiststream_vtbl = { unimpl_IPersistStream_GetSizeMax };
- -HRESULT DMUSIC_CreateDirectMusicCollectionImpl(REFIID lpcGUID, void **ppobj, IUnknown *pUnkOuter) +HRESULT collection_create(IUnknown **ret_iface) { - IDirectMusicCollectionImpl* obj; - HRESULT hr; - - *ppobj = NULL; - if (pUnkOuter) - return CLASS_E_NOAGGREGATION; - - obj = calloc(1, sizeof(IDirectMusicCollectionImpl)); - if (!obj) - return E_OUTOFMEMORY; - - obj->IDirectMusicCollection_iface.lpVtbl = &DirectMusicCollection_Collection_Vtbl; - obj->ref = 1; - dmobject_init(&obj->dmobj, &CLSID_DirectMusicCollection, - (IUnknown*)&obj->IDirectMusicCollection_iface); - obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl; - obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl; - - list_init (&obj->Instruments); + IDirectMusicCollectionImpl *obj;
- hr = IDirectMusicCollection_QueryInterface(&obj->IDirectMusicCollection_iface, lpcGUID, ppobj); - IDirectMusicCollection_Release(&obj->IDirectMusicCollection_iface); - - return hr; + *ret_iface = NULL; + if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY; + obj->IDirectMusicCollection_iface.lpVtbl = &DirectMusicCollection_Collection_Vtbl; + obj->ref = 1; + dmobject_init(&obj->dmobj, &CLSID_DirectMusicCollection, + (IUnknown *)&obj->IDirectMusicCollection_iface); + obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl; + obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl; + + list_init(&obj->Instruments); + + TRACE("Created DirectMusicCollection %p\n", obj); + *ret_iface = (IUnknown *)&obj->IDirectMusicCollection_iface; + return S_OK; } diff --git a/dlls/dmusic/dmusic.c b/dlls/dmusic/dmusic.c index d284b32fdd7..6fc5f9b08d8 100644 --- a/dlls/dmusic/dmusic.c +++ b/dlls/dmusic/dmusic.c @@ -579,22 +579,15 @@ static void create_system_ports_list(IDirectMusic8Impl* object) object->num_system_ports = nb_ports; }
-/* For ClassFactory */ -HRESULT DMUSIC_CreateDirectMusicImpl(REFIID riid, void **ret_iface, IUnknown *unkouter) +HRESULT music_create(IUnknown **ret_iface) { IDirectMusic8Impl *dmusic; HRESULT ret;
- TRACE("(%s, %p, %p)\n", debugstr_guid(riid), ret_iface, unkouter); + TRACE("(%p)\n", ret_iface);
*ret_iface = NULL; - if (unkouter) - return CLASS_E_NOAGGREGATION; - - dmusic = calloc(1, sizeof(IDirectMusic8Impl)); - if (!dmusic) - return E_OUTOFMEMORY; - + if (!(dmusic = calloc(1, sizeof(*dmusic)))) return E_OUTOFMEMORY; dmusic->IDirectMusic8_iface.lpVtbl = &DirectMusic8_Vtbl; dmusic->ref = 1; ret = master_clock_create(&dmusic->master_clock); @@ -605,8 +598,7 @@ HRESULT DMUSIC_CreateDirectMusicImpl(REFIID riid, void **ret_iface, IUnknown *un
create_system_ports_list(dmusic);
- ret = IDirectMusic8Impl_QueryInterface(&dmusic->IDirectMusic8_iface, riid, ret_iface); - IDirectMusic8_Release(&dmusic->IDirectMusic8_iface); - - return ret; + TRACE("Created DirectMusic %p\n", dmusic); + *ret_iface = (IUnknown *)&dmusic->IDirectMusic8_iface; + return S_OK; } diff --git a/dlls/dmusic/dmusic_main.c b/dlls/dmusic/dmusic_main.c index 509e80f872b..f0aaca8947a 100644 --- a/dlls/dmusic/dmusic_main.c +++ b/dlls/dmusic/dmusic_main.c @@ -41,7 +41,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
typedef struct { IClassFactory IClassFactory_iface; - HRESULT (*fnCreateInstance)(REFIID riid, void **ppv, IUnknown *pUnkOuter); + HRESULT (*create_instance)(IUnknown **ret_iface); } IClassFactoryImpl;
/****************************************************************** @@ -82,14 +82,23 @@ static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) return 1; /* non-heap based object */ }
-static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, - REFIID riid, void **ppv) +static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *unk_outer, REFIID riid, void **ret_iface) { - IClassFactoryImpl *This = impl_from_IClassFactory(iface); + IClassFactoryImpl *This = impl_from_IClassFactory(iface); + IUnknown *object; + HRESULT hr;
- TRACE ("(%p, %s, %p)\n", pUnkOuter, debugstr_dmguid(riid), ppv); + TRACE("(%p, %s, %p)\n", unk_outer, debugstr_dmguid(riid), ret_iface);
- return This->fnCreateInstance(riid, ppv, pUnkOuter); + *ret_iface = NULL; + if (unk_outer) return CLASS_E_NOAGGREGATION; + if (SUCCEEDED(hr = This->create_instance(&object))) + { + hr = IUnknown_QueryInterface(object, riid, ret_iface); + IUnknown_Release(object); + } + + return hr; }
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) @@ -106,9 +115,8 @@ static const IClassFactoryVtbl classfactory_vtbl = { ClassFactory_LockServer };
-static IClassFactoryImpl DirectMusic_CF = {{&classfactory_vtbl}, DMUSIC_CreateDirectMusicImpl}; -static IClassFactoryImpl Collection_CF = {{&classfactory_vtbl}, - DMUSIC_CreateDirectMusicCollectionImpl}; +static IClassFactoryImpl DirectMusic_CF = {{&classfactory_vtbl}, music_create}; +static IClassFactoryImpl Collection_CF = {{&classfactory_vtbl}, collection_create};
diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index 03c1e6970ee..003bbbb6544 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -91,8 +91,8 @@ typedef struct instrument_articulation { */
/* CLSID */ -extern HRESULT DMUSIC_CreateDirectMusicImpl(REFIID riid, void **ret_iface, IUnknown *pUnkOuter); -extern HRESULT DMUSIC_CreateDirectMusicCollectionImpl(REFIID riid, void **ppobj, IUnknown *pUnkOuter); +extern HRESULT music_create(IUnknown **ret_iface); +extern HRESULT collection_create(IUnknown **ret_iface);
/* Internal */ extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmusic/collection.c | 49 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 46939aad65f..2ff53a0fe23 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -54,8 +54,7 @@ static inline IDirectMusicCollectionImpl *impl_from_IPersistStream(IPersistStrea return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, dmobj.IPersistStream_iface); }
-/* IDirectMusicCollectionImpl IUnknown part: */ -static HRESULT WINAPI IDirectMusicCollectionImpl_QueryInterface(IDirectMusicCollection *iface, +static HRESULT WINAPI collection_QueryInterface(IDirectMusicCollection *iface, REFIID riid, void **ret_iface) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); @@ -80,7 +79,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_QueryInterface(IDirectMusicColl return S_OK; }
-static ULONG WINAPI IDirectMusicCollectionImpl_AddRef(IDirectMusicCollection *iface) +static ULONG WINAPI collection_AddRef(IDirectMusicCollection *iface) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); ULONG ref = InterlockedIncrement(&This->ref); @@ -90,7 +89,7 @@ static ULONG WINAPI IDirectMusicCollectionImpl_AddRef(IDirectMusicCollection *if return ref; }
-static ULONG WINAPI IDirectMusicCollectionImpl_Release(IDirectMusicCollection *iface) +static ULONG WINAPI collection_Release(IDirectMusicCollection *iface) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); ULONG ref = InterlockedDecrement(&This->ref); @@ -104,8 +103,7 @@ static ULONG WINAPI IDirectMusicCollectionImpl_Release(IDirectMusicCollection *i return ref; }
-/* IDirectMusicCollection Interface follows: */ -static HRESULT WINAPI IDirectMusicCollectionImpl_GetInstrument(IDirectMusicCollection *iface, +static HRESULT WINAPI collection_GetInstrument(IDirectMusicCollection *iface, DWORD patch, IDirectMusicInstrument **instrument) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); @@ -132,7 +130,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_GetInstrument(IDirectMusicColle return DMUS_E_INVALIDPATCH; }
-static HRESULT WINAPI IDirectMusicCollectionImpl_EnumInstrument(IDirectMusicCollection *iface, +static HRESULT WINAPI collection_EnumInstrument(IDirectMusicCollection *iface, DWORD index, DWORD *patch, LPWSTR name, DWORD name_length) { IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); @@ -161,16 +159,16 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_EnumInstrument(IDirectMusicColl return S_FALSE; }
-static const IDirectMusicCollectionVtbl DirectMusicCollection_Collection_Vtbl = { - IDirectMusicCollectionImpl_QueryInterface, - IDirectMusicCollectionImpl_AddRef, - IDirectMusicCollectionImpl_Release, - IDirectMusicCollectionImpl_GetInstrument, - IDirectMusicCollectionImpl_EnumInstrument +static const IDirectMusicCollectionVtbl collection_vtbl = +{ + collection_QueryInterface, + collection_AddRef, + collection_Release, + collection_GetInstrument, + collection_EnumInstrument, };
-/* IDirectMusicCollectionImpl IDirectMusicObject part: */ -static HRESULT WINAPI col_IDirectMusicObject_ParseDescriptor(IDirectMusicObject *iface, +static HRESULT WINAPI collection_object_ParseDescriptor(IDirectMusicObject *iface, IStream *stream, DMUS_OBJECTDESC *desc) { struct chunk_entry riff = {0}; @@ -201,17 +199,17 @@ static HRESULT WINAPI col_IDirectMusicObject_ParseDescriptor(IDirectMusicObject return S_OK; }
-static const IDirectMusicObjectVtbl dmobject_vtbl = { +static const IDirectMusicObjectVtbl collection_object_vtbl = +{ dmobj_IDirectMusicObject_QueryInterface, dmobj_IDirectMusicObject_AddRef, dmobj_IDirectMusicObject_Release, dmobj_IDirectMusicObject_GetDescriptor, dmobj_IDirectMusicObject_SetDescriptor, - col_IDirectMusicObject_ParseDescriptor + collection_object_ParseDescriptor, };
-/* IDirectMusicCollectionImpl IPersistStream part: */ -static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, +static HRESULT WINAPI collection_stream_Load(IPersistStream *iface, IStream *stream) { IDirectMusicCollectionImpl *This = impl_from_IPersistStream(iface); @@ -509,15 +507,16 @@ static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, return S_OK; }
-static const IPersistStreamVtbl persiststream_vtbl = { +static const IPersistStreamVtbl collection_stream_vtbl = +{ dmobj_IPersistStream_QueryInterface, dmobj_IPersistStream_AddRef, dmobj_IPersistStream_Release, unimpl_IPersistStream_GetClassID, unimpl_IPersistStream_IsDirty, - IPersistStreamImpl_Load, + collection_stream_Load, unimpl_IPersistStream_Save, - unimpl_IPersistStream_GetSizeMax + unimpl_IPersistStream_GetSizeMax, };
HRESULT collection_create(IUnknown **ret_iface) @@ -526,12 +525,12 @@ HRESULT collection_create(IUnknown **ret_iface)
*ret_iface = NULL; if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY; - obj->IDirectMusicCollection_iface.lpVtbl = &DirectMusicCollection_Collection_Vtbl; + obj->IDirectMusicCollection_iface.lpVtbl = &collection_vtbl; obj->ref = 1; dmobject_init(&obj->dmobj, &CLSID_DirectMusicCollection, (IUnknown *)&obj->IDirectMusicCollection_iface); - obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl; - obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl; + obj->dmobj.IDirectMusicObject_iface.lpVtbl = &collection_object_vtbl; + obj->dmobj.IPersistStream_iface.lpVtbl = &collection_stream_vtbl;
list_init(&obj->Instruments);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmusic/collection.c | 56 +++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 29 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 2ff53a0fe23..7223aa23bdb 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -24,14 +24,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic); WINE_DECLARE_DEBUG_CHANNEL(dmfile);
-/***************************************************************************** - * IDirectMusicCollectionImpl implementation - */ -typedef struct IDirectMusicCollectionImpl { +struct collection +{ IDirectMusicCollection IDirectMusicCollection_iface; struct dmobject dmobj; LONG ref; - /* IDirectMusicCollectionImpl fields */ + IStream *pStm; /* stream from which we load collection and later instruments */ LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */ LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */ @@ -42,22 +40,22 @@ typedef struct IDirectMusicCollectionImpl { POOLCUE *pPoolCues; /* instruments */ struct list Instruments; -} IDirectMusicCollectionImpl; +};
-static inline IDirectMusicCollectionImpl *impl_from_IDirectMusicCollection(IDirectMusicCollection *iface) +static inline struct collection *impl_from_IDirectMusicCollection(IDirectMusicCollection *iface) { - return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IDirectMusicCollection_iface); + return CONTAINING_RECORD(iface, struct collection, IDirectMusicCollection_iface); }
-static inline IDirectMusicCollectionImpl *impl_from_IPersistStream(IPersistStream *iface) +static inline struct collection *impl_from_IPersistStream(IPersistStream *iface) { - return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, dmobj.IPersistStream_iface); + return CONTAINING_RECORD(iface, struct collection, dmobj.IPersistStream_iface); }
static HRESULT WINAPI collection_QueryInterface(IDirectMusicCollection *iface, REFIID riid, void **ret_iface) { - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); + struct collection *This = impl_from_IDirectMusicCollection(iface);
TRACE("(%p, %s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
@@ -81,7 +79,7 @@ static HRESULT WINAPI collection_QueryInterface(IDirectMusicCollection *iface,
static ULONG WINAPI collection_AddRef(IDirectMusicCollection *iface) { - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); + struct collection *This = impl_from_IDirectMusicCollection(iface); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p): new ref = %lu\n", iface, ref); @@ -91,7 +89,7 @@ static ULONG WINAPI collection_AddRef(IDirectMusicCollection *iface)
static ULONG WINAPI collection_Release(IDirectMusicCollection *iface) { - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); + struct collection *This = impl_from_IDirectMusicCollection(iface); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): new ref = %lu\n", iface, ref); @@ -106,7 +104,7 @@ static ULONG WINAPI collection_Release(IDirectMusicCollection *iface) static HRESULT WINAPI collection_GetInstrument(IDirectMusicCollection *iface, DWORD patch, IDirectMusicInstrument **instrument) { - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); + struct collection *This = impl_from_IDirectMusicCollection(iface); DMUS_PRIVATE_INSTRUMENTENTRY *inst_entry; struct list *list_entry; DWORD inst_patch; @@ -133,7 +131,7 @@ static HRESULT WINAPI collection_GetInstrument(IDirectMusicCollection *iface, static HRESULT WINAPI collection_EnumInstrument(IDirectMusicCollection *iface, DWORD index, DWORD *patch, LPWSTR name, DWORD name_length) { - IDirectMusicCollectionImpl *This = impl_from_IDirectMusicCollection(iface); + struct collection *This = impl_from_IDirectMusicCollection(iface); DWORD i = 0; DMUS_PRIVATE_INSTRUMENTENTRY *inst_entry; struct list *list_entry; @@ -212,7 +210,7 @@ static const IDirectMusicObjectVtbl collection_object_vtbl = static HRESULT WINAPI collection_stream_Load(IPersistStream *iface, IStream *stream) { - IDirectMusicCollectionImpl *This = impl_from_IPersistStream(iface); + struct collection *This = impl_from_IPersistStream(iface); DMUS_PRIVATE_CHUNK chunk; DWORD StreamSize, StreamCount, ListSize[2], ListCount[2]; LARGE_INTEGER liMove; /* used when skipping chunks */ @@ -521,20 +519,20 @@ static const IPersistStreamVtbl collection_stream_vtbl =
HRESULT collection_create(IUnknown **ret_iface) { - IDirectMusicCollectionImpl *obj; + struct collection *collection;
*ret_iface = NULL; - if (!(obj = calloc(1, sizeof(*obj)))) return E_OUTOFMEMORY; - obj->IDirectMusicCollection_iface.lpVtbl = &collection_vtbl; - obj->ref = 1; - dmobject_init(&obj->dmobj, &CLSID_DirectMusicCollection, - (IUnknown *)&obj->IDirectMusicCollection_iface); - obj->dmobj.IDirectMusicObject_iface.lpVtbl = &collection_object_vtbl; - obj->dmobj.IPersistStream_iface.lpVtbl = &collection_stream_vtbl; - - list_init(&obj->Instruments); - - TRACE("Created DirectMusicCollection %p\n", obj); - *ret_iface = (IUnknown *)&obj->IDirectMusicCollection_iface; + if (!(collection = calloc(1, sizeof(*collection)))) return E_OUTOFMEMORY; + collection->IDirectMusicCollection_iface.lpVtbl = &collection_vtbl; + collection->ref = 1; + dmobject_init(&collection->dmobj, &CLSID_DirectMusicCollection, + (IUnknown *)&collection->IDirectMusicCollection_iface); + collection->dmobj.IDirectMusicObject_iface.lpVtbl = &collection_object_vtbl; + collection->dmobj.IPersistStream_iface.lpVtbl = &collection_stream_vtbl; + + list_init(&collection->Instruments); + + TRACE("Created DirectMusicCollection %p\n", collection); + *ret_iface = (IUnknown *)&collection->IDirectMusicCollection_iface; return S_OK; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmusic/collection.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 7223aa23bdb..ca0f30db80a 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -31,7 +31,6 @@ struct collection LONG ref;
IStream *pStm; /* stream from which we load collection and later instruments */ - LARGE_INTEGER liCollectionPosition; /* offset in a stream where collection was loaded from */ LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */ CHAR *szCopyright; /* FIXME: should probably be placed somewhere else */ DLSHEADER *pHeader; @@ -214,12 +213,9 @@ static HRESULT WINAPI collection_stream_Load(IPersistStream *iface, DMUS_PRIVATE_CHUNK chunk; DWORD StreamSize, StreamCount, ListSize[2], ListCount[2]; LARGE_INTEGER liMove; /* used when skipping chunks */ - ULARGE_INTEGER dlibCollectionPosition, dlibInstrumentPosition, dlibWavePoolPosition; + ULARGE_INTEGER dlibInstrumentPosition, dlibWavePoolPosition;
IStream_AddRef(stream); /* add count for later references */ - liMove.QuadPart = 0; - IStream_Seek(stream, liMove, STREAM_SEEK_CUR, &dlibCollectionPosition); /* store offset, in case it'll be needed later */ - This->liCollectionPosition.QuadPart = dlibCollectionPosition.QuadPart; This->pStm = stream;
IStream_Read(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD), NULL);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmusic/collection.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index ca0f30db80a..19fc48ce555 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -31,7 +31,6 @@ struct collection LONG ref;
IStream *pStm; /* stream from which we load collection and later instruments */ - LARGE_INTEGER liWavePoolTablePosition; /* offset in a stream where wave pool table can be found */ CHAR *szCopyright; /* FIXME: should probably be placed somewhere else */ DLSHEADER *pHeader; /* pool table */ @@ -213,7 +212,7 @@ static HRESULT WINAPI collection_stream_Load(IPersistStream *iface, DMUS_PRIVATE_CHUNK chunk; DWORD StreamSize, StreamCount, ListSize[2], ListCount[2]; LARGE_INTEGER liMove; /* used when skipping chunks */ - ULARGE_INTEGER dlibInstrumentPosition, dlibWavePoolPosition; + ULARGE_INTEGER dlibInstrumentPosition;
IStream_AddRef(stream); /* add count for later references */ This->pStm = stream; @@ -357,9 +356,6 @@ static HRESULT WINAPI collection_stream_Load(IPersistStream *iface, } case FOURCC_WVPL: { TRACE_(dmfile)(": wave pool list (mark & skip)\n"); - liMove.QuadPart = 0; - IStream_Seek(stream, liMove, STREAM_SEEK_CUR, &dlibWavePoolPosition); /* store position */ - This->liWavePoolTablePosition.QuadPart = dlibWavePoolPosition.QuadPart; liMove.QuadPart = chunk.dwSize - sizeof(FOURCC); IStream_Seek(stream, liMove, STREAM_SEEK_CUR, NULL); break;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmusic/collection.c | 2 +- dlls/dmusic/dmusic_private.h | 3 ++- dlls/dmusic/instrument.c | 28 +++++++++++----------------- 3 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 19fc48ce555..1331efbd05d 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -377,7 +377,7 @@ static HRESULT WINAPI collection_stream_Load(IPersistStream *iface, DMUS_PRIVATE_INSTRUMENTENTRY *new_instrument = calloc(1, sizeof(DMUS_PRIVATE_INSTRUMENTENTRY)); TRACE_(dmfile)(": instrument list\n"); /* Only way to create this one... even M$ does it discretely */ - DMUSIC_CreateDirectMusicInstrumentImpl(&IID_IDirectMusicInstrument, (void**)&new_instrument->pInstrument, NULL); + instrument_create(&new_instrument->pInstrument); { IDirectMusicInstrumentImpl *instrument = impl_from_IDirectMusicInstrument(new_instrument->pInstrument); /* Store offset and length, they will be needed when loading the instrument */ diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index 003bbbb6544..05738c1fcf1 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -97,10 +97,11 @@ extern HRESULT collection_create(IUnknown **ret_iface); /* Internal */ extern HRESULT DMUSIC_CreateDirectMusicBufferImpl(LPDMUS_BUFFERDESC desc, LPVOID* ret_iface); extern HRESULT DMUSIC_CreateReferenceClockImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); -extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter);
extern HRESULT download_create(DWORD size, IDirectMusicDownload **ret_iface);
+extern HRESULT instrument_create(IDirectMusicInstrument **ret_iface); + /***************************************************************************** * IDirectMusic8Impl implementation structure */ diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index 767c4419225..3d4d7478be6 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -119,24 +119,18 @@ static const IDirectMusicInstrumentVtbl DirectMusicInstrument_Vtbl = IDirectMusicInstrumentImpl_SetPatch };
-/* for ClassFactory */ -HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) { - IDirectMusicInstrumentImpl* dminst; - HRESULT hr; - - dminst = calloc(1, sizeof(IDirectMusicInstrumentImpl)); - if (NULL == dminst) { - *ppobj = NULL; - return E_OUTOFMEMORY; - } - dminst->IDirectMusicInstrument_iface.lpVtbl = &DirectMusicInstrument_Vtbl; - dminst->ref = 1; - - hr = IDirectMusicInstrument_QueryInterface(&dminst->IDirectMusicInstrument_iface, lpcGUID, - ppobj); - IDirectMusicInstrument_Release(&dminst->IDirectMusicInstrument_iface); +HRESULT instrument_create(IDirectMusicInstrument **ret_iface) +{ + IDirectMusicInstrumentImpl *dminst;
- return hr; + *ret_iface = NULL; + if (!(dminst = calloc(1, sizeof(*dminst)))) return E_OUTOFMEMORY; + dminst->IDirectMusicInstrument_iface.lpVtbl = &DirectMusicInstrument_Vtbl; + dminst->ref = 1; + + TRACE("Created DirectMusicInstrument %p\n", dminst); + *ret_iface = &dminst->IDirectMusicInstrument_iface; + return S_OK; }
static HRESULT read_from_stream(IStream *stream, void *data, ULONG size)
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmusic/collection.c | 2 +- dlls/dmusic/dmusic_private.h | 3 +-- dlls/dmusic/instrument.c | 28 +++++++++++++--------------- 3 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 1331efbd05d..8ec8cefad95 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -115,7 +115,7 @@ static HRESULT WINAPI collection_GetInstrument(IDirectMusicCollection *iface, if (patch == inst_patch) { *instrument = inst_entry->pInstrument; IDirectMusicInstrument_AddRef(inst_entry->pInstrument); - IDirectMusicInstrumentImpl_CustomLoad(inst_entry->pInstrument, This->pStm); + instrument_load(inst_entry->pInstrument, This->pStm); TRACE(": returning instrument %p\n", *instrument); return S_OK; } diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index 05738c1fcf1..3c910bb4593 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -201,8 +201,7 @@ static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDire return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface); }
-/* custom :) */ -extern HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream); +extern HRESULT instrument_load(IDirectMusicInstrument *iface, IStream *stream);
/***************************************************************************** * Misc. diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index 3d4d7478be6..6a394290ebd 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -25,8 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static const GUID IID_IDirectMusicInstrumentPRIVATE = { 0xbcb20080, 0xa40c, 0x11d1, { 0x86, 0xbc, 0x00, 0xc0, 0x4f, 0xbf, 0x8f, 0xef } };
-/* IDirectMusicInstrument IUnknown part: */ -static HRESULT WINAPI IDirectMusicInstrumentImpl_QueryInterface(LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ret_iface) +static HRESULT WINAPI instrument_QueryInterface(LPDIRECTMUSICINSTRUMENT iface, REFIID riid, LPVOID *ret_iface) { TRACE("(%p)->(%s, %p)\n", iface, debugstr_dmguid(riid), ret_iface);
@@ -56,7 +55,7 @@ static HRESULT WINAPI IDirectMusicInstrumentImpl_QueryInterface(LPDIRECTMUSICINS return E_NOINTERFACE; }
-static ULONG WINAPI IDirectMusicInstrumentImpl_AddRef(LPDIRECTMUSICINSTRUMENT iface) +static ULONG WINAPI instrument_AddRef(LPDIRECTMUSICINSTRUMENT iface) { IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); ULONG ref = InterlockedIncrement(&This->ref); @@ -66,7 +65,7 @@ static ULONG WINAPI IDirectMusicInstrumentImpl_AddRef(LPDIRECTMUSICINSTRUMENT if return ref; }
-static ULONG WINAPI IDirectMusicInstrumentImpl_Release(LPDIRECTMUSICINSTRUMENT iface) +static ULONG WINAPI instrument_Release(LPDIRECTMUSICINSTRUMENT iface) { IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); ULONG ref = InterlockedDecrement(&This->ref); @@ -87,8 +86,7 @@ static ULONG WINAPI IDirectMusicInstrumentImpl_Release(LPDIRECTMUSICINSTRUMENT i return ref; }
-/* IDirectMusicInstrumentImpl IDirectMusicInstrument part: */ -static HRESULT WINAPI IDirectMusicInstrumentImpl_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch) +static HRESULT WINAPI instrument_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch) { IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
@@ -99,7 +97,7 @@ static HRESULT WINAPI IDirectMusicInstrumentImpl_GetPatch(LPDIRECTMUSICINSTRUMEN return S_OK; }
-static HRESULT WINAPI IDirectMusicInstrumentImpl_SetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch) +static HRESULT WINAPI instrument_SetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch) { IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface);
@@ -110,13 +108,13 @@ static HRESULT WINAPI IDirectMusicInstrumentImpl_SetPatch(LPDIRECTMUSICINSTRUMEN return S_OK; }
-static const IDirectMusicInstrumentVtbl DirectMusicInstrument_Vtbl = +static const IDirectMusicInstrumentVtbl instrument_vtbl = { - IDirectMusicInstrumentImpl_QueryInterface, - IDirectMusicInstrumentImpl_AddRef, - IDirectMusicInstrumentImpl_Release, - IDirectMusicInstrumentImpl_GetPatch, - IDirectMusicInstrumentImpl_SetPatch + instrument_QueryInterface, + instrument_AddRef, + instrument_Release, + instrument_GetPatch, + instrument_SetPatch, };
HRESULT instrument_create(IDirectMusicInstrument **ret_iface) @@ -125,7 +123,7 @@ HRESULT instrument_create(IDirectMusicInstrument **ret_iface)
*ret_iface = NULL; if (!(dminst = calloc(1, sizeof(*dminst)))) return E_OUTOFMEMORY; - dminst->IDirectMusicInstrument_iface.lpVtbl = &DirectMusicInstrument_Vtbl; + dminst->IDirectMusicInstrument_iface.lpVtbl = &instrument_vtbl; dminst->ref = 1;
TRACE("Created DirectMusicInstrument %p\n", dminst); @@ -278,7 +276,7 @@ static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stre }
/* Function that loads all instrument data and which is called from IDirectMusicCollection_GetInstrument as in native */ -HRESULT IDirectMusicInstrumentImpl_CustomLoad(IDirectMusicInstrument *iface, IStream *stream) +HRESULT instrument_load(IDirectMusicInstrument *iface, IStream *stream) { IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); HRESULT hr;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/dmusic/collection.c | 4 ++-- dlls/dmusic/dmusic_private.h | 14 ++++---------- dlls/dmusic/instrument.c | 26 +++++++++++++------------- dlls/dmusic/port.c | 2 +- 4 files changed, 20 insertions(+), 26 deletions(-)
diff --git a/dlls/dmusic/collection.c b/dlls/dmusic/collection.c index 8ec8cefad95..5332adff084 100644 --- a/dlls/dmusic/collection.c +++ b/dlls/dmusic/collection.c @@ -140,7 +140,7 @@ static HRESULT WINAPI collection_EnumInstrument(IDirectMusicCollection *iface, LIST_FOR_EACH(list_entry, &This->Instruments) { inst_entry = LIST_ENTRY(list_entry, DMUS_PRIVATE_INSTRUMENTENTRY, entry); if (i == index) { - IDirectMusicInstrumentImpl *instrument = impl_from_IDirectMusicInstrument(inst_entry->pInstrument); + struct instrument *instrument = impl_from_IDirectMusicInstrument(inst_entry->pInstrument); IDirectMusicInstrument_GetPatch(inst_entry->pInstrument, patch); if (name) { length = min(lstrlenW(instrument->wszName), name_length - 1); @@ -379,7 +379,7 @@ static HRESULT WINAPI collection_stream_Load(IPersistStream *iface, /* Only way to create this one... even M$ does it discretely */ instrument_create(&new_instrument->pInstrument); { - IDirectMusicInstrumentImpl *instrument = impl_from_IDirectMusicInstrument(new_instrument->pInstrument); + struct instrument *instrument = impl_from_IDirectMusicInstrument(new_instrument->pInstrument); /* Store offset and length, they will be needed when loading the instrument */ liMove.QuadPart = 0; IStream_Seek(stream, liMove, STREAM_SEEK_CUR, &dlibInstrumentPosition); diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index 3c910bb4593..4eae993f259 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -49,8 +49,6 @@ typedef struct IDirectMusicBufferImpl IDirectMusicBufferImpl; typedef struct IDirectMusicDownloadedInstrumentImpl IDirectMusicDownloadedInstrumentImpl; typedef struct IReferenceClockImpl IReferenceClockImpl;
-typedef struct IDirectMusicInstrumentImpl IDirectMusicInstrumentImpl; - /***************************************************************************** * Some stuff to make my life easier :=) */ @@ -175,15 +173,11 @@ typedef struct _DMUS_PRIVATE_POOLCUE { struct list entry; /* for listing elements */ } DMUS_PRIVATE_POOLCUE, *LPDMUS_PRIVATE_POOLCUE;
-/***************************************************************************** - * IDirectMusicInstrumentImpl implementation structure - */ -struct IDirectMusicInstrumentImpl { - /* IUnknown fields */ +struct instrument +{ IDirectMusicInstrument IDirectMusicInstrument_iface; LONG ref;
- /* IDirectMusicInstrumentImpl fields */ LARGE_INTEGER liInstrumentPosition; /* offset in a stream where instrument chunk can be found */ ULONG length; /* Length of the instrument in the stream */ GUID id; @@ -196,9 +190,9 @@ struct IDirectMusicInstrumentImpl { instrument_articulation *articulations; };
-static inline IDirectMusicInstrumentImpl *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface) +static inline struct instrument *impl_from_IDirectMusicInstrument(IDirectMusicInstrument *iface) { - return CONTAINING_RECORD(iface, IDirectMusicInstrumentImpl, IDirectMusicInstrument_iface); + return CONTAINING_RECORD(iface, struct instrument, IDirectMusicInstrument_iface); }
extern HRESULT instrument_load(IDirectMusicInstrument *iface, IStream *stream); diff --git a/dlls/dmusic/instrument.c b/dlls/dmusic/instrument.c index 6a394290ebd..5677f128060 100644 --- a/dlls/dmusic/instrument.c +++ b/dlls/dmusic/instrument.c @@ -57,7 +57,7 @@ static HRESULT WINAPI instrument_QueryInterface(LPDIRECTMUSICINSTRUMENT iface, R
static ULONG WINAPI instrument_AddRef(LPDIRECTMUSICINSTRUMENT iface) { - IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); + struct instrument *This = impl_from_IDirectMusicInstrument(iface); ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p): new ref = %lu\n", iface, ref); @@ -67,7 +67,7 @@ static ULONG WINAPI instrument_AddRef(LPDIRECTMUSICINSTRUMENT iface)
static ULONG WINAPI instrument_Release(LPDIRECTMUSICINSTRUMENT iface) { - IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); + struct instrument *This = impl_from_IDirectMusicInstrument(iface); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p): new ref = %lu\n", iface, ref); @@ -88,7 +88,7 @@ static ULONG WINAPI instrument_Release(LPDIRECTMUSICINSTRUMENT iface)
static HRESULT WINAPI instrument_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD* pdwPatch) { - IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); + struct instrument *This = impl_from_IDirectMusicInstrument(iface);
TRACE("(%p)->(%p)\n", This, pdwPatch);
@@ -99,7 +99,7 @@ static HRESULT WINAPI instrument_GetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD*
static HRESULT WINAPI instrument_SetPatch(LPDIRECTMUSICINSTRUMENT iface, DWORD dwPatch) { - IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); + struct instrument *This = impl_from_IDirectMusicInstrument(iface);
TRACE("(%p, %ld): stub\n", This, dwPatch);
@@ -119,15 +119,15 @@ static const IDirectMusicInstrumentVtbl instrument_vtbl =
HRESULT instrument_create(IDirectMusicInstrument **ret_iface) { - IDirectMusicInstrumentImpl *dminst; + struct instrument *instrument;
*ret_iface = NULL; - if (!(dminst = calloc(1, sizeof(*dminst)))) return E_OUTOFMEMORY; - dminst->IDirectMusicInstrument_iface.lpVtbl = &instrument_vtbl; - dminst->ref = 1; + if (!(instrument = calloc(1, sizeof(*instrument)))) return E_OUTOFMEMORY; + instrument->IDirectMusicInstrument_iface.lpVtbl = &instrument_vtbl; + instrument->ref = 1;
- TRACE("Created DirectMusicInstrument %p\n", dminst); - *ret_iface = &dminst->IDirectMusicInstrument_iface; + TRACE("Created DirectMusicInstrument %p\n", instrument); + *ret_iface = &instrument->IDirectMusicInstrument_iface; return S_OK; }
@@ -172,7 +172,7 @@ static inline HRESULT advance_stream(IStream *stream, ULONG bytes) return ret; }
-static HRESULT load_region(IDirectMusicInstrumentImpl *This, IStream *stream, instrument_region *region, ULONG length) +static HRESULT load_region(struct instrument *This, IStream *stream, instrument_region *region, ULONG length) { HRESULT ret; DMUS_PRIVATE_CHUNK chunk; @@ -242,7 +242,7 @@ static HRESULT load_region(IDirectMusicInstrumentImpl *This, IStream *stream, in return S_OK; }
-static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stream, ULONG length) +static HRESULT load_articulation(struct instrument *This, IStream *stream, ULONG length) { HRESULT ret; instrument_articulation *articulation; @@ -278,7 +278,7 @@ static HRESULT load_articulation(IDirectMusicInstrumentImpl *This, IStream *stre /* Function that loads all instrument data and which is called from IDirectMusicCollection_GetInstrument as in native */ HRESULT instrument_load(IDirectMusicInstrument *iface, IStream *stream) { - IDirectMusicInstrumentImpl *This = impl_from_IDirectMusicInstrument(iface); + struct instrument *This = impl_from_IDirectMusicInstrument(iface); HRESULT hr; DMUS_PRIVATE_CHUNK chunk; ULONG i = 0; diff --git a/dlls/dmusic/port.c b/dlls/dmusic/port.c index d221fcbc102..94ab970ae76 100644 --- a/dlls/dmusic/port.c +++ b/dlls/dmusic/port.c @@ -266,7 +266,7 @@ static HRESULT WINAPI synth_port_DownloadInstrument(IDirectMusicPort *iface, IDi IDirectMusicDownloadedInstrument **downloaded_instrument, DMUS_NOTERANGE *note_ranges, DWORD num_note_ranges) { struct synth_port *This = synth_from_IDirectMusicPort(iface); - IDirectMusicInstrumentImpl *instrument_object; + struct instrument *instrument_object; HRESULT ret; BOOL on_heap; HANDLE download;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=137048
Your paranoid android.
=== debian11b (64 bit WoW report) ===
Report validation errors: imm32:imm32 crashed (c0000005)
This merge request was approved by Michael Stefaniuc.
Mac build failure due to "warning: failed to remove ccache/8: Directory not empty"