wavemap open bug patch

Robert Reif reif at earthlink.net
Sun May 30 21:22:45 CDT 2004


Fixes a bug where wrong a return value was returned when mapping is not 
possible.
-------------- next part --------------
Index: dlls/winmm/wavemap/wavemap.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/wavemap/wavemap.c,v
retrieving revision 1.32
diff -u -r1.32 wavemap.c
--- dlls/winmm/wavemap/wavemap.c	5 Sep 2003 23:08:27 -0000	1.32
+++ dlls/winmm/wavemap/wavemap.c	31 May 2004 02:19:31 -0000
@@ -121,6 +121,7 @@
 			      DWORD dwFlags)
 {
     DWORD	ret;
+    TRACE("(%p, %04x, %p, %p, %08lx)\n", wom, idx, lpDesc, lpwfx, dwFlags);
 
     /* destination is always PCM, so the formulas below apply */
     lpwfx->nBlockAlign = (lpwfx->nChannels * lpwfx->wBitsPerSample) / 8;
@@ -138,6 +139,7 @@
 	    wom->hAcmStream = 0;
 	}
     }
+    WARN("ret = %08lx\n", ret);
     return ret;
 }
 
@@ -146,6 +148,7 @@
     UINT 		ndlo, ndhi;
     UINT		i;
     WAVEMAPDATA*	wom = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEMAPDATA));
+    DWORD               res;
 
     TRACE("(%p %p %08lx)\n", lpdwUser, lpDesc, dwFlags);
 
@@ -187,7 +190,7 @@
         /* try some ACM stuff */
 
 #define	TRY(sps,bps)    wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
-                        switch (wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
+                        switch (res=wodOpenHelper(wom, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
                             case MMSYSERR_NOERROR: wom->avgSpeedInner = wfx.nAvgBytesPerSec; goto found; \
                             case WAVERR_BADFORMAT: break; \
                             default: goto error; \
@@ -255,6 +258,11 @@
     return MMSYSERR_NOERROR;
 error:
     HeapFree(GetProcessHeap(), 0, wom);
+    if (res==ACMERR_NOTPOSSIBLE) {
+        WARN("ret = WAVERR_BADFORMAT\n");
+        return WAVERR_BADFORMAT;
+    }
+    WARN("ret = MMSYSERR_ERROR\n");
     return MMSYSERR_ERROR;
 }
 
@@ -594,6 +602,7 @@
     UINT 		ndlo, ndhi;
     UINT		i;
     WAVEMAPDATA*	wim = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEMAPDATA));
+    DWORD               res;
 
     TRACE("(%p %p %08lx)\n", lpdwUser, lpDesc, dwFlags);
 
@@ -635,7 +644,7 @@
         /* try some ACM stuff */
         
 #define	TRY(sps,bps)    wfx.nSamplesPerSec = (sps); wfx.wBitsPerSample = (bps); \
-                        switch (widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
+                        switch (res=widOpenHelper(wim, i, lpDesc, &wfx, dwFlags | WAVE_FORMAT_DIRECT)) { \
                         case MMSYSERR_NOERROR: wim->avgSpeedInner = wfx.nAvgBytesPerSec; goto found; \
                         case WAVERR_BADFORMAT: break; \
                         default: goto error; \
@@ -702,6 +711,11 @@
     return MMSYSERR_NOERROR;
 error:
     HeapFree(GetProcessHeap(), 0, wim);
+    if (res==ACMERR_NOTPOSSIBLE) {
+        WARN("ret = WAVERR_BADFORMAT\n");
+        return WAVERR_BADFORMAT;
+    }
+    WARN("ret = MMSYSERR_ERROR\n");
     return MMSYSERR_ERROR;
 }
 


More information about the wine-patches mailing list