Michael Stefaniuc : dmloader: Use the ARRAY_SIZE() macro.

Alexandre Julliard julliard at winehq.org
Tue Oct 23 16:10:03 CDT 2018


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Tue Oct 23 19:42:30 2018 +0200

dmloader: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dmloader/debug.c  | 10 +++++-----
 dlls/dmloader/loader.c |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/dmloader/debug.c b/dlls/dmloader/debug.c
index 9d48776..d072391 100644
--- a/dlls/dmloader/debug.c
+++ b/dlls/dmloader/debug.c
@@ -269,7 +269,7 @@ const char *debugstr_dmguid (const GUID *id) {
 	unsigned int i;
 
 	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))
 			return guids[i].name;
 	}
@@ -416,7 +416,7 @@ const char *debugstr_dmreturn (DWORD code) {
 	};
 	
 	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)
 			return codes[i].name;
 	}
@@ -461,7 +461,7 @@ static const char *debugstr_DMUS_OBJ_FLAGS (DWORD flagmask) {
 	    FE(DMUS_OBJ_MEMORY),
 	    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 */
@@ -469,7 +469,7 @@ static const char *debugstr_DMUS_CONTAINER_FLAGS (DWORD flagmask) {
     static const flag_info flags[] = {
 	    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 */
@@ -477,7 +477,7 @@ static const char *debugstr_DMUS_CONTAINED_OBJF_FLAGS (DWORD flagmask) {
     static const flag_info flags[] = {
 	    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 */
diff --git a/dlls/dmloader/loader.c b/dlls/dmloader/loader.c
index 10a2151..8b979da 100644
--- a/dlls/dmloader/loader.c
+++ b/dlls/dmloader/loader.c
@@ -894,9 +894,9 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_LoadObjectFromFile(IDirectMusicLoad
 	*/
         get_search_path(This, rguidClassID, wszLoaderSearchPath);
     /* 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 */
-		!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 */
 		TRACE(": cannot find file\n");
 		return DMUS_E_LOADER_FAILEDOPEN;




More information about the wine-cvs mailing list