From 419d6692d58b980ccf93b1f2aebcd1c6d26f5056 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: dsound: Get rid of redundant NULL check. --- dlls/dsound/capture.c | 32 +++++++++++++------------------- 1 files changed, 13 insertions(+), 19 deletions(-) diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c index 312c90f..0e75dd7 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); - - 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); - } + 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)); + 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, -- 1.5.6.3