From 7b5668a6e7bccdaefb69e099345fc7c3855a5cec Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Thu, 24 May 2018 23:46:27 +0200 Subject: [PATCH] include: Make ARRAY_SIZE() available in wine/test.h. Signed-off-by: Michael Stefaniuc Signed-off-by: Alexandre Julliard --- dlls/advapi32/tests/cred.c | 2 -- dlls/advapi32/tests/eventlog.c | 2 -- dlls/advapi32/tests/registry.c | 1 - dlls/advapi32/tests/security.c | 2 -- dlls/comctl32/tests/button.c | 1 - dlls/comdlg32/tests/filedlg.c | 2 -- dlls/d2d1/tests/d2d1.c | 4 ---- dlls/d3d10core/tests/device.c | 4 ---- dlls/d3d11/tests/d3d11.c | 4 ---- dlls/d3d8/tests/device.c | 2 -- dlls/d3d9/tests/d3d9ex.c | 2 -- dlls/d3d9/tests/device.c | 2 -- dlls/d3d9/tests/stateblock.c | 2 -- dlls/d3d9/tests/visual.c | 2 -- dlls/d3dx9_36/tests/effect.c | 2 -- dlls/d3dx9_36/tests/math.c | 2 -- dlls/d3dx9_36/tests/mesh.c | 2 -- dlls/ddraw/tests/ddraw1.c | 4 ---- dlls/ddraw/tests/ddraw2.c | 4 ---- dlls/ddraw/tests/ddraw4.c | 4 ---- dlls/ddraw/tests/ddraw7.c | 4 ---- dlls/dmcompos/tests/dmcompos.c | 2 -- dlls/dmime/tests/dmime.c | 2 -- dlls/dmloader/tests/loader.c | 2 -- dlls/dmstyle/tests/dmstyle.c | 2 -- dlls/dwrite/tests/analyzer.c | 2 -- dlls/dwrite/tests/font.c | 2 -- dlls/dwrite/tests/layout.c | 2 -- dlls/dxgi/tests/device.c | 4 ---- dlls/shell32/tests/shellpath.c | 4 ---- dlls/shell32/tests/shlfolder.c | 2 -- dlls/user32/tests/cursoricon.c | 2 -- dlls/usp10/tests/usp10.c | 4 ---- dlls/xmllite/tests/reader.c | 2 -- include/wine/test.h | 2 ++ 35 files changed, 2 insertions(+), 86 deletions(-) diff --git a/dlls/advapi32/tests/cred.c b/dlls/advapi32/tests/cred.c index 90454c7ab8b..01e2a5efa33 100644 --- a/dlls/advapi32/tests/cred.c +++ b/dlls/advapi32/tests/cred.c @@ -27,8 +27,6 @@ #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - static BOOL (WINAPI *pCredDeleteA)(LPCSTR,DWORD,DWORD); static BOOL (WINAPI *pCredEnumerateA)(LPCSTR,DWORD,DWORD *,PCREDENTIALA **); static VOID (WINAPI *pCredFree)(PVOID); diff --git a/dlls/advapi32/tests/eventlog.c b/dlls/advapi32/tests/eventlog.c index 3f4c00914ff..d613c95315e 100644 --- a/dlls/advapi32/tests/eventlog.c +++ b/dlls/advapi32/tests/eventlog.c @@ -32,8 +32,6 @@ #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - static BOOL (WINAPI *pCreateWellKnownSid)(WELL_KNOWN_SID_TYPE,PSID,PSID,DWORD*); static BOOL (WINAPI *pGetEventLogInformation)(HANDLE,DWORD,LPVOID,DWORD,LPDWORD); diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 17b83cb057a..9d248685ca7 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -32,7 +32,6 @@ #include "winerror.h" #include "aclapi.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) #define IS_HKCR(hk) ((UINT_PTR)hk > 0 && ((UINT_PTR)hk & 3) == 2) static HKEY hkey_main; diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index 35fd032a849..925e6fa8063 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -36,8 +36,6 @@ #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - #ifndef PROCESS_QUERY_LIMITED_INFORMATION #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000 #endif diff --git a/dlls/comctl32/tests/button.c b/dlls/comctl32/tests/button.c index 05fa3039183..db8d2b0156f 100644 --- a/dlls/comctl32/tests/button.c +++ b/dlls/comctl32/tests/button.c @@ -28,7 +28,6 @@ #include "msg.h" #define IS_WNDPROC_HANDLE(x) (((ULONG_PTR)(x) >> 16) == (~0u >> 16)) -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) static BOOL (WINAPI *pSetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR); static BOOL (WINAPI *pRemoveWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR); diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c index fd78a64e130..aedb18a1926 100644 --- a/dlls/comdlg32/tests/filedlg.c +++ b/dlls/comdlg32/tests/filedlg.c @@ -1026,8 +1026,6 @@ static UINT_PTR WINAPI test_extension_wndproc(HWND dlg, UINT msg, WPARAM wParam, return FALSE; } -#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - static void test_extension_helper(OPENFILENAMEA* ofn, const char *filter, const char *expected_filename) { diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 8299ceb7d4d..26c81e660ea 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -26,10 +26,6 @@ #include "dwrite.h" #include "wincodec.h" -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct resource_readback { ID3D10Resource *resource; diff --git a/dlls/d3d10core/tests/device.c b/dlls/d3d10core/tests/device.c index 50521bda443..819285ee228 100644 --- a/dlls/d3d10core/tests/device.c +++ b/dlls/d3d10core/tests/device.c @@ -26,10 +26,6 @@ #include "wine/heap.h" #include "wine/test.h" -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - #define BITS_NNAN 0xffc00000 #define BITS_NAN 0x7fc00000 #define BITS_NINF 0xff800000 diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 09301c7e0e9..f6f4fe3a558 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -28,10 +28,6 @@ #include "wine/heap.h" #include "wine/test.h" -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - #define BITS_NNAN 0xffc00000 #define BITS_NAN 0x7fc00000 #define BITS_NINF 0xff800000 diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 5fa0d59e60d..6bae783644a 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -28,8 +28,6 @@ #include #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - struct vec3 { float x, y, z; diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index d210b8baedf..63b7c5a46d9 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -26,8 +26,6 @@ #include #include -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - static HMODULE d3d9_handle = 0; static DEVMODEW registry_mode; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 0eba7662bfd..bd1890f45c5 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -27,8 +27,6 @@ #include #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - struct vec3 { float x, y, z; diff --git a/dlls/d3d9/tests/stateblock.c b/dlls/d3d9/tests/stateblock.c index aec698a58e8..0983cf7b4f1 100644 --- a/dlls/d3d9/tests/stateblock.c +++ b/dlls/d3d9/tests/stateblock.c @@ -21,8 +21,6 @@ #include #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - static DWORD texture_stages; /* ============================ State Testing Framework ========================== */ diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index d0c77953f45..835c8377e47 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -34,8 +34,6 @@ #include #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - struct vec2 { float x, y; diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index a75b67c7f62..4f26b63a130 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -41,8 +41,6 @@ static float get_nan(void) #define NAN get_nan() #endif -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*arr)) - /* helper functions */ static BOOL compare_float(FLOAT f, FLOAT g, UINT ulps) { diff --git a/dlls/d3dx9_36/tests/math.c b/dlls/d3dx9_36/tests/math.c index b687e5d6dd3..e433b1f50e5 100644 --- a/dlls/d3dx9_36/tests/math.c +++ b/dlls/d3dx9_36/tests/math.c @@ -23,8 +23,6 @@ #include "d3dx9.h" #include -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - static BOOL compare_float(float f, float g, unsigned int ulps) { int x = *(int *)&f; diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c index 6ebd5b82156..3fcd65ffbbb 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c @@ -42,8 +42,6 @@ static inline float __port_nan(void) #define admitted_error 0.0001f -#define ARRAY_SIZE(array) (sizeof(array)/sizeof(*array)) - #define compare_vertex_sizes(type, exp) \ got=D3DXGetFVFVertexSize(type); \ ok(got==exp, "Expected: %d, Got: %d\n", exp, got); diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index fb0858f253b..c767d3a38d3 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -29,10 +29,6 @@ static DEVMODEW registry_mode; static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct vec2 { float x, y; diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index c2b438cf2ae..794f90b9400 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -31,10 +31,6 @@ static DEVMODEW registry_mode; static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct vec2 { float x, y; diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 9c4c5a3e5b2..172d99d1670 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -31,10 +31,6 @@ static DEVMODEW registry_mode; static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct vec2 { float x, y; diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index fb144090791..35a45c03456 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -32,10 +32,6 @@ static DEVMODEW registry_mode; static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - struct vec2 { float x, y; diff --git a/dlls/dmcompos/tests/dmcompos.c b/dlls/dmcompos/tests/dmcompos.c index 27cea9e3360..3419eca3b38 100644 --- a/dlls/dmcompos/tests/dmcompos.c +++ b/dlls/dmcompos/tests/dmcompos.c @@ -26,8 +26,6 @@ #include #include -#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); static BOOL missing_dmcompos(void) diff --git a/dlls/dmime/tests/dmime.c b/dlls/dmime/tests/dmime.c index 9dd00520f87..b7bf542fd81 100644 --- a/dlls/dmime/tests/dmime.c +++ b/dlls/dmime/tests/dmime.c @@ -27,8 +27,6 @@ #include #include -#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - static BOOL missing_dmime(void) { IDirectMusicSegment8 *dms; diff --git a/dlls/dmloader/tests/loader.c b/dlls/dmloader/tests/loader.c index 46e46d4baf4..13b575e120f 100644 --- a/dlls/dmloader/tests/loader.c +++ b/dlls/dmloader/tests/loader.c @@ -24,8 +24,6 @@ #include #include "wine/test.h" -#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); static unsigned char mp3file[] = "\xFF\xFB\x92\x04"; /* MP3 header */ static unsigned char rifffile[8+4+8+16+8+256] = "RIFF\x24\x01\x00\x00WAVE" /* header: 4 ("WAVE") + (8 + 16) (format segment) + (8 + 256) (data segment) = 0x124 */ diff --git a/dlls/dmstyle/tests/dmstyle.c b/dlls/dmstyle/tests/dmstyle.c index ed12315a196..9d247812ca2 100644 --- a/dlls/dmstyle/tests/dmstyle.c +++ b/dlls/dmstyle/tests/dmstyle.c @@ -26,8 +26,6 @@ #include #include -#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); static BOOL missing_dmstyle(void) diff --git a/dlls/dwrite/tests/analyzer.c b/dlls/dwrite/tests/analyzer.c index 93ee152c23c..77369a7ef9c 100644 --- a/dlls/dwrite/tests/analyzer.c +++ b/dlls/dwrite/tests/analyzer.c @@ -31,8 +31,6 @@ #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - static IDWriteFactory *factory; static const WCHAR test_fontfile[] = {'w','i','n','e','_','t','e','s','t','_','f','o','n','t','.','t','t','f',0}; diff --git a/dlls/dwrite/tests/font.c b/dlls/dwrite/tests/font.c index 44a81a199e8..f21aecdd5d2 100644 --- a/dlls/dwrite/tests/font.c +++ b/dlls/dwrite/tests/font.c @@ -33,8 +33,6 @@ #include "wine/heap.h" #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - #define MS_CMAP_TAG DWRITE_MAKE_OPENTYPE_TAG('c','m','a','p') #define MS_VDMX_TAG DWRITE_MAKE_OPENTYPE_TAG('V','D','M','X') #define MS_GASP_TAG DWRITE_MAKE_OPENTYPE_TAG('g','a','s','p') diff --git a/dlls/dwrite/tests/layout.c b/dlls/dwrite/tests/layout.c index c2dd273c6c1..652f6b78ac7 100644 --- a/dlls/dwrite/tests/layout.c +++ b/dlls/dwrite/tests/layout.c @@ -29,8 +29,6 @@ #include "wine/test.h" -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) - static const WCHAR tahomaW[] = {'T','a','h','o','m','a',0}; static const WCHAR enusW[] = {'e','n','-','u','s',0}; diff --git a/dlls/dxgi/tests/device.c b/dlls/dxgi/tests/device.c index b18ee5904fb..d9ffa50f782 100644 --- a/dlls/dxgi/tests/device.c +++ b/dlls/dxgi/tests/device.c @@ -23,10 +23,6 @@ #include "d3d11.h" #include "wine/test.h" -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - enum frame_latency { DEFAULT_FRAME_LATENCY = 3, diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index f6674313f8e..613c4eb15d4 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -43,10 +43,6 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) ( sizeof(x) / sizeof((x)[0]) ) -#endif - /* from pidl.h, not included here: */ #ifndef PT_CPL /* Guess, Win7 uses this for CSIDL_CONTROLS */ #define PT_CPL 0x01 /* no path */ diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 4ce9a4efba1..6460fd93815 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -44,8 +44,6 @@ DEFINE_GUID(IID_IParentAndItem, 0xB3A4B685, 0xB685, 0x4805, 0x99,0xD9, 0x5D,0xEA,0xD2,0x87,0x32,0x36); DEFINE_GUID(CLSID_ShellDocObjView, 0xe7e4bc40, 0xe76a, 0x11ce, 0xa9,0xbb, 0x00,0xaa,0x00,0x4a,0xe8,0x37); -#define ARRAY_SIZE(x) ( sizeof(x) / sizeof((x)[0]) ) - static IMalloc *ppM; static HRESULT (WINAPI *pSHCreateItemFromIDList)(PCIDLIST_ABSOLUTE pidl, REFIID riid, void **ppv); diff --git a/dlls/user32/tests/cursoricon.c b/dlls/user32/tests/cursoricon.c index 5099c08d708..95a6878e9a0 100644 --- a/dlls/user32/tests/cursoricon.c +++ b/dlls/user32/tests/cursoricon.c @@ -1053,8 +1053,6 @@ static const DWORD biSize_tests[] = { 0xffffffff }; -#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) - static void test_LoadImageBitmap(const char * test_desc, HBITMAP hbm) { BITMAP bm; diff --git a/dlls/usp10/tests/usp10.c b/dlls/usp10/tests/usp10.c index f548b5792cc..aa26997112d 100644 --- a/dlls/usp10/tests/usp10.c +++ b/dlls/usp10/tests/usp10.c @@ -31,10 +31,6 @@ #include #include -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) -#endif - typedef struct _itemTest { char todo_flag[6]; int iCharPos; diff --git a/dlls/xmllite/tests/reader.c b/dlls/xmllite/tests/reader.c index 975724ab189..41adad15981 100644 --- a/dlls/xmllite/tests/reader.c +++ b/dlls/xmllite/tests/reader.c @@ -32,8 +32,6 @@ #include "wine/test.h" #include "wine/heap.h" -#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0])) - DEFINE_GUID(IID_IXmlReaderInput, 0x0b3ccc9b, 0x9214, 0x428b, 0xa2, 0xae, 0xef, 0x3a, 0xa8, 0x71, 0xaf, 0xda); static WCHAR *a2w(const char *str) diff --git a/include/wine/test.h b/include/wine/test.h index e3e4bcf77b7..476b4d98470 100644 --- a/include/wine/test.h +++ b/include/wine/test.h @@ -130,6 +130,8 @@ extern void __winetest_cdecl winetest_trace( const char *msg, ... ) WINETEST_PRI #define todo_wine_if(is_todo) todo_if((is_todo) && !strcmp(winetest_platform, "wine")) +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + #ifdef NONAMELESSUNION # define U(x) (x).u # define U1(x) (x).u1 -- 2.11.4.GIT