Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- dlls/shell32/tests/autocomplete.c | 4 ++-- dlls/shell32/tests/shelldispatch.c | 14 +++++++------- dlls/shell32/tests/shelllink.c | 2 +- dlls/shell32/tests/shellole.c | 2 +- dlls/shell32/tests/shellpath.c | 4 ++-- dlls/shell32/tests/shlexec.c | 14 +++++++------- dlls/shell32/tests/string.c | 8 ++++---- 7 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/dlls/shell32/tests/autocomplete.c b/dlls/shell32/tests/autocomplete.c index 859734ce59..1c51e5179f 100644 --- a/dlls/shell32/tests/autocomplete.c +++ b/dlls/shell32/tests/autocomplete.c @@ -369,7 +369,7 @@ static void test_custom_source(void) hr = CoCreateInstance(&CLSID_AutoComplete, NULL, CLSCTX_INPROC_SERVER, &IID_IAutoComplete2, (void**)&autocomplete); ok(hr == S_OK, "CoCreateInstance failed: %x\n", hr);
- string_enumerator_create((void**)&enumerator, suggestions, sizeof(suggestions) / sizeof(*suggestions)); + string_enumerator_create((void**)&enumerator, suggestions, ARRAY_SIZE(suggestions));
hr = IAutoComplete2_SetOptions(autocomplete, ACO_AUTOSUGGEST | ACO_AUTOAPPEND); ok(hr == S_OK, "IAutoComplete2_SetOptions failed: %x\n", hr); @@ -385,7 +385,7 @@ static void test_custom_source(void) TranslateMessage(&msg); DispatchMessageA(&msg); } - SendMessageW(hwnd_edit, WM_GETTEXT, sizeof(buffer) / sizeof(*buffer), (LPARAM)buffer); + SendMessageW(hwnd_edit, WM_GETTEXT, ARRAY_SIZE(buffer), (LPARAM)buffer); ok(lstrcmpW(str_beta, buffer) == 0, "Expected %s, got %s\n", wine_dbgstr_w(str_beta), wine_dbgstr_w(buffer));
ShowWindow(hMainWnd, SW_HIDE); diff --git a/dlls/shell32/tests/shelldispatch.c b/dlls/shell32/tests/shelldispatch.c index ed109a9e17..30c8291f58 100644 --- a/dlls/shell32/tests/shelldispatch.c +++ b/dlls/shell32/tests/shelldispatch.c @@ -161,7 +161,7 @@ static void test_namespace(void) ok(folder == NULL, "expected NULL, got %p\n", folder);
/* test valid folder ids */ - for (i = 0; i < sizeof(special_folders)/sizeof(special_folders[0]); i++) + for (i = 0; i < ARRAY_SIZE(special_folders); i++) { V_VT(&var) = VT_I4; V_I4(&var) = special_folders[i]; @@ -474,7 +474,7 @@ static void test_items(void) ok(!item, "item is not null\n");
/* create test files */ - for (i = 0; i < sizeof(file_defs)/sizeof(file_defs[0]); i++) + for (i = 0; i < ARRAY_SIZE(file_defs); i++) { switch (file_defs[i].type) { @@ -605,7 +605,7 @@ static void test_items(void) V_VT(&int_index) = VT_I4;
/* test the folder item corresponding to each file */ - for (i = 0; i < sizeof(file_defs)/sizeof(file_defs[0]); i++) + for (i = 0; i < ARRAY_SIZE(file_defs); i++) { VARIANT_BOOL b; BSTR name; @@ -729,7 +729,7 @@ static void test_items(void) }
/* test that there are only as many folder items as there were files */ - V_I4(&int_index) = sizeof(file_defs)/sizeof(file_defs[0]); + V_I4(&int_index) = ARRAY_SIZE(file_defs); item = (FolderItem*)0xdeadbeef; r = FolderItems_Item(items, int_index, &item); ok(r == S_FALSE, "expected S_FALSE, got %08x\n", r); @@ -975,7 +975,7 @@ if (0) /* crashes on pre-vista */ { IShellView_Release(view);
/* Try with some other folder, that's not a desktop */ - GetTempPathW(sizeof(pathW)/sizeof(pathW[0]), pathW); + GetTempPathW(ARRAY_SIZE(pathW), pathW); hr = IShellFolder_ParseDisplayName(desktop, NULL, NULL, pathW, NULL, &pidl, NULL); ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1218,7 +1218,7 @@ static void test_ParseName(void) &IID_IShellDispatch, (void**)&sd); ok(hr == S_OK, "got 0x%08x\n", hr);
- GetTempPathW(sizeof(pathW)/sizeof(pathW[0]), pathW); + GetTempPathW(ARRAY_SIZE(pathW), pathW); V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(pathW); hr = IShellDispatch_NameSpace(sd, v, &folder); @@ -1287,7 +1287,7 @@ static void test_Verbs(void) &IID_IShellDispatch, (void**)&sd); ok(hr == S_OK, "got 0x%08x\n", hr);
- GetTempPathW(sizeof(pathW)/sizeof(pathW[0]), pathW); + GetTempPathW(ARRAY_SIZE(pathW), pathW); V_VT(&v) = VT_BSTR; V_BSTR(&v) = SysAllocString(pathW); hr = IShellDispatch_NameSpace(sd, v, &folder); diff --git a/dlls/shell32/tests/shelllink.c b/dlls/shell32/tests/shelllink.c index 1e07090dc4..65e9a6dd55 100644 --- a/dlls/shell32/tests/shelllink.c +++ b/dlls/shell32/tests/shelllink.c @@ -1287,7 +1287,7 @@ if (0) ok(hicon == NULL, "Got icon %p\n", hicon);
/* Create a temporary non-executable file */ - GetTempPathW(sizeof(pathW)/sizeof(pathW[0]), pathW); + GetTempPathW(ARRAY_SIZE(pathW), pathW); lstrcatW(pathW, nameW); file = CreateFileW(pathW, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ok(file != INVALID_HANDLE_VALUE, "Failed to create a test file\n"); diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c index 4144f18155..4b91302a15 100644 --- a/dlls/shell32/tests/shellole.c +++ b/dlls/shell32/tests/shellole.c @@ -869,7 +869,7 @@ static void test_SHCreateSessionKey(void) HKEY hkey, hkey2; HRESULT hr; DWORD session; - WCHAR sessionW[(sizeof(session_format)/sizeof(WCHAR)) + 16]; + WCHAR sessionW[ARRAY_SIZE(session_format) + 16]; LONG ret;
if (!pSHCreateSessionKey) diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index 613c4eb15d..505da2778e 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -114,7 +114,7 @@ static const BYTE printersType[] = { PT_YAGUID, PT_SHELLEXT, 0x71 }; static const BYTE ieSpecialType[] = { PT_IESPECIAL2 }; static const BYTE shellExtType[] = { PT_SHELLEXT }; static const BYTE workgroupType[] = { PT_WORKGRP }; -#define DECLARE_TYPE(x, y) { x, sizeof(y) / sizeof(y[0]), y } +#define DECLARE_TYPE(x, y) { x, ARRAY_SIZE(y), y } static const struct shellExpectedValues requiredShellValues[] = { DECLARE_TYPE(CSIDL_BITBUCKET, guidType), DECLARE_TYPE(CSIDL_CONTROLS, controlPanelType), @@ -2545,7 +2545,7 @@ static void test_DoEnvironmentSubst(void) "%HOMEDRIVE%%HOMEPATH%", "%OS% %windir%"}; /* always the last entry in the table */
- for (i = 0; i < (sizeof(names)/sizeof(LPSTR)); i++) + for (i = 0; i < (ARRAY_SIZE(names)); i++) { memset(bufferA, '#', MAX_PATH - 1); bufferA[MAX_PATH - 1] = 0; diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index 7cdae878db..c67cc46a46 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -758,7 +758,7 @@ static LSTATUS myRegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey) dwMaxSubkeyLen++; dwMaxValueLen++; dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen); - if (dwMaxLen > sizeof(szNameBuf)/sizeof(CHAR)) + if (dwMaxLen > ARRAY_SIZE(szNameBuf)) { /* Name too big: alloc a buffer for it */ if (!(lpszName = heap_alloc(dwMaxLen*sizeof(CHAR)))) @@ -1329,7 +1329,7 @@ static BOOL test_one_cmdline(const cmdline_tests_t* test) int i, count;
/* trace("----- cmd='%s'\n", test->cmd); */ - MultiByteToWideChar(CP_ACP, 0, test->cmd, -1, cmdW, sizeof(cmdW)/sizeof(*cmdW)); + MultiByteToWideChar(CP_ACP, 0, test->cmd, -1, cmdW, ARRAY_SIZE(cmdW)); argsW = cl2a = CommandLineToArgvW(cmdW, &cl2a_count); if (argsW == NULL && cl2a_count == -1) { @@ -1349,7 +1349,7 @@ static BOOL test_one_cmdline(const cmdline_tests_t* test) { if (i < count) { - MultiByteToWideChar(CP_ACP, 0, test->args[i], -1, argW, sizeof(argW)/sizeof(*argW)); + MultiByteToWideChar(CP_ACP, 0, test->args[i], -1, argW, ARRAY_SIZE(argW)); todo_wine_if(test->todo & (1 << (i+4))) ok(!lstrcmpW(*argsW, argW), "%s: arg[%d] expected %s but got %s\n", test->cmd, i, wine_dbgstr_w(argW), wine_dbgstr_w(*argsW)); } @@ -1395,7 +1395,7 @@ static void test_commandline2argv(void) "expected NULL-terminated list of commandline arguments\n"); if (numargs == 1) { - GetModuleFileNameW(NULL, strW, sizeof(strW)/sizeof(*strW)); + GetModuleFileNameW(NULL, strW, ARRAY_SIZE(strW)); ok(!lstrcmpW(args[0], strW), "wrong path to the current executable: %s instead of %s\n", wine_dbgstr_w(args[0]), wine_dbgstr_w(strW)); } if (args) LocalFree(args); @@ -1859,7 +1859,7 @@ static void test_fileurls(void) return; }
- get_long_path_name(tmpdir, longtmpdir, sizeof(longtmpdir)/sizeof(*longtmpdir)); + get_long_path_name(tmpdir, longtmpdir, ARRAY_SIZE(longtmpdir)); SetEnvironmentVariableA("urlprefix", "file:///");
test=fileurl_tests; @@ -2779,7 +2779,7 @@ static void init_test(void)
/* Setup the test shortcuts */ sprintf(filename, "%s\test_shortcut_shlexec.lnk", tmpdir); - MultiByteToWideChar(CP_ACP, 0, filename, -1, lnkfile, sizeof(lnkfile)/sizeof(*lnkfile)); + MultiByteToWideChar(CP_ACP, 0, filename, -1, lnkfile, ARRAY_SIZE(lnkfile)); desc.description=NULL; desc.workdir=NULL; sprintf(filename, "%s\test file.shlexec", tmpdir); @@ -2793,7 +2793,7 @@ static void init_test(void) create_lnk(lnkfile, &desc, 0);
sprintf(filename, "%s\test_shortcut_exe.lnk", tmpdir); - MultiByteToWideChar(CP_ACP, 0, filename, -1, lnkfile, sizeof(lnkfile)/sizeof(*lnkfile)); + MultiByteToWideChar(CP_ACP, 0, filename, -1, lnkfile, ARRAY_SIZE(lnkfile)); desc.description=NULL; desc.workdir=NULL; desc.path=argv0; diff --git a/dlls/shell32/tests/string.c b/dlls/shell32/tests/string.c index 6cdb386eba..5fd589300b 100644 --- a/dlls/shell32/tests/string.c +++ b/dlls/shell32/tests/string.c @@ -67,14 +67,14 @@ static void test_StrRetToStringNW(void) strret.uType = STRRET_WSTR; U(strret).pOleStr = CoDupStrW("Test"); memset(buff, 0xff, sizeof(buff)); - ret = pStrRetToStrNAW(buff, sizeof(buff)/sizeof(WCHAR), &strret, NULL); + ret = pStrRetToStrNAW(buff, ARRAY_SIZE(buff), &strret, NULL); ok(ret == TRUE && !strcmpW(buff, szTestW), "STRRET_WSTR: dup failed, ret=%d\n", ret);
strret.uType = STRRET_CSTR; lstrcpyA(U(strret).cStr, "Test"); memset(buff, 0xff, sizeof(buff)); - ret = pStrRetToStrNAW(buff, sizeof(buff)/sizeof(WCHAR), &strret, NULL); + ret = pStrRetToStrNAW(buff, ARRAY_SIZE(buff), &strret, NULL); ok(ret == TRUE && !strcmpW(buff, szTestW), "STRRET_CSTR: dup failed, ret=%d\n", ret);
@@ -82,7 +82,7 @@ static void test_StrRetToStringNW(void) U(strret).uOffset = 1; strcpy((char*)&iidl, " Test"); memset(buff, 0xff, sizeof(buff)); - ret = pStrRetToStrNAW(buff, sizeof(buff)/sizeof(WCHAR), &strret, iidl); + ret = pStrRetToStrNAW(buff, ARRAY_SIZE(buff), &strret, iidl); ok(ret == TRUE && !strcmpW(buff, szTestW), "STRRET_OFFSET: dup failed, ret=%d\n", ret);
@@ -92,7 +92,7 @@ if (0) /* Invalid dest - should return FALSE, except NT4 does not, so we don't check. */ strret.uType = STRRET_WSTR; U(strret).pOleStr = CoDupStrW("Test"); - pStrRetToStrNAW(NULL, sizeof(buff)/sizeof(WCHAR), &strret, NULL); + pStrRetToStrNAW(NULL, ARRAY_SIZE(buff), &strret, NULL); trace("NULL dest: ret=%d\n", ret); } }