dmusic: Use more sensible and consistent field names for IDirectMusic8Impl.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2017-05-10 14:43:59 +02:00 committed by Alexandre Julliard
parent 251d1c0b86
commit b75e8bc6bd
2 changed files with 19 additions and 25 deletions

View File

@ -72,9 +72,9 @@ static ULONG WINAPI IDirectMusic8Impl_Release(LPDIRECTMUSIC8 iface)
TRACE("(%p)->(): new ref = %u\n", This, ref); TRACE("(%p)->(): new ref = %u\n", This, ref);
if (!ref) { if (!ref) {
IReferenceClock_Release(&This->pMasterClock->IReferenceClock_iface); IReferenceClock_Release(&This->master_clock->IReferenceClock_iface);
HeapFree(GetProcessHeap(), 0, This->system_ports); HeapFree(GetProcessHeap(), 0, This->system_ports);
HeapFree(GetProcessHeap(), 0, This->ppPorts); HeapFree(GetProcessHeap(), 0, This->ports);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
DMUSIC_UnlockModule(); DMUSIC_UnlockModule();
} }
@ -92,7 +92,7 @@ static HRESULT WINAPI IDirectMusic8Impl_EnumPort(LPDIRECTMUSIC8 iface, DWORD ind
if (!port_caps) if (!port_caps)
return E_POINTER; return E_POINTER;
if (index >= This->nb_system_ports) if (index >= This->num_system_ports)
return S_FALSE; return S_FALSE;
*port_caps = This->system_ports[index].caps; *port_caps = This->system_ports[index].caps;
@ -156,12 +156,12 @@ static HRESULT WINAPI IDirectMusic8Impl_CreatePort(LPDIRECTMUSIC8 iface, REFCLSI
*port = NULL; *port = NULL;
return hr; return hr;
} }
This->nrofports++; This->num_ports++;
if (!This->ppPorts) if (!This->ports)
This->ppPorts = HeapAlloc(GetProcessHeap(), 0, sizeof(LPDIRECTMUSICPORT) * This->nrofports); This->ports = HeapAlloc(GetProcessHeap(), 0, sizeof(IDirectMusicPort *) * This->num_ports);
else else
This->ppPorts = HeapReAlloc(GetProcessHeap(), 0, This->ppPorts, sizeof(LPDIRECTMUSICPORT) * This->nrofports); This->ports = HeapReAlloc(GetProcessHeap(), 0, This->ports, sizeof(IDirectMusicPort *) * This->num_ports);
This->ppPorts[This->nrofports - 1] = new_port; This->ports[This->num_ports - 1] = new_port;
*port = new_port; *port = new_port;
return S_OK; return S_OK;
} }
@ -209,9 +209,9 @@ static HRESULT WINAPI IDirectMusic8Impl_GetMasterClock(LPDIRECTMUSIC8 iface, LPG
TRACE("(%p)->(%p, %p)\n", This, guid_clock, reference_clock); TRACE("(%p)->(%p, %p)\n", This, guid_clock, reference_clock);
if (guid_clock) if (guid_clock)
*guid_clock = This->pMasterClock->pClockInfo.guidClock; *guid_clock = This->master_clock->pClockInfo.guidClock;
if (reference_clock) { if (reference_clock) {
*reference_clock = &This->pMasterClock->IReferenceClock_iface; *reference_clock = &This->master_clock->IReferenceClock_iface;
IReferenceClock_AddRef(*reference_clock); IReferenceClock_AddRef(*reference_clock);
} }
@ -235,9 +235,9 @@ static HRESULT WINAPI IDirectMusic8Impl_Activate(LPDIRECTMUSIC8 iface, BOOL enab
TRACE("(%p)->(%u)\n", This, enable); TRACE("(%p)->(%u)\n", This, enable);
for (i = 0; i < This->nrofports; i++) for (i = 0; i < This->num_ports; i++)
{ {
hr = IDirectMusicPort_Activate(This->ppPorts[i], enable); hr = IDirectMusicPort_Activate(This->ports[i], enable);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
} }
@ -396,7 +396,7 @@ static void create_system_ports_list(IDirectMusic8Impl* object)
if (FAILED(hr)) if (FAILED(hr))
nb_ports--; nb_ports--;
object->nb_system_ports = nb_ports; object->num_system_ports = nb_ports;
} }
/* For ClassFactory */ /* For ClassFactory */
@ -417,10 +417,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicImpl(LPCGUID riid, LPVOID* ret_iface, LPU
dmusic->IDirectMusic8_iface.lpVtbl = &DirectMusic8_Vtbl; dmusic->IDirectMusic8_iface.lpVtbl = &DirectMusic8_Vtbl;
dmusic->ref = 1; dmusic->ref = 1;
dmusic->pMasterClock = NULL; ret = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (void **)&dmusic->master_clock, NULL);
dmusic->ppPorts = NULL;
dmusic->nrofports = 0;
ret = DMUSIC_CreateReferenceClockImpl(&IID_IReferenceClock, (LPVOID*)&dmusic->pMasterClock, NULL);
if (FAILED(ret)) { if (FAILED(ret)) {
HeapFree(GetProcessHeap(), 0, dmusic); HeapFree(GetProcessHeap(), 0, dmusic);
return ret; return ret;

View File

@ -106,16 +106,13 @@ extern HRESULT DMUSIC_CreateDirectMusicInstrumentImpl (LPCGUID lpcGUID, LPVOID*
* IDirectMusic8Impl implementation structure * IDirectMusic8Impl implementation structure
*/ */
struct IDirectMusic8Impl { struct IDirectMusic8Impl {
/* IUnknown fields */
IDirectMusic8 IDirectMusic8_iface; IDirectMusic8 IDirectMusic8_iface;
LONG ref; LONG ref;
IReferenceClockImpl *master_clock;
/* IDirectMusicImpl fields */ IDirectMusicPort **ports;
IReferenceClockImpl* pMasterClock; int num_ports;
IDirectMusicPort** ppPorts; port_info *system_ports;
int nrofports; int num_system_ports;
port_info* system_ports;
int nb_system_ports;
}; };
/***************************************************************************** /*****************************************************************************