Jörg Höhle : dsound: Get rid of redundant NULL check.

Alexandre Julliard julliard at winehq.org
Tue Oct 6 10:35:47 CDT 2009


Module: wine
Branch: master
Commit: 6aac7cfafac114cc5aec84a27860802198dc90a6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6aac7cfafac114cc5aec84a27860802198dc90a6

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Sun Oct  4 14:30:50 2009 +0200

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,




More information about the wine-cvs mailing list