[PATCH] localui: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Mon Jul 30 14:18:07 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
This time with the signed off


 dlls/localui/localui.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/localui/localui.c b/dlls/localui/localui.c
index 9fb975cd85..77c8bf0d76 100644
--- a/dlls/localui/localui.c
+++ b/dlls/localui/localui.c
@@ -375,7 +375,7 @@ static INT_PTR CALLBACK dlgproc_lptconfig(HWND hwnd, UINT msg, WPARAM wparam, LP
             status = FALSE;
             res = GetDlgItemInt(hwnd, LPTCONFIG_EDIT, (BOOL *) &status, FALSE);
             /* length is in WCHAR, including the '\0' */
-            GetDlgItemTextW(hwnd, LPTCONFIG_EDIT, bufferW, sizeof(bufferW) / sizeof(bufferW[0]));
+            GetDlgItemTextW(hwnd, LPTCONFIG_EDIT, bufferW, ARRAY_SIZE(bufferW));
             TRACE("got %s and %u (translated: %u)\n", debugstr_w(bufferW), res, status);
 
             /* native localui.dll use the same limits */
@@ -416,10 +416,10 @@ static DWORD get_type_from_name(LPCWSTR name)
 {
     HANDLE  hfile;
 
-    if (!strncmpiW(name, portname_LPT, sizeof(portname_LPT) / sizeof(WCHAR) -1))
+    if (!strncmpiW(name, portname_LPT, ARRAY_SIZE(portname_LPT) -1))
         return PORT_IS_LPT;
 
-    if (!strncmpiW(name, portname_COM, sizeof(portname_COM) / sizeof(WCHAR) -1))
+    if (!strncmpiW(name, portname_COM, ARRAY_SIZE(portname_COM) -1))
         return PORT_IS_COM;
 
     if (!strcmpiW(name, portname_FILE))
@@ -431,10 +431,10 @@ static DWORD get_type_from_name(LPCWSTR name)
     if (name[0] == '|')
         return PORT_IS_PIPE;
 
-    if (!strncmpW(name, portname_CUPS, sizeof(portname_CUPS) / sizeof(WCHAR) -1))
+    if (!strncmpW(name, portname_CUPS, ARRAY_SIZE(portname_CUPS) -1))
         return PORT_IS_CUPS;
 
-    if (!strncmpW(name, portname_LPR, sizeof(portname_LPR) / sizeof(WCHAR) -1))
+    if (!strncmpW(name, portname_LPR, ARRAY_SIZE(portname_LPR) -1))
         return PORT_IS_LPR;
 
     /* Must be a file or a directory. Does the file exist ? */
-- 
2.14.4




More information about the wine-devel mailing list