[PATCH] msgsm32.acm: Avoid an ARRAY_SIZE-like macro
Andrew Eikum
aeikum at codeweavers.com
Thu Jul 12 11:15:06 CDT 2018
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Wed, Jul 11, 2018 at 10:06:11PM +0200, Michael Stefaniuc wrote:
> Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
> ---
> dlls/msgsm32.acm/msgsm32.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/dlls/msgsm32.acm/msgsm32.c b/dlls/msgsm32.acm/msgsm32.c
> index cce1303455..99eef9624e 100644
> --- a/dlls/msgsm32.acm/msgsm32.c
> +++ b/dlls/msgsm32.acm/msgsm32.c
> @@ -199,7 +199,6 @@ static BOOL GSM_FormatValidate(const WAVEFORMATEX *wfx)
> }
>
> static const DWORD gsm_rates[] = { 8000, 11025, 22050, 44100, 48000, 96000 };
> -#define NUM_RATES (sizeof(gsm_rates)/sizeof(*gsm_rates))
>
> /***********************************************************************
> * GSM_FormatTagDetails
> @@ -241,13 +240,13 @@ static LRESULT GSM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
> case 0:
> aftd->dwFormatTag = WAVE_FORMAT_PCM;
> aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
> - aftd->cStandardFormats = NUM_RATES;
> + aftd->cStandardFormats = ARRAY_SIZE(gsm_rates);
> lstrcpyW(aftd->szFormatTag, szPcm);
> break;
> case 1:
> aftd->dwFormatTag = WAVE_FORMAT_GSM610;
> aftd->cbFormatSize = sizeof(GSM610WAVEFORMAT);
> - aftd->cStandardFormats = NUM_RATES;
> + aftd->cStandardFormats = ARRAY_SIZE(gsm_rates);
> lstrcpyW(aftd->szFormatTag, szGsm);
> break;
> }
> @@ -270,7 +269,7 @@ static LRESULT GSM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
> switch (afd->dwFormatTag)
> {
> case WAVE_FORMAT_PCM:
> - if (afd->dwFormatIndex >= NUM_RATES) return ACMERR_NOTPOSSIBLE;
> + if (afd->dwFormatIndex >= ARRAY_SIZE(gsm_rates)) return ACMERR_NOTPOSSIBLE;
> afd->pwfx->nChannels = 1;
> afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex];
> afd->pwfx->wBitsPerSample = 16;
> @@ -278,7 +277,7 @@ static LRESULT GSM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
> afd->pwfx->nAvgBytesPerSec = afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign;
> break;
> case WAVE_FORMAT_GSM610:
> - if (afd->dwFormatIndex >= NUM_RATES) return ACMERR_NOTPOSSIBLE;
> + if (afd->dwFormatIndex >= ARRAY_SIZE(gsm_rates)) return ACMERR_NOTPOSSIBLE;
> afd->pwfx->nChannels = 1;
> afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex];
> afd->pwfx->wBitsPerSample = 0;
> --
> 2.14.4
>
>
>
More information about the wine-devel
mailing list