Michael Stefaniuc : wscript: Use the ARRAY_SIZE() macro.
Alexandre Julliard
julliard at winehq.org
Fri Jul 13 15:01:47 CDT 2018
Module: wine
Branch: master
Commit: f140ad6e05c650f7234d2d72e8dd7e7cc8ec62a9
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f140ad6e05c650f7234d2d72e8dd7e7cc8ec62a9
Author: Michael Stefaniuc <mstefani at winehq.org>
Date: Fri Jul 13 19:01:27 2018 +0200
wscript: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/wscript/host.c | 6 +++---
programs/wscript/main.c | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/programs/wscript/host.c b/programs/wscript/host.c
index fb95c0c..fb1c86f 100644
--- a/programs/wscript/host.c
+++ b/programs/wscript/host.c
@@ -84,7 +84,7 @@ static void print_string(const WCHAR *string)
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), string, len, &count, NULL);
if(ret) {
static const WCHAR crnlW[] = {'\r','\n'};
- WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), crnlW, sizeof(crnlW)/sizeof(*crnlW), &count, NULL);
+ WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), crnlW, ARRAY_SIZE(crnlW), &count, NULL);
return;
}
@@ -183,7 +183,7 @@ static HRESULT WINAPI Host_get_FullName(IHost *iface, BSTR *out_Path)
WINE_TRACE("(%p)\n", out_Path);
- if(GetModuleFileNameW(NULL, fullPath, sizeof(fullPath)/sizeof(WCHAR)) == 0)
+ if(GetModuleFileNameW(NULL, fullPath, ARRAY_SIZE(fullPath)) == 0)
return E_FAIL;
if(!(*out_Path = SysAllocString(fullPath)))
return E_OUTOFMEMORY;
@@ -198,7 +198,7 @@ static HRESULT WINAPI Host_get_Path(IHost *iface, BSTR *out_Path)
WINE_TRACE("(%p)\n", out_Path);
- if(GetModuleFileNameW(NULL, path, sizeof(path)/sizeof(WCHAR)) == 0)
+ if(GetModuleFileNameW(NULL, path, ARRAY_SIZE(path)) == 0)
return E_FAIL;
pos = strrchrW(path, '\\');
howMany = pos - path;
diff --git a/programs/wscript/main.c b/programs/wscript/main.c
index 3537f9d..1cbb9e7 100644
--- a/programs/wscript/main.c
+++ b/programs/wscript/main.c
@@ -253,7 +253,7 @@ static BOOL get_engine_clsid(const WCHAR *ext, CLSID *clsid)
if(res != ERROR_SUCCESS)
return FALSE;
- size = sizeof(fileid)/sizeof(WCHAR);
+ size = ARRAY_SIZE(fileid);
res = RegQueryValueW(hkey, NULL, fileid, &size);
RegCloseKey(hkey);
if(res != ERROR_SUCCESS)
@@ -266,7 +266,7 @@ static BOOL get_engine_clsid(const WCHAR *ext, CLSID *clsid)
if(res != ERROR_SUCCESS)
return FALSE;
- size = sizeof(progid)/sizeof(WCHAR);
+ size = ARRAY_SIZE(progid);
res = RegQueryValueW(hkey, NULL, progid, &size);
RegCloseKey(hkey);
if(res != ERROR_SUCCESS)
@@ -446,8 +446,8 @@ int WINAPI wWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cm
WINE_FIXME("No file name specified\n");
return 1;
}
- res = GetFullPathNameW(filename, sizeof(scriptFullName)/sizeof(WCHAR), scriptFullName, &filepart);
- if(!res || res > sizeof(scriptFullName)/sizeof(WCHAR))
+ res = GetFullPathNameW(filename, ARRAY_SIZE(scriptFullName), scriptFullName, &filepart);
+ if(!res || res > ARRAY_SIZE(scriptFullName))
return 1;
ext = strrchrW(filepart, '.');
More information about the wine-cvs
mailing list