[PATCH] ieframe: Use the ARRAY_SIZE() macro
Michael Stefaniuc
mstefani at winehq.org
Thu Aug 16 13:19:29 CDT 2018
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/ieframe/dochost.c | 2 +-
dlls/ieframe/ieframe_main.c | 2 +-
dlls/ieframe/iexplore.c | 10 +++++-----
dlls/ieframe/intshcut.c | 4 ++--
dlls/ieframe/navigate.c | 10 +++++-----
dlls/ieframe/oleobject.c | 2 +-
dlls/ieframe/shellbrowser.c | 2 +-
7 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/dlls/ieframe/dochost.c b/dlls/ieframe/dochost.c
index 424868d62e..d22ad3d18c 100644
--- a/dlls/ieframe/dochost.c
+++ b/dlls/ieframe/dochost.c
@@ -428,7 +428,7 @@ static void update_travellog(DocHost *This)
static const WCHAR about_schemeW[] = {'a','b','o','u','t',':'};
- if(This->url && !strncmpiW(This->url, about_schemeW, sizeof(about_schemeW)/sizeof(*about_schemeW))) {
+ if(This->url && !strncmpiW(This->url, about_schemeW, ARRAY_SIZE(about_schemeW))) {
TRACE("Skipping about URL\n");
return;
}
diff --git a/dlls/ieframe/ieframe_main.c b/dlls/ieframe/ieframe_main.c
index a862f9afe5..e207ce0575 100644
--- a/dlls/ieframe/ieframe_main.c
+++ b/dlls/ieframe/ieframe_main.c
@@ -91,7 +91,7 @@ static 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/ieframe/iexplore.c b/dlls/ieframe/iexplore.c
index aac1436239..1a83ee38bb 100644
--- a/dlls/ieframe/iexplore.c
+++ b/dlls/ieframe/iexplore.c
@@ -263,7 +263,7 @@ static void add_tbs_to_menu(HMENU menu)
WCHAR classes_key[] = {'S','o','f','t','w','a','r','e','\\',
'C','l','a','s','s','e','s','\\','C','L','S','I','D',0};
WCHAR guid[39];
- DWORD value_len = sizeof(guid)/sizeof(guid[0]);
+ DWORD value_len = ARRAY_SIZE(guid);
int i;
if(SHRegOpenUSKeyW(classes_key, KEY_READ, NULL, &classes_handle, TRUE) != ERROR_SUCCESS)
@@ -276,11 +276,11 @@ static void add_tbs_to_menu(HMENU menu)
for(i = 0; SHRegEnumUSValueW(toolbar_handle, i, guid, &value_len, NULL, NULL, NULL, SHREGENUM_HKLM) == ERROR_SUCCESS; i++)
{
WCHAR tb_name[100];
- DWORD tb_name_len = sizeof(tb_name)/sizeof(tb_name[0]);
+ DWORD tb_name_len = ARRAY_SIZE(tb_name);
HUSKEY tb_class_handle;
MENUITEMINFOW item;
LSTATUS ret;
- value_len = sizeof(guid)/sizeof(guid[0]);
+ value_len = ARRAY_SIZE(guid);
if(lstrlenW(guid) != 38)
{
@@ -418,7 +418,7 @@ static void add_tb_button(InternetExplorer *ie, int bmp, int cmd, int strId)
TBBUTTON btn;
WCHAR buf[30];
- LoadStringW(ieframe_instance, strId, buf, sizeof(buf)/sizeof(buf[0]));
+ LoadStringW(ieframe_instance, strId, buf, ARRAY_SIZE(buf));
btn.iBitmap = bmp;
btn.idCommand = cmd;
@@ -445,7 +445,7 @@ static void create_rebar(InternetExplorer *ie)
HIMAGELIST imagelist;
SIZE toolbar_size;
- LoadStringW(ieframe_instance, IDS_ADDRESS, addr, sizeof(addr)/sizeof(addr[0]));
+ LoadStringW(ieframe_instance, IDS_ADDRESS, addr, ARRAY_SIZE(addr));
hwndRebar = CreateWindowExW(WS_EX_TOOLWINDOW, REBARCLASSNAMEW, NULL,
WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN|RBS_VARHEIGHT|CCS_TOP|CCS_NODIVIDER, 0, 0, 0, 0,
diff --git a/dlls/ieframe/intshcut.c b/dlls/ieframe/intshcut.c
index 2376b1b424..4331bb9b0a 100644
--- a/dlls/ieframe/intshcut.c
+++ b/dlls/ieframe/intshcut.c
@@ -93,7 +93,7 @@ static BOOL run_winemenubuilder( const WCHAR *args )
WCHAR app[MAX_PATH];
void *redir;
- GetSystemDirectoryW( app, MAX_PATH - sizeof(menubuilder)/sizeof(WCHAR) );
+ GetSystemDirectoryW( app, MAX_PATH - ARRAY_SIZE( menubuilder ));
strcatW( app, menubuilder );
len = (strlenW( app ) + strlenW( args ) + 1) * sizeof(WCHAR);
@@ -278,7 +278,7 @@ static HRESULT WINAPI UniformResourceLocatorW_InvokeCommand(IUniformResourceLoca
return E_NOTIMPL;
}
- hres = CoInternetParseUrl(This->url, PARSE_SCHEMA, 0, app, sizeof(app)/sizeof(WCHAR), NULL, 0);
+ hres = CoInternetParseUrl(This->url, PARSE_SCHEMA, 0, app, ARRAY_SIZE(app), NULL, 0);
if(FAILED(hres))
return E_FAIL;
diff --git a/dlls/ieframe/navigate.c b/dlls/ieframe/navigate.c
index 658857fadd..96fb083005 100644
--- a/dlls/ieframe/navigate.c
+++ b/dlls/ieframe/navigate.c
@@ -111,7 +111,7 @@ static void set_status_text(BindStatusCallback *This, ULONG statuscode, LPCWSTR
fmt[0] = 0;
/* the format string must have one "%s" for the str */
LoadStringW(ieframe_instance, IDS_STATUSFMT_FIRST + statuscode, fmt, IDS_STATUSFMT_MAXLEN);
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), fmt, str);
+ snprintfW(buffer, ARRAY_SIZE(buffer), fmt, str);
}
V_VT(&arg) = VT_BSTR;
@@ -576,7 +576,7 @@ static void on_before_navigate2(DocHost *This, LPCWSTR url, SAFEARRAY *post_data
DISPPARAMS dispparams;
VARIANTARG params[7];
WCHAR file_path[MAX_PATH];
- DWORD file_path_len = sizeof(file_path) / sizeof(*file_path);
+ DWORD file_path_len = ARRAY_SIZE(file_path);
dispparams.cArgs = 7;
dispparams.cNamedArgs = 0;
@@ -642,7 +642,7 @@ static BOOL try_application_url(LPCWSTR url)
static const WCHAR wszURLProtocol[] = {'U','R','L',' ','P','r','o','t','o','c','o','l',0};
- hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, app, sizeof(app)/sizeof(WCHAR), NULL, 0);
+ hres = CoInternetParseUrl(url, PARSE_SCHEMA, 0, app, ARRAY_SIZE(app), NULL, 0);
if(FAILED(hres))
return FALSE;
@@ -674,7 +674,7 @@ static HRESULT create_moniker(LPCWSTR url, IMoniker **mon)
if(PathIsURLW(url))
return CreateURLMoniker(NULL, url, mon);
- size = sizeof(new_url)/sizeof(WCHAR);
+ size = ARRAY_SIZE(new_url);
hres = UrlApplySchemeW(url, new_url, &size, URL_APPLY_GUESSSCHEME | URL_APPLY_GUESSFILE | URL_APPLY_DEFAULT);
TRACE("was %s got %s\n", debugstr_w(url), debugstr_w(new_url));
if(FAILED(hres)) {
@@ -978,7 +978,7 @@ HRESULT navigate_url(DocHost *This, LPCWSTR url, const VARIANT *Flags,
}else {
DWORD size;
- size = sizeof(new_url)/sizeof(WCHAR);
+ size = ARRAY_SIZE(new_url);
hres = UrlApplySchemeW(url, new_url, &size,
URL_APPLY_GUESSSCHEME | URL_APPLY_GUESSFILE | URL_APPLY_DEFAULT);
if(FAILED(hres)) {
diff --git a/dlls/ieframe/oleobject.c b/dlls/ieframe/oleobject.c
index 1ff9a92666..22fe4b1848 100644
--- a/dlls/ieframe/oleobject.c
+++ b/dlls/ieframe/oleobject.c
@@ -385,7 +385,7 @@ static HRESULT WINAPI EnumOLEVERB_Next(IEnumOLEVERB *iface, ULONG celt, OLEVERB
if(pceltFetched)
*pceltFetched = 0;
- if(This->iter == sizeof(verbs)/sizeof(*verbs))
+ if(This->iter == ARRAY_SIZE(verbs))
return S_FALSE;
if(celt)
diff --git a/dlls/ieframe/shellbrowser.c b/dlls/ieframe/shellbrowser.c
index f75689e49a..78e0e85a79 100644
--- a/dlls/ieframe/shellbrowser.c
+++ b/dlls/ieframe/shellbrowser.c
@@ -658,7 +658,7 @@ static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(
VARIANT_BOOL cancel = VARIANT_FALSE;
SAFEARRAY *post_data;
WCHAR file_path[MAX_PATH];
- DWORD file_path_len = sizeof(file_path) / sizeof(*file_path);
+ DWORD file_path_len = ARRAY_SIZE(file_path);
TRACE("%p %p %s %x %s %p %d %s %d %p\n", This, pDispatch, debugstr_w(lpszUrl),
dwFlags, debugstr_w(lpszFrameName), pPostData, cbPostData,
--
2.14.4
More information about the wine-devel
mailing list