Michael Stefaniuc : dmstyle: Use the generic IPersistStream for DMMotifTrack.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jun 30 10:07:58 CDT 2015
Module: wine
Branch: master
Commit: 699efa6f3e274f52ad33a320c2baf102f6d7784f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=699efa6f3e274f52ad33a320c2baf102f6d7784f
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Tue Jun 30 09:28:28 2015 +0200
dmstyle: Use the generic IPersistStream for DMMotifTrack.
---
dlls/dmstyle/motiftrack.c | 67 +++++++++++---------------------------------
dlls/dmstyle/tests/dmstyle.c | 2 +-
2 files changed, 18 insertions(+), 51 deletions(-)
diff --git a/dlls/dmstyle/motiftrack.c b/dlls/dmstyle/motiftrack.c
index 8261dfe..d4a4eff 100644
--- a/dlls/dmstyle/motiftrack.c
+++ b/dlls/dmstyle/motiftrack.c
@@ -18,6 +18,7 @@
*/
#include "dmstyle_private.h"
+#include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
@@ -26,9 +27,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
*/
typedef struct IDirectMusicMotifTrack {
IDirectMusicTrack8 IDirectMusicTrack8_iface;
- const IPersistStreamVtbl *PersistStreamVtbl;
+ struct dmobject dmobj; /* IPersistStream only */
LONG ref;
- DMUS_OBJECTDESC *pDesc;
} IDirectMusicMotifTrack;
/* IDirectMusicMotifTrack IDirectMusicTrack8 part: */
@@ -50,7 +50,7 @@ static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *
IsEqualIID(riid, &IID_IDirectMusicTrack8))
*ret_iface = iface;
else if (IsEqualIID(riid, &IID_IPersistStream))
- *ret_iface = &This->PersistStreamVtbl;
+ *ret_iface = &This->dmobj.IPersistStream_iface;
else {
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE;
@@ -248,52 +248,21 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
IDirectMusicTrack8Impl_Join
};
-/* IDirectMusicMotifTrack IPersistStream part: */
-static HRESULT WINAPI IDirectMusicMotifTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
- ICOM_THIS_MULTI(IDirectMusicMotifTrack, PersistStreamVtbl, iface);
- return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj);
-}
-
-static ULONG WINAPI IDirectMusicMotifTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
- ICOM_THIS_MULTI(IDirectMusicMotifTrack, PersistStreamVtbl, iface);
- return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface);
-}
-
-static ULONG WINAPI IDirectMusicMotifTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
- ICOM_THIS_MULTI(IDirectMusicMotifTrack, PersistStreamVtbl, iface);
- return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface);
-}
-
-static HRESULT WINAPI IDirectMusicMotifTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI IDirectMusicMotifTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI IDirectMusicMotifTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) {
+static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *stream)
+{
FIXME(": Loading not implemented yet\n");
return S_OK;
}
-static HRESULT WINAPI IDirectMusicMotifTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) {
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI IDirectMusicMotifTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) {
- return E_NOTIMPL;
-}
-
-static const IPersistStreamVtbl DirectMusicMotifTrack_PersistStream_Vtbl = {
- IDirectMusicMotifTrack_IPersistStream_QueryInterface,
- IDirectMusicMotifTrack_IPersistStream_AddRef,
- IDirectMusicMotifTrack_IPersistStream_Release,
- IDirectMusicMotifTrack_IPersistStream_GetClassID,
- IDirectMusicMotifTrack_IPersistStream_IsDirty,
- IDirectMusicMotifTrack_IPersistStream_Load,
- IDirectMusicMotifTrack_IPersistStream_Save,
- IDirectMusicMotifTrack_IPersistStream_GetSizeMax
+static const IPersistStreamVtbl persiststream_vtbl = {
+ dmobj_IPersistStream_QueryInterface,
+ dmobj_IPersistStream_AddRef,
+ dmobj_IPersistStream_Release,
+ dmobj_IPersistStream_GetClassID,
+ unimpl_IPersistStream_IsDirty,
+ IPersistStreamImpl_Load,
+ unimpl_IPersistStream_Save,
+ unimpl_IPersistStream_GetSizeMax
};
/* for ClassFactory */
@@ -308,12 +277,10 @@ HRESULT WINAPI create_dmmotiftrack(REFIID lpcGUID, void **ppobj)
return E_OUTOFMEMORY;
}
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
- track->PersistStreamVtbl = &DirectMusicMotifTrack_PersistStream_Vtbl;
- track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
- DM_STRUCT_INIT(track->pDesc);
- track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
- track->pDesc->guidClass = CLSID_DirectMusicMotifTrack;
track->ref = 1;
+ dmobject_init(&track->dmobj, &CLSID_DirectMusicMotifTrack,
+ (IUnknown *)&track->IDirectMusicTrack8_iface);
+ track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
DMSTYLE_LockModule();
hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);
diff --git a/dlls/dmstyle/tests/dmstyle.c b/dlls/dmstyle/tests/dmstyle.c
index d611c9a..e98b29c 100644
--- a/dlls/dmstyle/tests/dmstyle.c
+++ b/dlls/dmstyle/tests/dmstyle.c
@@ -257,7 +257,7 @@ static void test_track(void)
{ X(DirectMusicAuditionTrack), TRUE, FALSE, FALSE },
{ X(DirectMusicChordTrack), TRUE, TRUE, FALSE },
{ X(DirectMusicCommandTrack), TRUE, TRUE, TRUE },
- { X(DirectMusicMotifTrack), FALSE, FALSE, TRUE },
+ { X(DirectMusicMotifTrack), FALSE, FALSE, FALSE },
{ X(DirectMusicMuteTrack), TRUE, FALSE, FALSE },
{ X(DirectMusicStyleTrack), FALSE, TRUE, FALSE },
};
More information about the wine-cvs
mailing list