wshom: Use ARRAY_SIZE() macro.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-02-27 01:47:57 +03:00 committed by Alexandre Julliard
parent db2a3b7028
commit c0ba650969
3 changed files with 7 additions and 5 deletions

View File

@ -859,7 +859,7 @@ static HRESULT WINAPI WshShortcut_get_Arguments(IWshShortcut *iface, BSTR *Argum
*Arguments = NULL; *Arguments = NULL;
hr = IShellLinkW_GetArguments(This->link, buffW, sizeof(buffW)/sizeof(WCHAR)); hr = IShellLinkW_GetArguments(This->link, buffW, ARRAY_SIZE(buffW));
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
@ -917,7 +917,7 @@ static HRESULT WINAPI WshShortcut_get_IconLocation(IWshShortcut *iface, BSTR *Ic
if (!IconPath) if (!IconPath)
return E_POINTER; 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; if (FAILED(hr)) return hr;
sprintfW(pathW, fmtW, buffW, icon); sprintfW(pathW, fmtW, buffW, icon);
@ -1006,7 +1006,7 @@ static HRESULT WINAPI WshShortcut_get_WorkingDirectory(IWshShortcut *iface, BSTR
return E_POINTER; return E_POINTER;
*WorkingDirectory = NULL; *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; if (FAILED(hr)) return hr;
*WorkingDirectory = SysAllocString(buffW); *WorkingDirectory = SysAllocString(buffW);
@ -1395,7 +1395,7 @@ static HKEY get_root_key(const WCHAR *path)
}; };
int i; 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))) if (!strncmpW(path, rootkeys[i].full, strlenW(rootkeys[i].full)))
return rootkeys[i].hkey; return rootkeys[i].hkey;
if (rootkeys[i].abbrev[0] && !strncmpW(path, rootkeys[i].abbrev, strlenW(rootkeys[i].abbrev))) if (rootkeys[i].abbrev[0] && !strncmpW(path, rootkeys[i].abbrev, strlenW(rootkeys[i].abbrev)))

View File

@ -107,7 +107,7 @@ void release_typelib(void)
if(!typelib) if(!typelib)
return; return;
for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++) for(i = 0; i < ARRAY_SIZE(typeinfos); i++)
if(typeinfos[i]) if(typeinfos[i])
ITypeInfo_Release(typeinfos[i]); ITypeInfo_Release(typeinfos[i]);

View File

@ -25,6 +25,8 @@
#include "ole2.h" #include "ole2.h"
#include "olectl.h" #include "olectl.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
/* typelibs */ /* typelibs */
typedef enum tid_t { typedef enum tid_t {
NULL_tid, NULL_tid,