[PATCH 06/12] imaadp32.acm: Remove unnecessary checks.

Zebediah Figura z.figura12 at gmail.com
Tue Jun 6 15:14:55 CDT 2017


These are already checked in msacm32 or not checked on Windows.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/imaadp32.acm/imaadp32.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/dlls/imaadp32.acm/imaadp32.c b/dlls/imaadp32.acm/imaadp32.c
index 78a0ac4c6c..da1acd6b9f 100644
--- a/dlls/imaadp32.acm/imaadp32.c
+++ b/dlls/imaadp32.acm/imaadp32.c
@@ -614,7 +614,6 @@ static	LRESULT	ADPCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
 	switch (afd->dwFormatTag)
         {
 	case WAVE_FORMAT_PCM:
-	    if (afd->dwFormatIndex >= NUM_PCM_FORMATS) return ACMERR_NOTPOSSIBLE;
 	    afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels;
 	    afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate;
 	    afd->pwfx->wBitsPerSample = PCM_Formats[afd->dwFormatIndex].nBits;
@@ -627,18 +626,14 @@ static	LRESULT	ADPCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
 		afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign;
 	    break;
 	case WAVE_FORMAT_IMA_ADPCM:
-	    if (afd->dwFormatIndex >= NUM_ADPCM_FORMATS) return ACMERR_NOTPOSSIBLE;
 	    afd->pwfx->nChannels = ADPCM_Formats[afd->dwFormatIndex].nChannels;
 	    afd->pwfx->nSamplesPerSec = ADPCM_Formats[afd->dwFormatIndex].rate;
 	    afd->pwfx->wBitsPerSample = ADPCM_Formats[afd->dwFormatIndex].nBits;
 	    afd->pwfx->nBlockAlign = 1024;
 	    /* we got 4 bits per sample */
-	    afd->pwfx->nAvgBytesPerSec =
-		(afd->pwfx->nSamplesPerSec * 4) / 8;
-            if (afd->cbwfx >= sizeof(WAVEFORMATEX))
-                afd->pwfx->cbSize = sizeof(WORD);
-            if (afd->cbwfx >= sizeof(IMAADPCMWAVEFORMAT))
-                ((IMAADPCMWAVEFORMAT*)afd->pwfx)->wSamplesPerBlock = (1024 - 4 * afd->pwfx->nChannels) * (2 / afd->pwfx->nChannels) + 1;
+            afd->pwfx->nAvgBytesPerSec = (afd->pwfx->nSamplesPerSec * 4) / 8;
+            afd->pwfx->cbSize = sizeof(WORD);
+            ((IMAADPCMWAVEFORMAT*)afd->pwfx)->wSamplesPerBlock = (1024 - 4 * afd->pwfx->nChannels) * (2 / afd->pwfx->nChannels) + 1;
 	    break;
 	default:
             WARN("Unsupported tag %08x\n", afd->dwFormatTag);
@@ -662,9 +657,7 @@ static	LRESULT	ADPCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
 static	LRESULT	ADPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
 {
     /* some tests ... */
-    if (adfs->cbwfxSrc < sizeof(PCMWAVEFORMAT) ||
-	adfs->cbwfxDst < sizeof(PCMWAVEFORMAT) ||
-	adfs->pwfxSrc->wFormatTag == adfs->pwfxDst->wFormatTag ||
+    if (adfs->pwfxSrc->wFormatTag == adfs->pwfxDst->wFormatTag ||
 	ADPCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
 
     /* If no suggestion for destination, then copy source value */
@@ -692,14 +685,12 @@ static	LRESULT	ADPCM_FormatSuggest(PACMDRVFORMATSUGGEST adfs)
     switch (adfs->pwfxDst->wFormatTag)
     {
     case WAVE_FORMAT_PCM:
-        if (adfs->cbwfxSrc < sizeof(IMAADPCMWAVEFORMAT)) return ACMERR_NOTPOSSIBLE;
         adfs->pwfxDst->nBlockAlign = (adfs->pwfxDst->nChannels * adfs->pwfxDst->wBitsPerSample) / 8;
         adfs->pwfxDst->nAvgBytesPerSec = adfs->pwfxDst->nSamplesPerSec * adfs->pwfxDst->nBlockAlign;
         /* check if result is ok */
         if (ADPCM_GetFormatIndex(adfs->pwfxDst) == 0xFFFFFFFF) return ACMERR_NOTPOSSIBLE;
         break;
     case WAVE_FORMAT_IMA_ADPCM:
-        if (adfs->cbwfxDst < sizeof(IMAADPCMWAVEFORMAT)) return ACMERR_NOTPOSSIBLE;
         init_wfx_ima_adpcm((IMAADPCMWAVEFORMAT*)adfs->pwfxDst);
         /* FIXME: not handling header overhead */
         TRACE("setting spb=%u\n", ((IMAADPCMWAVEFORMAT*)adfs->pwfxDst)->wSamplesPerBlock);
-- 
2.13.0




More information about the wine-patches mailing list