msgsm32.acm: Avoid an ARRAY_SIZE-like macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-07-11 22:06:11 +02:00 committed by Alexandre Julliard
parent 29db422794
commit 8abd579252
1 changed files with 4 additions and 5 deletions

View File

@ -199,7 +199,6 @@ static BOOL GSM_FormatValidate(const WAVEFORMATEX *wfx)
} }
static const DWORD gsm_rates[] = { 8000, 11025, 22050, 44100, 48000, 96000 }; static const DWORD gsm_rates[] = { 8000, 11025, 22050, 44100, 48000, 96000 };
#define NUM_RATES (sizeof(gsm_rates)/sizeof(*gsm_rates))
/*********************************************************************** /***********************************************************************
* GSM_FormatTagDetails * GSM_FormatTagDetails
@ -241,13 +240,13 @@ static LRESULT GSM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd, DWORD dwQuery)
case 0: case 0:
aftd->dwFormatTag = WAVE_FORMAT_PCM; aftd->dwFormatTag = WAVE_FORMAT_PCM;
aftd->cbFormatSize = sizeof(PCMWAVEFORMAT); aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
aftd->cStandardFormats = NUM_RATES; aftd->cStandardFormats = ARRAY_SIZE(gsm_rates);
lstrcpyW(aftd->szFormatTag, szPcm); lstrcpyW(aftd->szFormatTag, szPcm);
break; break;
case 1: case 1:
aftd->dwFormatTag = WAVE_FORMAT_GSM610; aftd->dwFormatTag = WAVE_FORMAT_GSM610;
aftd->cbFormatSize = sizeof(GSM610WAVEFORMAT); aftd->cbFormatSize = sizeof(GSM610WAVEFORMAT);
aftd->cStandardFormats = NUM_RATES; aftd->cStandardFormats = ARRAY_SIZE(gsm_rates);
lstrcpyW(aftd->szFormatTag, szGsm); lstrcpyW(aftd->szFormatTag, szGsm);
break; break;
} }
@ -270,7 +269,7 @@ static LRESULT GSM_FormatDetails(PACMFORMATDETAILSW afd, DWORD dwQuery)
switch (afd->dwFormatTag) switch (afd->dwFormatTag)
{ {
case WAVE_FORMAT_PCM: 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->nChannels = 1;
afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex]; afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex];
afd->pwfx->wBitsPerSample = 16; 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; afd->pwfx->nAvgBytesPerSec = afd->pwfx->nSamplesPerSec * afd->pwfx->nBlockAlign;
break; break;
case WAVE_FORMAT_GSM610: 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->nChannels = 1;
afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex]; afd->pwfx->nSamplesPerSec = gsm_rates[afd->dwFormatIndex];
afd->pwfx->wBitsPerSample = 0; afd->pwfx->wBitsPerSample = 0;