[PATCH] inetcpl.cpl: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Fri Jul 20 14:45:46 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/inetcpl.cpl/connections.c |  9 ++++-----
 dlls/inetcpl.cpl/general.c     |  4 ++--
 dlls/inetcpl.cpl/security.c    | 10 +++++-----
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/dlls/inetcpl.cpl/connections.c b/dlls/inetcpl.cpl/connections.c
index 707fb3c4f7..648cd3d002 100644
--- a/dlls/inetcpl.cpl/connections.c
+++ b/dlls/inetcpl.cpl/connections.c
@@ -273,13 +273,12 @@ static INT_PTR connections_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
     }
     TRACE("ProxyEnable set to %x\n", use_proxy);
 
-    proxy_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_SERVER,
-            proxy, sizeof(proxy)/sizeof(proxy[0]));
+    proxy_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_SERVER, proxy, ARRAY_SIZE(proxy));
     if(proxy_len)
     {
         proxy[proxy_len++] = ':';
-        port_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_PORT,
-            proxy+proxy_len, sizeof(proxy)/sizeof(proxy[0])-proxy_len);
+        port_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_PORT, proxy+proxy_len,
+                ARRAY_SIZE(proxy)-proxy_len);
         if(!port_len)
         {
             proxy[proxy_len++] = '8';
@@ -305,7 +304,7 @@ static INT_PTR connections_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
 
     use_pac_script = IsDlgButtonChecked(hwnd, IDC_USE_PAC_SCRIPT);
     pac_script_len = GetDlgItemTextW(hwnd, IDC_EDIT_PAC_SCRIPT,
-            pac_script, sizeof(pac_script)/sizeof(pac_script[0]));
+            pac_script, ARRAY_SIZE(pac_script));
     if(!pac_script_len) use_pac_script = FALSE;
     if(use_pac_script)
     {
diff --git a/dlls/inetcpl.cpl/general.c b/dlls/inetcpl.cpl/general.c
index e0f473caf7..b9fbf1eb0a 100644
--- a/dlls/inetcpl.cpl/general.c
+++ b/dlls/inetcpl.cpl/general.c
@@ -263,10 +263,10 @@ static INT_PTR general_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
     if (psn->hdr.code == PSN_APPLY)
     {
         *buffer = 0;
-        GetDlgItemTextW(hwnd, IDC_HOME_EDIT, buffer, sizeof(buffer)/sizeof(WCHAR));
+        GetDlgItemTextW(hwnd, IDC_HOME_EDIT, buffer, ARRAY_SIZE(buffer));
         TRACE("EDITTEXT has %s\n", debugstr_w(buffer));
 
-        res = parse_url_from_outside(buffer, parsed, sizeof(parsed)/sizeof(WCHAR));
+        res = parse_url_from_outside(buffer, parsed, ARRAY_SIZE(parsed));
         TRACE("got %d with %s\n", res, debugstr_w(parsed));
 
         if (res)
diff --git a/dlls/inetcpl.cpl/security.c b/dlls/inetcpl.cpl/security.c
index 543ada433d..e11caf1fc3 100644
--- a/dlls/inetcpl.cpl/security.c
+++ b/dlls/inetcpl.cpl/security.c
@@ -73,7 +73,7 @@ static DWORD url_templates[] = {URLTEMPLATE_CUSTOM,
 static DWORD index_from_urltemplate(URLTEMPLATE value)
 {
 
-    DWORD index = sizeof(url_templates) / sizeof(url_templates[0]);
+    DWORD index = ARRAY_SIZE(url_templates);
 
     while((index > 0) && (url_templates[index-1] != value))
         index--;
@@ -105,12 +105,12 @@ static void update_security_level(secdlg_data *sd, DWORD lv_index, DWORD tb_inde
         current_index = (tb_index > 0) ? tb_index : index_from_urltemplate(sd->levels[lv_index]);
 
         name[0] = 0;
-        LoadStringW(hcpl, IDS_SEC_LEVEL0 + current_index, name, sizeof(name)/sizeof(name[0]));
+        LoadStringW(hcpl, IDS_SEC_LEVEL0 + current_index, name, ARRAY_SIZE(name));
         TRACE("new level #%d: %s\n", current_index, debugstr_w(name));
         SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_LEVEL), name);
 
         name[0] = 0;
-        LoadStringW(hcpl, IDS_SEC_LEVEL0_INFO + (current_index * 0x10), name, sizeof(name)/sizeof(name[0]));
+        LoadStringW(hcpl, IDS_SEC_LEVEL0_INFO + (current_index * 0x10), name, ARRAY_SIZE(name));
         TRACE("new level info: %s\n", debugstr_w(name));
         SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_LEVEL_INFO), name);
 
@@ -134,8 +134,8 @@ static void update_zone_info(secdlg_data *sd, DWORD lv_index)
 
     SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_ZONE_INFO), za->szDescription);
 
-    len = LoadStringW(hcpl, IDS_SEC_SETTINGS, name, sizeof(name)/sizeof(*name));
-    lstrcpynW(&name[len], za->szDisplayName, sizeof(name)/sizeof(*name) - len - 1);
+    len = LoadStringW(hcpl, IDS_SEC_SETTINGS, name, ARRAY_SIZE(name));
+    lstrcpynW(&name[len], za->szDisplayName, ARRAY_SIZE(name) - len - 1);
 
     TRACE("new title: %s\n", debugstr_w(name));
     SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_GROUP), name);
-- 
2.14.4




More information about the wine-devel mailing list