Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2018
- 68 participants
- 1149 messages
[PATCH 1/4] explorer: Add a private message to notify the graphics driver when activity occurs.
by Zebediah Figura
Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
programs/explorer/desktop.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c
index a2d9e1a..f5a01c2 100644
--- a/programs/explorer/desktop.c
+++ b/programs/explorer/desktop.c
@@ -46,6 +46,10 @@ static const WCHAR default_driver[] = {'m','a','c',',','x','1','1',0};
static const WCHAR default_driver[] = {'x','1','1',0};
#endif
+static void (CDECL *wine_notify_activity)(void);
+
+#define WM_WINE_NOTIFY_ACTIVITY WM_USER
+
static BOOL using_root;
struct launcher
@@ -661,6 +665,11 @@ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPAR
}
return 0;
+ case WM_WINE_NOTIFY_ACTIVITY:
+ if (wine_notify_activity)
+ wine_notify_activity();
+ return 0;
+
default:
return DefWindowProcW( hwnd, message, wp, lp );
}
@@ -1005,6 +1014,8 @@ void manage_desktop( WCHAR *arg )
{
pShellDDEInit( TRUE );
}
+
+ wine_notify_activity = (void *)GetProcAddress( graphics_driver, "wine_notify_activity" );
}
}
--
2.7.4
June 21, 2018
[PATCH 1/1] wsdapi/tests: Add tests for MatchProbeEx.
by Owen Rudge
Signed-off-by: Owen Rudge <orudge(a)codeweavers.com>
---
dlls/wsdapi/tests/discovery.c | 194
+++++++++++++++++++++++++++++++++++++++++-
1 file changed, 193 insertions(+), 1 deletion(-)
June 21, 2018
Re: [PATCH 1/2] ntdll/tests: Use the available ARRAY_SIZE() macro
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39291
Your paranoid android.
=== w2008s64 (32 bit threadpool) ===
TestBot process got stuck or died unexpectedly
The previous 1 run(s) terminated abnormally
=== wvistau64 (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
0890:info: unhandled exception c0000005 at 00340000
=== wvistau64_zh_CN (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
0bb8:info: unhandled exception c0000005 at 00370000
=== wvistau64_fr (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
072c:info: unhandled exception c0000005 at 00340000
=== wvistau64_he (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
0bd8:info: unhandled exception c0000005 at 002C0000
=== w2008s64 (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
0870:info: unhandled exception c0000005 at 003D0000
=== w7u (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
=== w7pro64 (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
0af4:info: unhandled exception c0000005 at 00350000
=== w8 (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
0f84:info: unhandled exception c0000005 at 00310000
=== w864 (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
0d00:info: unhandled exception c0000005 at 00350000
=== w1064 (32 bit info) ===
info.c:1792: Test failed: Expected STATUS_SUCCESS, got c0000022
0db8:info: unhandled exception c0000005 at 002D0000
June 21, 2018
[PATCH 2/2] ntdll/tests: Avoid ARRAY_SIZE-like macros
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/ntdll/tests/large_int.c | 8 +++-----
dlls/ntdll/tests/rtl.c | 6 ++----
dlls/ntdll/tests/rtlstr.c | 31 +++++++++++--------------------
dlls/ntdll/tests/string.c | 24 ++++++++++--------------
4 files changed, 26 insertions(+), 43 deletions(-)
diff --git a/dlls/ntdll/tests/large_int.c b/dlls/ntdll/tests/large_int.c
index da7afa4f25..c980aebe5d 100644
--- a/dlls/ntdll/tests/large_int.c
+++ b/dlls/ntdll/tests/large_int.c
@@ -102,7 +102,6 @@ static const magic_divide_t magic_divide[] = {
{ ULL(0x74ae3b5f,0x1558c800), ULL(0x2f1e28fd,0x1b5cca00), 41, 0xabcde},
};
-#define NB_MAGIC_DIVIDE (sizeof(magic_divide)/sizeof(*magic_divide))
static void test_RtlExtendedMagicDivide(void)
@@ -110,7 +109,7 @@ static void test_RtlExtendedMagicDivide(void)
int i;
LONGLONG result;
- for (i = 0; i < NB_MAGIC_DIVIDE; i++) {
+ for (i = 0; i < ARRAY_SIZE(magic_divide); i++) {
result = pRtlExtendedMagicDivide(magic_divide[i].a, magic_divide[i].b, magic_divide[i].shift);
ok(result == magic_divide[i].result,
"call failed: RtlExtendedMagicDivide(0x%s, 0x%s, %d) has result 0x%s, expected 0x%s\n",
@@ -271,7 +270,6 @@ static const largeint2str_t largeint2str[] = {
{20, 0xdeadbeef, 0, 9, "-------------------------------------------------------------------", STATUS_INVALID_PARAMETER},
{-8, 07654321, 0, 12, "-------------------------------------------------------------------", STATUS_INVALID_PARAMETER},
};
-#define NB_LARGEINT2STR (sizeof(largeint2str)/sizeof(*largeint2str))
static void one_RtlInt64ToUnicodeString_test(int test_num, const largeint2str_t *largeint2str)
@@ -360,7 +358,7 @@ static void test_RtlInt64ToUnicodeString(void)
{
int test_num;
- for (test_num = 0; test_num < NB_LARGEINT2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(largeint2str); test_num++) {
one_RtlInt64ToUnicodeString_test(test_num, &largeint2str[test_num]);
} /* for */
}
@@ -405,7 +403,7 @@ static void test_RtlLargeIntegerToChar(void)
int test_num;
ULONGLONG value;
- for (test_num = 0; test_num < NB_LARGEINT2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(largeint2str); test_num++) {
one_RtlLargeIntegerToChar_test(test_num, &largeint2str[test_num]);
} /* for */
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index db3dc9ff4e..e202408caa 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -708,7 +708,6 @@ static const all_accesses_t all_accesses[] = {
{0xFEDCBA76, 0xC8C4B242, 1},
{0xC8C4B242, 0xFEDCBA76, 0},
};
-#define NB_ALL_ACCESSES (sizeof(all_accesses)/sizeof(*all_accesses))
static void test_RtlAreAllAccessesGranted(void)
@@ -722,7 +721,7 @@ static void test_RtlAreAllAccessesGranted(void)
return;
}
- for (test_num = 0; test_num < NB_ALL_ACCESSES; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(all_accesses); test_num++) {
result = pRtlAreAllAccessesGranted(all_accesses[test_num].GrantedAccess,
all_accesses[test_num].DesiredAccess);
ok(all_accesses[test_num].result == result,
@@ -751,7 +750,6 @@ static const any_accesses_t any_accesses[] = {
{0xFEDCBA76, 0x00040000, 1},
{0xFED8BA76, 0x00040000, 0},
};
-#define NB_ANY_ACCESSES (sizeof(any_accesses)/sizeof(*any_accesses))
static void test_RtlAreAnyAccessesGranted(void)
@@ -765,7 +763,7 @@ static void test_RtlAreAnyAccessesGranted(void)
return;
}
- for (test_num = 0; test_num < NB_ANY_ACCESSES; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(any_accesses); test_num++) {
result = pRtlAreAnyAccessesGranted(any_accesses[test_num].GrantedAccess,
any_accesses[test_num].DesiredAccess);
ok(any_accesses[test_num].result == result,
diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c
index 53cc185939..8b948fa82a 100644
--- a/dlls/ntdll/tests/rtlstr.c
+++ b/dlls/ntdll/tests/rtlstr.c
@@ -406,7 +406,6 @@ static const dupl_ustr_t dupl_ustr[] = {
{ 3, 0, 2, 2, NULL, 40, 42, 42, NULL, 40, 42, 0, NULL, STATUS_INVALID_PARAMETER},
{ 3, 0, 0, 0, NULL, 40, 42, 42, NULL, 0, 2, 2, "", STATUS_SUCCESS},
};
-#define NB_DUPL_USTR (sizeof(dupl_ustr)/sizeof(*dupl_ustr))
static void test_RtlDuplicateUnicodeString(void)
@@ -429,7 +428,7 @@ static void test_RtlDuplicateUnicodeString(void)
return;
}
- for (test_num = 0; test_num < NB_DUPL_USTR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(dupl_ustr); test_num++) {
source_str.Length = dupl_ustr[test_num].source_Length;
source_str.MaximumLength = dupl_ustr[test_num].source_MaximumLength;
if (dupl_ustr[test_num].source_buf != NULL) {
@@ -776,7 +775,6 @@ static const ustr2astr_t ustr2astr[] = {
{ 0, 0, 12, NULL, 10, 10, 12, NULL, FALSE, 5, 0, 0, NULL, STATUS_BUFFER_OVERFLOW},
#endif
};
-#define NB_USTR2ASTR (sizeof(ustr2astr)/sizeof(*ustr2astr))
static void test_RtlUnicodeStringToAnsiString(void)
@@ -789,7 +787,7 @@ static void test_RtlUnicodeStringToAnsiString(void)
NTSTATUS result;
unsigned int test_num;
- for (test_num = 0; test_num < NB_USTR2ASTR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(ustr2astr); test_num++) {
ansi_str.Length = ustr2astr[test_num].ansi_Length;
ansi_str.MaximumLength = ustr2astr[test_num].ansi_MaximumLength;
if (ustr2astr[test_num].ansi_buf != NULL) {
@@ -852,7 +850,6 @@ static const app_asc2str_t app_asc2str[] = {
{ 5, 14, 15, NULL, NULL, 5, 14, 15, NULL, STATUS_SUCCESS},
{ 5, 12, 15, "Tst\0S01234abcde", "tr\0i", 7, 12, 15, "Tst\0Str234abcde", STATUS_SUCCESS},
};
-#define NB_APP_ASC2STR (sizeof(app_asc2str)/sizeof(*app_asc2str))
static void test_RtlAppendAsciizToString(void)
@@ -862,7 +859,7 @@ static void test_RtlAppendAsciizToString(void)
NTSTATUS result;
unsigned int test_num;
- for (test_num = 0; test_num < NB_APP_ASC2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(app_asc2str); test_num++) {
dest_str.Length = app_asc2str[test_num].dest_Length;
dest_str.MaximumLength = app_asc2str[test_num].dest_MaximumLength;
if (app_asc2str[test_num].dest_buf != NULL) {
@@ -922,7 +919,6 @@ static const app_str2str_t app_str2str[] = {
{ 5, 14, 15, NULL, 0, 0, 7, NULL, 5, 14, 15, NULL, STATUS_SUCCESS},
{ 5, 12, 15, "Tst\0S01234abcde", 4, 4, 7, "tr\0iZY", 9, 12, 15, "Tst\0Str\0i4abcde", STATUS_SUCCESS},
};
-#define NB_APP_STR2STR (sizeof(app_str2str)/sizeof(*app_str2str))
static void test_RtlAppendStringToString(void)
@@ -934,7 +930,7 @@ static void test_RtlAppendStringToString(void)
NTSTATUS result;
unsigned int test_num;
- for (test_num = 0; test_num < NB_APP_STR2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(app_str2str); test_num++) {
dest_str.Length = app_str2str[test_num].dest_Length;
dest_str.MaximumLength = app_str2str[test_num].dest_MaximumLength;
if (app_str2str[test_num].dest_buf != NULL) {
@@ -1005,7 +1001,6 @@ static const app_uni2str_t app_uni2str[] = {
{ 4, 14, 14, "Fake0123abcdef", "U\0stri\0", 10, 14, 14, "FakeU\0stri\0\0ef", STATUS_SUCCESS},
{ 6, 14, 16, "Te\0\0stabcdefghij", "St\0\0ri", 8, 14, 16, "Te\0\0stSt\0\0efghij", STATUS_SUCCESS},
};
-#define NB_APP_UNI2STR (sizeof(app_uni2str)/sizeof(*app_uni2str))
static void test_RtlAppendUnicodeToString(void)
@@ -1015,7 +1010,7 @@ static void test_RtlAppendUnicodeToString(void)
NTSTATUS result;
unsigned int test_num;
- for (test_num = 0; test_num < NB_APP_UNI2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(app_uni2str); test_num++) {
dest_str.Length = app_uni2str[test_num].dest_Length;
dest_str.MaximumLength = app_uni2str[test_num].dest_MaximumLength;
if (app_uni2str[test_num].dest_buf != NULL) {
@@ -1079,7 +1074,6 @@ static const app_ustr2str_t app_ustr2str[] = {
{ 4, 14, 14, NULL, 0, 0, 8, NULL, 4, 14, 14, NULL, STATUS_SUCCESS},
{ 6, 14, 16, "Te\0\0stabcdefghij", 6, 8, 8, "St\0\0riZY", 12, 14, 16, "Te\0\0stSt\0\0ri\0\0ij", STATUS_SUCCESS},
};
-#define NB_APP_USTR2STR (sizeof(app_ustr2str)/sizeof(*app_ustr2str))
static void test_RtlAppendUnicodeStringToString(void)
@@ -1091,7 +1085,7 @@ static void test_RtlAppendUnicodeStringToString(void)
NTSTATUS result;
unsigned int test_num;
- for (test_num = 0; test_num < NB_APP_USTR2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(app_ustr2str); test_num++) {
dest_str.Length = app_ustr2str[test_num].dest_Length;
dest_str.MaximumLength = app_ustr2str[test_num].dest_MaximumLength;
if (app_ustr2str[test_num].dest_buf != NULL) {
@@ -1189,7 +1183,6 @@ static const find_ch_in_ustr_t find_ch_in_ustr[] = {
{ 2, "abcdabcdabcdabcdabcdabcd", "abcd", 0, STATUS_NOT_FOUND},
{ 3, "abcdabcdabcdabcdabcdabcd", "abcd", 0, STATUS_NOT_FOUND},
};
-#define NB_FIND_CH_IN_USTR (sizeof(find_ch_in_ustr)/sizeof(*find_ch_in_ustr))
static void test_RtlFindCharInUnicodeString(void)
@@ -1209,7 +1202,7 @@ static void test_RtlFindCharInUnicodeString(void)
return;
}
- for (test_num = 0; test_num < NB_FIND_CH_IN_USTR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(find_ch_in_ustr); test_num++) {
if (find_ch_in_ustr[test_num].main_str != NULL) {
main_str.Length = strlen(find_ch_in_ustr[test_num].main_str) * sizeof(WCHAR);
main_str.MaximumLength = main_str.Length + sizeof(WCHAR);
@@ -1371,7 +1364,6 @@ static const str2int_t str2int[] = {
{-8, "0", 0, STATUS_INVALID_PARAMETER}, /* Negative base */
/* { 0, NULL, 0, STATUS_SUCCESS}, */ /* NULL as string */
};
-#define NB_STR2INT (sizeof(str2int)/sizeof(*str2int))
static void test_RtlUnicodeStringToInteger(void)
@@ -1382,7 +1374,7 @@ static void test_RtlUnicodeStringToInteger(void)
WCHAR *wstr;
UNICODE_STRING uni;
- for (test_num = 0; test_num < NB_STR2INT; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(str2int); test_num++) {
wstr = AtoW(str2int[test_num].str);
value = 0xdeadbeef;
pRtlInitUnicodeString(&uni, wstr);
@@ -1451,7 +1443,7 @@ static void test_RtlCharToInteger(void)
int value;
NTSTATUS result;
- for (test_num = 0; test_num < NB_STR2INT; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(str2int); test_num++) {
/* w2k skips a leading '\0' and processes the string after */
if (str2int[test_num].str[0] != '\0') {
value = 0xdeadbeef;
@@ -1600,7 +1592,6 @@ static const int2str_t int2str[] = {
{20, 0xdeadbeef, 0, 9, "-----------------------------------", STATUS_INVALID_PARAMETER}, /* ill. base */
{-8, 07654321, 0, 12, "-----------------------------------", STATUS_INVALID_PARAMETER}, /* neg. base */
};
-#define NB_INT2STR (sizeof(int2str)/sizeof(*int2str))
static void one_RtlIntegerToUnicodeString_test(int test_num, const int2str_t *int2str)
@@ -1673,7 +1664,7 @@ static void test_RtlIntegerToUnicodeString(void)
{
size_t test_num;
- for (test_num = 0; test_num < NB_INT2STR; test_num++)
+ for (test_num = 0; test_num < ARRAY_SIZE(int2str); test_num++)
one_RtlIntegerToUnicodeString_test(test_num, &int2str[test_num]);
}
@@ -1700,7 +1691,7 @@ static void test_RtlIntegerToChar(void)
NTSTATUS result;
size_t test_num;
- for (test_num = 0; test_num < NB_INT2STR; test_num++)
+ for (test_num = 0; test_num < ARRAY_SIZE(int2str); test_num++)
one_RtlIntegerToChar_test(test_num, &int2str[test_num]);
result = pRtlIntegerToChar(int2str[0].value, 20, int2str[0].MaximumLength, NULL);
diff --git a/dlls/ntdll/tests/string.c b/dlls/ntdll/tests/string.c
index 407bc0ffec..708d6e7b65 100644
--- a/dlls/ntdll/tests/string.c
+++ b/dlls/ntdll/tests/string.c
@@ -212,7 +212,6 @@ static const ulong2str_t ulong2str[] = {
{36, 62193781, "111111\0------------------------------------------------------------", 0x77},
{37, 71270178, "111111\0------------------------------------------------------------", 0x77},
};
-#define NB_ULONG2STR (sizeof(ulong2str)/sizeof(*ulong2str))
static void one_itoa_test(int test_num, const ulong2str_t *ulong2str)
@@ -276,7 +275,7 @@ static void test_ulongtoa(void)
{
int test_num;
- for (test_num = 0; test_num < NB_ULONG2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(ulong2str); test_num++) {
if (ulong2str[test_num].mask & 0x01) {
one_itoa_test(test_num, &ulong2str[test_num]);
} /* if */
@@ -402,7 +401,7 @@ static void test_ulongtow(void)
int test_num;
LPWSTR result;
- for (test_num = 0; test_num < NB_ULONG2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(ulong2str); test_num++) {
if (ulong2str[test_num].mask & 0x10) {
one_itow_test(test_num, &ulong2str[test_num]);
} /* if */
@@ -588,7 +587,6 @@ static const ulonglong2str_t ulonglong2str[] = {
{37, 71270178, "111111\0------------------------------------------------------------", 0x33},
{99, ULL(0x2,0x3c9e468c), "111111\0------------------------------------------------------------", 0x33},
};
-#define NB_ULONGLONG2STR (sizeof(ulonglong2str)/sizeof(*ulonglong2str))
static void one_i64toa_test(int test_num, const ulonglong2str_t *ulonglong2str)
@@ -642,7 +640,7 @@ static void test_ulonglongtoa(void)
{
int test_num;
- for (test_num = 0; test_num < NB_ULONGLONG2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(ulonglong2str); test_num++) {
if (ulonglong2str[test_num].mask & 0x01) {
one_i64toa_test(test_num, &ulonglong2str[test_num]);
} /* if */
@@ -746,7 +744,7 @@ static void test_ulonglongtow(void)
int test_num;
LPWSTR result;
- for (test_num = 0; test_num < NB_ULONGLONG2STR; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(ulonglong2str); test_num++) {
if (ulonglong2str[test_num].mask & 0x10) {
one_i64tow_test(test_num, &ulonglong2str[test_num]);
} /* if */
@@ -885,7 +883,6 @@ static const str2long_t str2long[] = {
{ "", 0 }, /* empty string */
/* { NULL, 0 }, */ /* NULL as string */
};
-#define NB_STR2LONG (sizeof(str2long)/sizeof(*str2long))
static void test_wtoi(void)
@@ -894,7 +891,7 @@ static void test_wtoi(void)
UNICODE_STRING uni;
int result;
- for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(str2long); test_num++) {
pRtlCreateUnicodeStringFromAsciiz(&uni, str2long[test_num].str);
result = p_wtoi(uni.Buffer);
ok(result == str2long[test_num].value,
@@ -909,7 +906,7 @@ static void test_atoi(void)
int test_num;
int result;
- for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(str2long); test_num++) {
result = patoi(str2long[test_num].str);
ok(result == str2long[test_num].value,
"(test %d): call failed: _atoi(\"%s\") has result %d, expected: %d\n",
@@ -922,7 +919,7 @@ static void test_atol(void)
int test_num;
int result;
- for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(str2long); test_num++) {
result = patol(str2long[test_num].str);
ok(result == str2long[test_num].value,
"(test %d): call failed: _atol(\"%s\") has result %d, expected: %d\n",
@@ -936,7 +933,7 @@ static void test_wtol(void)
UNICODE_STRING uni;
LONG result;
- for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(str2long); test_num++) {
pRtlCreateUnicodeStringFromAsciiz(&uni, str2long[test_num].str);
result = p_wtol(uni.Buffer);
ok(result == str2long[test_num].value,
@@ -1068,7 +1065,6 @@ static const str2longlong_t str2longlong[] = {
{ "", 0 }, /* empty string */
/* { NULL, 0 }, */ /* NULL as string */
};
-#define NB_STR2LONGLONG (sizeof(str2longlong)/sizeof(*str2longlong))
static void test_atoi64(void)
@@ -1076,7 +1072,7 @@ static void test_atoi64(void)
int test_num;
LONGLONG result;
- for (test_num = 0; test_num < NB_STR2LONGLONG; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(str2longlong); test_num++) {
result = p_atoi64(str2longlong[test_num].str);
if (str2longlong[test_num].overflow)
ok(result == str2longlong[test_num].value ||
@@ -1100,7 +1096,7 @@ static void test_wtoi64(void)
UNICODE_STRING uni;
LONGLONG result;
- for (test_num = 0; test_num < NB_STR2LONGLONG; test_num++) {
+ for (test_num = 0; test_num < ARRAY_SIZE(str2longlong); test_num++) {
pRtlCreateUnicodeStringFromAsciiz(&uni, str2longlong[test_num].str);
result = p_wtoi64(uni.Buffer);
if (str2longlong[test_num].overflow)
--
2.14.4
June 21, 2018
[PATCH 1/2] ntdll/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/ntdll/tests/directory.c | 4 ++--
dlls/ntdll/tests/exception.c | 16 +++++++---------
dlls/ntdll/tests/file.c | 4 ++--
dlls/ntdll/tests/info.c | 2 +-
dlls/ntdll/tests/om.c | 6 +++---
dlls/ntdll/tests/pipe.c | 4 ++--
dlls/ntdll/tests/rtl.c | 6 +++---
dlls/ntdll/tests/rtlstr.c | 10 +++++-----
dlls/ntdll/tests/string.c | 2 +-
dlls/ntdll/tests/threadpool.c | 14 +++++++-------
10 files changed, 33 insertions(+), 35 deletions(-)
diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c
index f8f27f9d77..2c6170b8b4 100644
--- a/dlls/ntdll/tests/directory.c
+++ b/dlls/ntdll/tests/directory.c
@@ -74,8 +74,8 @@ static struct testfile_s {
{ 0, 0, FILE_ATTRIBUTE_DIRECTORY, {'.'}, ". directory" },
{ 0, 0, FILE_ATTRIBUTE_DIRECTORY, {'.','.'}, ".. directory" }
};
-static const int test_dir_count = sizeof(testfiles) / sizeof(testfiles[0]);
-static const int max_test_dir_size = sizeof(testfiles) / sizeof(testfiles[0]) + 5; /* size of above plus some for .. etc */
+static const int test_dir_count = ARRAY_SIZE(testfiles);
+static const int max_test_dir_size = ARRAY_SIZE(testfiles) + 5; /* size of above plus some for .. etc */
static const WCHAR dummyW[] = {'d','u','m','m','y',0};
static const WCHAR dotW[] = {'.',0};
diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c
index e30cd593d7..5998f54b04 100644
--- a/dlls/ntdll/tests/exception.c
+++ b/dlls/ntdll/tests/exception.c
@@ -643,7 +643,7 @@ static void test_prot_fault(void)
{
unsigned int i;
- for (i = 0; i < sizeof(exceptions)/sizeof(exceptions[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(exceptions); i++)
{
if (is_wow64 && exceptions[i].wow64_broken && !strcmp( winetest_platform, "windows" ))
{
@@ -1734,7 +1734,7 @@ static void call_virtual_unwind( int testnum, const struct unwind_test *test )
for (j = 0; j < 16; j++)
{
- static const UINT nb_regs = sizeof(test->results[i].regs) / sizeof(test->results[i].regs[0]);
+ static const UINT nb_regs = ARRAY_SIZE(test->results[i].regs);
for (k = 0; k < nb_regs; k++)
{
@@ -1888,14 +1888,12 @@ static void test_virtual_unwind(void)
static const struct unwind_test tests[] =
{
- { function_0, sizeof(function_0), unwind_info_0,
- results_0, sizeof(results_0)/sizeof(results_0[0]) },
- { function_1, sizeof(function_1), unwind_info_1,
- results_1, sizeof(results_1)/sizeof(results_1[0]) }
+ { function_0, sizeof(function_0), unwind_info_0, results_0, ARRAY_SIZE(results_0) },
+ { function_1, sizeof(function_1), unwind_info_1, results_1, ARRAY_SIZE(results_1) }
};
unsigned int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
call_virtual_unwind( i, &tests[i] );
}
@@ -2429,7 +2427,7 @@ static void test_prot_fault(void)
{
unsigned int i;
- for (i = 0; i < sizeof(exceptions)/sizeof(exceptions[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(exceptions); i++)
{
got_exception = 0;
run_exception_test(handler, &exceptions[i], &exceptions[i].code,
@@ -2567,7 +2565,7 @@ static void test_debug_registers(void)
HANDLE thread;
int i;
- for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(tests); i++)
{
memset(&ctx, 0, sizeof(ctx));
ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index f88d16b449..d9d029b7f3 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -563,7 +563,7 @@ static void delete_file_test(void)
ok(0, "couldn't get temp dir\n");
return;
}
- if (ret + sizeof(testdirW)/sizeof(WCHAR)-1 + sizeof(subdirW)/sizeof(WCHAR)-1 >= MAX_PATH)
+ if (ret + ARRAY_SIZE(testdirW)-1 + ARRAY_SIZE(subdirW)-1 >= MAX_PATH)
{
ok(0, "MAX_PATH exceeded in constructing paths\n");
return;
@@ -3379,7 +3379,7 @@ static void test_NtCreateFile(void)
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
status = pNtCreateFile(&handle, GENERIC_READ, &attr, &io, NULL,
td[i].attrib_in, FILE_SHARE_READ|FILE_SHARE_WRITE,
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 6c93c3cd58..4a2d9e6933 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -1613,7 +1613,7 @@ static void test_query_process_debug_flags(int argc, char **argv)
ok(!status, "NtQueryInformationProcess failed, status %#x.\n", status);
ok(debug_flags == TRUE, "Expected flag TRUE, got %x.\n", debug_flags);
- for (i = 0; i < sizeof(test_flags)/sizeof(test_flags[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_flags); i++)
{
DWORD expected_flags = !(test_flags[i] & DEBUG_ONLY_THIS_PROCESS);
sprintf(cmdline, "%s %s %s", argv[0], argv[1], "debuggee");
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 43c5ee46d7..52b4a83968 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -650,7 +650,7 @@ static void test_name_limits(void)
/* named pipes */
memcpy( str.Buffer, pipeW, sizeof(pipeW) );
- for (i = 0; i < 65536 / sizeof(WCHAR); i++) str.Buffer[i + sizeof(pipeW)/sizeof(WCHAR)] = 'a';
+ for (i = 0; i < 65536 / sizeof(WCHAR); i++) str.Buffer[i + ARRAY_SIZE(pipeW)] = 'a';
str.Length = 0;
attr.RootDirectory = 0;
attr.Attributes = OBJ_CASE_INSENSITIVE;
@@ -703,7 +703,7 @@ static void test_name_limits(void)
/* mailslots */
memcpy( str.Buffer, mailslotW, sizeof(mailslotW) );
- for (i = 0; i < 65536 / sizeof(WCHAR); i++) str.Buffer[i + sizeof(mailslotW)/sizeof(WCHAR)] = 'a';
+ for (i = 0; i < 65536 / sizeof(WCHAR); i++) str.Buffer[i + ARRAY_SIZE(mailslotW)] = 'a';
str.Length = 0;
status = pNtCreateMailslotFile( &ret, GENERIC_ALL, &attr, &iosb, 0, 0, 0, NULL );
ok( status == STATUS_OBJECT_PATH_SYNTAX_BAD, "%u: NtCreateMailslotFile failed %x\n", str.Length, status );
@@ -744,7 +744,7 @@ static void test_name_limits(void)
/* registry keys */
memcpy( str.Buffer, registryW, sizeof(registryW) );
- for (i = 0; i < 65536 / sizeof(WCHAR); i++) str.Buffer[i + sizeof(registryW)/sizeof(WCHAR)] = 'a';
+ for (i = 0; i < 65536 / sizeof(WCHAR); i++) str.Buffer[i + ARRAY_SIZE(registryW)] = 'a';
str.Length = 0;
status = pNtCreateKey( &ret, GENERIC_ALL, &attr, 0, NULL, 0, NULL );
todo_wine
diff --git a/dlls/ntdll/tests/pipe.c b/dlls/ntdll/tests/pipe.c
index 2978274715..c8e6809423 100644
--- a/dlls/ntdll/tests/pipe.c
+++ b/dlls/ntdll/tests/pipe.c
@@ -230,8 +230,8 @@ static void test_create(void)
static const DWORD sharing[] = { FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE };
static const DWORD pipe_config[]= { 1, 0, 2 };
- for (j = 0; j < sizeof(sharing) / sizeof(DWORD); j++) {
- for (k = 0; k < sizeof(access) / sizeof(DWORD); k++) {
+ for (j = 0; j < ARRAY_SIZE(sharing); j++) {
+ for (k = 0; k < ARRAY_SIZE(access); k++) {
HANDLE hclient;
BOOL should_succeed = TRUE;
diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c
index 2e3a7de75d..db3dc9ff4e 100644
--- a/dlls/ntdll/tests/rtl.c
+++ b/dlls/ntdll/tests/rtl.c
@@ -680,7 +680,7 @@ static void test_RtlRandom(void)
}
seed = 0;
- for (i = 0; i < sizeof(res) / sizeof(res[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(res); i++)
{
res[i] = pRtlRandom(&seed);
ok(seed != res[i], "%i: seed is same as res %x\n", i, seed);
@@ -1226,7 +1226,7 @@ static void test_RtlIpv4StringToAddress(void)
{ "::1", STATUS_INVALID_PARAMETER, 0, { -1 } },
{ ":1", STATUS_INVALID_PARAMETER, 0, { -1 } },
};
- const int testcount = sizeof(tests) / sizeof(tests[0]);
+ const int testcount = ARRAY_SIZE(tests);
int i;
if (!pRtlIpv4StringToAddressA)
@@ -1787,7 +1787,7 @@ static void test_RtlDecompressBuffer(void)
ok(final_size == 0xdeadbeef, "got wrong final_size %u\n", final_size);
/* regular tests for RtlDecompressBuffer */
- for (i = 0; i < sizeof(test_lznt) / sizeof(test_lznt[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_lznt); i++)
{
trace("Running test %d (compressed_size=%u, uncompressed_size=%u, status=0x%08x)\n",
i, test_lznt[i].compressed_size, test_lznt[i].uncompressed_size, test_lznt[i].status);
diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c
index 7f889dfa0d..53cc185939 100644
--- a/dlls/ntdll/tests/rtlstr.c
+++ b/dlls/ntdll/tests/rtlstr.c
@@ -1769,7 +1769,7 @@ static void test_RtlIsTextUnicode(void)
be_unicode = HeapAlloc(GetProcessHeap(), 0, sizeof(unicode) + sizeof(WCHAR));
be_unicode[0] = 0xfffe;
- for (i = 0; i < sizeof(unicode)/sizeof(unicode[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(unicode); i++)
{
be_unicode[i + 1] = (unicode[i] >> 8) | ((unicode[i] & 0xff) << 8);
}
@@ -1791,7 +1791,7 @@ static void test_RtlIsTextUnicode(void)
be_unicode_no_controls = HeapAlloc(GetProcessHeap(), 0, sizeof(unicode) + sizeof(WCHAR));
ok(be_unicode_no_controls != NULL, "Expected HeapAlloc to succeed.\n");
be_unicode_no_controls[0] = 0xfffe;
- for (i = 0; i < sizeof(unicode_no_controls)/sizeof(unicode_no_controls[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(unicode_no_controls); i++)
be_unicode_no_controls[i + 1] = (unicode_no_controls[i] >> 8) | ((unicode_no_controls[i] & 0xff) << 8);
@@ -2093,7 +2093,7 @@ static void test_RtlUnicodeToUTF8N(void)
const WCHAR special_string[] = { 'X',0x80,0xd800,0 };
const unsigned char special_expected[] = { 'X',0xc2,0x80,0xef,0xbf,0xbd,0 };
unsigned int input_len;
- const unsigned int test_count = sizeof(unicode_to_utf8) / sizeof(unicode_to_utf8[0]);
+ const unsigned int test_count = ARRAY_SIZE(unicode_to_utf8);
unsigned int i;
if (!pRtlUnicodeToUTF8N)
@@ -2374,7 +2374,7 @@ static void unicode_expect_(const WCHAR *out_string, ULONG buflen, ULONG out_cha
ok_(__FILE__, line)(buffer[i] == out_string[i],
"buffer[%d] = 0x%x, expected 0x%x\n",
i, buffer[i], out_string[i]);
- for (; i < sizeof(buffer) / sizeof(WCHAR); i++)
+ for (; i < ARRAY_SIZE(buffer); i++)
ok_(__FILE__, line)(buffer[i] == 0x5555,
"buffer[%d] = 0x%x, expected 0x5555\n",
i, buffer[i]);
@@ -2396,7 +2396,7 @@ static void test_RtlUTF8ToUnicodeN(void)
const char special_string[] = { 'X',0xc2,0x80,0xF0,0x90,0x80,0x80,0 };
const WCHAR special_expected[] = { 'X',0x80,0xd800,0xdc00,0 };
unsigned int input_len;
- const unsigned int test_count = sizeof(utf8_to_unicode) / sizeof(utf8_to_unicode[0]);
+ const unsigned int test_count = ARRAY_SIZE(utf8_to_unicode);
unsigned int i;
if (!pRtlUTF8ToUnicodeN)
diff --git a/dlls/ntdll/tests/string.c b/dlls/ntdll/tests/string.c
index 8fca5d46d5..407bc0ffec 100644
--- a/dlls/ntdll/tests/string.c
+++ b/dlls/ntdll/tests/string.c
@@ -1258,7 +1258,7 @@ static void test_bsearch(void)
int *x, l, i, j;
/* just try all array sizes */
- for (j=1;j<sizeof(arr)/sizeof(arr[0]);j++) {
+ for (j=1;j<ARRAY_SIZE(arr);j++) {
for (i=0;i<j;i++) {
l = arr[i];
x = p_bsearch (&l, arr, j, sizeof(arr[0]), intcomparefunc);
diff --git a/dlls/ntdll/tests/threadpool.c b/dlls/ntdll/tests/threadpool.c
index af0b6673d3..3bd2d994ec 100644
--- a/dlls/ntdll/tests/threadpool.c
+++ b/dlls/ntdll/tests/threadpool.c
@@ -1824,7 +1824,7 @@ static void test_tp_multi_wait(void)
environment.Pool = pool;
/* create semaphores and corresponding wait objects */
- for (i = 0; i < sizeof(semaphores)/sizeof(semaphores[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(semaphores); i++)
{
semaphores[i] = CreateSemaphoreW(NULL, 0, 1, NULL);
ok(semaphores[i] != NULL, "failed to create semaphore %i\n", i);
@@ -1838,7 +1838,7 @@ static void test_tp_multi_wait(void)
}
/* release all semaphores and wait for callback */
- for (i = 0; i < sizeof(semaphores)/sizeof(semaphores[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(semaphores); i++)
{
multi_wait_info.result = 0;
ReleaseSemaphore(semaphores[i], 1, NULL);
@@ -1851,7 +1851,7 @@ static void test_tp_multi_wait(void)
}
/* repeat the same test in reverse order */
- for (i = sizeof(semaphores)/sizeof(semaphores[0]) - 1; i >= 0; i--)
+ for (i = ARRAY_SIZE(semaphores) - 1; i >= 0; i--)
{
multi_wait_info.result = 0;
ReleaseSemaphore(semaphores[i], 1, NULL);
@@ -1865,13 +1865,13 @@ static void test_tp_multi_wait(void)
/* test timeout of wait objects */
multi_wait_info.result = 0;
- for (i = 0; i < sizeof(semaphores)/sizeof(semaphores[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(semaphores); i++)
{
when.QuadPart = (ULONGLONG)50 * -10000;
pTpSetWait(waits[i], semaphores[i], &when);
}
- for (i = 0; i < sizeof(semaphores)/sizeof(semaphores[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(semaphores); i++)
{
result = WaitForSingleObject(semaphore, 150);
ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", result);
@@ -1880,14 +1880,14 @@ static void test_tp_multi_wait(void)
ok(multi_wait_info.result >> 16, "expected multi_wait_info.result >> 16 != 0\n");
/* destroy the wait objects and semaphores while waiting */
- for (i = 0; i < sizeof(semaphores)/sizeof(semaphores[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(semaphores); i++)
{
pTpSetWait(waits[i], semaphores[i], NULL);
}
Sleep(50);
- for (i = 0; i < sizeof(semaphores)/sizeof(semaphores[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(semaphores); i++)
{
pTpReleaseWait(waits[i]);
NtClose(semaphores[i]);
--
2.14.4
June 21, 2018
[PATCH] wininet/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/wininet/tests/ftp.c | 2 +-
dlls/wininet/tests/http.c | 10 ++++-----
dlls/wininet/tests/internet.c | 16 ++++++-------
dlls/wininet/tests/url.c | 52 +++++++++++++++++++++----------------------
dlls/wininet/tests/urlcache.c | 4 ++--
5 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index d2118faded..6f50104f3b 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -735,7 +735,7 @@ static void test_command(HINTERNET hFtp, HINTERNET hConnect)
return;
}
- for (i = 0; i < sizeof(command_test) / sizeof(command_test[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(command_test); i++)
{
SetLastError(0xdeadbeef);
ret = pFtpCommandA(hFtp, FALSE, FTP_TRANSFER_TYPE_ASCII, command_test[i].cmd, 0, NULL);
diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c
index 0524ddf3fd..ace8512399 100644
--- a/dlls/wininet/tests/http.c
+++ b/dlls/wininet/tests/http.c
@@ -172,7 +172,7 @@ static BOOL (WINAPI *pInternetGetSecurityInfoByURLA)(LPSTR,PCCERT_CHAIN_CONTEXT*
static int strcmp_wa(LPCWSTR strw, const char *stra)
{
WCHAR buf[512];
- MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, ARRAY_SIZE(buf));
return lstrcmpW(strw, buf);
}
@@ -4204,7 +4204,7 @@ static void test_http_status(int port)
DWORD i, size;
BOOL res;
- for(i=0; i < sizeof(http_status_tests)/sizeof(*http_status_tests); i++) {
+ for(i = 0; i < ARRAY_SIZE(http_status_tests); i++) {
send_buffer = http_status_tests[i].response_text;
open_simple_request(&req, "localhost", port, NULL, "/send_from_buffer");
@@ -6543,14 +6543,14 @@ static const struct notification async_send_request_ex_chunked_test[] =
static const struct notification_data notification_data[] = {
{
async_send_request_ex_chunked_test,
- sizeof(async_send_request_ex_chunked_test)/sizeof(async_send_request_ex_chunked_test[0]),
+ ARRAY_SIZE(async_send_request_ex_chunked_test),
"GET",
"test.winehq.org",
"tests/data.php"
},
{
async_send_request_ex_test,
- sizeof(async_send_request_ex_test)/sizeof(async_send_request_ex_test[0]),
+ ARRAY_SIZE(async_send_request_ex_test),
"POST",
"test.winehq.org",
"tests/post.php",
@@ -6565,7 +6565,7 @@ static const struct notification_data notification_data[] = {
},
{
async_send_request_ex_resolve_failure_test,
- sizeof(async_send_request_ex_resolve_failure_test)/sizeof(async_send_request_ex_resolve_failure_test[0]),
+ ARRAY_SIZE(async_send_request_ex_resolve_failure_test),
"GET",
"brokenhost",
"index.html",
diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c
index 39c698f5db..7889e40ea8 100644
--- a/dlls/wininet/tests/internet.c
+++ b/dlls/wininet/tests/internet.c
@@ -629,7 +629,7 @@ static void test_cookie_url(void)
ok(!res && GetLastError() == ERROR_INVALID_PARAMETER,
"InternetGetCookeA failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
- len = sizeof(bufw)/sizeof(*bufw);
+ len = ARRAY_SIZE(bufw);
res = InternetGetCookieW(about_blankW, NULL, bufw, &len);
ok(!res && GetLastError() == ERROR_INVALID_PARAMETER,
"InternetGetCookeW failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
@@ -639,7 +639,7 @@ static void test_cookie_url(void)
ok(!res && GetLastError() == ERROR_INVALID_PARAMETER,
"InternetGetCookeExA failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
- len = sizeof(bufw)/sizeof(*bufw);
+ len = ARRAY_SIZE(bufw);
res = pInternetGetCookieExW(about_blankW, NULL, bufw, &len, 0, NULL);
ok(!res && GetLastError() == ERROR_INVALID_PARAMETER,
"InternetGetCookeExW failed: %u, expected ERROR_INVALID_PARAMETER\n", GetLastError());
@@ -887,7 +887,7 @@ static void InternetTimeFromSystemTimeW_test(void)
/* test too small buffer size */
SetLastError(0xdeadbeef);
- ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, string, sizeof(string)/sizeof(string[0]) );
+ ret = pInternetTimeFromSystemTimeW( &time, INTERNET_RFC1123_FORMAT, string, ARRAY_SIZE(string));
error = GetLastError();
ok( !ret, "InternetTimeFromSystemTimeW should have returned FALSE\n" );
ok( error == ERROR_INSUFFICIENT_BUFFER,
@@ -1084,7 +1084,7 @@ static void test_PrivacyGetSetZonePreferenceW(void)
trace("template %u\n", old_template);
if(old_template == PRIVACY_TEMPLATE_ADVANCED) {
- pref_size = sizeof(pref)/sizeof(WCHAR);
+ pref_size = ARRAY_SIZE(pref);
ret = pPrivacyGetZonePreferenceW(zone, type, &old_template, pref, &pref_size);
ok(ret == 0, "expected ret == 0, got %u\n", ret);
}
@@ -1721,7 +1721,7 @@ static void test_InternetGetConnectedStateExW(void)
flags = 0;
buffer[0] = 0;
- res = pInternetGetConnectedStateExW(&flags, buffer, sizeof(buffer) / sizeof(buffer[0]), 0);
+ res = pInternetGetConnectedStateExW(&flags, buffer, ARRAY_SIZE(buffer), 0);
trace("Internet Connection: Flags 0x%02x - Name '%s'\n", flags, wine_dbgstr_w(buffer));
todo_wine
ok (flags & INTERNET_RAS_INSTALLED, "Missing RAS flag\n");
@@ -1755,21 +1755,21 @@ todo_wine
ok(!buffer[0], "Buffer must not change, got %02X\n", buffer[0]);
buffer[0] = 0;
- res = pInternetGetConnectedStateExW(NULL, buffer, sizeof(buffer) / sizeof(buffer[0]), 0);
+ res = pInternetGetConnectedStateExW(NULL, buffer, ARRAY_SIZE(buffer), 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
sz = lstrlenW(buffer);
ok(sz > 0, "Expected a connection name\n");
buffer[0] = 0;
flags = 0;
- res = pInternetGetConnectedStateExW(&flags, buffer, sizeof(buffer) / sizeof(buffer[0]), 0);
+ res = pInternetGetConnectedStateExW(&flags, buffer, ARRAY_SIZE(buffer), 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
sz = lstrlenW(buffer);
ok(sz > 0, "Expected a connection name\n");
flags = 0;
- res = pInternetGetConnectedStateExW(&flags, NULL, sizeof(buffer) / sizeof(buffer[0]), 0);
+ res = pInternetGetConnectedStateExW(&flags, NULL, ARRAY_SIZE(buffer), 0);
ok(res == TRUE, "Expected TRUE, got %d\n", res);
ok(flags, "Expected at least one flag set\n");
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
index 0af58358eb..18c77b6647 100644
--- a/dlls/wininet/tests/url.c
+++ b/dlls/wininet/tests/url.c
@@ -672,17 +672,17 @@ static void InternetCrackUrlW_test(void)
memset(&comp, 0, sizeof comp);
comp.dwStructSize = sizeof(comp);
comp.lpszScheme = scheme;
- comp.dwSchemeLength = sizeof(scheme)/sizeof(scheme[0]);
+ comp.dwSchemeLength = ARRAY_SIZE(scheme);
comp.lpszHostName = host;
- comp.dwHostNameLength = sizeof(host)/sizeof(host[0]);
+ comp.dwHostNameLength = ARRAY_SIZE(host);
comp.lpszUserName = user;
- comp.dwUserNameLength = sizeof(user)/sizeof(user[0]);
+ comp.dwUserNameLength = ARRAY_SIZE(user);
comp.lpszPassword = pwd;
- comp.dwPasswordLength = sizeof(pwd)/sizeof(pwd[0]);
+ comp.dwPasswordLength = ARRAY_SIZE(pwd);
comp.lpszUrlPath = urlpart;
- comp.dwUrlPathLength = sizeof(urlpart)/sizeof(urlpart[0]);
+ comp.dwUrlPathLength = ARRAY_SIZE(urlpart);
comp.lpszExtraInfo = extra;
- comp.dwExtraInfoLength = sizeof(extra)/sizeof(extra[0]);
+ comp.dwExtraInfoLength = ARRAY_SIZE(extra);
SetLastError(0xdeadbeef);
r = InternetCrackUrlW(NULL, 0, 0, &comp );
@@ -721,9 +721,9 @@ static void InternetCrackUrlW_test(void)
memset(&comp, 0, sizeof comp);
comp.dwStructSize = sizeof comp;
comp.lpszHostName = host;
- comp.dwHostNameLength = sizeof(host)/sizeof(host[0]);
+ comp.dwHostNameLength = ARRAY_SIZE(host);
comp.lpszUrlPath = urlpart;
- comp.dwUrlPathLength = sizeof(urlpart)/sizeof(urlpart[0]);
+ comp.dwUrlPathLength = ARRAY_SIZE(urlpart);
r = InternetCrackUrlW(url, 0, 0, &comp );
ok( r, "failed to crack url\n");
@@ -739,11 +739,11 @@ static void InternetCrackUrlW_test(void)
memset(&comp, 0, sizeof comp);
comp.dwStructSize = sizeof comp;
comp.lpszHostName = host;
- comp.dwHostNameLength = sizeof(host)/sizeof(host[0]);
+ comp.dwHostNameLength = ARRAY_SIZE(host);
comp.lpszUrlPath = urlpart;
- comp.dwUrlPathLength = sizeof(urlpart)/sizeof(urlpart[0]);
+ comp.dwUrlPathLength = ARRAY_SIZE(urlpart);
comp.lpszExtraInfo = NULL;
- comp.dwExtraInfoLength = sizeof(extra)/sizeof(extra[0]);
+ comp.dwExtraInfoLength = ARRAY_SIZE(extra);
r = InternetCrackUrlW(url, 0, 0, &comp );
ok( r, "failed to crack url\n");
@@ -763,17 +763,17 @@ static void InternetCrackUrlW_test(void)
memset(&comp, 0, sizeof(comp));
comp.dwStructSize = sizeof(comp);
comp.lpszScheme = scheme;
- comp.dwSchemeLength = sizeof(scheme)/sizeof(scheme[0]);
+ comp.dwSchemeLength = ARRAY_SIZE(scheme);
comp.lpszHostName = host;
- comp.dwHostNameLength = sizeof(host)/sizeof(host[0]);
+ comp.dwHostNameLength = ARRAY_SIZE(host);
comp.lpszUserName = user;
- comp.dwUserNameLength = sizeof(user)/sizeof(user[0]);
+ comp.dwUserNameLength = ARRAY_SIZE(user);
comp.lpszPassword = pwd;
- comp.dwPasswordLength = sizeof(pwd)/sizeof(pwd[0]);
+ comp.dwPasswordLength = ARRAY_SIZE(pwd);
comp.lpszUrlPath = urlpart;
- comp.dwUrlPathLength = sizeof(urlpart)/sizeof(urlpart[0]);
+ comp.dwUrlPathLength = ARRAY_SIZE(urlpart);
comp.lpszExtraInfo = extra;
- comp.dwExtraInfoLength = sizeof(extra)/sizeof(extra[0]);
+ comp.dwExtraInfoLength = ARRAY_SIZE(extra);
r = InternetCrackUrlW(url2, 0, 0, &comp);
ok(!r, "InternetCrackUrl should have failed\n");
@@ -791,17 +791,17 @@ static void InternetCrackUrlW_test(void)
memset(&comp, 0, sizeof comp);
comp.dwStructSize = sizeof comp;
comp.lpszScheme = scheme;
- comp.dwSchemeLength = sizeof(scheme)/sizeof(scheme[0]);
+ comp.dwSchemeLength = ARRAY_SIZE(scheme);
comp.lpszHostName = host;
- comp.dwHostNameLength = sizeof(host)/sizeof(host[0]);
+ comp.dwHostNameLength = ARRAY_SIZE(host);
comp.lpszUserName = user;
- comp.dwUserNameLength = sizeof(user)/sizeof(user[0]);
+ comp.dwUserNameLength = ARRAY_SIZE(user);
comp.lpszPassword = pwd;
- comp.dwPasswordLength = sizeof(pwd)/sizeof(pwd[0]);
+ comp.dwPasswordLength = ARRAY_SIZE(pwd);
comp.lpszUrlPath = urlpart;
- comp.dwUrlPathLength = sizeof(urlpart)/sizeof(urlpart[0]);
+ comp.dwUrlPathLength = ARRAY_SIZE(urlpart);
comp.lpszExtraInfo = extra;
- comp.dwExtraInfoLength = sizeof(extra)/sizeof(extra[0]);
+ comp.dwExtraInfoLength = ARRAY_SIZE(extra);
r = InternetCrackUrlW(url3, 0, 0, &comp );
ok( r, "InternetCrackUrlW failed unexpectedly\n");
ok( host[0] == 'x', "host should be x.org\n");
@@ -812,9 +812,9 @@ static void InternetCrackUrlW_test(void)
memset(&comp, 0, sizeof(comp));
comp.dwStructSize = sizeof(comp);
comp.lpszHostName = host;
- comp.dwHostNameLength = sizeof(host)/sizeof(host[0]);
+ comp.dwHostNameLength = ARRAY_SIZE(host);
comp.lpszUrlPath = urlpart;
- comp.dwUrlPathLength = sizeof(urlpart)/sizeof(urlpart[0]);
+ comp.dwUrlPathLength = ARRAY_SIZE(urlpart);
r = InternetCrackUrlW(url3, 0, ICU_DECODE, &comp);
todo_wine ok(r, "InternetCrackUrlW failed unexpectedly\n");
todo_wine ok(!strcmp_wa(host, "x.org"), "host is %s, should be x.org\n", wine_dbgstr_w(host));
@@ -1224,7 +1224,7 @@ START_TEST(url)
return;
}
- for(i=0; i < sizeof(crack_url_tests)/sizeof(*crack_url_tests); i++)
+ for(i = 0; i < ARRAY_SIZE(crack_url_tests); i++)
test_crack_url(crack_url_tests+i);
test_long_url();
diff --git a/dlls/wininet/tests/urlcache.c b/dlls/wininet/tests/urlcache.c
index 310054b6a7..3799500489 100644
--- a/dlls/wininet/tests/urlcache.c
+++ b/dlls/wininet/tests/urlcache.c
@@ -891,13 +891,13 @@ static void test_urlcacheW(void)
if(ie10_cache) {
if(!MultiByteToWideChar(CP_ACP, 0, urls[6].encoded_url, -1,
- urls[6].url, sizeof(urls[6].url)/sizeof(WCHAR)))
+ urls[6].url, ARRAY_SIZE(urls[6].url)))
urls[6].url[0] = 0;
trace("converted url in test 6: %s\n", wine_dbgstr_w(urls[6].url));
}
- for(i=0; i<sizeof(urls)/sizeof(*urls); i++) {
+ for(i=0; i<ARRAY_SIZE(urls); i++) {
INTERNET_CACHE_ENTRY_INFOA *entry_infoA;
INTERNET_CACHE_ENTRY_INFOW *entry_infoW;
DWORD size;
--
2.14.4
June 21, 2018
[PATCH] appwiz.cpl: Support installing minor updates when installing addons
by Piotr Caban
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
---
dlls/appwiz.cpl/addons.c | 5 +++++
1 file changed, 5 insertions(+)
June 21, 2018
Re: [PATCH 3/3] Add new test for DXTn volume textures.
by Marvin
Hi,
While running your changed tests on Windows, I think I found new failures.
Being a bot and all I'm not very good at pattern recognition, so I might be
wrong, but could you please double-check?
Full results can be found at
https://testbot.winehq.org/JobDetails.pl?Key=39289
Your paranoid android.
=== w1064 (64 bit visual) ===
visual.c:8645: Test failed: Got unexpected color 0x00007580 for quad 2 (different colors).
June 21, 2018
[PATCH 3/3] Add new test for DXTn volume textures.
by Connor McAdams
To properly test the functionality of DXTn volume textures, I have added
new tests for DXT1, DXT3, and DXT5 replacing the old DXT5 test. I also
added a function to get the alpha values of pixels, although there may
have been a reason one wasn't included in the first place, it's the only
real way to make sure the alpha is behaving properly on the formats.
---
dlls/d3d9/tests/visual.c | 190 ++++++++++++++++++++++++++++++++---------------
1 file changed, 131 insertions(+), 59 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index b36c189..ec121b0 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -186,6 +186,31 @@ static void release_surface_readback(struct surface_readback *rb)
IDirect3DSurface9_Release(rb->surface);
}
+static DWORD getAlphaPixelColor(IDirect3DDevice9 *device, UINT x, UINT y)
+{
+ DWORD ret;
+ IDirect3DSurface9 *rt;
+ struct surface_readback rb;
+ HRESULT hr;
+
+ hr = IDirect3DDevice9_GetRenderTarget(device, 0, &rt);
+ if(FAILED(hr))
+ {
+ trace("Can't get the render target, hr %#x.\n", hr);
+ return 0xdeadbeed;
+ }
+
+ get_rt_readback(rt, &rb);
+ /* Remove the X channel for now. DirectX and OpenGL have different ideas how to treat it apparently, and it isn't
+ * really important for these tests
+ */
+ ret = get_readback_color(&rb, x, y) & 0xffffffff;
+ release_surface_readback(&rb);
+
+ IDirect3DSurface9_Release(rt);
+ return ret;
+}
+
static DWORD getPixelColor(IDirect3DDevice9 *device, UINT x, UINT y)
{
DWORD ret;
@@ -17741,22 +17766,39 @@ done:
DestroyWindow(window);
}
-static void volume_dxt5_test(void)
+static void volume_dxtn_test(void)
{
IDirect3DVolumeTexture9 *texture;
IDirect3DDevice9 *device;
D3DLOCKED_BOX box;
IDirect3D9 *d3d;
- unsigned int i;
+ unsigned int i, x;
ULONG refcount;
DWORD color;
HWND window;
HRESULT hr;
- static const char texture_data[] =
+ static const char dxt1_texture_data[] =
+ {
+ /* A 8x4x2 texture consisting of 4 4x4 blocks. The colors of the blocks are red, green, blue and white. */
+ 0x00, 0xF8, 0x00, 0xF8, 0xF0, 0xF0, 0xF0, 0xF0,
+ 0xE0, 0x07, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0x1F, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00
+ };
+ static const char dxt3_texture_data[] =
+ {
+ /* A 8x4x2 texture consisting of 4 4x4 blocks. The colors of the blocks are red, green, blue and white. The red block goes from
+ * 15 to 0 on alpha level. */
+ 0xFF, 0xEE, 0xFF, 0xEE, 0xFF, 0xEE, 0xFF, 0xEE, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
+ 0xFF, 0xDD, 0xFF, 0xDD, 0xFF, 0xDD, 0xFF, 0xDD, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00,
+ 0xFF, 0xCC, 0xFF, 0xCC, 0xFF, 0xCC, 0xFF, 0xCC, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xFF, 0xBB, 0xFF, 0xBB, 0xFF, 0xBB, 0xFF, 0xBB, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
+ };
+ static const char dxt5_texture_data[] =
{
/* A 8x4x2 texture consisting of 4 4x4 blocks. The colors of the blocks are red, green, blue and white. */
- 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
+ 0xff, 0xff, 0x80, 0x0D, 0xD8, 0x80, 0x0D, 0xD8, 0x00, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
@@ -17778,70 +17820,100 @@ static void volume_dxt5_test(void)
{{ 1.0f, -1.0f, 1.0f}, { 1.0f, 0.0f, 0.75f}},
{{ 1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 0.75f}},
};
- static const DWORD expected_colors[] = {0x00ff0000, 0x0000ff00, 0x000000ff, 0x00ffffff};
-
- window = create_window();
- d3d = Direct3DCreate9(D3D_SDK_VERSION);
- ok(!!d3d, "Failed to create a D3D object.\n");
- if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
- D3DFMT_X8R8G8B8, 0, D3DRTYPE_VOLUMETEXTURE, D3DFMT_DXT5)))
+ static const DWORD expected_colors[3][8] = {
{
- skip("DXT5 volume textures are not supported, skipping test.\n");
- goto done;
- }
- if (!(device = create_device(d3d, window, window, TRUE)))
+ 0xFFFF0000, 0x00000000, 0xFF00FF00, 0xFF00FF00,
+ 0xFF0000FF, 0xFF0000FF, 0xFFFFFFFF, 0xFFFFFFFF,
+ },
{
- skip("Failed to create a D3D device, skipping tests.\n");
- goto done;
+ 0xFFFF0000, 0xEEFF0000, 0xFF00FF00, 0xDD00FF00,
+ 0xFF0000FF, 0xCC0000FF, 0xFFFFFFFF, 0xBBFFFFFF,
+ },
+ {
+ 0xFFFF0000, 0x00FF0000, 0xFF00FF00, 0xFF00FF00,
+ 0xFF0000FF, 0xFF0000FF, 0xFFFFFFFF, 0xFFFFFFFF
}
+ };
+ static const char *const dxtn[3] = {"DXT1", "DXT3", "DXT5"};
+ static const unsigned int fmt[3] = {D3DFMT_DXT1, D3DFMT_DXT3, D3DFMT_DXT5};
- hr = IDirect3DDevice9_CreateVolumeTexture(device, 8, 4, 2, 1, 0, D3DFMT_DXT5,
- D3DPOOL_MANAGED, &texture, NULL);
- ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr);
+ for (x = 0; x < 3; x++)
+ {
+ window = create_window();
+ d3d = Direct3DCreate9(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+ if (FAILED(IDirect3D9_CheckDeviceFormat(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
+ D3DFMT_A8B8G8R8, 0, D3DRTYPE_VOLUMETEXTURE, fmt[x])))
+ {
+ skip("%s volume textures are not supported, skipping test.\n", dxtn[x]);
+ continue;
+ }
+ if (!(device = create_device(d3d, window, window, TRUE)))
+ {
+ skip("Failed to create a D3D device, skipping tests.\n");
+ continue;
+ }
- hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &box, NULL, 0);
- ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr);
- memcpy(box.pBits, texture_data, sizeof(texture_data));
- hr = IDirect3DVolumeTexture9_UnlockBox(texture, 0);
- ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_CreateVolumeTexture(device, 8, 4, 2, 1, 0, fmt[x],
+ D3DPOOL_MANAGED, &texture, NULL);
+ ok(SUCCEEDED(hr), "Failed to create volume texture, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0));
- ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture);
- ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
- ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
- ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
- ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
- hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
- ok(SUCCEEDED(hr), "Failed to set mag filter, hr %#x.\n", hr);
+ hr = IDirect3DVolumeTexture9_LockBox(texture, 0, &box, NULL, 0);
+ ok(SUCCEEDED(hr), "Failed to lock volume texture, hr %#x.\n", hr);
+ switch (x)
+ {
+ case 0:
+ memcpy(box.pBits, dxt1_texture_data, sizeof(dxt1_texture_data));
+ break;
+ case 1:
+ memcpy(box.pBits, dxt3_texture_data, sizeof(dxt3_texture_data));
+ break;
+ case 2:
+ memcpy(box.pBits, dxt5_texture_data, sizeof(dxt5_texture_data));
+ break;
+ }
+ hr = IDirect3DVolumeTexture9_UnlockBox(texture, 0);
+ ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
- hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0);
- ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
- hr = IDirect3DDevice9_BeginScene(device);
- ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
- hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads));
- ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
- hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[4], sizeof(*quads));
- ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
- hr = IDirect3DDevice9_EndScene(device);
- ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ | D3DFVF_TEX1 | D3DFVF_TEXCOORDSIZE3(0));
+ ok(SUCCEEDED(hr), "Failed to set FVF, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetTexture(device, 0, (IDirect3DBaseTexture9 *)texture);
+ ok(SUCCEEDED(hr), "Failed to set texture, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+ ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
+ ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetTextureStageState(device, 1, D3DTSS_COLOROP, D3DTOP_DISABLE);
+ ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
+ ok(SUCCEEDED(hr), "Failed to set mag filter, hr %#x.\n", hr);
- for (i = 0; i < 4; i++)
- {
- color = getPixelColor(device, 80 + 160 * i, 240);
- ok (color_match(color, expected_colors[i], 1),
- "Expected color 0x%08x, got 0x%08x, case %u.\n", expected_colors[i], color, i);
+ hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00ff00ff, 1.0f, 0);
+ ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_BeginScene(device);
+ ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[0], sizeof(*quads));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, &quads[4], sizeof(*quads));
+ ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_EndScene(device);
+ ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
+
+ for (i = 0; i < 8; i++)
+ {
+ color = getAlphaPixelColor(device, 40 + 80 * i, 240);
+ ok (color_match(color, expected_colors[x][i], 1),
+ "Expected color 0x%08x, got 0x%08x, case %u.\n", expected_colors[x][i], color, i);
+ }
+
+ hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
+ ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
+ IDirect3DVolumeTexture9_Release(texture);
+
+ refcount = IDirect3DDevice9_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
}
- hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
- ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
- IDirect3DVolumeTexture9_Release(texture);
- refcount = IDirect3DDevice9_Release(device);
- ok(!refcount, "Device has %u references left.\n", refcount);
-done:
IDirect3D9_Release(d3d);
DestroyWindow(window);
}
@@ -24131,7 +24203,7 @@ START_TEST(visual)
zenable_test();
fog_special_test();
volume_srgb_test();
- volume_dxt5_test();
+ volume_dxtn_test();
add_dirty_rect_test();
multisampled_depth_buffer_test();
resz_test();
--
2.7.4
June 21, 2018
[PATCH 2/3] Add format change before upload for non-volume textures
by Connor McAdams
This patch keeps non-volume DXTn textures from being converted to
b8g8r8a8. I have tested it and it does work converting them all, but the
GPU can handle them normally. Volume textures are the only ones the
GPU handles incorrectly.
---
dlls/wined3d/texture.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index c316906..a998b9c 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -1948,6 +1948,32 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
bo.addr += src_box->left * format->byte_count;
}
+ if (format->id == WINED3DFMT_DXT5 || format->id == WINED3DFMT_DXT4 ||
+ format->id == WINED3DFMT_DXT3 || format->id == WINED3DFMT_DXT2 ||
+ format->id == WINED3DFMT_DXT1)
+ {
+ if (target == GL_TEXTURE_3D)
+ {
+ struct wined3d_format temp;
+
+ f = *format;
+ temp.upload = f.upload;
+ format = &f;
+ format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM, WINED3DUSAGE_TEXTURE);
+ f = *format;
+ f.upload = temp.upload;
+ f.conv_byte_count = 4;
+ format = &f;
+ texture->resource.format_flags &= ~WINED3DFMT_FLAG_BLOCKS;
+ }
+ else
+ {
+ f = *format;
+ f.upload = NULL;
+ format = &f;
+ }
+ }
+
if (format->upload)
{
unsigned int dst_row_pitch, dst_slice_pitch;
--
2.7.4
June 21, 2018