dmstyle: Use the generic IPersistStream for DMChordTrack.

This commit is contained in:
Michael Stefaniuc 2015-07-01 09:22:32 +02:00 committed by Alexandre Julliard
parent 9a653533d3
commit 0248befa25
1 changed files with 27 additions and 57 deletions

View File

@ -19,6 +19,7 @@
*/ */
#include "dmstyle_private.h" #include "dmstyle_private.h"
#include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); WINE_DEFAULT_DEBUG_CHANNEL(dmstyle);
WINE_DECLARE_DEBUG_CHANNEL(dmfile); WINE_DECLARE_DEBUG_CHANNEL(dmfile);
@ -28,9 +29,8 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile);
*/ */
typedef struct IDirectMusicChordTrack { typedef struct IDirectMusicChordTrack {
IDirectMusicTrack8 IDirectMusicTrack8_iface; IDirectMusicTrack8 IDirectMusicTrack8_iface;
const IPersistStreamVtbl *PersistStreamVtbl; struct dmobject dmobj; /* IPersistStream only */
LONG ref; LONG ref;
DMUS_OBJECTDESC *pDesc;
DWORD dwScale; DWORD dwScale;
} IDirectMusicChordTrack; } IDirectMusicChordTrack;
@ -53,7 +53,7 @@ static HRESULT WINAPI IDirectMusicTrack8Impl_QueryInterface(IDirectMusicTrack8 *
IsEqualIID(riid, &IID_IDirectMusicTrack8)) IsEqualIID(riid, &IID_IDirectMusicTrack8))
*ret_iface = iface; *ret_iface = iface;
else if (IsEqualIID(riid, &IID_IPersistStream)) else if (IsEqualIID(riid, &IID_IPersistStream))
*ret_iface = &This->PersistStreamVtbl; *ret_iface = &This->dmobj.IPersistStream_iface;
else { else {
WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface); WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ret_iface);
return E_NOINTERFACE; return E_NOINTERFACE;
@ -249,35 +249,6 @@ static const IDirectMusicTrack8Vtbl dmtrack8_vtbl = {
IDirectMusicTrack8Impl_Join IDirectMusicTrack8Impl_Join
}; };
/* IDirectMusicChordTrack IPersistStream part: */
static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_QueryInterface (LPPERSISTSTREAM iface, REFIID riid, LPVOID *ppobj) {
ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack8_QueryInterface(&This->IDirectMusicTrack8_iface, riid, ppobj);
}
static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_AddRef (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack8_AddRef(&This->IDirectMusicTrack8_iface);
}
static ULONG WINAPI IDirectMusicChordTrack_IPersistStream_Release (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
return IDirectMusicTrack8_Release(&This->IDirectMusicTrack8_iface);
}
static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetClassID (LPPERSISTSTREAM iface, CLSID* pClassID) {
ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
TRACE("(%p, %p)\n", This, pClassID);
*pClassID = CLSID_DirectMusicChordTrack;
return S_OK;
}
static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_IsDirty (LPPERSISTSTREAM iface) {
ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface);
FIXME("(%p): stub, always S_FALSE\n", This);
return S_FALSE;
}
static HRESULT parse_chordtrack_list(IDirectMusicChordTrack *This, DMUS_PRIVATE_CHUNK *pChunk, static HRESULT parse_chordtrack_list(IDirectMusicChordTrack *This, DMUS_PRIVATE_CHUNK *pChunk,
IStream *pStm) IStream *pStm)
{ {
@ -354,9 +325,14 @@ static HRESULT parse_chordtrack_list(IDirectMusicChordTrack *This, DMUS_PRIVATE_
return S_OK; return S_OK;
} }
static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREAM iface, IStream* pStm) { static inline IDirectMusicChordTrack *impl_from_IPersistStream(IPersistStream *iface)
ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); {
return CONTAINING_RECORD(iface, IDirectMusicChordTrack, dmobj.IPersistStream_iface);
}
static HRESULT WINAPI IPersistStreamImpl_Load(IPersistStream *iface, IStream *pStm)
{
IDirectMusicChordTrack *This = impl_from_IPersistStream(iface);
DMUS_PRIVATE_CHUNK Chunk; DMUS_PRIVATE_CHUNK Chunk;
LARGE_INTEGER liMove; LARGE_INTEGER liMove;
HRESULT hr; HRESULT hr;
@ -397,27 +373,23 @@ static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Load (LPPERSISTSTREA
return S_OK; return S_OK;
} }
static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty) { static HRESULT WINAPI IPersistStreamImpl_Save(IPersistStream *iface, IStream *stream,
ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); BOOL cleardirty)
{
IDirectMusicChordTrack *This = impl_from_IPersistStream(iface);
FIXME("(%p): Saving not implemented yet\n", This); FIXME("(%p): Saving not implemented yet\n", This);
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI IDirectMusicChordTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize) { static const IPersistStreamVtbl persiststream_vtbl = {
ICOM_THIS_MULTI(IDirectMusicChordTrack, PersistStreamVtbl, iface); dmobj_IPersistStream_QueryInterface,
FIXME("(%p, %p): stub\n", This, pcbSize); dmobj_IPersistStream_AddRef,
return E_NOTIMPL; dmobj_IPersistStream_Release,
} dmobj_IPersistStream_GetClassID,
unimpl_IPersistStream_IsDirty,
static const IPersistStreamVtbl DirectMusicChordTrack_PersistStream_Vtbl = { IPersistStreamImpl_Load,
IDirectMusicChordTrack_IPersistStream_QueryInterface, IPersistStreamImpl_Save,
IDirectMusicChordTrack_IPersistStream_AddRef, unimpl_IPersistStream_GetSizeMax
IDirectMusicChordTrack_IPersistStream_Release,
IDirectMusicChordTrack_IPersistStream_GetClassID,
IDirectMusicChordTrack_IPersistStream_IsDirty,
IDirectMusicChordTrack_IPersistStream_Load,
IDirectMusicChordTrack_IPersistStream_Save,
IDirectMusicChordTrack_IPersistStream_GetSizeMax
}; };
/* for ClassFactory */ /* for ClassFactory */
@ -432,12 +404,10 @@ HRESULT WINAPI create_dmchordtrack(REFIID lpcGUID, void **ppobj)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl; track->IDirectMusicTrack8_iface.lpVtbl = &dmtrack8_vtbl;
track->PersistStreamVtbl = &DirectMusicChordTrack_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_DirectMusicChordTrack;
track->ref = 1; track->ref = 1;
dmobject_init(&track->dmobj, &CLSID_DirectMusicChordTrack,
(IUnknown *)&track->IDirectMusicTrack8_iface);
track->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
DMSTYLE_LockModule(); DMSTYLE_LockModule();
hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj); hr = IDirectMusicTrack8_QueryInterface(&track->IDirectMusicTrack8_iface, lpcGUID, ppobj);