[PATCH v2] msacm32: Avoid an ARRAY_SIZE-like macro
Andrew Eikum
aeikum at codeweavers.com
Thu Jul 12 08:30:35 CDT 2018
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Wed, Jul 11, 2018 at 10:06:17PM +0200, Michael Stefaniuc wrote:
> Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
> ---
> v2: Keep the <TAB> indentation
>
>
> dlls/msacm32/pcmconverter.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/dlls/msacm32/pcmconverter.c b/dlls/msacm32/pcmconverter.c
> index d52662ac76..f26f125fcd 100644
> --- a/dlls/msacm32/pcmconverter.c
> +++ b/dlls/msacm32/pcmconverter.c
> @@ -71,7 +71,6 @@ static DWORD PCM_drvClose(DWORD dwDevID)
> return 1;
> }
>
> -#define NUM_PCM_FORMATS (sizeof(PCM_Formats) / sizeof(PCM_Formats[0]))
> #define NUM_OF(a,b) ((a)/(b))
>
> /* flags for fdwDriver */
> @@ -114,7 +113,7 @@ static DWORD PCM_GetFormatIndex(LPWAVEFORMATEX wfx)
> unsigned int i;
> TRACE("(%p)\n", wfx);
>
> - for (i = 0; i < NUM_PCM_FORMATS; i++) {
> + for (i = 0; i < ARRAY_SIZE(PCM_Formats); i++) {
> if (wfx->nChannels == PCM_Formats[i].nChannels &&
> wfx->nSamplesPerSec == PCM_Formats[i].rate &&
> wfx->wBitsPerSample == PCM_Formats[i].nBits)
> @@ -1035,7 +1034,7 @@ static LRESULT PCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
> aftd->dwFormatTag = WAVE_FORMAT_PCM;
> aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
> aftd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CONVERTER;
> - aftd->cStandardFormats = NUM_PCM_FORMATS;
> + aftd->cStandardFormats = ARRAY_SIZE(PCM_Formats);
> aftd->szFormatTag[0] = 0;
>
> return MMSYSERR_NOERROR;
> @@ -1057,7 +1056,7 @@ static LRESULT PCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
> }
> break;
> case ACM_FORMATDETAILSF_INDEX:
> - assert(afd->dwFormatIndex < NUM_PCM_FORMATS);
> + assert(afd->dwFormatIndex < ARRAY_SIZE(PCM_Formats));
> afd->pwfx->wFormatTag = WAVE_FORMAT_PCM;
> afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels;
> afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate;
> --
> 2.14.4
>
>
>
More information about the wine-devel
mailing list