dmloader: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-10-23 19:42:30 +02:00 committed by Alexandre Julliard
parent 4059759ccd
commit 47e57c58b6
2 changed files with 7 additions and 7 deletions

View File

@ -269,7 +269,7 @@ const char *debugstr_dmguid (const GUID *id) {
unsigned int i; unsigned int i;
if (!id) return "(null)"; if (!id) return "(null)";
for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) { for (i = 0; i < ARRAY_SIZE(guids); i++) {
if (IsEqualGUID(id, guids[i].guid)) if (IsEqualGUID(id, guids[i].guid))
return guids[i].name; return guids[i].name;
} }
@ -416,7 +416,7 @@ const char *debugstr_dmreturn (DWORD code) {
}; };
unsigned int i; unsigned int i;
for (i = 0; i < sizeof(codes)/sizeof(codes[0]); i++) { for (i = 0; i < ARRAY_SIZE(codes); i++) {
if (code == codes[i].val) if (code == codes[i].val)
return codes[i].name; return codes[i].name;
} }
@ -461,7 +461,7 @@ static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
FE(DMUS_OBJ_MEMORY), FE(DMUS_OBJ_MEMORY),
FE(DMUS_OBJ_STREAM) FE(DMUS_OBJ_STREAM)
}; };
return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0])); return debugstr_flags(flagmask, flags, ARRAY_SIZE(flags));
} }
/* dump DMUS_CONTAINER flags */ /* dump DMUS_CONTAINER flags */
@ -469,7 +469,7 @@ static const char *debugstr_DMUS_CONTAINER_FLAGS (DWORD flagmask) {
static const flag_info flags[] = { static const flag_info flags[] = {
FE(DMUS_CONTAINER_NOLOADS) FE(DMUS_CONTAINER_NOLOADS)
}; };
return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0])); return debugstr_flags(flagmask, flags, ARRAY_SIZE(flags));
} }
/* dump DMUS_CONTAINED_OBJF flags */ /* dump DMUS_CONTAINED_OBJF flags */
@ -477,7 +477,7 @@ static const char *debugstr_DMUS_CONTAINED_OBJF_FLAGS (DWORD flagmask) {
static const flag_info flags[] = { static const flag_info flags[] = {
FE(DMUS_CONTAINED_OBJF_KEEP) FE(DMUS_CONTAINED_OBJF_KEEP)
}; };
return debugstr_flags (flagmask, flags, sizeof(flags)/sizeof(flags[0])); return debugstr_flags(flagmask, flags, ARRAY_SIZE(flags));
} }
/* Dump whole DMUS_OBJECTDESC struct */ /* Dump whole DMUS_OBJECTDESC struct */

View File

@ -894,9 +894,9 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_LoadObjectFromFile(IDirectMusicLoad
*/ */
get_search_path(This, rguidClassID, wszLoaderSearchPath); get_search_path(This, rguidClassID, wszLoaderSearchPath);
/* search in current directory */ /* search in current directory */
if (!SearchPathW (NULL, pwzFilePath, NULL, sizeof(ObjDesc.wszFileName)/sizeof(WCHAR), ObjDesc.wszFileName, NULL) && if (!SearchPathW(NULL, pwzFilePath, NULL, ARRAY_SIZE(ObjDesc.wszFileName), ObjDesc.wszFileName, NULL) &&
/* search in loader's search path */ /* search in loader's search path */
!SearchPathW (wszLoaderSearchPath, pwzFilePath, NULL, sizeof(ObjDesc.wszFileName)/sizeof(WCHAR), ObjDesc.wszFileName, NULL)) { !SearchPathW(wszLoaderSearchPath, pwzFilePath, NULL, ARRAY_SIZE(ObjDesc.wszFileName), ObjDesc.wszFileName, NULL)) {
/* cannot find file */ /* cannot find file */
TRACE(": cannot find file\n"); TRACE(": cannot find file\n");
return DMUS_E_LOADER_FAILEDOPEN; return DMUS_E_LOADER_FAILEDOPEN;