From: Zebediah Figura Subject: [PATCH 06/12] imaadp32.acm: Remove unnecessary checks. Message-Id: <20170606201501.6502-6-z.figura12@gmail.com> Date: Tue, 6 Jun 2017 15:14:55 -0500 In-Reply-To: <20170606201501.6502-1-z.figura12@gmail.com> References: <20170606201501.6502-1-z.figura12@gmail.com> These are already checked in msacm32 or not checked on Windows. Signed-off-by: Zebediah Figura --- 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