Huw Davies : dsound: Merge two identical allocation blocks.

Alexandre Julliard julliard at winehq.org
Mon Feb 27 15:12:09 CST 2017


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Sun Feb 26 17:42:22 2017 +0000

dsound: Merge two identical allocation blocks.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dsound/primary.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index ed41a5c..b10ba02 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -238,19 +238,9 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device, WAVEFORMATEX *wfx,
         mixfloat = TRUE;
 
     /* reallocate emulated primary buffer */
-    if (forcewave) {
-        if (device->buffer)
-            newbuf = HeapReAlloc(GetProcessHeap(), 0, device->buffer, new_buflen);
-        else
-            newbuf = HeapAlloc(GetProcessHeap(), 0, new_buflen);
-
-        if (!newbuf) {
-            ERR("failed to allocate primary buffer\n");
-            return DSERR_OUTOFMEMORY;
-        }
-        FillMemory(newbuf, new_buflen, (wfx->wBitsPerSample == 8) ? 128 : 0);
-    } else if (!mixfloat) {
-        new_buflen = frames * sizeof(float);
+    if (forcewave || !mixfloat) {
+        if (!forcewave)
+            new_buflen = frames * sizeof(float);
 
         if (device->buffer)
             newbuf = HeapReAlloc(GetProcessHeap(), 0, device->buffer, new_buflen);




More information about the wine-cvs mailing list