[PATCH] attrib: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Mon Jul 23 17:01:23 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 programs/attrib/attrib.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/programs/attrib/attrib.c b/programs/attrib/attrib.c
index a5742048bc..79a599aafd 100644
--- a/programs/attrib/attrib.c
+++ b/programs/attrib/attrib.c
@@ -36,7 +36,7 @@ static WCHAR *ATTRIB_LoadMessage(UINT id)
     static WCHAR msg[MAXSTRING];
     const WCHAR failedMsg[]  = {'F', 'a', 'i', 'l', 'e', 'd', '!', 0};
 
-    if (!LoadStringW(GetModuleHandleW(NULL), id, msg, sizeof(msg)/sizeof(WCHAR))) {
+    if (!LoadStringW(GetModuleHandleW(NULL), id, msg, ARRAY_SIZE(msg))) {
         WINE_FIXME("LoadString failed with %d\n", GetLastError());
         lstrcpyW(msg, failedMsg);
     }
@@ -236,7 +236,7 @@ static BOOL ATTRIB_processdirectory(const WCHAR *rootdir, const WCHAR *filespec,
                 strcpyW(buffer, rootdir);
                 strcatW(buffer, fd.cFileName);
                 ATTRIB_wprintf(fmt, flags, buffer);
-                for (count = 0; count < (sizeof(flags)/sizeof(WCHAR) - 1); count++) flags[count] = ' ';
+                for (count = 0; count < (ARRAY_SIZE(flags) - 1); count++) flags[count] = ' ';
                 found = TRUE;
             }
         } while (FindNextFileW(hff, &fd) != 0);
@@ -302,7 +302,7 @@ int wmain(int argc, WCHAR *argv[])
     /* Name may be a relative or explicit path, so calculate curdir based on
        current locations, stripping off the filename                         */
     WINE_TRACE("Supplied name: '%s'\n", wine_dbgstr_w(originalname));
-    GetFullPathNameW(originalname, sizeof(curdir)/sizeof(WCHAR), curdir, &namepart);
+    GetFullPathNameW(originalname, ARRAY_SIZE(curdir), curdir, &namepart);
     WINE_TRACE("Result: '%s'\n", wine_dbgstr_w(curdir));
     if (namepart) {
         strcpyW(name, namepart);
-- 
2.14.4




More information about the wine-devel mailing list