Module: wine Branch: master Commit: 0110dc24462761ba24b6c7bd9539a1232c11480c URL: https://gitlab.winehq.org/wine/wine/-/commit/0110dc24462761ba24b6c7bd9539a12...
Author: Rémi Bernon rbernon@codeweavers.com Date: Wed Sep 6 09:21:24 2023 +0200
dmusic: Get rid of the IDirectMusicInstrumentImpl typedef.
---
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;