Michael Stefaniuc : msacm32: Avoid an ARRAY_SIZE-like macro.

Alexandre Julliard julliard at winehq.org
Thu Jul 12 17:45:40 CDT 2018


Module: wine
Branch: master
Commit: 756958f6113159ccba0ffe58c4c6d8b693cf2aa3
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=756958f6113159ccba0ffe58c4c6d8b693cf2aa3

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Wed Jul 11 22:06:17 2018 +0200

msacm32: Avoid an ARRAY_SIZE-like macro.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 d52662a..f26f125 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;




More information about the wine-cvs mailing list