additional winearts patch

Jeremy Shaw jeremy.shaw at lindows.com
Thu Jan 8 13:45:56 CST 2004


This patch is an addition to my previous patch based on the discussion
on wine-devel.

I changed a HeapFree()/HeapAlloc() to a HeapRealloc().
I changed *bytes to equal 0 anytime we write less bytes that we expected we could.
I assign pointers to NULL after a HeapFree().

Jeremy Shaw.

--- orig/dlls/winmm/winearts/audio.c
+++ mod/dlls/winmm/winearts/audio.c
@@ -288,7 +288,7 @@
   if(wwo->sound_buffer)
   {
     HeapFree(GetProcessHeap(), 0, wwo->sound_buffer);
-    wwo->sound_buffer = 0;
+    wwo->sound_buffer = NULL;
   }
 
   wwo->buffer_size = 0;
@@ -465,6 +465,7 @@
 {
     CloseHandle(mr->msg_event);
     HeapFree(GetProcessHeap(),0,mr->messages);
+    mr->messages=NULL;
     DeleteCriticalSection(&mr->msg_crst);
     return 0;
 }
@@ -718,8 +719,8 @@
     {
       if(wwo->sound_buffer)
       {
-	HeapFree(GetProcessHeap(), 0, wwo->sound_buffer);
-	wwo->sound_buffer = 0;
+	HeapRealloc(GetProcessHeap(), 0, wwo->sound_buffer, toWrite);
+	wwo->buffer_size = toWrite;
       }
     }
 
@@ -777,7 +778,11 @@
     else
         wwo->dwPartialOffset += written;    /* Remove the amount written */
 
-    *bytes -= written;
+    if (written < toWrite)
+	*bytes = 0;
+    else
+	*bytes -= written;
+
     wwo->dwWrittenTotal += written; /* update stats on this wave device */
 
     return written; /* return the number of bytes written */



More information about the wine-patches mailing list