[PATCH 2/2] wshom: Use ARRAY_SIZE() macro
Nikolay Sivov
nsivov at codeweavers.com
Mon Feb 26 16:47:57 CST 2018
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/wshom.ocx/shell.c | 8 ++++----
dlls/wshom.ocx/wshom_main.c | 2 +-
dlls/wshom.ocx/wshom_private.h | 2 ++
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/wshom.ocx/shell.c b/dlls/wshom.ocx/shell.c
index a023786cc1..d7b36cf6c7 100644
--- a/dlls/wshom.ocx/shell.c
+++ b/dlls/wshom.ocx/shell.c
@@ -859,7 +859,7 @@ static HRESULT WINAPI WshShortcut_get_Arguments(IWshShortcut *iface, BSTR *Argum
*Arguments = NULL;
- hr = IShellLinkW_GetArguments(This->link, buffW, sizeof(buffW)/sizeof(WCHAR));
+ hr = IShellLinkW_GetArguments(This->link, buffW, ARRAY_SIZE(buffW));
if (FAILED(hr))
return hr;
@@ -917,7 +917,7 @@ static HRESULT WINAPI WshShortcut_get_IconLocation(IWshShortcut *iface, BSTR *Ic
if (!IconPath)
return E_POINTER;
- hr = IShellLinkW_GetIconLocation(This->link, buffW, sizeof(buffW)/sizeof(WCHAR), &icon);
+ hr = IShellLinkW_GetIconLocation(This->link, buffW, ARRAY_SIZE(buffW), &icon);
if (FAILED(hr)) return hr;
sprintfW(pathW, fmtW, buffW, icon);
@@ -1006,7 +1006,7 @@ static HRESULT WINAPI WshShortcut_get_WorkingDirectory(IWshShortcut *iface, BSTR
return E_POINTER;
*WorkingDirectory = NULL;
- hr = IShellLinkW_GetWorkingDirectory(This->link, buffW, sizeof(buffW)/sizeof(WCHAR));
+ hr = IShellLinkW_GetWorkingDirectory(This->link, buffW, ARRAY_SIZE(buffW));
if (FAILED(hr)) return hr;
*WorkingDirectory = SysAllocString(buffW);
@@ -1395,7 +1395,7 @@ static HKEY get_root_key(const WCHAR *path)
};
int i;
- for (i = 0; i < sizeof(rootkeys)/sizeof(rootkeys[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(rootkeys); i++) {
if (!strncmpW(path, rootkeys[i].full, strlenW(rootkeys[i].full)))
return rootkeys[i].hkey;
if (rootkeys[i].abbrev[0] && !strncmpW(path, rootkeys[i].abbrev, strlenW(rootkeys[i].abbrev)))
diff --git a/dlls/wshom.ocx/wshom_main.c b/dlls/wshom.ocx/wshom_main.c
index 0098b026a0..a44b44ce8f 100644
--- a/dlls/wshom.ocx/wshom_main.c
+++ b/dlls/wshom.ocx/wshom_main.c
@@ -107,7 +107,7 @@ void release_typelib(void)
if(!typelib)
return;
- for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
+ for(i = 0; i < ARRAY_SIZE(typeinfos); i++)
if(typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
diff --git a/dlls/wshom.ocx/wshom_private.h b/dlls/wshom.ocx/wshom_private.h
index a10cf2683a..3d5eb1b8c1 100644
--- a/dlls/wshom.ocx/wshom_private.h
+++ b/dlls/wshom.ocx/wshom_private.h
@@ -25,6 +25,8 @@
#include "ole2.h"
#include "olectl.h"
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
+
/* typelibs */
typedef enum tid_t {
NULL_tid,
--
2.16.1
More information about the wine-devel
mailing list