[PATCH] clock: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Mon Jul 23 17:01:24 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 programs/clock/main.c     | 4 ++--
 programs/clock/winclock.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/programs/clock/main.c b/programs/clock/main.c
index 04bfe64424..3ad636be43 100644
--- a/programs/clock/main.c
+++ b/programs/clock/main.c
@@ -72,7 +72,7 @@ static VOID CLOCK_UpdateWindowCaption(VOID)
     /* Set frame caption */
     if (Globals.bDate) {
 	chars = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, NULL, NULL,
-                               szCaption, sizeof(szCaption)/sizeof(WCHAR));
+                               szCaption, ARRAY_SIZE(szCaption));
         if (chars) {
 	    --chars;
 	    szCaption[chars++] = ' ';
@@ -255,7 +255,7 @@ static int CLOCK_MenuCommand (WPARAM wParam)
         }
             /* show "about" box */
         case IDM_ABOUT: {
-            LoadStringW(Globals.hInstance, IDS_CLOCK, szApp, sizeof(szApp)/sizeof(WCHAR));
+            LoadStringW(Globals.hInstance, IDS_CLOCK, szApp, ARRAY_SIZE(szApp));
             lstrcpyW(szAppRelease,szApp);
             ShellAboutW(Globals.hMainWnd, szApp, szAppRelease, 0);
             break;
diff --git a/programs/clock/winclock.c b/programs/clock/winclock.c
index 0b2def11ab..53c3821d95 100644
--- a/programs/clock/winclock.c
+++ b/programs/clock/winclock.c
@@ -187,7 +187,7 @@ HFONT SizeFont(HDC dc, int x, int y, BOOL bSeconds, const LOGFONTW* font)
     int chars;
 
     chars = GetTimeFormatW(LOCALE_USER_DEFAULT, bSeconds ? 0 : TIME_NOSECONDS, NULL,
-                           NULL, szTime, sizeof(szTime)/sizeof(WCHAR));
+                           NULL, szTime, ARRAY_SIZE(szTime));
     if (!chars)
 	return 0;
 
@@ -219,7 +219,7 @@ void DigitalClock(HDC dc, int x, int y, BOOL bSeconds, HFONT font)
     int chars;
 
     chars = GetTimeFormatW(LOCALE_USER_DEFAULT, bSeconds ? 0 : TIME_NOSECONDS, NULL,
-                           NULL, szTime, sizeof(szTime)/sizeof(WCHAR));
+                           NULL, szTime, ARRAY_SIZE(szTime));
     if (!chars)
 	return;
     --chars;
-- 
2.14.4




More information about the wine-devel mailing list