[PATCH] xcopy: Use the ARRAY_SIZE() macro
Michael Stefaniuc
mstefani at winehq.org
Fri Jul 13 12:01:26 CDT 2018
Signed-off-by: Michael Stefaniuc <mstefani 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 cdf0bdfb26..616c7d2700 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;
--
2.14.4
More information about the wine-devel
mailing list