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

Alexandre Julliard julliard at winehq.org
Fri Jul 13 15:01:47 CDT 2018


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Fri Jul 13 19:01:26 2018 +0200

xcopy: Use the ARRAY_SIZE() macro.

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

---

 programs/xcopy/xcopy.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/programs/xcopy/xcopy.c b/programs/xcopy/xcopy.c
index cdf0bdf..616c7d2 100644
--- a/programs/xcopy/xcopy.c
+++ b/programs/xcopy/xcopy.c
@@ -84,7 +84,7 @@ static WCHAR *XCOPY_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);
     }
@@ -269,7 +269,7 @@ static BOOL XCOPY_ProcessExcludeFile(WCHAR* filename, WCHAR* endOfName) {
     }
 
     /* Process line by line */
-    while (fgetws(buffer, sizeof(buffer)/sizeof(WCHAR), inFile) != NULL) {
+    while (fgetws(buffer, ARRAY_SIZE(buffer), inFile) != NULL) {
         EXCLUDELIST *thisEntry;
         int length = lstrlenW(buffer);
 
@@ -840,9 +840,9 @@ static int XCOPY_ParseCommandLine(WCHAR *suppliedsource,
                                   /* Debug info: */
                                   FileTimeToSystemTime (&dateRange, &st);
                                   GetDateFormatW(0, DATE_SHORTDATE, &st, NULL, datestring,
-                                                 sizeof(datestring)/sizeof(WCHAR));
+                                                 ARRAY_SIZE(datestring));
                                   GetTimeFormatW(0, TIME_NOSECONDS, &st,
-                                                 NULL, timestring, sizeof(timestring)/sizeof(WCHAR));
+                                                 NULL, timestring, ARRAY_SIZE(timestring));
 
                                   WINE_TRACE("Date being used is: %s %s\n",
                                              wine_dbgstr_w(datestring), wine_dbgstr_w(timestring));
@@ -987,7 +987,7 @@ static int XCOPY_ProcessSourceParm(WCHAR *suppliedsource, WCHAR *stem,
             lstrcpyW(spec, suppliedsource+2);
         } else {
             WCHAR curdir[MAXSTRING];
-            GetCurrentDirectoryW(sizeof(curdir)/sizeof(WCHAR), curdir);
+            GetCurrentDirectoryW(ARRAY_SIZE(curdir), curdir);
             stem[0] = curdir[0];
             stem[1] = curdir[1];
             stem[2] = 0x00;




More information about the wine-cvs mailing list