[PATCH 2/2] dsound: Use a better name for IDirectSoundBufferImpl_Create()
Michael Stefaniuc
mstefani at redhat.de
Tue Dec 22 03:50:34 CST 2015
Signed-off-by: Michael Stefaniuc <mstefani at redhat.de>
---
dlls/dsound/buffer.c | 24 +++++++++---------------
dlls/dsound/dsound.c | 7 ++-----
dlls/dsound/dsound_private.h | 6 ++----
3 files changed, 13 insertions(+), 24 deletions(-)
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c
index d7717fd..2a80c3f 100644
--- a/dlls/dsound/buffer.c
+++ b/dlls/dsound/buffer.c
@@ -983,19 +983,15 @@ static const IDirectSoundBuffer8Vtbl dsbvt =
IDirectSoundBufferImpl_GetObjectInPath
};
-HRESULT IDirectSoundBufferImpl_Create(
- DirectSoundDevice * device,
- IDirectSoundBufferImpl **pdsb,
- LPCDSBUFFERDESC dsbd)
+HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *dsbd,
+ IDirectSoundBuffer **buffer)
{
IDirectSoundBufferImpl *dsb;
LPWAVEFORMATEX wfex = dsbd->lpwfxFormat;
HRESULT err = DS_OK;
DWORD capf = 0;
- TRACE("(%p,%p,%p)\n",device,pdsb,dsbd);
-
- *pdsb = NULL;
+ TRACE("(%p,%p,%p)\n", device, dsbd, buffer);
if (dsbd->dwBufferBytes < DSBSIZE_MIN || dsbd->dwBufferBytes > DSBSIZE_MAX) {
WARN("invalid parameter: dsbd->dwBufferBytes = %d\n", dsbd->dwBufferBytes);
@@ -1107,14 +1103,12 @@ HRESULT IDirectSoundBufferImpl_Create(
RtlInitializeResource(&dsb->lock);
- /* register buffer if not primary */
- if (!(dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER)) {
- err = DirectSoundDevice_AddBuffer(device, dsb);
- if (err == DS_OK)
- *pdsb = dsb;
- else
- IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
- }
+ /* register buffer */
+ err = DirectSoundDevice_AddBuffer(device, dsb);
+ if (err == DS_OK)
+ *buffer = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface;
+ else
+ IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
return err;
}
diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c
index e50ef58..ccefd1f 100644
--- a/dlls/dsound/dsound.c
+++ b/dlls/dsound/dsound.c
@@ -469,8 +469,6 @@ static HRESULT DirectSoundDevice_CreateSoundBuffer(
WARN("primarybuffer_create() failed\n");
}
} else {
- IDirectSoundBufferImpl * dsb;
-
if (dsbd->lpwfxFormat == NULL) {
WARN("invalid parameter: dsbd->lpwfxFormat can't be NULL for "
"secondary buffer\n");
@@ -547,9 +545,8 @@ static HRESULT DirectSoundDevice_CreateSoundBuffer(
return DSERR_INVALIDPARAM;
}
- hres = IDirectSoundBufferImpl_Create(device, &dsb, dsbd);
- if (dsb) {
- *ppdsb = (IDirectSoundBuffer*)&dsb->IDirectSoundBuffer8_iface;
+ hres = secondarybuffer_create(device, dsbd, ppdsb);
+ if (SUCCEEDED(hres)) {
if (dsbd->dwFlags & DSBCAPS_LOCHARDWARE)
device->drvcaps.dwFreeHwMixingAllBuffers--;
} else
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index 9c001ed..07bda48 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -182,10 +182,8 @@ void put_stereo2quad(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel
void put_mono2surround51(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN;
void put_stereo2surround51(const IDirectSoundBufferImpl *dsb, DWORD pos, DWORD channel, float value) DECLSPEC_HIDDEN;
-HRESULT IDirectSoundBufferImpl_Create(
- DirectSoundDevice *device,
- IDirectSoundBufferImpl **ppdsb,
- LPCDSBUFFERDESC dsbd) DECLSPEC_HIDDEN;
+HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *dsbd,
+ IDirectSoundBuffer **buffer) DECLSPEC_HIDDEN;
HRESULT IDirectSoundBufferImpl_Duplicate(
DirectSoundDevice *device,
IDirectSoundBufferImpl **ppdsb,
--
2.4.3
More information about the wine-patches
mailing list