Commit b716661c authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

msi/tests: Use the available ARRAY_SIZE() macro.

parent 94d8ba78
......@@ -5221,12 +5221,12 @@ static void test_collation(void)
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n");
sz = sizeof(bufferW) / sizeof(bufferW[0]);
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!memcmp(bufferW, letter_a_ring, sizeof(letter_a_ring)),
"Expected %s, got %s\n", wine_dbgstr_w(letter_a_ring), wine_dbgstr_w(bufferW));
sz = sizeof(bufferW) / sizeof(bufferW[0]);
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpW(bufferW, letter_C), "Expected C, got %s\n", wine_dbgstr_w(bufferW));
......@@ -5234,12 +5234,12 @@ static void test_collation(void)
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n");
sz = sizeof(bufferW) / sizeof(bufferW[0]);
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!memcmp(bufferW, letter_a_with_ring, sizeof(letter_a_with_ring)),
"Expected %s, got %s\n", wine_dbgstr_w(letter_a_with_ring), wine_dbgstr_w(bufferW));
sz = sizeof(bufferW) / sizeof(bufferW[0]);
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpW(bufferW, letter_D), "Expected D, got %s\n", wine_dbgstr_w(bufferW));
......@@ -5257,12 +5257,12 @@ static void test_collation(void)
r = MsiViewFetch(hview, &hrec);
ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n");
sz = sizeof(bufferW) / sizeof(bufferW[0]);
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 1, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!memcmp(bufferW, letter_a_with_ring, sizeof(letter_a_with_ring)),
"Expected %s, got %s\n", wine_dbgstr_w(letter_a_with_ring), wine_dbgstr_w(bufferW));
sz = sizeof(bufferW) / sizeof(bufferW[0]);
sz = ARRAY_SIZE(bufferW);
r = MsiRecordGetStringW(hrec, 2, bufferW, &sz);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmpW(bufferW, letter_D), "Expected D, got %s\n", wine_dbgstr_w(bufferW));
......
......@@ -1094,7 +1094,7 @@ static void test_MsiGetFileHash(void)
r = pMsiGetFileHashA(name, 0, NULL);
ok(r == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", r);
for (i = 0; i < sizeof(hash_data) / sizeof(hash_data[0]); i++)
for (i = 0; i < ARRAY_SIZE(hash_data); i++)
{
int ret;
......@@ -3313,7 +3313,7 @@ static void test_MsiProvideComponent(void)
create_test_files();
create_file("msitest\\sourcedir.txt", 1000);
create_database(msifile, sd_tables, sizeof(sd_tables) / sizeof(msi_table));
create_database(msifile, sd_tables, ARRAY_SIZE(sd_tables));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
......@@ -13446,7 +13446,7 @@ static void test_MsiConfigureProductEx(void)
create_file_data("msitest\\helium", "helium", 500);
create_file_data("msitest\\lithium", "lithium", 500);
create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
create_database(msifile, mcp_tables, ARRAY_SIZE(mcp_tables));
if (is_wow64)
access |= KEY_WOW64_64KEY;
......@@ -13574,7 +13574,7 @@ static void test_MsiConfigureProductEx(void)
ok(!delete_pf("msitest\\lithium", TRUE), "File not removed\n");
ok(!delete_pf("msitest", FALSE), "Directory not removed\n");
create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
create_database(msifile, mcp_tables, ARRAY_SIZE(mcp_tables));
/* install the product, machine */
r = MsiInstallProductA(msifile, "ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42");
......@@ -13615,7 +13615,7 @@ static void test_MsiConfigureProductEx(void)
ok(pf_exists("msitest"), "File not installed\n");
RegCloseKey(props);
create_database(msifile, mcp_tables, sizeof(mcp_tables) / sizeof(msi_table));
create_database(msifile, mcp_tables, ARRAY_SIZE(mcp_tables));
/* LastUsedSource can be used as a last resort */
r = MsiConfigureProductExA("{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}",
......@@ -13723,7 +13723,7 @@ static void test_MsiSetFeatureAttributes(void)
skip("process is limited\n");
return;
}
create_database( msifile, tables, sizeof(tables) / sizeof(tables[0]) );
create_database( msifile, tables, ARRAY_SIZE( tables ));
strcpy( path, CURR_DIR );
strcat( path, "\\" );
......@@ -13805,7 +13805,7 @@ static void test_MsiGetFeatureInfo(void)
skip("process is limited\n");
return;
}
create_database( msifile, tables, sizeof(tables) / sizeof(tables[0]) );
create_database( msifile, tables, ARRAY_SIZE( tables ));
strcpy( path, CURR_DIR );
strcat( path, "\\" );
......@@ -13989,9 +13989,9 @@ static void test_lastusedsource(void)
create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0");
DeleteFileA("maximus");
create_database("msifile0.msi", lus0_tables, sizeof(lus0_tables) / sizeof(msi_table));
create_database("msifile1.msi", lus1_tables, sizeof(lus1_tables) / sizeof(msi_table));
create_database("msifile2.msi", lus2_tables, sizeof(lus2_tables) / sizeof(msi_table));
create_database("msifile0.msi", lus0_tables, ARRAY_SIZE(lus0_tables));
create_database("msifile1.msi", lus1_tables, ARRAY_SIZE(lus1_tables));
create_database("msifile2.msi", lus2_tables, ARRAY_SIZE(lus2_tables));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
......@@ -14111,7 +14111,7 @@ static void test_setpropertyfolder(void)
CreateDirectoryA("msitest", NULL);
create_file("msitest\\maximus", 500);
create_database(msifile, spf_tables, sizeof(spf_tables) / sizeof(msi_table));
create_database(msifile, spf_tables, ARRAY_SIZE(spf_tables));
MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
......@@ -14154,7 +14154,7 @@ static void test_sourcedir_props(void)
create_test_files();
create_file("msitest\\sourcedir.txt", 1000);
create_database(msifile, sd_tables, sizeof(sd_tables) / sizeof(msi_table));
create_database(msifile, sd_tables, ARRAY_SIZE(sd_tables));
MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
......@@ -14221,11 +14221,11 @@ static void test_concurrentinstall(void)
create_file("msitest\\maximus", 500);
create_file("msitest\\msitest\\augustus", 500);
create_database(msifile, ci_tables, sizeof(ci_tables) / sizeof(msi_table));
create_database(msifile, ci_tables, ARRAY_SIZE(ci_tables));
lstrcpyA(path, CURR_DIR);
lstrcatA(path, "\\msitest\\concurrent.msi");
create_database(path, ci2_tables, sizeof(ci2_tables) / sizeof(msi_table));
create_database(path, ci2_tables, ARRAY_SIZE(ci2_tables));
MsiSetInternalUI(INSTALLUILEVEL_FULL, NULL);
......@@ -14269,7 +14269,7 @@ static void test_command_line_parsing(void)
}
create_test_files();
create_database(msifile, cl_tables, sizeof(cl_tables)/sizeof(msi_table));
create_database(msifile, cl_tables, ARRAY_SIZE(cl_tables));
MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL);
......
......@@ -187,7 +187,7 @@ static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey, REGSAM acce
dwMaxSubkeyLen++;
dwMaxValueLen++;
dwMaxLen = max(dwMaxSubkeyLen, dwMaxValueLen);
if (dwMaxLen > sizeof(szNameBuf)/sizeof(WCHAR))
if (dwMaxLen > ARRAY_SIZE(szNameBuf))
{
/* Name too big: alloc a buffer for it */
if (!(lpszName = HeapAlloc( GetProcessHeap(), 0, dwMaxLen*sizeof(WCHAR))))
......
......@@ -731,7 +731,7 @@ static void test_simple_patch( void )
CreateDirectoryA( "msitest", NULL );
create_file( "msitest\\patch.txt", 1000 );
create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
create_database( msifile, tables, ARRAY_SIZE(tables) );
create_patch( mspfile );
MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
......@@ -929,7 +929,7 @@ static void test_MsiOpenDatabase( void )
MsiCloseHandle( hdb );
DeleteFileA( mspfile );
create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
create_database( msifile, tables, ARRAY_SIZE(tables) );
create_patch( mspfile );
r = MsiOpenDatabaseW( msifileW, MSIDBOPEN_READONLY + MSIDBOPEN_PATCHFILE, &hdb );
......@@ -1072,7 +1072,7 @@ static void test_system_tables( void )
CreateDirectoryA( "msitest", NULL );
create_file( "msitest\\patch.txt", 1000 );
create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
create_database( msifile, tables, ARRAY_SIZE(tables) );
create_patch( mspfile );
MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
......@@ -1261,7 +1261,7 @@ static void test_patch_registration( void )
CreateDirectoryA( "msitest", NULL );
create_file( "msitest\\patch.txt", 1000 );
create_database( msifile, tables, sizeof(tables) / sizeof(struct msi_table) );
create_database( msifile, tables, ARRAY_SIZE(tables) );
create_patch( mspfile );
MsiSetInternalUI( INSTALLUILEVEL_NONE, NULL );
......
......@@ -138,7 +138,7 @@ static void test_msirecord(void)
ok(buf[0] == 0, "MsiRecordGetStringA returned the wrong string\n");
ok(sz == 0, "MsiRecordGetStringA returned the wrong length\n");
bufW[0] = 0;
sz = sizeof bufW / sizeof bufW[0];
sz = ARRAY_SIZE(bufW);
r = MsiRecordGetStringW(h, 0, bufW, &sz);
ok(r == ERROR_SUCCESS, "Failed to get string at 0\n");
ok(bufW[0] == 0, "MsiRecordGetStringW returned the wrong string\n");
......@@ -156,7 +156,7 @@ static void test_msirecord(void)
ok(buf[0] == 0, "MsiRecordGetStringA returned the wrong string\n");
ok(sz == 0, "MsiRecordGetStringA returned the wrong length\n");
bufW[0] = 0;
sz = sizeof bufW / sizeof bufW[0];
sz = ARRAY_SIZE(bufW);
r = MsiRecordGetStringW(h, 0, bufW, &sz);
ok(r == ERROR_SUCCESS, "Failed to get string at 0\n");
ok(bufW[0] == 0, "MsiRecordGetStringW returned the wrong string\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment