[4/4] msacm32: Quit on unsupported destination format in PCM_FormatSuggest

Bruno Jesus 00cpxxx at gmail.com
Tue Sep 8 23:10:55 CDT 2015


Some minor tab/space fixes too. Reviewed by Andrew Eikum.

Fixes https://bugs.winehq.org/show_bug.cgi?id=14193
-------------- next part --------------

---
 dlls/msacm32/pcmconverter.c | 21 +++++++++++++--------
 dlls/msacm32/tests/msacm.c  |  1 -
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/dlls/msacm32/pcmconverter.c b/dlls/msacm32/pcmconverter.c
index cf92d93..f56d155 100644
--- a/dlls/msacm32/pcmconverter.c
+++ b/dlls/msacm32/pcmconverter.c
@@ -839,28 +839,33 @@ static	LRESULT	PCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
 
     /* some tests ... */
     if (adfs->cbwfxSrc < sizeof(PCMWAVEFORMAT) ||
-	adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) ||
-	PCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) {
+        adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) ||
+        PCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) {
             WARN("not possible\n");
             return ACMERR_NOTPOSSIBLE;
     }
 
     /* is no suggestion for destination, then copy source value */
     if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS)) {
-	adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
+        adfs->pwfxDst->nChannels = adfs->pwfxSrc->nChannels;
     }
     if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NSAMPLESPERSEC)) {
-	adfs->pwfxDst->nSamplesPerSec = adfs->pwfxSrc->nSamplesPerSec;
+        adfs->pwfxDst->nSamplesPerSec = adfs->pwfxSrc->nSamplesPerSec;
     }
     if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WBITSPERSAMPLE)) {
-	adfs->pwfxDst->wBitsPerSample = adfs->pwfxSrc->wBitsPerSample;
+        adfs->pwfxDst->wBitsPerSample = adfs->pwfxSrc->wBitsPerSample;
     }
     if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_WFORMATTAG)) {
-	if (adfs->pwfxSrc->wFormatTag != WAVE_FORMAT_PCM) {
-            WARN("not possible\n");
+        if (adfs->pwfxSrc->wFormatTag != WAVE_FORMAT_PCM) {
+            WARN("source format 0x%x not supported\n", adfs->pwfxSrc->wFormatTag);
+            return ACMERR_NOTPOSSIBLE;
+        }
+        adfs->pwfxDst->wFormatTag = adfs->pwfxSrc->wFormatTag;
+    } else {
+        if (adfs->pwfxDst->wFormatTag != WAVE_FORMAT_PCM) {
+            WARN("destination format 0x%x not supported\n", adfs->pwfxDst->wFormatTag);
             return ACMERR_NOTPOSSIBLE;
         }
-	adfs->pwfxDst->wFormatTag = adfs->pwfxSrc->wFormatTag;
     }
     /* check if result is ok */
     if (PCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) {
diff --git a/dlls/msacm32/tests/msacm.c b/dlls/msacm32/tests/msacm.c
index e897fc9..88ad330 100644
--- a/dlls/msacm32/tests/msacm.c
+++ b/dlls/msacm32/tests/msacm.c
@@ -652,7 +652,6 @@ todo_wine
             | ACM_FORMATSUGGESTF_WBITSPERSAMPLE
             | ACM_FORMATSUGGESTF_WFORMATTAG;
     rc = acmFormatSuggest(NULL, &src, &dst, sizeof(dst), suggest);
-todo_wine
     ok(rc == ACMERR_NOTPOSSIBLE, "failed with error 0x%x\n", rc);
     memset(&dst, 0, sizeof(dst));
     suggest = 0;
-- 
2.1.4



More information about the wine-patches mailing list