[PATCH] wineps.drv: Use the ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Thu Aug 9 13:59:34 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/wineps.drv/driver.c |  6 +++---
 dlls/wineps.drv/pen.c    | 10 +++++-----
 dlls/wineps.drv/type42.c |  4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/dlls/wineps.drv/driver.c b/dlls/wineps.drv/driver.c
index 612bf69df4..64d813a44c 100644
--- a/dlls/wineps.drv/driver.c
+++ b/dlls/wineps.drv/driver.c
@@ -285,7 +285,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
         res = di->pi->ppd->DefaultResolution;
         len = sprintfW(buf, resW, res);
         buf[len++] = ' ';
-        LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, sizeof(buf)/sizeof(buf[0]) - len);
+        LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len);
         SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf);
         SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_SETITEMDATA, 0, MAKELONG(res, res));
         Cursel = 0;
@@ -317,7 +317,7 @@ static INT_PTR CALLBACK PSDRV_PaperDlgProc(HWND hwnd, UINT msg,
             else
                 len = sprintfW(buf, resxyW, res->resx, res->resy);
             buf[len++] = ' ';
-            LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, sizeof(buf)/sizeof(buf[0]) - len);
+            LoadStringW(PSDRV_hInstance, IDS_DPI, buf + len, ARRAY_SIZE(buf) - len);
             idx = SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_ADDSTRING, 0, (LPARAM)buf);
             SendDlgItemMessageW(hwnd, IDD_QUALITY, CB_SETITEMDATA, idx, MAKELONG(res->resx, res->resy));
 
@@ -557,7 +557,7 @@ INT PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput,
     WCHAR SetupW[64];
     static const WCHAR PAPERW[] = {'P','A','P','E','R','\0'};
 
-    LoadStringW(PSDRV_hInstance, IDS_SETUP, SetupW, sizeof(SetupW)/sizeof(SetupW[0]));
+    LoadStringW(PSDRV_hInstance, IDS_SETUP, SetupW, ARRAY_SIZE(SetupW));
     hinstComctl32 = LoadLibraryA("comctl32.dll");
     pCreatePropertySheetPage = (void*)GetProcAddress(hinstComctl32,
 						    "CreatePropertySheetPageW");
diff --git a/dlls/wineps.drv/pen.c b/dlls/wineps.drv/pen.c
index 2526fa931f..b3ad60606e 100644
--- a/dlls/wineps.drv/pen.c
+++ b/dlls/wineps.drv/pen.c
@@ -93,27 +93,27 @@ HPEN PSDRV_SelectPen( PHYSDEV dev, HPEN hpen, const struct brush_pattern *patter
     switch(physDev->pen.style) {
     case PS_DASH:
         memcpy( physDev->pen.dash, PEN_dash, sizeof(PEN_dash) );
-        physDev->pen.dash_len = sizeof(PEN_dash) / sizeof(DWORD);
+        physDev->pen.dash_len = ARRAY_SIZE( PEN_dash );
 	break;
 
     case PS_DOT:
         memcpy( physDev->pen.dash, PEN_dot, sizeof(PEN_dot) );
-        physDev->pen.dash_len = sizeof(PEN_dot) / sizeof(DWORD);
+        physDev->pen.dash_len = ARRAY_SIZE( PEN_dot );
 	break;
 
     case PS_DASHDOT:
         memcpy( physDev->pen.dash, PEN_dashdot, sizeof(PEN_dashdot) );
-        physDev->pen.dash_len = sizeof(PEN_dashdot) / sizeof(DWORD);
+        physDev->pen.dash_len = ARRAY_SIZE( PEN_dashdot );
 	break;
 
     case PS_DASHDOTDOT:
         memcpy( physDev->pen.dash, PEN_dashdotdot, sizeof(PEN_dashdotdot) );
-        physDev->pen.dash_len = sizeof(PEN_dashdotdot) / sizeof(DWORD);
+        physDev->pen.dash_len = ARRAY_SIZE( PEN_dashdotdot );
 	break;
 
     case PS_ALTERNATE:
         memcpy( physDev->pen.dash, PEN_alternate, sizeof(PEN_alternate) );
-        physDev->pen.dash_len = sizeof(PEN_alternate) / sizeof(DWORD);
+        physDev->pen.dash_len = ARRAY_SIZE( PEN_alternate );
 	break;
 
     case PS_USERSTYLE:
diff --git a/dlls/wineps.drv/type42.c b/dlls/wineps.drv/type42.c
index c0cda50a8d..8a56cc6b6c 100644
--- a/dlls/wineps.drv/type42.c
+++ b/dlls/wineps.drv/type42.c
@@ -70,7 +70,7 @@ static const OTTable tables_templ[] = {
 };
 
 struct tagTYPE42 {
-    OTTable tables[sizeof(tables_templ)/sizeof(tables_templ[0])];
+    OTTable tables[ARRAY_SIZE(tables_templ)];
     int glyf_tab, loca_tab, head_tab; /* indices of glyf, loca and head tables */
     int hmtx_tab, maxp_tab;
     int num_of_written_tables;
@@ -138,7 +138,7 @@ TYPE42 *T42_download_header(PHYSDEV dev, char *ps_name,
                             RECT *bbox, UINT emsize)
 {
     DWORD i, j, tablepos, nb_blocks, glyf_off = 0, loca_off = 0, cur_off;
-    WORD num_of_tables = sizeof(tables_templ) / sizeof(tables_templ[0]) - 1;
+    WORD num_of_tables = ARRAY_SIZE(tables_templ) - 1;
     char *buf;
     TYPE42 *t42;
     static const char start[] = /* name, fontbbox */
-- 
2.14.4




More information about the wine-devel mailing list