Nikolay Sivov : wshom: Use ARRAY_SIZE() macro.
Module: wine Branch: master Commit: c0ba650969743026fd258c396049c5f4da7095bb URL: https://source.winehq.org/git/wine.git/?a=commit;h=c0ba650969743026fd258c396... Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Feb 27 01:47:57 2018 +0300 wshom: Use ARRAY_SIZE() macro. Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- 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 a023786..d7b36cf 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 0098b02..a44b44c 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 a10cf26..3d5eb1b 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,
participants (1)
-
Alexandre Julliard