From 6aac7cfafac114cc5aec84a27860802198dc90a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20H=C3=B6hle?= Date: Sun, 4 Oct 2009 14:30:50 +0200 Subject: [PATCH] dsound: Get rid of redundant NULL check. --- dlls/dsound/capture.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c index 312c90f92cd..0e75dd74132 100644 --- a/dlls/dsound/capture.c +++ b/dlls/dsound/capture.c @@ -1351,7 +1351,7 @@ HRESULT IDirectSoundCaptureBufferImpl_Create( if ( ((lpcDSCBufferDesc->dwSize != sizeof(DSCBUFFERDESC)) && (lpcDSCBufferDesc->dwSize != sizeof(DSCBUFFERDESC1))) || (lpcDSCBufferDesc->dwBufferBytes == 0) || - (lpcDSCBufferDesc->lpwfxFormat == NULL) ) { + (lpcDSCBufferDesc->lpwfxFormat == NULL) ) { /* FIXME: DSERR_BADFORMAT ? */ WARN("invalid lpcDSCBufferDesc\n"); *ppobj = NULL; return DSERR_INVALIDPARAM; @@ -1359,25 +1359,19 @@ HRESULT IDirectSoundCaptureBufferImpl_Create( wfex = lpcDSCBufferDesc->lpwfxFormat; - if (wfex) { - TRACE("(formattag=0x%04x,chans=%d,samplerate=%d," - "bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n", - wfex->wFormatTag, wfex->nChannels, wfex->nSamplesPerSec, - wfex->nAvgBytesPerSec, wfex->nBlockAlign, - wfex->wBitsPerSample, wfex->cbSize); + TRACE("(formattag=0x%04x,chans=%d,samplerate=%d," + "bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n", + wfex->wFormatTag, wfex->nChannels, wfex->nSamplesPerSec, + wfex->nAvgBytesPerSec, wfex->nBlockAlign, + wfex->wBitsPerSample, wfex->cbSize); - if (wfex->wFormatTag == WAVE_FORMAT_PCM) { - device->pwfx = HeapAlloc(GetProcessHeap(),0,sizeof(WAVEFORMATEX)); - *device->pwfx = *wfex; - device->pwfx->cbSize = 0; - } else { - device->pwfx = HeapAlloc(GetProcessHeap(),0,sizeof(WAVEFORMATEX)+wfex->cbSize); - CopyMemory(device->pwfx, wfex, sizeof(WAVEFORMATEX)+wfex->cbSize); - } + if (wfex->wFormatTag == WAVE_FORMAT_PCM) { + device->pwfx = HeapAlloc(GetProcessHeap(),0,sizeof(WAVEFORMATEX)); + CopyMemory(device->pwfx, wfex, sizeof(PCMWAVEFORMAT)); + device->pwfx->cbSize = 0; } else { - WARN("lpcDSCBufferDesc->lpwfxFormat == 0\n"); - *ppobj = NULL; - return DSERR_INVALIDPARAM; /* FIXME: DSERR_BADFORMAT ? */ + device->pwfx = HeapAlloc(GetProcessHeap(),0,sizeof(WAVEFORMATEX)+wfex->cbSize); + CopyMemory(device->pwfx, wfex, sizeof(WAVEFORMATEX)+wfex->cbSize); } *ppobj = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,