dsound: Get rid of redundant NULL check.

This commit is contained in:
Jörg Höhle 2009-10-04 14:30:50 +02:00 committed by Alexandre Julliard
parent 203c538aaa
commit 6aac7cfafa
1 changed files with 12 additions and 18 deletions

View File

@ -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,