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 4/5] mstask: Implement IEnumWorkItems::Skip().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task_scheduler.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c
index ccb6d6c078..262dd0c49f 100644
--- a/dlls/mstask/task_scheduler.c
+++ b/dlls/mstask/task_scheduler.c
@@ -206,9 +206,17 @@ static HRESULT WINAPI EnumWorkItems_Next(IEnumWorkItems *iface, ULONG count, LPW
static HRESULT WINAPI EnumWorkItems_Skip(IEnumWorkItems *iface, ULONG count)
{
- EnumWorkItemsImpl *This = impl_from_IEnumWorkItems(iface);
- FIXME("(%p)->(%u): stub\n", This, count);
- return E_NOTIMPL;
+ LPWSTR *names;
+ ULONG fetched;
+ HRESULT hr;
+
+ TRACE("(%p)->(%u)\n", iface, count);
+
+ hr = EnumWorkItems_Next(iface, count, &names, &fetched);
+ if (SUCCEEDED(hr))
+ free_list(names, fetched);
+
+ return hr;
}
static HRESULT WINAPI EnumWorkItems_Reset(IEnumWorkItems *iface)
--
2.16.3
June 8, 2018
[PATCH 3/5] mstask: Implement IEnumWorkItems::Reset().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task_scheduler.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c
index 8db6e28b5e..ccb6d6c078 100644
--- a/dlls/mstask/task_scheduler.c
+++ b/dlls/mstask/task_scheduler.c
@@ -214,8 +214,16 @@ static HRESULT WINAPI EnumWorkItems_Skip(IEnumWorkItems *iface, ULONG count)
static HRESULT WINAPI EnumWorkItems_Reset(IEnumWorkItems *iface)
{
EnumWorkItemsImpl *This = impl_from_IEnumWorkItems(iface);
- FIXME("(%p): stub\n", This);
- return E_NOTIMPL;
+
+ TRACE("(%p)\n", This);
+
+ if (This->handle != INVALID_HANDLE_VALUE)
+ {
+ FindClose(This->handle);
+ This->handle = INVALID_HANDLE_VALUE;
+ }
+
+ return S_OK;
}
static HRESULT WINAPI EnumWorkItems_Clone(IEnumWorkItems *iface, IEnumWorkItems **cloned)
--
2.16.3
June 8, 2018
[PATCH 2/5] mstask: Implement IEnumWorkItems::Next().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task_scheduler.c | 98 +++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 96 insertions(+), 2 deletions(-)
diff --git a/dlls/mstask/task_scheduler.c b/dlls/mstask/task_scheduler.c
index 416a3218d0..8db6e28b5e 100644
--- a/dlls/mstask/task_scheduler.c
+++ b/dlls/mstask/task_scheduler.c
@@ -43,6 +43,7 @@ typedef struct
{
IEnumWorkItems IEnumWorkItems_iface;
LONG ref;
+ HANDLE handle;
} EnumWorkItemsImpl;
static inline TaskSchedulerImpl *impl_from_ITaskScheduler(ITaskScheduler *iface)
@@ -97,6 +98,8 @@ static ULONG WINAPI EnumWorkItems_Release(IEnumWorkItems *iface)
if (ref == 0)
{
+ if (This->handle != INVALID_HANDLE_VALUE)
+ FindClose(This->handle);
heap_free(This);
InterlockedDecrement(&dll_ref);
}
@@ -104,11 +107,101 @@ static ULONG WINAPI EnumWorkItems_Release(IEnumWorkItems *iface)
return ref;
}
+static void free_list(LPWSTR *list, LONG count)
+{
+ LONG i;
+
+ for (i = 0; i < count; i++)
+ CoTaskMemFree(list[i]);
+
+ CoTaskMemFree(list);
+}
+
+static inline BOOL is_file(const WIN32_FIND_DATAW *data)
+{
+ return !(data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+}
+
static HRESULT WINAPI EnumWorkItems_Next(IEnumWorkItems *iface, ULONG count, LPWSTR **names, ULONG *fetched)
{
+ static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\','*',0 };
EnumWorkItemsImpl *This = impl_from_IEnumWorkItems(iface);
- FIXME("(%p)->(%u %p %p): stub\n", This, count, names, fetched);
- return E_NOTIMPL;
+ WCHAR path[MAX_PATH];
+ WIN32_FIND_DATAW data;
+ ULONG enumerated, dummy;
+ LPWSTR *list;
+ HRESULT hr = S_FALSE;
+
+ TRACE("(%p)->(%u %p %p)\n", This, count, names, fetched);
+
+ if (!count || !names || (!fetched && count > 1)) return E_INVALIDARG;
+
+ if (!fetched) fetched = &dummy;
+
+ *names = NULL;
+ *fetched = 0;
+ enumerated = 0;
+ list = NULL;
+
+ if (This->handle == INVALID_HANDLE_VALUE)
+ {
+ GetWindowsDirectoryW(path, MAX_PATH);
+ lstrcatW(path, tasksW);
+ This->handle = FindFirstFileW(path, &data);
+ if (This->handle == INVALID_HANDLE_VALUE)
+ return S_FALSE;
+ }
+ else
+ {
+ if (!FindNextFileW(This->handle, &data))
+ return S_FALSE;
+ }
+
+ do
+ {
+ if (is_file(&data))
+ {
+ LPWSTR *new_list;
+
+ if (!list)
+ new_list = CoTaskMemAlloc((enumerated + 1) * sizeof(list[0]));
+ else
+ new_list = CoTaskMemRealloc(list, (enumerated + 1) * sizeof(list[0]));
+ if (!new_list)
+ {
+ hr = E_OUTOFMEMORY;
+ break;
+ }
+
+ list = new_list;
+
+ list[enumerated] = CoTaskMemAlloc((lstrlenW(data.cFileName) + 1) * sizeof(WCHAR));
+ if (!list[enumerated])
+ {
+ hr = E_OUTOFMEMORY;
+ break;
+ }
+
+ lstrcpyW(list[enumerated], data.cFileName);
+ enumerated++;
+
+ if (enumerated >= count)
+ {
+ hr = S_OK;
+ break;
+ }
+ }
+ } while (FindNextFileW(This->handle, &data));
+
+ if (FAILED(hr))
+ free_list(list, enumerated);
+ else
+ {
+ *fetched = enumerated;
+ *names = list;
+ }
+
+ return hr;
}
static HRESULT WINAPI EnumWorkItems_Skip(IEnumWorkItems *iface, ULONG count)
@@ -154,6 +247,7 @@ static HRESULT create_task_enum(IEnumWorkItems **ret)
tasks->IEnumWorkItems_iface.lpVtbl = &EnumWorkItemsVtbl;
tasks->ref = 1;
+ tasks->handle = INVALID_HANDLE_VALUE;
*ret = &tasks->IEnumWorkItems_iface;
InterlockedIncrement(&dll_ref);
--
2.16.3
June 8, 2018
[PATCH 1/5] mstask: Implement ITask::GetExitCode().
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/mstask/task.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/dlls/mstask/task.c b/dlls/mstask/task.c
index 266029a58e..7499826937 100644
--- a/dlls/mstask/task.c
+++ b/dlls/mstask/task.c
@@ -685,8 +685,14 @@ static HRESULT WINAPI MSTASK_ITask_GetExitCode(ITask *iface, DWORD *exit_code)
TRACE("(%p, %p)\n", iface, exit_code);
+ if (This->status == SCHED_S_TASK_NOT_SCHEDULED)
+ {
+ *exit_code = 0;
+ return SCHED_S_TASK_HAS_NOT_RUN;
+ }
+
*exit_code = This->exit_code;
- return SCHED_S_TASK_HAS_NOT_RUN; /* FIXME */
+ return S_OK;
}
static HRESULT WINAPI MSTASK_ITask_SetComment(ITask *iface, LPCWSTR comment)
--
2.16.3
June 8, 2018
[PATCH 3/3] schedsvc: Add support for running missed tasks at the service start.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/schedsvc/atsvc.c | 24 ++++++++++++++++++++++++
dlls/schedsvc/schedsvc_private.h | 1 +
dlls/schedsvc/svc_main.c | 1 +
3 files changed, 26 insertions(+)
diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c
index b5b8317ded..f6ea0f0e23 100644
--- a/dlls/schedsvc/atsvc.c
+++ b/dlls/schedsvc/atsvc.c
@@ -1039,6 +1039,30 @@ void check_task_time(void)
LeaveCriticalSection(&at_job_list_section);
}
+void check_missed_task_time(void)
+{
+ FILETIME current_ft, last_ft;
+ struct job_t *job;
+
+ GetSystemTimeAsFileTime(¤t_ft);
+ FileTimeToLocalFileTime(¤t_ft, ¤t_ft);
+
+ EnterCriticalSection(&at_job_list_section);
+
+ LIST_FOR_EACH_ENTRY(job, &at_job_list, struct job_t, entry)
+ {
+ if (SystemTimeToFileTime(&job->data.last_runtime, &last_ft))
+ {
+ if (job_runs_at(job, &last_ft, ¤t_ft))
+ {
+ run_job(job);
+ }
+ }
+ }
+
+ LeaveCriticalSection(&at_job_list_section);
+}
+
void remove_job(const WCHAR *name)
{
struct job_t *job;
diff --git a/dlls/schedsvc/schedsvc_private.h b/dlls/schedsvc/schedsvc_private.h
index 10892d55ca..117c6f51ed 100644
--- a/dlls/schedsvc/schedsvc_private.h
+++ b/dlls/schedsvc/schedsvc_private.h
@@ -31,6 +31,7 @@ void update_process_status(DWORD pid) DECLSPEC_HIDDEN;
BOOL get_next_runtime(LARGE_INTEGER *rt) DECLSPEC_HIDDEN;
void check_task_time(void) DECLSPEC_HIDDEN;
void load_at_tasks(void) DECLSPEC_HIDDEN;
+void check_missed_task_time(void) DECLSPEC_HIDDEN;
static inline WCHAR *heap_strdupW(const WCHAR *src)
{
diff --git a/dlls/schedsvc/svc_main.c b/dlls/schedsvc/svc_main.c
index 2bba674b07..8e23a049db 100644
--- a/dlls/schedsvc/svc_main.c
+++ b/dlls/schedsvc/svc_main.c
@@ -54,6 +54,7 @@ static DWORD WINAPI tasks_monitor_thread(void *arg)
TRACE("Starting...\n");
load_at_tasks();
+ check_missed_task_time();
htimer = CreateWaitableTimerW(NULL, FALSE, NULL);
if (htimer == NULL)
--
2.16.3
June 8, 2018
[PATCH 2/3] schedsvc: Load job files at the service start up.
by Dmitry Timoshkov
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/schedsvc/atsvc.c | 41 ++++++++++++++++++++++++++++++++++++++++
dlls/schedsvc/schedsvc_private.h | 1 +
dlls/schedsvc/svc_main.c | 2 ++
3 files changed, 44 insertions(+)
diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c
index 597df34f2a..b5b8317ded 100644
--- a/dlls/schedsvc/atsvc.c
+++ b/dlls/schedsvc/atsvc.c
@@ -623,6 +623,47 @@ void add_job(const WCHAR *name)
LeaveCriticalSection(&at_job_list_section);
}
+static inline BOOL is_file(const WIN32_FIND_DATAW *data)
+{
+ return !(data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+}
+
+void load_at_tasks(void)
+{
+ static const WCHAR tasksW[] = { '\\','T','a','s','k','s','\\',0 };
+ static const WCHAR allW[] = { '*',0 };
+ WCHAR windir[MAX_PATH], path[MAX_PATH];
+ WIN32_FIND_DATAW data;
+ HANDLE handle;
+
+ GetWindowsDirectoryW(windir, MAX_PATH);
+ lstrcpyW(path, windir);
+ lstrcatW(path, tasksW);
+ lstrcatW(path, allW);
+
+ handle = FindFirstFileW(path, &data);
+ if (handle == INVALID_HANDLE_VALUE) return;
+
+ do
+ {
+ if (is_file(&data))
+ {
+ lstrcpyW(path, windir);
+ lstrcatW(path, tasksW);
+
+ if (lstrlenW(path) + lstrlenW(data.cFileName) < MAX_PATH)
+ {
+ lstrcatW(path, data.cFileName);
+ add_job(path);
+ }
+ else
+ FIXME("too long file name %s\n", debugstr_w(data.cFileName));
+ }
+ } while (FindNextFileW(handle, &data));
+
+ FindClose(handle);
+}
+
static BOOL write_signature(HANDLE hfile)
{
struct
diff --git a/dlls/schedsvc/schedsvc_private.h b/dlls/schedsvc/schedsvc_private.h
index d601030e78..10892d55ca 100644
--- a/dlls/schedsvc/schedsvc_private.h
+++ b/dlls/schedsvc/schedsvc_private.h
@@ -30,6 +30,7 @@ void add_process_to_queue(HANDLE hproc) DECLSPEC_HIDDEN;
void update_process_status(DWORD pid) DECLSPEC_HIDDEN;
BOOL get_next_runtime(LARGE_INTEGER *rt) DECLSPEC_HIDDEN;
void check_task_time(void) DECLSPEC_HIDDEN;
+void load_at_tasks(void) DECLSPEC_HIDDEN;
static inline WCHAR *heap_strdupW(const WCHAR *src)
{
diff --git a/dlls/schedsvc/svc_main.c b/dlls/schedsvc/svc_main.c
index 0dfac818fd..2bba674b07 100644
--- a/dlls/schedsvc/svc_main.c
+++ b/dlls/schedsvc/svc_main.c
@@ -53,6 +53,8 @@ static DWORD WINAPI tasks_monitor_thread(void *arg)
TRACE("Starting...\n");
+ load_at_tasks();
+
htimer = CreateWaitableTimerW(NULL, FALSE, NULL);
if (htimer == NULL)
{
--
2.16.3
June 8, 2018
[PATCH 1/3] schedsvc: Add a sanity check when loading a .job file.
by Dmitry Timoshkov
There was no problem with this patchset, however I had a file in the c:\windows\tasks
directory (dump_job.exe) that was leading to a crash in the job file loading code,
this patch fixes it.
Signed-off-by: Dmitry Timoshkov <dmitry(a)baikal.ru>
---
dlls/schedsvc/atsvc.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/dlls/schedsvc/atsvc.c b/dlls/schedsvc/atsvc.c
index 91ef3edca0..597df34f2a 100644
--- a/dlls/schedsvc/atsvc.c
+++ b/dlls/schedsvc/atsvc.c
@@ -394,6 +394,12 @@ static BOOL load_job_data(const char *data, DWORD size, struct job_t *info)
TRACE("file_version %04x\n", fixed->file_version);
TRACE("uuid %s\n", wine_dbgstr_guid(&fixed->uuid));
+ if (fixed->file_version != 0x0001)
+ {
+ TRACE("invalid file version\n");
+ return FALSE;
+ }
+
TRACE("name_size_offset %04x\n", fixed->name_size_offset);
TRACE("trigger_offset %04x\n", fixed->trigger_offset);
TRACE("error_retry_count %u\n", fixed->error_retry_count);
--
2.16.3
June 8, 2018
[PATCH] cdosys: Prefer native version.
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/cdosys/main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/cdosys/main.c b/dlls/cdosys/main.c
index 1a9affe..4728229 100644
--- a/dlls/cdosys/main.c
+++ b/dlls/cdosys/main.c
@@ -41,6 +41,8 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD reason, LPVOID lpv)
switch (reason)
{
+ case DLL_WINE_PREATTACH:
+ return FALSE; /* prefer native version */
case DLL_PROCESS_ATTACH:
instance = hInstDLL;
DisableThreadLibraryCalls(hInstDLL);
--
1.9.1
June 8, 2018
Re: [PATCH] kernel32/tests: Add tests for job object accounting
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=39044
Your paranoid android.
=== w1064 (64 bit process) ===
process.c:2532: Test failed: Expected NumberOfAssignedProcesses to be 0 (expected_count) is 1
process.c:2532: Test failed: Expected NumberOfProcessIdsInList to be 0 (expected_count) is 1
process.c:2533: Test failed: Expected basic_accounting.ActiveProcesses to be 0 (active_proc) is 1
June 8, 2018
[PATCH] kernel32/tests: Add tests for job object accounting
by Alistair Leslie-Hughes
From: Mark Jansen <mark.jansen(a)reactos.org>
Signed-off-by: Mark Jansen <mark.jansen(a)reactos.org>
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/kernel32/tests/process.c | 95 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 95 insertions(+)
diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c
index b1a4539..5324894 100644
--- a/dlls/kernel32/tests/process.c
+++ b/dlls/kernel32/tests/process.c
@@ -2394,6 +2394,69 @@ static void _create_process(int line, const char *command, LPPROCESS_INFORMATION
ok_(__FILE__, line)(ret, "CreateProcess error %u\n", GetLastError());
}
+#define test_assigned_proc(job, ...) _test_assigned_proc(__LINE__, job, __VA_ARGS__)
+static void _test_assigned_proc(int line, HANDLE job, int expected_count, ...)
+{
+ char buf[sizeof(JOBOBJECT_BASIC_PROCESS_ID_LIST) + sizeof(ULONG_PTR) * 20];
+ PJOBOBJECT_BASIC_PROCESS_ID_LIST pid_list = (JOBOBJECT_BASIC_PROCESS_ID_LIST *)buf;
+ DWORD ret_len, pid;
+ va_list valist;
+ int n;
+ BOOL ret;
+
+ memset(buf, 0, sizeof(buf));
+ ret = pQueryInformationJobObject(job, JobObjectBasicProcessIdList, pid_list, sizeof(buf), &ret_len);
+ ok_(__FILE__, line)(ret, "QueryInformationJobObject error %u\n", GetLastError());
+ if (ret)
+ {
+ todo_wine_if(expected_count)
+ ok_(__FILE__, line)(expected_count == pid_list->NumberOfAssignedProcesses,
+ "Expected NumberOfAssignedProcesses to be %d (expected_count) is %d\n",
+ expected_count, pid_list->NumberOfAssignedProcesses);
+ todo_wine_if(expected_count)
+ ok_(__FILE__, line)(expected_count == pid_list->NumberOfProcessIdsInList,
+ "Expected NumberOfProcessIdsInList to be %d (expected_count) is %d\n",
+ expected_count, pid_list->NumberOfProcessIdsInList);
+
+ va_start(valist, expected_count);
+ for (n = 0; n < min(expected_count, pid_list->NumberOfProcessIdsInList); ++n)
+ {
+ pid = va_arg(valist, DWORD);
+ ok_(__FILE__, line)(pid == pid_list->ProcessIdList[n],
+ "Expected pid_list->ProcessIdList[%d] to be %x is %lx\n",
+ n, pid, pid_list->ProcessIdList[n]);
+ }
+ va_end(valist);
+ }
+}
+
+#define test_accounting(job, total_proc, active_proc, terminated_proc) _test_accounting(__LINE__, job, total_proc, active_proc, terminated_proc)
+static void _test_accounting(int line, HANDLE job, int total_proc, int active_proc, int terminated_proc)
+{
+ JOBOBJECT_BASIC_ACCOUNTING_INFORMATION basic_accounting;
+ DWORD ret_len;
+ BOOL ret;
+
+ memset(&basic_accounting, 0, sizeof(basic_accounting));
+ ret = pQueryInformationJobObject(job, JobObjectBasicAccountingInformation, &basic_accounting, sizeof(basic_accounting), &ret_len);
+ ok_(__FILE__, line)(ret, "QueryInformationJobObject error %u\n", GetLastError());
+ if (ret)
+ {
+ /* Not going to check process times or page faults */
+
+ todo_wine_if(total_proc)
+ ok_(__FILE__, line)(total_proc == basic_accounting.TotalProcesses,
+ "Expected basic_accounting.TotalProcesses to be %d (total_proc) is %d\n",
+ total_proc, basic_accounting.TotalProcesses);
+ todo_wine_if(active_proc)
+ ok_(__FILE__, line)(active_proc == basic_accounting.ActiveProcesses,
+ "Expected basic_accounting.ActiveProcesses to be %d (active_proc) is %d\n",
+ active_proc, basic_accounting.ActiveProcesses);
+ ok_(__FILE__, line)(terminated_proc == basic_accounting.TotalTerminatedProcesses,
+ "Expected basic_accounting.TotalTerminatedProcesses to be %d (terminated_proc) is %d\n",
+ terminated_proc, basic_accounting.TotalTerminatedProcesses);
+ }
+}
static void test_IsProcessInJob(void)
{
@@ -2420,11 +2483,15 @@ static void test_IsProcessInJob(void)
ret = pIsProcessInJob(pi.hProcess, job, &out);
ok(ret, "IsProcessInJob error %u\n", GetLastError());
ok(!out, "IsProcessInJob returned out=%u\n", out);
+ test_assigned_proc(job, 0);
+ test_accounting(job, 0, 0, 0);
out = TRUE;
ret = pIsProcessInJob(pi.hProcess, job2, &out);
ok(ret, "IsProcessInJob error %u\n", GetLastError());
ok(!out, "IsProcessInJob returned out=%u\n", out);
+ test_assigned_proc(job2, 0);
+ test_accounting(job2, 0, 0, 0);
out = TRUE;
ret = pIsProcessInJob(pi.hProcess, NULL, &out);
@@ -2438,11 +2505,15 @@ static void test_IsProcessInJob(void)
ret = pIsProcessInJob(pi.hProcess, job, &out);
ok(ret, "IsProcessInJob error %u\n", GetLastError());
ok(out, "IsProcessInJob returned out=%u\n", out);
+ test_assigned_proc(job, 1, pi.dwProcessId);
+ test_accounting(job, 1, 1, 0);
out = TRUE;
ret = pIsProcessInJob(pi.hProcess, job2, &out);
ok(ret, "IsProcessInJob error %u\n", GetLastError());
ok(!out, "IsProcessInJob returned out=%u\n", out);
+ test_assigned_proc(job2, 0);
+ test_accounting(job2, 0, 0, 0);
out = FALSE;
ret = pIsProcessInJob(pi.hProcess, NULL, &out);
@@ -2458,6 +2529,8 @@ static void test_IsProcessInJob(void)
ret = pIsProcessInJob(pi.hProcess, job, &out);
ok(ret, "IsProcessInJob error %u\n", GetLastError());
ok(out, "IsProcessInJob returned out=%u\n", out);
+ test_assigned_proc(job, 0);
+ test_accounting(job, 1, 0, 0);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
@@ -2474,11 +2547,15 @@ static void test_TerminateJobObject(void)
job = pCreateJobObjectW(NULL, NULL);
ok(job != NULL, "CreateJobObject error %u\n", GetLastError());
+ test_assigned_proc(job, 0);
+ test_accounting(job, 0, 0, 0);
create_process("wait", &pi);
ret = pAssignProcessToJobObject(job, pi.hProcess);
ok(ret, "AssignProcessToJobObject error %u\n", GetLastError());
+ test_assigned_proc(job, 1, pi.dwProcessId);
+ test_accounting(job, 1, 1, 0);
ret = pTerminateJobObject(job, 123);
ok(ret, "TerminateJobObject error %u\n", GetLastError());
@@ -2486,6 +2563,8 @@ static void test_TerminateJobObject(void)
dwret = WaitForSingleObject(pi.hProcess, 1000);
ok(dwret == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", dwret);
if (dwret == WAIT_TIMEOUT) TerminateProcess(pi.hProcess, 0);
+ test_assigned_proc(job, 0);
+ test_accounting(job, 1, 0, 0);
ret = GetExitCodeProcess(pi.hProcess, &dwret);
ok(ret, "GetExitCodeProcess error %u\n", GetLastError());
@@ -2505,6 +2584,8 @@ static void test_TerminateJobObject(void)
ret = pAssignProcessToJobObject(job, pi.hProcess);
ok(!ret, "AssignProcessToJobObject unexpectedly succeeded\n");
expect_eq_d(ERROR_ACCESS_DENIED, GetLastError());
+ test_assigned_proc(job, 0);
+ test_accounting(job, 1, 0, 0);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
@@ -2691,11 +2772,15 @@ static void test_KillOnJobClose(void)
return;
}
ok(ret, "SetInformationJobObject error %u\n", GetLastError());
+ test_assigned_proc(job, 0);
+ test_accounting(job, 0, 0, 0);
create_process("wait", &pi);
ret = pAssignProcessToJobObject(job, pi.hProcess);
ok(ret, "AssignProcessToJobObject error %u\n", GetLastError());
+ test_assigned_proc(job, 1, pi.dwProcessId);
+ test_accounting(job, 1, 1, 0);
CloseHandle(job);
@@ -2799,6 +2884,8 @@ static HANDLE test_AddSelfToJob(void)
ret = pAssignProcessToJobObject(job, GetCurrentProcess());
ok(ret, "AssignProcessToJobObject error %u\n", GetLastError());
+ test_assigned_proc(job, 1, GetCurrentProcessId());
+ test_accounting(job, 1, 1, 0);
return job;
}
@@ -2826,6 +2913,8 @@ static void test_jobInheritance(HANDLE job)
ret = pIsProcessInJob(pi.hProcess, job, &out);
ok(ret, "IsProcessInJob error %u\n", GetLastError());
ok(out, "IsProcessInJob returned out=%u\n", out);
+ test_assigned_proc(job, 2, GetCurrentProcessId(), pi.dwProcessId);
+ test_accounting(job, 2, 2, 0);
dwret = WaitForSingleObject(pi.hProcess, 1000);
ok(dwret == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", dwret);
@@ -2854,6 +2943,8 @@ static void test_BreakawayOk(HANDLE job)
ret = CreateProcessA(NULL, buffer, NULL, NULL, FALSE, CREATE_BREAKAWAY_FROM_JOB, NULL, NULL, &si, &pi);
ok(!ret, "CreateProcessA expected failure\n");
expect_eq_d(ERROR_ACCESS_DENIED, GetLastError());
+ test_assigned_proc(job, 1, GetCurrentProcessId());
+ test_accounting(job, 2, 1, 0);
if (ret)
{
@@ -2876,6 +2967,8 @@ static void test_BreakawayOk(HANDLE job)
ret = pIsProcessInJob(pi.hProcess, job, &out);
ok(ret, "IsProcessInJob error %u\n", GetLastError());
ok(!out, "IsProcessInJob returned out=%u\n", out);
+ test_assigned_proc(job, 1, GetCurrentProcessId());
+ test_accounting(job, 2, 1, 0);
dwret = WaitForSingleObject(pi.hProcess, 1000);
ok(dwret == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", dwret);
@@ -2893,6 +2986,8 @@ static void test_BreakawayOk(HANDLE job)
ret = pIsProcessInJob(pi.hProcess, job, &out);
ok(ret, "IsProcessInJob error %u\n", GetLastError());
ok(!out, "IsProcessInJob returned out=%u\n", out);
+ test_assigned_proc(job, 1, GetCurrentProcessId());
+ test_accounting(job, 2, 1, 0);
dwret = WaitForSingleObject(pi.hProcess, 1000);
ok(dwret == WAIT_OBJECT_0, "WaitForSingleObject returned %u\n", dwret);
--
1.9.1
June 8, 2018
[PATCH] msxml3: Accept NormalizeAttributeValues property
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
dlls/msxml3/domdoc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index ddd7565..0b917c1 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -73,6 +73,7 @@ static const WCHAR PropValueXSLPatternW[] = {'X','S','L','P','a','t','t','e','r'
static const WCHAR PropertyResolveExternalsW[] = {'R','e','s','o','l','v','e','E','x','t','e','r','n','a','l','s',0};
static const WCHAR PropertyAllowXsltScriptW[] = {'A','l','l','o','w','X','s','l','t','S','c','r','i','p','t',0};
static const WCHAR PropertyAllowDocumentFunctionW[] = {'A','l','l','o','w','D','o','c','u','m','e','n','t','F','u','n','c','t','i','o','n',0};
+static const WCHAR PropertyNormalizeAttributeValuesW[] = {'N','o','r','m','a','l','i','z','e','A','t','t','r','i','b','u','t','e','V','a','l','u','e','s',0};
/* Anything that passes the test_get_ownerDocument()
* tests can go here (data shared between all instances).
@@ -3108,6 +3109,7 @@ static HRESULT WINAPI domdoc_setProperty(
lstrcmpiW(p, PropertyNewParserW) == 0 ||
lstrcmpiW(p, PropertyResolveExternalsW) == 0 ||
lstrcmpiW(p, PropertyAllowXsltScriptW) == 0 ||
+ lstrcmpiW(p, PropertyNormalizeAttributeValuesW) == 0 ||
lstrcmpiW(p, PropertyAllowDocumentFunctionW) == 0)
{
/* Ignore */
--
1.9.1
June 8, 2018
[PATCH] include: Updated enum AutomationIdentifierType values
by Alistair Leslie-Hughes
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
---
include/uiautomationcoreapi.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/uiautomationcoreapi.h b/include/uiautomationcoreapi.h
index 12c509f..1898fe9 100644
--- a/include/uiautomationcoreapi.h
+++ b/include/uiautomationcoreapi.h
@@ -45,7 +45,11 @@ enum AutomationIdentifierType
AutomationIdentifierType_Pattern,
AutomationIdentifierType_Event,
AutomationIdentifierType_ControlType,
- AutomationIdentifierType_TextAttribute
+ AutomationIdentifierType_TextAttribute,
+ AutomationIdentifierType_LandmarkType,
+ AutomationIdentifierType_Annotation,
+ AutomationIdentifierType_Changes,
+ AutomationIdentifierType_Style
};
HRESULT WINAPI UiaGetReservedMixedAttributeValue(IUnknown **value);
--
1.9.1
June 8, 2018
Re: [PATCH 1/3] user32: Make RegisterPointerDeviceNotifications return TRUE to fake success
by Fabian Maurer
Thanks for your feedback,
I updated my GetPointerDevices stub to return FALSE when the application tries to load
devices - now we only success if it queries the number of devices - and then we return 0.
This should be alright.
I made a small testcase to test if windows returns success for
RegisterTouchHitTestingWindow when the system doesn't have a pointer device - it does.
Since there is no touch device, it should be fine if we just never send the message - even if
the window is "registered".
I'd add a testcase, but I'm not sure how to go about that - since it's not guaranteed that
every machine the test runs one has 0 pointer devices. An idea how I could go about that?
Regards,
Fabian Maurer
####################################
#define _WIN32_WINNT _WIN32_WINNT_WIN8
#include <windows.h>
#include <stdio.h>
static LRESULT WINAPI WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
return DefWindowProcA(hwnd, message, wParam, lParam);
}
int main(void)
{
BOOL success;
UINT32 count;
WNDCLASSA cls = {0};
HANDLE hwnd;
POINTER_DEVICE_INFO devices[1];
cls.lpfnWndProc = WndProc;
cls.hInstance = GetModuleHandleA(0);
cls.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
cls.hbrBackground = GetStockObject(WHITE_BRUSH);
cls.lpszClassName = "testclass";
RegisterClassA(&cls);
hwnd = CreateWindowA("testclass", "Test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, 10,
10, 300, 300, NULL, NULL, NULL, 0);
printf("Handle: %p\n", hwnd);
success = GetPointerDevices(&count, NULL);
printf("success: %d, count: %d\n", success, count);
success = RegisterTouchHitTestingWindow(hwnd, TOUCH_HIT_TESTING_CLIENT);
printf("success: %d\n", success);
count = 1;
success = GetPointerDevices(&count, devices);
printf("success: %d, count: %d\n", success, count);
return 0;
}
####################################
output from testbot:
Handle: 00070234
success: 1, count: 0
success: 1
success: 0, count: 1
June 7, 2018
[PATCH v2 3/3] user32: Add RegisterTouchHitTestingWindow stub
by Fabian Maurer
Fixes bug 45303.
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
dlls/user32/misc.c | 9 +++++++++
dlls/user32/user32.spec | 1 +
2 files changed, 10 insertions(+)
diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c
index dfdd599299..b1b2c61aa0 100644
--- a/dlls/user32/misc.c
+++ b/dlls/user32/misc.c
@@ -863,6 +863,15 @@ BOOL WINAPI GetPointerDevices(UINT32 *device_count, POINTER_DEVICE_INFO *devices
return TRUE;
}
+/**********************************************************************
+ * RegisterTouchHitTestingWindow [USER32.@]
+ */
+BOOL WINAPI RegisterTouchHitTestingWindow(HWND hwnd, ULONG value)
+{
+ FIXME("(%p %d): stub\n", hwnd, value);
+ return TRUE;
+}
+
static const WCHAR imeW[] = {'I','M','E',0};
const struct builtin_class_descr IME_builtin_class =
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 7f652ee722..61e0e4e8cc 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -606,6 +606,7 @@
@ stdcall RegisterShellHookWindow (long)
@ stdcall RegisterSystemThread(long long)
@ stdcall RegisterTasklist (long)
+@ stdcall RegisterTouchHitTestingWindow(long long)
@ stdcall RegisterTouchWindow(long long)
# @ stub RegisterUserApiHook
@ stdcall RegisterWindowMessageA(str)
--
2.17.1
June 7, 2018
[PATCH v2 2/3] user32: Add stub for GetPointerDevices
by Fabian Maurer
Fixes bug 45302.
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
...ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec | 2 +-
dlls/user32/misc.c | 18 +++++++++++++++++
dlls/user32/user32.spec | 1 +
include/winuser.h | 20 +++++++++++++++++++
4 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/dlls/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec b/dlls/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec
index 72cfe3d954..3a043dc9c2 100644
--- a/dlls/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec
+++ b/dlls/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0/api-ms-win-rtcore-ntuser-wmpointer-l1-1-0.spec
@@ -4,7 +4,7 @@
@ stub GetPointerDevice
@ stub GetPointerDeviceProperties
@ stub GetPointerDeviceRects
-@ stub GetPointerDevices
+@ stdcall GetPointerDevices(ptr ptr) user32.GetPointerDevices
@ stub GetPointerFrameInfo
@ stub GetPointerFrameInfoHistory
@ stub GetPointerFramePenInfo
diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c
index c3f4030a90..dfdd599299 100644
--- a/dlls/user32/misc.c
+++ b/dlls/user32/misc.c
@@ -846,6 +846,24 @@ BOOL WINAPI RegisterPointerDeviceNotifications(HWND hwnd, BOOL notifyrange)
return TRUE;
}
+/**********************************************************************
+ * GetPointerDevices [USER32.@]
+ */
+BOOL WINAPI GetPointerDevices(UINT32 *device_count, POINTER_DEVICE_INFO *devices)
+{
+ FIXME("(%p %p): partial stub\n", device_count, devices);
+
+ if (!device_count)
+ return FALSE;
+
+ if (devices)
+ return FALSE;
+
+ *device_count = 0;
+ return TRUE;
+}
+
+
static const WCHAR imeW[] = {'I','M','E',0};
const struct builtin_class_descr IME_builtin_class =
{
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 2e5b203a85..7f652ee722 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -354,6 +354,7 @@
@ stdcall GetOpenClipboardWindow()
@ stdcall GetParent(long)
@ stdcall GetPhysicalCursorPos(ptr)
+@ stdcall GetPointerDevices(ptr ptr)
@ stdcall GetPriorityClipboardFormat(ptr long)
@ stdcall GetProcessDefaultLayout(ptr)
@ stdcall GetProcessDpiAwarenessInternal(long ptr)
diff --git a/include/winuser.h b/include/winuser.h
index 648efbe0e2..f546a4a1f3 100644
--- a/include/winuser.h
+++ b/include/winuser.h
@@ -3357,6 +3357,26 @@ typedef struct tagGESTUREINFO {
} GESTUREINFO, *PGESTUREINFO;
typedef GESTUREINFO const * PCGESTUREINFO;
+#define POINTER_DEVICE_PRODUCT_STRING_MAX 520
+
+typedef enum tagPOINTER_DEVICE_TYPE {
+ POINTER_DEVICE_TYPE_INTEGRATED_PEN = 0x00000001,
+ POINTER_DEVICE_TYPE_EXTERNAL_PEN = 0x00000002,
+ POINTER_DEVICE_TYPE_TOUCH = 0x00000003,
+ POINTER_DEVICE_TYPE_TOUCH_PAD = 0x00000004,
+ POINTER_DEVICE_TYPE_MAX = 0xFFFFFFFF
+} POINTER_DEVICE_TYPE;
+
+typedef struct tagPOINTER_DEVICE_INFO {
+ DWORD displayOrientation;
+ HANDLE device;
+ POINTER_DEVICE_TYPE pointerDeviceType;
+ HMONITOR monitor;
+ ULONG startingCursorId;
+ USHORT maxActiveContacts;
+ WCHAR productString[POINTER_DEVICE_PRODUCT_STRING_MAX];
+} POINTER_DEVICE_INFO;
+
#if defined(_WINGDI_) && !defined(NOGDI)
WINUSERAPI LONG WINAPI ChangeDisplaySettingsA(LPDEVMODEA,DWORD);
WINUSERAPI LONG WINAPI ChangeDisplaySettingsW(LPDEVMODEW,DWORD);
--
2.17.1
June 7, 2018
[PATCH v2 1/3] user32: Make RegisterPointerDeviceNotifications return TRUE to fake success
by Fabian Maurer
Fixes bug 45284.
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
dlls/user32/misc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c
index be4b71a4bc..c3f4030a90 100644
--- a/dlls/user32/misc.c
+++ b/dlls/user32/misc.c
@@ -843,7 +843,7 @@ LONG WINAPI GetDisplayConfigBufferSizes(UINT32 flags, UINT32 *num_path_info, UIN
BOOL WINAPI RegisterPointerDeviceNotifications(HWND hwnd, BOOL notifyrange)
{
FIXME("(%p %d): stub\n", hwnd, notifyrange);
- return FALSE;
+ return TRUE;
}
static const WCHAR imeW[] = {'I','M','E',0};
--
2.17.1
June 7, 2018
[PATCH] mshtml/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/mshtml/tests/dom.c | 59 ++++++++++++++--------------
dlls/mshtml/tests/htmldoc.c | 16 ++++----
dlls/mshtml/tests/htmllocation.c | 4 +-
dlls/mshtml/tests/protocol.c | 78 ++++++++++++++++++--------------------
dlls/mshtml/tests/script.c | 4 +-
dlls/mshtml/tests/xmlhttprequest.c | 4 +-
6 files changed, 80 insertions(+), 85 deletions(-)
diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c
index efdd856318..b120b47453 100644
--- a/dlls/mshtml/tests/dom.c
+++ b/dlls/mshtml/tests/dom.c
@@ -2704,7 +2704,7 @@ static void _test_elem_collection(unsigned line, IUnknown *unk,
memset(vs, 0, sizeof(vs));
fetched = 0;
- hres = IEnumVARIANT_Next(enum_var, sizeof(vs)/sizeof(*vs), vs, &fetched);
+ hres = IEnumVARIANT_Next(enum_var, ARRAY_SIZE(vs), vs, &fetched);
ok_(__FILE__,line)(hres == S_FALSE, "Next failed: %08x\n", hres);
ok_(__FILE__,line)(fetched == (len > 2 ? 2 : len), "fetched = %d\n", fetched);
if(len) {
@@ -6188,7 +6188,7 @@ static void _test_language_string(unsigned line, const WCHAR *lang, LCID lcid)
int res;
if(pLCIDToLocaleName) {
- res = pLCIDToLocaleName(lcid, buf, sizeof(buf)/sizeof(WCHAR), 0);
+ res = pLCIDToLocaleName(lcid, buf, ARRAY_SIZE(buf), 0);
ok_(__FILE__,line)(res, "LCIDToLocaleName failed: %u\n", GetLastError());
ok_(__FILE__,line)(!lstrcmpW(lang, buf), "lang = %s, expected %s\n", wine_dbgstr_w(lang), wine_dbgstr_w(buf));
}else {
@@ -6486,17 +6486,17 @@ static void test_unique_id(IHTMLDocument2 *doc, IHTMLElement *elem)
hres = IHTMLDocument3_get_uniqueID(doc3, &id);
ok(hres == S_OK, "get_uniqueID failed: %08x\n", hres);
- ok(SysStringLen(id) >= sizeof(prefixW)/sizeof(*prefixW), "id %s too short\n", wine_dbgstr_w(id));
+ ok(SysStringLen(id) >= ARRAY_SIZE(prefixW), "id %s too short\n", wine_dbgstr_w(id));
hres = IHTMLDocument3_get_uniqueID(doc3, &id2);
ok(hres == S_OK, "get_uniqueID failed: %08x\n", hres);
- ok(SysStringLen(id2) >= sizeof(prefixW)/sizeof(*prefixW), "id %s too short\n", wine_dbgstr_w(id2));
+ ok(SysStringLen(id2) >= ARRAY_SIZE(prefixW), "id %s too short\n", wine_dbgstr_w(id2));
ok(lstrcmpW(id, id2), "same unique ids %s\n", wine_dbgstr_w(id));
- id[sizeof(prefixW)/sizeof(*prefixW)-1] = 0;
+ id[ARRAY_SIZE(prefixW)-1] = 0;
ok(!lstrcmpW(id, prefixW), "unexpected prefix %s\n", wine_dbgstr_w(id));
- id2[sizeof(prefixW)/sizeof(*prefixW)-1] = 0;
+ id2[ARRAY_SIZE(prefixW)-1] = 0;
ok(!lstrcmpW(id2, prefixW), "unexpected prefix %s\n", wine_dbgstr_w(id2));
SysFreeString(id);
@@ -7267,7 +7267,7 @@ static void test_tr_elem(IHTMLElement *elem)
ok(hres == S_OK, "get_cells failed: %08x\n", hres);
ok(col != NULL, "get_cells returned NULL\n");
- test_elem_collection((IUnknown*)col, cell_types, sizeof(cell_types)/sizeof(*cell_types));
+ test_elem_collection((IUnknown*)col, cell_types, ARRAY_SIZE(cell_types));
IHTMLElementCollection_Release(col);
bstr = a2bstr("left");
@@ -7591,14 +7591,14 @@ static void test_table_elem(IHTMLElement *elem)
ok(hres == S_OK, "get_rows failed: %08x\n", hres);
ok(col != NULL, "get_rows returned NULL\n");
- test_elem_collection((IUnknown*)col, row_types, sizeof(row_types)/sizeof(*row_types));
+ test_elem_collection((IUnknown*)col, row_types, ARRAY_SIZE(row_types));
IHTMLElementCollection_Release(col);
- test_elem_all((IUnknown*)table, all_types, sizeof(all_types)/sizeof(*all_types));
+ test_elem_all((IUnknown*)table, all_types, ARRAY_SIZE(all_types));
node = clone_node((IUnknown*)table, VARIANT_TRUE);
test_elem_tag((IUnknown*)node, "TABLE");
- test_elem_all((IUnknown*)node, all_types, sizeof(all_types)/sizeof(*all_types));
+ test_elem_all((IUnknown*)node, all_types, ARRAY_SIZE(all_types));
IHTMLDOMNode_Release(node);
node = clone_node((IUnknown*)table, VARIANT_FALSE);
@@ -7611,7 +7611,7 @@ static void test_table_elem(IHTMLElement *elem)
ok(hres == S_OK, "get_tBodies failed: %08x\n", hres);
ok(col != NULL, "get_tBodies returned NULL\n");
- test_elem_collection((IUnknown*)col, tbodies_types, sizeof(tbodies_types)/sizeof(*tbodies_types));
+ test_elem_collection((IUnknown*)col, tbodies_types, ARRAY_SIZE(tbodies_types));
IHTMLElementCollection_Release(col);
test_table_cell_spacing(table, NULL);
@@ -7994,7 +7994,7 @@ static void test_iframe_elem(IHTMLElement *elem)
hres = IHTMLDocument2_get_all(content_doc, &col);
ok(hres == S_OK, "get_all failed: %08x\n", hres);
- test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
+ test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
IHTMLElementCollection_Release(col);
body = doc_get_body(content_doc);
@@ -8302,7 +8302,7 @@ static void test_elemsbyclass(IHTMLElement *div)
hres = IHTMLElement6_getElementsByClassName(elem, str, &collection);
ok(hres == S_OK, "getElementsByClassName failed: %08x\n", hres);
ok(collection != NULL, "collection == NULL\n");
- test_elem_collection((IUnknown*)collection, types, sizeof(types)/sizeof(*types));
+ test_elem_collection((IUnknown*)collection, types, ARRAY_SIZE(types));
IHTMLElementCollection_Release(collection);
SysFreeString(str);
@@ -8364,8 +8364,8 @@ static void test_elems(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_all(doc, &col);
ok(hres == S_OK, "get_all failed: %08x\n", hres);
- test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
- test_elem_col_item(col, "x", item_types, sizeof(item_types)/sizeof(item_types[0]));
+ test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
+ test_elem_col_item(col, "x", item_types, ARRAY_SIZE(item_types));
elem = get_elem_col_item_idx(col, 0);
test_elem_source_index(elem, 0);
@@ -8419,7 +8419,7 @@ static void test_elems(IHTMLDocument2 *doc)
elem = get_doc_elem(doc);
test_elem_istextedit(elem, VARIANT_FALSE);
- test_elem_all((IUnknown*)elem, all_types+1, sizeof(all_types)/sizeof(all_types[0])-1);
+ test_elem_all((IUnknown*)elem, all_types+1, ARRAY_SIZE(all_types)-1);
IHTMLElement_Release(elem);
get_elem_by_id(doc, "xxx", FALSE);
@@ -8964,7 +8964,7 @@ static void test_elems(IHTMLDocument2 *doc)
static const elem_type_t select_types[] = { ET_OPTION, ET_OPTION, ET_OPTION };
test_select_put_length((IUnknown*)elem, 3);
- test_elem_all((IUnknown*)elem, select_types, sizeof(select_types)/sizeof(*select_types));
+ test_elem_all((IUnknown*)elem, select_types, ARRAY_SIZE(select_types));
test_select_put_length((IUnknown*)elem, 1);
test_elem_all((IUnknown*)elem, select_types, 1);
IHTMLElement_Release(elem);
@@ -9204,7 +9204,7 @@ static void test_elem_names(IHTMLDocument2 *doc)
test_elem_set_innerhtml((IUnknown*)body,
"<input name=\"test\"><a name=\"test\"></a><a name=\"xxx\"></a><div id=\"test\"></div>");
col = doc_get_elems_by_name(doc, "test");
- test_elem_collection((IUnknown*)col, test1_types, sizeof(test1_types)/sizeof(*test1_types));
+ test_elem_collection((IUnknown*)col, test1_types, ARRAY_SIZE(test1_types));
IHTMLElementCollection_Release(col);
col = doc_get_elems_by_name(doc, "yyy");
@@ -9252,7 +9252,7 @@ static void test_elems2(IHTMLDocument2 *doc)
elem2 = get_doc_elem_by_id(doc, "innerid");
ok(elem2 != NULL, "elem2 == NULL\n");
test_elem_set_outerhtml((IUnknown*)elem2, "<br><a href=\"about:blank\" id=\"aid\">a</a>");
- test_elem_all((IUnknown*)div, outer_types, sizeof(outer_types)/sizeof(*outer_types));
+ test_elem_all((IUnknown*)div, outer_types, ARRAY_SIZE(outer_types));
IHTMLElement_Release(elem2);
elem2 = get_doc_elem_by_id(doc, "aid");
@@ -9407,8 +9407,7 @@ static void test_form_element(IHTMLDocument2 *doc, IHTMLElement *parent)
test_form_put_encoding((IUnknown*)elem, S_OK, "multipart/form-data");
test_form_put_encoding((IUnknown*)elem, E_INVALIDARG, "image/png");
test_form_encoding((IUnknown*)elem, "multipart/form-data");
- test_form_elements((IUnknown*)elem, elems_textarea_input,
- sizeof(elems_textarea_input)/sizeof(*elems_textarea_input));
+ test_form_elements((IUnknown*)elem, elems_textarea_input, ARRAY_SIZE(elems_textarea_input));
test_form_reset((IUnknown*)elem);
test_form_target((IUnknown*)elem);
@@ -9495,7 +9494,7 @@ static void test_create_elems(IHTMLDocument2 *doc)
hres = IHTMLElement_get_all(body, &disp);
ok(hres == S_OK, "get_all failed: %08x\n", hres);
- test_elem_collection((IUnknown*)disp, types1, sizeof(types1)/sizeof(types1[0]));
+ test_elem_collection((IUnknown*)disp, types1, ARRAY_SIZE(types1));
IDispatch_Release(disp);
test_node_remove_child((IUnknown*)body, node);
@@ -9636,12 +9635,12 @@ static void test_noscript(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_all(doc, &col);
ok(hres == S_OK, "get_all failed: %08x\n", hres);
- test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
+ test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
IHTMLElementCollection_Release(col);
body = doc_get_body(doc);
test_elem_set_innerhtml((IUnknown*)body, "<div>test</div><noscript><a href=\"about:blank\">A</a></noscript>");
- test_elem_all((IUnknown*)body, body_all_types, sizeof(body_all_types)/sizeof(*body_all_types));
+ test_elem_all((IUnknown*)body, body_all_types, ARRAY_SIZE(body_all_types));
IHTMLElement_Release(body);
}
@@ -9703,12 +9702,12 @@ static void test_create_stylesheet(IHTMLDocument2 *doc)
ET_DIV
};
- test_doc_all(doc, all_types, sizeof(all_types)/sizeof(*all_types));
+ test_doc_all(doc, all_types, ARRAY_SIZE(all_types));
hres = IHTMLDocument2_createStyleSheet(doc, NULL, -1, &stylesheet);
ok(hres == S_OK, "createStyleSheet failed: %08x\n", hres);
- test_doc_all(doc, all_types2, sizeof(all_types2)/sizeof(*all_types2));
+ test_doc_all(doc, all_types2, ARRAY_SIZE(all_types2));
doc_elem = get_doc_elem(doc);
@@ -9773,7 +9772,7 @@ static void test_indent(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_all(doc, &col);
ok(hres == S_OK, "get_all failed: %08x\n", hres);
- test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
+ test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
IHTMLElementCollection_Release(col);
range = test_create_body_range(doc);
@@ -9782,7 +9781,7 @@ static void test_indent(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_all(doc, &col);
ok(hres == S_OK, "get_all failed: %08x\n", hres);
- test_elem_collection((IUnknown*)col, indent_types, sizeof(indent_types)/sizeof(indent_types[0]));
+ test_elem_collection((IUnknown*)col, indent_types, ARRAY_SIZE(indent_types));
IHTMLElementCollection_Release(col);
}
@@ -9801,7 +9800,7 @@ static void test_cond_comment(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_all(doc, &col);
ok(hres == S_OK, "get_all failed: %08x\n", hres);
- test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
+ test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
IHTMLElementCollection_Release(col);
}
@@ -10116,7 +10115,7 @@ static void test_docfrag(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_all(doc, &col);
ok(hres == S_OK, "get_all failed: %08x\n", hres);
- test_elem_collection((IUnknown*)col, all_types, sizeof(all_types)/sizeof(all_types[0]));
+ test_elem_collection((IUnknown*)col, all_types, ARRAY_SIZE(all_types));
IHTMLElementCollection_Release(col);
div = test_create_elem(frag, "div");
diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c
index a03d0105a9..1f40fed4e7 100644
--- a/dlls/mshtml/tests/htmldoc.c
+++ b/dlls/mshtml/tests/htmldoc.c
@@ -6456,7 +6456,7 @@ static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
static void test_OleCommandTarget(IHTMLDocument2 *doc)
{
IOleCommandTarget *cmdtrg;
- OLECMD cmds[sizeof(expect_cmds)/sizeof(*expect_cmds)-1];
+ OLECMD cmds[ARRAY_SIZE(expect_cmds)-1];
int i;
HRESULT hres;
@@ -6465,19 +6465,19 @@ static void test_OleCommandTarget(IHTMLDocument2 *doc)
if(FAILED(hres))
return;
- for(i=0; i < sizeof(cmds)/sizeof(*cmds); i++) {
+ for(i=0; i < ARRAY_SIZE(cmds); i++) {
cmds[i].cmdID = i+1;
cmds[i].cmdf = 0xf0f0;
}
SET_EXPECT(QueryStatus_OPEN);
SET_EXPECT(QueryStatus_NEW);
- hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, sizeof(cmds)/sizeof(cmds[0]), cmds, NULL);
+ hres = IOleCommandTarget_QueryStatus(cmdtrg, NULL, ARRAY_SIZE(cmds), cmds, NULL);
ok(hres == S_OK, "QueryStatus failed: %08x\n", hres);
CHECK_CALLED(QueryStatus_OPEN);
CHECK_CALLED(QueryStatus_NEW);
- for(i=0; i < sizeof(cmds)/sizeof(*cmds); i++) {
+ for(i=0; i < ARRAY_SIZE(cmds); i++) {
ok(cmds[i].cmdID == i+1, "cmds[%d].cmdID canged to %x\n", i, cmds[i].cmdID);
if(i+1 == OLECMDID_FIND)
continue;
@@ -7332,7 +7332,7 @@ static void test_enum_objects(IOleContainer *container)
ok(enum_unknown != NULL, "enum_unknown == NULL\n");
fetched = 0xdeadbeef;
- hres = IEnumUnknown_Next(enum_unknown, sizeof(buf)/sizeof(*buf), buf, &fetched);
+ hres = IEnumUnknown_Next(enum_unknown, ARRAY_SIZE(buf), buf, &fetched);
ok(hres == S_FALSE, "Next returned %08x\n", hres);
ok(!fetched, "fetched = %d\n", fetched);
ok(buf[0] == (void*)0xdeadbeef, "buf[0] = %p\n", buf[0]);
@@ -7764,7 +7764,7 @@ static void test_cookies(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_cookie(doc, &str);
ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
if(str) {
- size = sizeof(buf)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buf);
b = InternetGetCookieW(http_urlW, NULL, buf, &size);
ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
ok(!lstrcmpW(buf, str), "cookie = %s, expected %s\n", wine_dbgstr_w(str), wine_dbgstr_w(buf));
@@ -7779,7 +7779,7 @@ static void test_cookies(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_cookie(doc, &str2);
ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
ok(str2 != NULL, "cookie = NULL\n");
- size = sizeof(buf)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buf);
b = InternetGetCookieW(http_urlW, NULL, buf, &size);
ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
@@ -7796,7 +7796,7 @@ static void test_cookies(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_cookie(doc, &str2);
ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
ok(str2 != NULL, "cookie = NULL\n");
- size = sizeof(buf)/sizeof(WCHAR);
+ size = ARRAY_SIZE(buf);
b = InternetGetCookieW(http_urlW, NULL, buf, &size);
ok(b, "InternetGetCookieW failed: %08x\n", GetLastError());
ok(!lstrcmpW(buf, str2), "cookie = %s, expected %s\n", wine_dbgstr_w(str2), wine_dbgstr_w(buf));
diff --git a/dlls/mshtml/tests/htmllocation.c b/dlls/mshtml/tests/htmllocation.c
index 458960a8d3..4781de9681 100644
--- a/dlls/mshtml/tests/htmllocation.c
+++ b/dlls/mshtml/tests/htmllocation.c
@@ -300,7 +300,7 @@ static void perform_test(const struct location_test* test)
if(FAILED(hres))
return;
- MultiByteToWideChar(CP_ACP, 0, test->url, -1, url, sizeof(url)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, test->url, -1, url, ARRAY_SIZE(url));
hres = CreateURLMoniker(NULL, url, &url_mon);
ok(hres == S_OK, "%s: CreateURLMoniker failed: 0x%08x\n", test->name, hres);
if(FAILED(hres)){
@@ -381,7 +381,7 @@ START_TEST(htmllocation)
CoInitialize(NULL);
- for(i=0; i < sizeof(location_tests)/sizeof(*location_tests); i++)
+ for(i=0; i < ARRAY_SIZE(location_tests); i++)
perform_test(location_tests+i);
CoUninitialize();
diff --git a/dlls/mshtml/tests/protocol.c b/dlls/mshtml/tests/protocol.c
index 62bda5c75f..80e356344d 100644
--- a/dlls/mshtml/tests/protocol.c
+++ b/dlls/mshtml/tests/protocol.c
@@ -271,7 +271,7 @@ static void test_res_url(const char *url_suffix)
HRESULT hres;
memcpy(url, res_url_base, res_url_base_len*sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, url_suffix, -1, url+res_url_base_len, sizeof(url)/sizeof(WCHAR)-res_url_base_len);
+ MultiByteToWideChar(CP_ACP, 0, url_suffix, -1, url+res_url_base_len, ARRAY_SIZE(url)-res_url_base_len);
hres = CoCreateInstance(&CLSID_ResProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void**)&protocol);
ok(hres == S_OK, "Could not create ResProtocol instance: %08x\n", hres);
@@ -296,13 +296,13 @@ static void res_sec_url_cmp(LPCWSTR url, DWORD size, LPCWSTR file)
static const WCHAR fileW[] = {'f','i','l','e',':','/','/'};
- if(size < sizeof(fileW)/sizeof(WCHAR) || memcmp(url, fileW, sizeof(fileW))) {
+ if(size < ARRAY_SIZE(fileW) || memcmp(url, fileW, sizeof(fileW))) {
ok(0, "wrong URL protocol\n");
return;
}
SetLastError(0xdeadbeef);
- len = SearchPathW(NULL, file, NULL, sizeof(buf)/sizeof(WCHAR), buf, NULL);
+ len = SearchPathW(NULL, file, NULL, ARRAY_SIZE(buf), buf, NULL);
if(!len) {
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
win_skip("SearchPathW is not implemented\n");
@@ -311,9 +311,9 @@ static void res_sec_url_cmp(LPCWSTR url, DWORD size, LPCWSTR file)
return;
}
- len += sizeof(fileW)/sizeof(WCHAR)+1;
+ len += ARRAY_SIZE(fileW)+1;
ok(len == size, "wrong size %u, expected %u\n", size, len);
- ok(!lstrcmpW(url + sizeof(fileW)/sizeof(WCHAR), buf), "wrong file part %s\n", wine_dbgstr_w(url));
+ ok(!lstrcmpW(url + ARRAY_SIZE(fileW), buf), "wrong file part %s\n", wine_dbgstr_w(url));
}
static void test_res_protocol(void)
@@ -355,14 +355,14 @@ static void test_res_protocol(void)
for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, i, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_DEFAULT_ACTION,
"[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
}
}
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_SECURITY_URL, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
res_sec_url_cmp(buf, size, mshtml_dllW);
ok(size == lstrlenW(buf)+1, "size = %d\n", size);
@@ -381,36 +381,32 @@ static void test_res_protocol(void)
ok(size == expected_size, "size = %d\n", size);
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url1, PARSE_SECURITY_URL, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == MK_E_SYNTAX || hres == E_INVALIDARG,
"ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url5, PARSE_SECURITY_URL, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url6, PARSE_SECURITY_URL, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == MK_E_SYNTAX, "ParseUrl failed: %08x, expected MK_E_SYNTAX\n", hres);
size = 0xdeadbeef;
buf[0] = '?';
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
ok(buf[0] == '?', "buf changed\n");
- ok(size == sizeof(blank_url)/sizeof(WCHAR) ||
- size == sizeof(buf)/sizeof(buf[0]), /* IE8 */
- "size=%d\n", size);
+ ok(size == ARRAY_SIZE(blank_url) || size == ARRAY_SIZE(buf), /* IE8 */ "size=%d\n", size);
size = 0xdeadbeef;
hres = IInternetProtocolInfo_ParseUrl(protocol_info, wrong_url1, PARSE_DOMAIN, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
ok(buf[0] == '?', "buf changed\n");
- ok(size == sizeof(wrong_url1)/sizeof(WCHAR) ||
- size == sizeof(buf)/sizeof(buf[0]), /* IE8 */
- "size=%d\n", size);
+ ok(size == ARRAY_SIZE(wrong_url1) || size == ARRAY_SIZE(buf), /* IE8 */ "size=%d\n", size);
if (0)
{
@@ -418,40 +414,40 @@ static void test_res_protocol(void)
size = 0xdeadbeef;
buf[0] = '?';
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
ok(buf[0] == '?', "buf changed\n");
ok(size == 1, "size=%u, expected 1\n", size);
buf[0] = '?';
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_DOMAIN, 0, buf,
- sizeof(buf)/sizeof(buf[0]), NULL, 0);
+ ARRAY_SIZE(buf), NULL, 0);
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
ok(buf[0] == '?', "buf changed\n");
buf[0] = '?';
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
- sizeof(buf)/sizeof(buf[0]), NULL, 0);
+ ARRAY_SIZE(buf), NULL, 0);
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
ok(buf[0] == '?', "buf changed\n");
}
buf[0] = '?';
hres = IInternetProtocolInfo_ParseUrl(protocol_info, blank_url, PARSE_UNESCAPE+1, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_DEFAULT_ACTION,
"ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
ok(buf[0] == '?', "buf changed\n");
size = 0xdeadbeef;
hres = IInternetProtocolInfo_CombineUrl(protocol_info, blank_url, test_part_url,
- 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
+ 0, buf, ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
ok(size == 0xdeadbeef, "size=%d\n", size);
size = 0xdeadbeef;
hres = IInternetProtocolInfo_CombineUrl(protocol_info, blank_url, test_part_url,
- URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
+ URL_FILE_USE_PATHURL, buf, ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
ok(size == 0xdeadbeef, "size=%d\n", size);
@@ -693,14 +689,14 @@ static void test_about_protocol(void)
for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, i, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_DEFAULT_ACTION,
"[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
}
}
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_SECURITY_URL, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
ok(!lstrcmpW(about_blank_url, buf), "buf != blank_url\n");
@@ -711,7 +707,7 @@ static void test_about_protocol(void)
ok(size == 12, "size = %d\n", size);
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_test_url, PARSE_SECURITY_URL, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == S_OK, "ParseUrl failed: %08x\n", hres);
ok(!lstrcmpW(about_test_url, buf), "buf != test_url\n");
ok(size == 11, "size = %d\n", size);
@@ -719,13 +715,12 @@ static void test_about_protocol(void)
size = 0xdeadbeef;
buf[0] = '?';
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_DOMAIN, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == S_OK || hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
ok(buf[0] == '?' || buf[0] == '\0' /* Win10 */,
"Expected buf to be unchanged or empty, got %s\n",
wine_dbgstr_w(buf));
- ok(size == sizeof(about_blank_url)/sizeof(WCHAR) ||
- size == sizeof(buf)/sizeof(buf[0]), /* IE8 */
+ ok(size == ARRAY_SIZE(about_blank_url) || size == ARRAY_SIZE(buf), /* IE8 */
"size=%d\n", size);
if (0)
@@ -734,44 +729,44 @@ static void test_about_protocol(void)
size = 0xdeadbeef;
buf[0] = '?';
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == E_FAIL, "ParseUrl failed: %08x\n", hres);
ok(buf[0] == '?', "buf changed\n");
ok(size == 1, "size=%u, expected 1\n", size);
buf[0] = '?';
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_DOMAIN, 0, buf,
- sizeof(buf)/sizeof(buf[0]), NULL, 0);
+ ARRAY_SIZE(buf), NULL, 0);
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
ok(buf[0] == '?', "buf changed\n");
buf[0] = '?';
hres = IInternetProtocolInfo_ParseUrl(protocol_info, NULL, PARSE_DOMAIN, 0, buf,
- sizeof(buf)/sizeof(buf[0]), NULL, 0);
+ ARRAY_SIZE(buf), NULL, 0);
ok(hres == E_POINTER, "ParseUrl failed: %08x\n", hres);
ok(buf[0] == '?', "buf changed\n");
}
hres = IInternetProtocolInfo_ParseUrl(protocol_info, about_blank_url, PARSE_UNESCAPE+1, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_DEFAULT_ACTION,
"ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
size = 0xdeadbeef;
hres = IInternetProtocolInfo_CombineUrl(protocol_info, about_blank_url, about_test_url,
- 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
+ 0, buf, ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
ok(size == 0xdeadbeef, "size=%d\n", size);
size = 0xdeadbeef;
hres = IInternetProtocolInfo_CombineUrl(protocol_info, about_blank_url, about_test_url,
- URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
+ URL_FILE_USE_PATHURL, buf, ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
ok(size == 0xdeadbeef, "size=%d\n", size);
size = 0xdeadbeef;
hres = IInternetProtocolInfo_CombineUrl(protocol_info, NULL, NULL,
- URL_FILE_USE_PATHURL, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
+ URL_FILE_USE_PATHURL, buf, ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
ok(size == 0xdeadbeef, "size=%d\n", size);
@@ -870,20 +865,20 @@ static void test_javascript_protocol(void)
for(i = PARSE_CANONICALIZE; i <= PARSE_UNESCAPE; i++) {
if(i != PARSE_SECURITY_URL && i != PARSE_DOMAIN) {
hres = IInternetProtocolInfo_ParseUrl(protocol_info, javascript_test_url, i, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_DEFAULT_ACTION,
"[%d] failed: %08x, expected INET_E_DEFAULT_ACTION\n", i, hres);
}
}
hres = IInternetProtocolInfo_ParseUrl(protocol_info, javascript_test_url, PARSE_UNESCAPE+1, 0, buf,
- sizeof(buf)/sizeof(buf[0]), &size, 0);
+ ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_DEFAULT_ACTION,
"ParseUrl failed: %08x, expected INET_E_DEFAULT_ACTION\n", hres);
size = 0xdeadbeef;
hres = IInternetProtocolInfo_CombineUrl(protocol_info, javascript_test_url, javascript_test_url,
- 0, buf, sizeof(buf)/sizeof(buf[0]), &size, 0);
+ 0, buf, ARRAY_SIZE(buf), &size, 0);
ok(hres == INET_E_USE_DEFAULT_PROTOCOLHANDLER, "CombineUrl failed: %08x\n", hres);
ok(size == 0xdeadbeef, "size=%d\n", size);
@@ -1007,7 +1002,8 @@ static void test_com_aggregation(const CLSID *clsid)
START_TEST(protocol)
{
- res_url_base_len = 6 + GetModuleFileNameW(NULL, res_url_base + 6 /* strlen("res://") */, sizeof(res_url_base)/sizeof(WCHAR)-6);
+ res_url_base_len = 6 + GetModuleFileNameW(NULL, res_url_base + 6 /* strlen("res://") */,
+ ARRAY_SIZE(res_url_base)-6);
OleInitialize(NULL);
diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c
index 3decb8690b..2e13f9b236 100644
--- a/dlls/mshtml/tests/script.c
+++ b/dlls/mshtml/tests/script.c
@@ -3378,9 +3378,9 @@ static void run_js_script(const char *test_name)
trace("running %s...\n", test_name);
ptr = url + lstrlenW(url);
- ptr += GetModuleFileNameW(NULL, ptr, url + sizeof(url)/sizeof(WCHAR) - ptr);
+ ptr += GetModuleFileNameW(NULL, ptr, url + ARRAY_SIZE(url) - ptr);
*ptr++ = '/';
- MultiByteToWideChar(CP_ACP, 0, test_name, -1, ptr, url + sizeof(url)/sizeof(WCHAR) - ptr);
+ MultiByteToWideChar(CP_ACP, 0, test_name, -1, ptr, url + ARRAY_SIZE(url) - ptr);
hres = CreateURLMoniker(NULL, url, &mon);
ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
diff --git a/dlls/mshtml/tests/xmlhttprequest.c b/dlls/mshtml/tests/xmlhttprequest.c
index 733987fce0..2be817914d 100644
--- a/dlls/mshtml/tests/xmlhttprequest.c
+++ b/dlls/mshtml/tests/xmlhttprequest.c
@@ -747,7 +747,7 @@ static void test_sync_xhr(IHTMLDocument2 *doc, const char *xml_url, const char *
SysFreeString(text);
if(expect_text)
- test_header(expect_headers, sizeof(expect_headers)/sizeof(expect_headers[0]));
+ test_header(expect_headers, ARRAY_SIZE(expect_headers));
val = 0xdeadbeef;
hres = IHTMLXMLHttpRequest_get_status(xhr, &val);
@@ -905,7 +905,7 @@ static void test_async_xhr(IHTMLDocument2 *doc, const char *xml_url, const char
SysFreeString(text);
if(expect_text)
- test_header(expect_headers, sizeof(expect_headers)/sizeof(expect_headers[0]));
+ test_header(expect_headers, ARRAY_SIZE(expect_headers));
val = 0xdeadbeef;
hres = IHTMLXMLHttpRequest_get_status(xhr, &val);
--
2.14.4
June 7, 2018
[PATCH] dinput/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/dinput/tests/device.c | 4 ++--
dlls/dinput/tests/dinput.c | 20 ++++++++++----------
dlls/dinput/tests/joystick.c | 8 +++-----
dlls/dinput/tests/keyboard.c | 10 +++++-----
4 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/dlls/dinput/tests/device.c b/dlls/dinput/tests/device.c
index 74940248ff..fa9b6f1436 100644
--- a/dlls/dinput/tests/device.c
+++ b/dlls/dinput/tests/device.c
@@ -51,7 +51,7 @@ static const DIDATAFORMAT data_format = {
sizeof(DIOBJECTDATAFORMAT),
DIDF_ABSAXIS,
32,
- sizeof(obj_data_format) / sizeof(obj_data_format[0]),
+ ARRAY_SIZE(obj_data_format),
(LPDIOBJECTDATAFORMAT)obj_data_format
};
@@ -94,7 +94,7 @@ static void test_object_info(IDirectInputDeviceA *device, HWND hwnd)
ok(cnt == cnt1, "Enum count changed from %d to %d\n", cnt, cnt1);
/* Testing EnumObjects with different types of device objects */
- for (type_index=0; type_index < sizeof(obj_types)/sizeof(obj_types[0]); type_index++)
+ for (type_index=0; type_index < ARRAY_SIZE(obj_types); type_index++)
{
hr = IDirectInputDevice_EnumObjects(device, enum_type_callback, &obj_types[type_index], obj_types[type_index]);
ok(SUCCEEDED(hr), "EnumObjects() failed: %08x\n", hr);
diff --git a/dlls/dinput/tests/dinput.c b/dlls/dinput/tests/dinput.c
index a5f7c0cfce..7e2da9ff32 100644
--- a/dlls/dinput/tests/dinput.c
+++ b/dlls/dinput/tests/dinput.c
@@ -106,7 +106,7 @@ static void test_preinitialization(void)
return;
}
- for (i = 0; i < sizeof(create_device_tests)/sizeof(create_device_tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(create_device_tests); i++)
{
if (create_device_tests[i].pdev) pDID = (void *)0xdeadbeef;
hr = IDirectInput_CreateDevice(pDI, create_device_tests[i].rguid,
@@ -117,7 +117,7 @@ static void test_preinitialization(void)
ok(pDID == NULL, "[%d] Output interface pointer is %p\n", i, pDID);
}
- for (i = 0; i < sizeof(enum_devices_tests)/sizeof(enum_devices_tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(enum_devices_tests); i++)
{
hr = IDirectInput_EnumDevices(pDI, enum_devices_tests[i].dwDevType,
enum_devices_tests[i].lpCallback,
@@ -217,7 +217,7 @@ static void test_DirectInputCreateEx(void)
return;
}
- for (i = 0; i < sizeof(invalid_param_list)/sizeof(invalid_param_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(invalid_param_list); i++)
{
if (invalid_param_list[i].ppdi) pUnk = (void *)0xdeadbeef;
hr = pDirectInputCreateEx(invalid_param_list[i].hinst ? hInstance : NULL,
@@ -230,7 +230,7 @@ static void test_DirectInputCreateEx(void)
ok(pUnk == invalid_param_list[i].expected_ppdi, "[%d] Output interface pointer is %p\n", i, pUnk);
}
- for (i = 0; i < sizeof(no_interface_list)/sizeof(no_interface_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(no_interface_list); i++)
{
pUnk = (void *)0xdeadbeef;
hr = pDirectInputCreateEx(hInstance, DIRECTINPUT_VERSION, no_interface_list[i], (void **)&pUnk, NULL);
@@ -238,7 +238,7 @@ static void test_DirectInputCreateEx(void)
ok(pUnk == (void *)0xdeadbeef, "[%d] Output interface pointer is %p\n", i, pUnk);
}
- for (i = 0; i < sizeof(iid_list)/sizeof(iid_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(iid_list); i++)
{
pUnk = NULL;
hr = pDirectInputCreateEx(hInstance, DIRECTINPUT_VERSION, iid_list[i], (void **)&pUnk, NULL);
@@ -249,9 +249,9 @@ static void test_DirectInputCreateEx(void)
}
/* Examine combinations of requested interfaces and version numbers. */
- for (i = 0; i < sizeof(directinput_version_list)/sizeof(directinput_version_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(directinput_version_list); i++)
{
- for (j = 0; j < sizeof(iid_list)/sizeof(iid_list[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(iid_list); j++)
{
pUnk = NULL;
hr = pDirectInputCreateEx(hInstance, directinput_version_list[i], iid_list[j], (void **)&pUnk, NULL);
@@ -311,7 +311,7 @@ static void test_QueryInterface(void)
hr = IDirectInput_QueryInterface(pDI, &IID_IUnknown, NULL);
ok(hr == E_POINTER, "IDirectInput_QueryInterface returned 0x%08x\n", hr);
- for (i = 0; i < sizeof(iid_list)/sizeof(iid_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(iid_list); i++)
{
pUnk = NULL;
hr = IDirectInput_QueryInterface(pDI, iid_list[i], (void **)&pUnk);
@@ -320,7 +320,7 @@ static void test_QueryInterface(void)
if (pUnk) IUnknown_Release(pUnk);
}
- for (i = 0; i < sizeof(no_interface_list)/sizeof(no_interface_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(no_interface_list); i++)
{
pUnk = (void *)0xdeadbeef;
hr = IDirectInput_QueryInterface(pDI, no_interface_list[i].riid, (void **)&pUnk);
@@ -512,7 +512,7 @@ static void test_Initialize(void)
hr = IDirectInput_Initialize(pDI, hInstance, 0xcafe);
ok(hr == DIERR_OLDDIRECTINPUTVERSION, "IDirectInput_Initialize returned 0x%08x\n", hr);
- for (i = 0; i < sizeof(directinput_version_list)/sizeof(directinput_version_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(directinput_version_list); i++)
{
hr = IDirectInput_Initialize(pDI, hInstance, directinput_version_list[i]);
ok(hr == DI_OK, "IDirectInput_Initialize returned 0x%08x\n", hr);
diff --git a/dlls/dinput/tests/joystick.c b/dlls/dinput/tests/joystick.c
index b4ffba5c5d..69e95d0c2d 100644
--- a/dlls/dinput/tests/joystick.c
+++ b/dlls/dinput/tests/joystick.c
@@ -30,8 +30,6 @@
#include "wingdi.h"
#include "dinput.h"
-#define numObjects(x) (sizeof(x) / sizeof(x[0]))
-
typedef struct tagUserData {
IDirectInputA *pDI;
DWORD version;
@@ -62,7 +60,7 @@ static const DIDATAFORMAT c_dfDIJoystickTest = {
sizeof(DIOBJECTDATAFORMAT),
DIDF_ABSAXIS,
sizeof(DIJOYSTATE2),
- numObjects(dfDIJoystickTest),
+ ARRAY_SIZE(dfDIJoystickTest),
(LPDIOBJECTDATAFORMAT)dfDIJoystickTest
};
@@ -178,7 +176,7 @@ static const struct effect_id
static const struct effect_id* effect_from_guid(const GUID *guid)
{
unsigned int i;
- for (i = 0; i < sizeof(effect_conversion) / sizeof(effect_conversion[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(effect_conversion); i++)
if (IsEqualGUID(guid, effect_conversion[i].guid))
return &effect_conversion[i];
return NULL;
@@ -504,7 +502,7 @@ static BOOL CALLBACK EnumJoysticks(const DIDEVICEINSTANCEA *lpddi, void *pvRef)
effect_data.eff.dwDuration = INFINITE;
effect_data.eff.dwGain = DI_FFNOMINALMAX;
effect_data.eff.dwTriggerButton = DIEB_NOTRIGGER;
- effect_data.eff.cAxes = sizeof(axes) / sizeof(axes[0]);
+ effect_data.eff.cAxes = ARRAY_SIZE(axes);
effect_data.eff.rgdwAxes = axes;
effect_data.eff.rglDirection = direction;
diff --git a/dlls/dinput/tests/keyboard.c b/dlls/dinput/tests/keyboard.c
index 576a94cc7d..59411cbfa5 100644
--- a/dlls/dinput/tests/keyboard.c
+++ b/dlls/dinput/tests/keyboard.c
@@ -101,7 +101,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
df.dwObjSize = sizeof( DIOBJECTDATAFORMAT );
df.dwFlags = DIDF_RELAXIS;
df.dwDataSize = sizeof( custom_state );
- df.dwNumObjs = sizeof( dodf )/sizeof( dodf[0] );
+ df.dwNumObjs = ARRAY_SIZE(dodf);
df.rgodf = dodf;
hr = IDirectInput_CreateDevice(pDI, &GUID_SysKeyboard, &pKeyboard, NULL);
@@ -139,7 +139,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
memset(custom_state, 0x56, sizeof(custom_state));
IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state);
- for (i = 0; i < sizeof(custom_state) / sizeof(custom_state[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(custom_state); i++)
ok(custom_state[i] == 0, "Should be zeroed, got 0x%08x\n", custom_state[i]);
/* simulate some keyboard input */
@@ -160,7 +160,7 @@ static void acquire_tests(IDirectInputA *pDI, HWND hwnd)
ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %08x\n", hr);
hr = IDirectInputDevice_GetDeviceState(pKeyboard, sizeof(custom_state), custom_state);
ok(SUCCEEDED(hr), "IDirectInputDevice_GetDeviceState failed: %08x\n", hr);
- for (i = 0; i < sizeof(custom_state) / sizeof(custom_state[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(custom_state); i++)
ok(custom_state[i] == 0, "Should be zeroed, got 0x%08x\n", custom_state[i]);
}
keybd_event('Q', 0, KEYEVENTF_KEYUP, 0);
@@ -316,7 +316,7 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
HKL hkl, hkl_orig;
MSG msg;
- for (i = 0; i < sizeof(expected)/sizeof(expected[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(expected); i++)
{
if (expected[i].langid == langid)
{
@@ -340,7 +340,7 @@ static void test_dik_codes(IDirectInputA *dI, HWND hwnd, LANGID langid)
SetFocus(hwnd);
pump_messages();
- for (i = 0; i < sizeof(key2dik_en)/sizeof(key2dik_en[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(key2dik_en); i++)
{
BYTE kbd_state[256];
UINT n;
--
2.14.4
June 7, 2018
[PATCH] dinput8/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/dinput8/tests/device.c | 12 ++++++------
dlls/dinput8/tests/dinput.c | 18 +++++++++---------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/dlls/dinput8/tests/device.c b/dlls/dinput8/tests/device.c
index 2b06f624c2..aaeddd9b7b 100644
--- a/dlls/dinput8/tests/device.c
+++ b/dlls/dinput8/tests/device.c
@@ -317,8 +317,8 @@ static void test_action_mapping(void)
memset (&af, 0, sizeof(af));
af.dwSize = sizeof(af);
af.dwActionSize = sizeof(DIACTIONA);
- af.dwDataSize = 4 * sizeof(actionMapping) / sizeof(actionMapping[0]);
- af.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]);
+ af.dwDataSize = 4 * ARRAY_SIZE(actionMapping);
+ af.dwNumActions = ARRAY_SIZE(actionMapping);
af.rgoAction = actionMapping;
af.guidActionMap = ACTION_MAPPING_GUID;
af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */
@@ -357,8 +357,8 @@ static void test_action_mapping(void)
hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0);
ok (hr == DI_NOEFFECT, "SetActionMap should have no effect with no actions to map hr=%08x\n", hr);
- af.dwDataSize = 4 * sizeof(actionMapping) / sizeof(actionMapping[0]);
- af.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]);
+ af.dwDataSize = 4 * ARRAY_SIZE(actionMapping);
+ af.dwNumActions = ARRAY_SIZE(actionMapping);
/* test DIDSAM_NOUSER */
dps.diph.dwSize = sizeof(dps);
@@ -448,8 +448,8 @@ static void test_save_settings(void)
memset (&af, 0, sizeof(af));
af.dwSize = sizeof(af);
af.dwActionSize = sizeof(DIACTIONA);
- af.dwDataSize = 4 * sizeof(actions) / sizeof(actions[0]);
- af.dwNumActions = sizeof(actions) / sizeof(actions[0]);
+ af.dwDataSize = 4 * ARRAY_SIZE(actions);
+ af.dwNumActions = ARRAY_SIZE(actions);
af.rgoAction = actions;
af.guidActionMap = mapping_guid;
af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */
diff --git a/dlls/dinput8/tests/dinput.c b/dlls/dinput8/tests/dinput.c
index e16542ab13..b093437096 100644
--- a/dlls/dinput8/tests/dinput.c
+++ b/dlls/dinput8/tests/dinput.c
@@ -82,7 +82,7 @@ static void test_preinitialization(void)
return;
}
- for (i = 0; i < sizeof(create_device_tests)/sizeof(create_device_tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(create_device_tests); i++)
{
if (create_device_tests[i].pdev) pDID = (void *)0xdeadbeef;
hr = IDirectInput8_CreateDevice(pDI, create_device_tests[i].rguid,
@@ -93,7 +93,7 @@ static void test_preinitialization(void)
ok(pDID == NULL, "[%d] Output interface pointer is %p\n", i, pDID);
}
- for (i = 0; i < sizeof(enum_devices_tests)/sizeof(enum_devices_tests[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(enum_devices_tests); i++)
{
hr = IDirectInput8_EnumDevices(pDI, enum_devices_tests[i].dwDevType,
enum_devices_tests[i].lpCallback,
@@ -186,7 +186,7 @@ static void test_DirectInput8Create(void)
IUnknown *pUnk;
HRESULT hr;
- for (i = 0; i < sizeof(invalid_param_list)/sizeof(invalid_param_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(invalid_param_list); i++)
{
if (invalid_param_list[i].ppdi) pUnk = (void *)0xdeadbeef;
hr = DirectInput8Create(invalid_param_list[i].hinst ? hInstance : NULL,
@@ -199,7 +199,7 @@ static void test_DirectInput8Create(void)
ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk);
}
- for (i = 0; i < sizeof(no_interface_list)/sizeof(no_interface_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(no_interface_list); i++)
{
pUnk = (void *)0xdeadbeef;
hr = DirectInput8Create(hInstance, DIRECTINPUT_VERSION, no_interface_list[i], (void **)&pUnk, NULL);
@@ -207,7 +207,7 @@ static void test_DirectInput8Create(void)
ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk);
}
- for (i = 0; i < sizeof(iid_list)/sizeof(iid_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(iid_list); i++)
{
pUnk = NULL;
hr = DirectInput8Create(hInstance, DIRECTINPUT_VERSION, iid_list[i], (void **)&pUnk, NULL);
@@ -268,7 +268,7 @@ static void test_QueryInterface(void)
hr = IDirectInput8_QueryInterface(pDI, &IID_IUnknown, NULL);
ok(hr == E_POINTER, "IDirectInput8_QueryInterface returned 0x%08x\n", hr);
- for (i = 0; i < sizeof(iid_list)/sizeof(iid_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(iid_list); i++)
{
pUnk = NULL;
hr = IDirectInput8_QueryInterface(pDI, iid_list[i], (void **)&pUnk);
@@ -277,7 +277,7 @@ static void test_QueryInterface(void)
if (pUnk)
{
int j;
- for (j = 0; j < sizeof(iid_list)/sizeof(iid_list[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(iid_list); j++)
{
IUnknown *pUnk1 = NULL;
hr = IDirectInput8_QueryInterface(pUnk, iid_list[j], (void **)&pUnk1);
@@ -289,7 +289,7 @@ static void test_QueryInterface(void)
}
}
- for (i = 0; i < sizeof(no_interface_list)/sizeof(no_interface_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(no_interface_list); i++)
{
pUnk = (void *)0xdeadbeef;
hr = IDirectInput8_QueryInterface(pDI, no_interface_list[i].riid, (void **)&pUnk);
@@ -527,7 +527,7 @@ static void test_EnumDevicesBySemantics(void)
memset (&diaf, 0, sizeof(diaf));
diaf.dwSize = sizeof(diaf);
diaf.dwActionSize = sizeof(DIACTIONA);
- diaf.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]);
+ diaf.dwNumActions = ARRAY_SIZE(actionMapping);
diaf.dwDataSize = 4 * diaf.dwNumActions;
diaf.rgoAction = actionMapping;
diaf.guidActionMap = ACTION_MAPPING_GUID;
--
2.14.4
June 7, 2018
[PATCH] ieframe/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/ieframe/tests/intshcut.c | 2 +-
dlls/ieframe/tests/webbrowser.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/ieframe/tests/intshcut.c b/dlls/ieframe/tests/intshcut.c
index 0959a61880..803e7ec60e 100644
--- a/dlls/ieframe/tests/intshcut.c
+++ b/dlls/ieframe/tests/intshcut.c
@@ -331,7 +331,7 @@ static void test_Load(void)
GetTempPathW(MAX_PATH, file_path);
lstrcatW(file_path, test_urlW);
- for(test = load_tests; test < load_tests + sizeof(load_tests)/sizeof(*load_tests); test++) {
+ for(test = load_tests; test < load_tests + ARRAY_SIZE(load_tests); test++) {
IPropertySetStorage *propsetstorage;
IPropertyStorage *propstorage;
PROPVARIANT v;
diff --git a/dlls/ieframe/tests/webbrowser.c b/dlls/ieframe/tests/webbrowser.c
index ca2a13162b..706d5071a9 100644
--- a/dlls/ieframe/tests/webbrowser.c
+++ b/dlls/ieframe/tests/webbrowser.c
@@ -2167,7 +2167,7 @@ static void test_EnumVerbs(IWebBrowser2 *wb)
fetched = 0xdeadbeef;
memset(verbs, 0xa, sizeof(verbs));
verbs[1].lVerb = 0xdeadbeef;
- hres = IEnumOLEVERB_Next(enum_verbs, sizeof(verbs)/sizeof(*verbs), verbs, &fetched);
+ hres = IEnumOLEVERB_Next(enum_verbs, ARRAY_SIZE(verbs), verbs, &fetched);
ok(hres == S_OK, "Next failed: %08x\n", hres);
ok(!fetched, "fetched = %d\n", fetched);
/* Although fetched==0, an element is returned. */
@@ -2184,12 +2184,12 @@ static void test_EnumVerbs(IWebBrowser2 *wb)
fetched = 0xdeadbeef;
memset(verbs, 0xa, sizeof(verbs));
verbs[0].lVerb = 0xdeadbeef;
- hres = IEnumOLEVERB_Next(enum_verbs, sizeof(verbs)/sizeof(*verbs), verbs, &fetched);
+ hres = IEnumOLEVERB_Next(enum_verbs, ARRAY_SIZE(verbs), verbs, &fetched);
todo_wine ok(hres == S_OK, "Next failed: %08x\n", hres);
todo_wine ok(fetched == 1, "fetched = %d\n", fetched);
todo_wine ok(verbs[0].lVerb != 0xdeadbeef, "verbs[0].lVerb = %x\n", verbs[0].lVerb);
- hres = IEnumOLEVERB_Next(enum_verbs, sizeof(verbs)/sizeof(*verbs), verbs, &fetched);
+ hres = IEnumOLEVERB_Next(enum_verbs, ARRAY_SIZE(verbs), verbs, &fetched);
ok(hres == S_FALSE, "Next failed: %08x\n", hres);
ok(!fetched, "fetched = %d\n", fetched);
--
2.14.4
June 7, 2018
[PATCH] gdiplus/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/gdiplus/tests/graphics.c | 10 +++----
dlls/gdiplus/tests/graphicspath.c | 58 +++++++++++++++++++--------------------
dlls/gdiplus/tests/image.c | 40 +++++++++++++--------------
3 files changed, 54 insertions(+), 54 deletions(-)
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 6acc656c8f..ae75c0efc1 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -3721,7 +3721,7 @@ static void test_GdipMeasureString(void)
expect(Ok, status);
expect(UnitPixel, font_unit);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
GpImage *image;
@@ -3799,7 +3799,7 @@ todo_wine
expect(Ok, status);
expect(unit, font_unit);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
REAL unit_scale;
GpImage *image;
@@ -3883,7 +3883,7 @@ todo_wine
}
/* Font with units = UnitWorld */
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
GpPointF pt = {0.0, 100.0};
GpImage* image;
@@ -3972,7 +3972,7 @@ static void test_transform(void)
GpPointF ptf[2];
UINT i;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].scale, &image);
ptf[0].X = td[i].in[0].X;
@@ -4032,7 +4032,7 @@ static void test_pen_thickness(void)
BitmapData bd;
INT min, max, size;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
status = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat24bppRGB, NULL, &u.bitmap);
expect(Ok, status);
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index c5403cbe0e..096fbc600a 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -207,7 +207,7 @@ static void test_line2(void)
status = GdipAddPathLine2(path, &(line2_points[6]), 3);
expect(Ok, status);
- ok_path(path, line2_path, sizeof(line2_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, line2_path, ARRAY_SIZE(line2_path), FALSE);
GdipDeletePath(path);
}
@@ -278,7 +278,7 @@ static void test_arc(void)
status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, 0.0);
expect(Ok, status);
- ok_path(path, arc_path, sizeof(arc_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, arc_path, ARRAY_SIZE(arc_path), FALSE);
GdipDeletePath(path);
}
@@ -458,7 +458,7 @@ static void test_pathpath(void)
status = GdipAddPathPath(path1, path2, TRUE);
expect(Ok, status);
- ok_path(path1, pathpath_path, sizeof(pathpath_path)/sizeof(path_test_t), FALSE);
+ ok_path(path1, pathpath_path, ARRAY_SIZE(pathpath_path), FALSE);
GdipDeletePath(path1);
GdipDeletePath(path2);
@@ -529,7 +529,7 @@ static void test_ellipse(void)
status = GdipAddPathEllipse(path, 10.0, 300.0, 0.0, 1.0);
expect(Ok, status);
- ok_path(path, ellipse_path, sizeof(ellipse_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, ellipse_path, ARRAY_SIZE(ellipse_path), FALSE);
GdipDeletePath(path);
}
@@ -565,7 +565,7 @@ static void test_linei(void)
status = GdipAddPathLineI(path, 35.0, 35.0, 36.0, 38.0);
expect(Ok, status);
- ok_path(path, linei_path, sizeof(linei_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, linei_path, ARRAY_SIZE(linei_path), FALSE);
GdipDeletePath(path);
}
@@ -614,7 +614,7 @@ static void test_polygon(void)
status = GdipAddPathPolygon(path, points, 5);
expect(Ok, status);
/* check resulting path */
- ok_path(path, poly_path, sizeof(poly_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, poly_path, ARRAY_SIZE(poly_path), FALSE);
GdipDeletePath(path);
}
@@ -643,7 +643,7 @@ static void test_rect(void)
status = GdipAddPathRectangle(path, 100.0, 50.0, 120.0, 30.0);
expect(Ok, status);
- ok_path(path, rect_path, sizeof(rect_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, rect_path, ARRAY_SIZE(rect_path), FALSE);
GdipDeletePath(path);
@@ -661,7 +661,7 @@ static void test_rect(void)
status = GdipAddPathRectangles(path, (GDIPCONST GpRectF*)&rects, 2);
expect(Ok, status);
- ok_path(path, rect_path, sizeof(rect_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, rect_path, ARRAY_SIZE(rect_path), FALSE);
GdipDeletePath(path);
}
@@ -756,7 +756,7 @@ static void test_addcurve(void)
/* add to empty path */
status = GdipAddPathCurve2(path, points, 4, 1.0);
expect(Ok, status);
- ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, addcurve_path, ARRAY_SIZE(addcurve_path), FALSE);
GdipDeletePath(path);
/* add to notempty path and opened figure */
@@ -764,7 +764,7 @@ static void test_addcurve(void)
GdipAddPathLine(path, 100.0, 120.0, 123.0, 10.0);
status = GdipAddPathCurve2(path, points, 4, 1.0);
expect(Ok, status);
- ok_path(path, addcurve_path2, sizeof(addcurve_path2)/sizeof(path_test_t), FALSE);
+ ok_path(path, addcurve_path2, ARRAY_SIZE(addcurve_path2), FALSE);
/* NULL args */
GdipResetPath(path);
@@ -789,12 +789,12 @@ static void test_addcurve(void)
/* use all points */
status = GdipAddPathCurve3(path, points, 4, 0, 3, 1.0);
expect(Ok, status);
- ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, addcurve_path, ARRAY_SIZE(addcurve_path), FALSE);
GdipResetPath(path);
status = GdipAddPathCurve3(path, points, 4, 1, 2, 1.0);
expect(Ok, status);
- ok_path(path, addcurve_path3, sizeof(addcurve_path3)/sizeof(path_test_t), FALSE);
+ ok_path(path, addcurve_path3, ARRAY_SIZE(addcurve_path3), FALSE);
GdipDeletePath(path);
}
@@ -844,7 +844,7 @@ static void test_addclosedcurve(void)
/* add to empty path */
status = GdipAddPathClosedCurve2(path, points, 4, 1.0);
expect(Ok, status);
- ok_path(path, addclosedcurve_path, sizeof(addclosedcurve_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, addclosedcurve_path, ARRAY_SIZE(addclosedcurve_path), FALSE);
GdipDeletePath(path);
}
@@ -886,7 +886,7 @@ static void test_reverse(void)
status = GdipReversePath(path);
expect(Ok, status);
- ok_path(path, reverse_path, sizeof(reverse_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, reverse_path, ARRAY_SIZE(reverse_path), FALSE);
GdipDeletePath(path);
}
@@ -917,21 +917,21 @@ static void test_addpie(void)
status = GdipAddPathPie(path, 0.0, 0.0, 100.0, 50.0, 10.0, 50.0);
expect(Ok, status);
- ok_path(path, addpie_path, sizeof(addpie_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, addpie_path, ARRAY_SIZE(addpie_path), FALSE);
status = GdipResetPath(path);
expect(Ok, status);
/* zero width base ellipse */
status = GdipAddPathPie(path, 0.0, 0.0, 0.0, 60.0, -90.0, 24.0);
expect(InvalidParameter, status);
- ok_path(path, addpie_path2, sizeof(addpie_path2)/sizeof(path_test_t), FALSE);
+ ok_path(path, addpie_path2, ARRAY_SIZE(addpie_path2), FALSE);
status = GdipResetPath(path);
expect(Ok, status);
/* zero height base ellipse */
status = GdipAddPathPie(path, 0.0, 0.0, 60.0, 0.0 , -90.0, 24.0);
expect(InvalidParameter, status);
- ok_path(path, addpie_path3, sizeof(addpie_path3)/sizeof(path_test_t), FALSE);
+ ok_path(path, addpie_path3, ARRAY_SIZE(addpie_path3), FALSE);
GdipDeletePath(path);
}
@@ -1020,7 +1020,7 @@ static void test_flatten(void)
status = GdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
- ok_path(path, flattenellipse_path, sizeof(flattenellipse_path)/sizeof(path_test_t), TRUE);
+ ok_path(path, flattenellipse_path, ARRAY_SIZE(flattenellipse_path), TRUE);
status = GdipResetPath(path);
expect(Ok, status);
@@ -1028,7 +1028,7 @@ static void test_flatten(void)
expect(Ok, status);
status = GdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
- ok_path(path, flattenline_path, sizeof(flattenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, flattenline_path, ARRAY_SIZE(flattenline_path), FALSE);
status = GdipResetPath(path);
expect(Ok, status);
@@ -1036,7 +1036,7 @@ static void test_flatten(void)
expect(Ok, status);
status = GdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
- ok_path(path, flattenarc_path, sizeof(flattenarc_path)/sizeof(path_test_t), TRUE);
+ ok_path(path, flattenarc_path, ARRAY_SIZE(flattenarc_path), TRUE);
/* easy case - quater of a full circle */
status = GdipResetPath(path);
@@ -1045,7 +1045,7 @@ static void test_flatten(void)
expect(Ok, status);
status = GdipFlattenPath(path, NULL, 1.0);
expect(Ok, status);
- ok_path(path, flattenquater_path, sizeof(flattenquater_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, flattenquater_path, ARRAY_SIZE(flattenquater_path), FALSE);
GdipDeleteMatrix(m);
GdipDeletePath(path);
@@ -1119,7 +1119,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* horizontal 2x stretch */
status = GdipResetPath(path);
@@ -1132,7 +1132,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* vertical 2x stretch */
status = GdipResetPath(path);
@@ -1145,7 +1145,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend);
expect(Ok, status);
@@ -1161,7 +1161,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_dash_path, sizeof(widenline_dash_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_dash_path, ARRAY_SIZE(widenline_dash_path), FALSE);
status = GdipSetPenDashStyle(pen, DashStyleSolid);
expect(Ok, status);
@@ -1178,7 +1178,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* horizontal 2x stretch */
status = GdipResetPath(path);
@@ -1191,7 +1191,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* vertical 2x stretch */
status = GdipResetPath(path);
@@ -1204,7 +1204,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_wide_path, sizeof(widenline_wide_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_wide_path, ARRAY_SIZE(widenline_wide_path), FALSE);
status = GdipScaleMatrix(m, 1.0, 0.5, MatrixOrderAppend);
expect(Ok, status);
@@ -1221,7 +1221,7 @@ static void test_widen(void)
status = GdipWidenPath(path, pen, m, 1.0);
expect(Ok, status);
- ok_path(path, widenline_path, sizeof(widenline_path)/sizeof(path_test_t), FALSE);
+ ok_path(path, widenline_path, ARRAY_SIZE(widenline_path), FALSE);
/* pen width = 0 pixels - native fails to widen but can draw with this pen */
GdipDeletePen(pen);
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
index 4fd2744132..88d195f6c9 100644
--- a/dlls/gdiplus/tests/image.c
+++ b/dlls/gdiplus/tests/image.c
@@ -55,10 +55,10 @@ static void expect_guid(REFGUID expected, REFGUID got, int line, BOOL todo)
char buffer[39];
char buffer2[39];
- StringFromGUID2(got, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
- WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL);
- StringFromGUID2(expected, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
- WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer2, sizeof(buffer2), NULL, NULL);
+ StringFromGUID2(got, bufferW, ARRAY_SIZE(bufferW));
+ WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer, sizeof(buffer), NULL, NULL);
+ StringFromGUID2(expected, bufferW, ARRAY_SIZE(bufferW));
+ WideCharToMultiByte(CP_ACP, 0, bufferW, ARRAY_SIZE(bufferW), buffer2, sizeof(buffer2), NULL, NULL);
todo_wine_if (todo)
ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer);
}
@@ -3311,7 +3311,7 @@ static void test_image_properties(void)
char buf[256];
} item;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
image = load_image(td[i].image_data, td[i].image_size);
if (!image)
@@ -3629,9 +3629,9 @@ static void test_tiff_properties(void)
prop_count = 0xdeadbeef;
status = GdipGetPropertyCount(image, &prop_count);
expect(Ok, status);
- ok(prop_count == sizeof(td)/sizeof(td[0]) ||
- broken(prop_count == sizeof(td)/sizeof(td[0]) - 1) /* Win7 SP0 */,
- "expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count);
+ ok(prop_count == ARRAY_SIZE(td) ||
+ broken(prop_count == ARRAY_SIZE(td) - 1) /* Win7 SP0 */,
+ "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id));
@@ -3739,8 +3739,8 @@ static void test_GdipGetAllPropertyItems(void)
prop_count = 0xdeadbeef;
status = GdipGetPropertyCount(image, &prop_count);
expect(Ok, status);
- ok(prop_count == sizeof(td)/sizeof(td[0]),
- "expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count);
+ ok(prop_count == ARRAY_SIZE(td),
+ "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id));
@@ -4014,7 +4014,7 @@ static void test_bitmapbits(void)
} palette;
ARGB *entries = palette.pal.Entries;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
BYTE pixels[sizeof(pixels_24)];
memcpy(pixels, pixels_24, sizeof(pixels_24));
@@ -4283,7 +4283,7 @@ static void test_image_format(void)
BitmapData data;
UINT i, ret;
- for (i = 0; i < sizeof(fmt)/sizeof(fmt[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(fmt); i++)
{
status = GdipCreateBitmapFromScan0(1, 1, 0, fmt[i], NULL, &bitmap);
ok(status == Ok || broken(status == InvalidParameter) /* before win7 */,
@@ -4435,7 +4435,7 @@ static void test_DrawImage_scale(void)
status = GdipSetInterpolationMode(graphics, InterpolationModeNearestNeighbor);
expect(Ok, status);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
status = GdipSetPixelOffsetMode(graphics, td[i].pixel_offset_mode);
expect(Ok, status);
@@ -4541,10 +4541,10 @@ static void test_gif_properties(void)
status = GdipGetPropertyCount(image, &prop_count);
expect(Ok, status);
- ok(prop_count == sizeof(td)/sizeof(td[0]) || broken(prop_count == 1) /* before win7 */,
- "expected property count %u, got %u\n", (UINT)(sizeof(td)/sizeof(td[0])), prop_count);
+ ok(prop_count == ARRAY_SIZE(td) || broken(prop_count == 1) /* before win7 */,
+ "expected property count %u, got %u\n", (UINT) ARRAY_SIZE(td), prop_count);
- if (prop_count != sizeof(td)/sizeof(td[0]))
+ if (prop_count != ARRAY_SIZE(td))
{
GdipDisposeImage(image);
return;
@@ -4818,7 +4818,7 @@ static void test_supported_encoders(void)
status = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat24bppRGB, NULL, &bm);
ok(status == Ok, "GdipCreateBitmapFromScan0 error %d\n", status);
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
ret = get_encoder_clsid(td[i].mime, &format, &clsid);
ok(ret, "%s encoder is not in the list\n", wine_dbgstr_w(td[i].mime));
@@ -4868,7 +4868,7 @@ static void test_createeffect(void)
stat = pGdipCreateEffect(noneffect, &effect);
todo_wine expect(Win32Error, stat);
- for(i=0; i < sizeof(effectlist) / sizeof(effectlist[0]); i++)
+ for(i=0; i < ARRAY_SIZE(effectlist); i++)
{
stat = pGdipCreateEffect(*effectlist[i], &effect);
todo_wine expect(Ok, stat);
@@ -4981,7 +4981,7 @@ static void test_histogram(void)
expect(Ok, stat);
expect(256, num);
- for (i = 0; i < sizeof(test_formats)/sizeof(test_formats[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_formats); i++)
{
num = 0;
stat = pGdipBitmapGetHistogramSize(test_formats[i], &num);
@@ -5131,7 +5131,7 @@ static void test_png_color_formats(void)
UINT flags;
int i;
- for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(td); i++)
{
memcpy(buf, png_1x1_data, sizeof(png_1x1_data));
buf[24] = td[i].bit_depth;
--
2.14.4
June 7, 2018
[PATCH] d3dcompiler/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/d3dcompiler_43/tests/asm.c | 27 ++++++++++++++-------------
dlls/d3dcompiler_43/tests/blob.c | 18 +++++++++---------
dlls/d3dcompiler_43/tests/hlsl.c | 14 +++++++-------
dlls/d3dcompiler_43/tests/reflection.c | 18 +++++++++---------
4 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/asm.c b/dlls/d3dcompiler_43/tests/asm.c
index 6fd78c186e..f077369ba8 100644
--- a/dlls/d3dcompiler_43/tests/asm.c
+++ b/dlls/d3dcompiler_43/tests/asm.c
@@ -108,7 +108,7 @@ static void preproc_test(void) {
},
};
- exec_tests("preproc", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("preproc", tests, ARRAY_SIZE(tests));
}
static void ps_1_1_test(void) {
@@ -134,7 +134,7 @@ static void ps_1_1_test(void) {
},
};
- exec_tests("ps_1_1", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("ps_1_1", tests, ARRAY_SIZE(tests));
}
static void vs_1_1_test(void) {
@@ -277,7 +277,7 @@ static void vs_1_1_test(void) {
},
};
- exec_tests("vs_1_1", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("vs_1_1", tests, ARRAY_SIZE(tests));
}
static void ps_1_3_test(void) {
@@ -517,7 +517,7 @@ static void ps_1_3_test(void) {
},
};
- exec_tests("ps_1_3", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("ps_1_3", tests, ARRAY_SIZE(tests));
}
static void ps_1_4_test(void) {
@@ -627,7 +627,7 @@ static void ps_1_4_test(void) {
},
};
- exec_tests("ps_1_4", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("ps_1_4", tests, ARRAY_SIZE(tests));
}
static void vs_2_0_test(void) {
@@ -818,7 +818,7 @@ static void vs_2_0_test(void) {
},
};
- exec_tests("vs_2_0", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("vs_2_0", tests, ARRAY_SIZE(tests));
}
static void vs_2_x_test(void) {
@@ -879,7 +879,7 @@ static void vs_2_x_test(void) {
},
};
- exec_tests("vs_2_x", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("vs_2_x", tests, ARRAY_SIZE(tests));
}
static void ps_2_0_test(void) {
@@ -952,7 +952,7 @@ static void ps_2_0_test(void) {
},
};
- exec_tests("ps_2_0", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("ps_2_0", tests, ARRAY_SIZE(tests));
}
static void ps_2_x_test(void) {
@@ -1090,7 +1090,7 @@ static void ps_2_x_test(void) {
},
};
- exec_tests("ps_2_x", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("ps_2_x", tests, ARRAY_SIZE(tests));
}
static void vs_3_0_test(void) {
@@ -1175,7 +1175,7 @@ static void vs_3_0_test(void) {
};
- exec_tests("vs_3_0", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("vs_3_0", tests, ARRAY_SIZE(tests));
}
static void ps_3_0_test(void) {
@@ -1261,7 +1261,7 @@ static void ps_3_0_test(void) {
},
};
- exec_tests("ps_3_0", tests, sizeof(tests) / sizeof(tests[0]));
+ exec_tests("ps_3_0", tests, ARRAY_SIZE(tests));
}
static void failure_test(void) {
@@ -1408,7 +1408,8 @@ static void failure_test(void) {
unsigned int i;
ID3DBlob *shader, *messages;
- for(i = 0; i < (sizeof(tests) / sizeof(tests[0])); i++) {
+ for(i = 0; i < ARRAY_SIZE(tests); i++)
+ {
shader = NULL;
messages = NULL;
hr = D3DAssemble(tests[i], strlen(tests[i]), NULL,
@@ -1689,7 +1690,7 @@ static void d3dpreprocess_test(void)
/* pInclude tests */
include.ID3DInclude_iface.lpVtbl = &D3DInclude_Vtbl;
- for (i = 0; i < sizeof(include_test_shaders) / sizeof(include_test_shaders[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(include_test_shaders); ++i)
{
shader = NULL;
messages = NULL;
diff --git a/dlls/d3dcompiler_43/tests/blob.c b/dlls/d3dcompiler_43/tests/blob.c
index ba69abfb60..d99df825ee 100644
--- a/dlls/d3dcompiler_43/tests/blob.c
+++ b/dlls/d3dcompiler_43/tests/blob.c
@@ -171,7 +171,7 @@ static void test_get_blob_part(void)
ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
ok(TAG_ISGN == *(dword+9), "ISGN got %#x, expected %#x.\n", *(dword+9), TAG_ISGN);
- for (i = 0; i < sizeof(parts) / sizeof(parts[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(parts); i++)
{
hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
@@ -202,7 +202,7 @@ static void test_get_blob_part(void)
ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
ok(TAG_OSGN == *(dword+9), "OSGN got %#x, expected %#x.\n", *(dword+9), TAG_OSGN);
- for (i = 0; i < sizeof(parts) / sizeof(parts[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(parts); i++)
{
hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
@@ -234,7 +234,7 @@ static void test_get_blob_part(void)
ok(TAG_ISGN == *(dword+10), "ISGN got %#x, expected %#x.\n", *(dword+10), TAG_ISGN);
ok(TAG_OSGN == *(dword+32), "OSGN got %#x, expected %#x.\n", *(dword+32), TAG_OSGN);
- for (i = 0; i < sizeof(parts) / sizeof(parts[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(parts); i++)
{
hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
@@ -278,7 +278,7 @@ static void test_get_blob_part(void)
dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
- for (i = 0; i < sizeof(parts) / sizeof(parts[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(parts); i++)
{
/* There isn't a full DXBC blob returned for D3D_BLOB_LEGACY_SHADER */
hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
@@ -298,7 +298,7 @@ static void test_get_blob_part(void)
dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
- for (i = 0; i < sizeof(parts) / sizeof(parts[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(parts); i++)
{
/* There isn't a full DXBC blob returned for D3D_BLOB_XNA_PREPASS_SHADER */
hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
@@ -318,7 +318,7 @@ static void test_get_blob_part(void)
dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
ok(test_blob_part[0] != *dword, "DXBC failed got %#x.\n", *dword);
- for (i = 0; i < sizeof(parts) / sizeof(parts[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(parts); i++)
{
/* There isn't a full DXBC blob returned for D3D_BLOB_XNA_SHADER */
hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
@@ -606,7 +606,7 @@ static void test_get_blob_part2(void)
ok(TAG_DXBC == *dword, "DXBC got %#x, expected %#x.\n", *dword, TAG_DXBC);
ok(TAG_PCSG == *(dword+9), "PCSG got %#x, expected %#x.\n", *(dword+9), TAG_PCSG);
- for (i = 0; i < sizeof(parts) / sizeof(parts[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(parts); i++)
{
hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
@@ -639,7 +639,7 @@ static void test_get_blob_part2(void)
ok(TAG_OSGN == *(dword+24), "OSGN got %#x, expected %#x.\n", *(dword+24), TAG_OSGN);
ok(TAG_PCSG == *(dword+37), "PCSG got %#x, expected %#x.\n", *(dword+37), TAG_PCSG);
- for (i = 0; i < sizeof(parts) / sizeof(parts[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(parts); i++)
{
hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
@@ -673,7 +673,7 @@ static void test_get_blob_part2(void)
dword = ((DWORD*)ID3D10Blob_GetBufferPointer(blob));
ok(TAG_DXBC != *dword, "DXBC failed got %#x.\n", *dword);
- for (i = 0; i < sizeof(parts) / sizeof(parts[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(parts); i++)
{
/* There isn't a full DXBC blob returned for D3D_BLOB_DEBUG_INFO */
hr = D3DGetBlobPart(dword, size, parts[i], 0, &blob2);
diff --git a/dlls/d3dcompiler_43/tests/hlsl.c b/dlls/d3dcompiler_43/tests/hlsl.c
index 856a09c2c5..546a0e5d2e 100644
--- a/dlls/d3dcompiler_43/tests/hlsl.c
+++ b/dlls/d3dcompiler_43/tests/hlsl.c
@@ -320,7 +320,7 @@ static void test_swizzle(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_
set_float4_d3d9(device, constants, "color", 0.0303f, 0.0f, 0.0f, 0.0202f);
compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry,
- probes, sizeof(probes) / sizeof(*probes), 1, 1, __LINE__);
+ probes, ARRAY_SIZE(probes), 1, 1, __LINE__);
ID3DXConstantTable_Release(constants);
IDirect3DPixelShader9_Release(pshader);
@@ -363,7 +363,7 @@ static void test_math(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_geo
ID3DXConstantTable_SetFloat(constants, device, "$z", z);
compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry,
- probes, sizeof(probes) / sizeof(*probes), 1, 1, __LINE__);
+ probes, ARRAY_SIZE(probes), 1, 1, __LINE__);
ID3DXConstantTable_Release(constants);
IDirect3DPixelShader9_Release(pshader);
@@ -417,7 +417,7 @@ static void test_conditionals(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *
if (pshader != NULL)
{
compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, if_greater_probes,
- sizeof(if_greater_probes) / sizeof(*if_greater_probes), 32, 1, __LINE__);
+ ARRAY_SIZE(if_greater_probes), 32, 1, __LINE__);
ID3DXConstantTable_Release(constants);
IDirect3DPixelShader9_Release(pshader);
@@ -427,7 +427,7 @@ static void test_conditionals(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *
if (pshader != NULL)
{
compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, ternary_operator_probes,
- sizeof(ternary_operator_probes) / sizeof(*ternary_operator_probes), 8, 1, __LINE__);
+ ARRAY_SIZE(ternary_operator_probes), 8, 1, __LINE__);
ID3DXConstantTable_Release(constants);
IDirect3DPixelShader9_Release(pshader);
@@ -476,7 +476,7 @@ static void test_float_vectors(IDirect3DDevice9 *device, IDirect3DVertexBuffer9
if (pshader != NULL)
{
compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, vec4_indexing_test1_probes,
- sizeof(vec4_indexing_test1_probes) / sizeof(*vec4_indexing_test1_probes), 1, 1, __LINE__);
+ ARRAY_SIZE(vec4_indexing_test1_probes), 1, 1, __LINE__);
ID3DXConstantTable_Release(constants);
IDirect3DPixelShader9_Release(pshader);
@@ -488,7 +488,7 @@ static void test_float_vectors(IDirect3DDevice9 *device, IDirect3DVertexBuffer9
ID3DXConstantTable_SetInt(constants, device, "i", 2);
compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, vec4_indexing_test2_probes,
- sizeof(vec4_indexing_test2_probes) / sizeof(*vec4_indexing_test2_probes), 32, 1, __LINE__);
+ ARRAY_SIZE(vec4_indexing_test2_probes), 32, 1, __LINE__);
ID3DXConstantTable_Release(constants);
IDirect3DPixelShader9_Release(pshader);
@@ -550,7 +550,7 @@ static void test_trig(IDirect3DDevice9 *device, IDirect3DVertexBuffer9 *quad_geo
if (pshader != NULL)
{
compute_shader_probe9(device, vshader_passthru, pshader, quad_geometry, sincos_probes,
- sizeof(sincos_probes) / sizeof(*sincos_probes), 32, 1, __LINE__);
+ ARRAY_SIZE(sincos_probes), 32, 1, __LINE__);
ID3DXConstantTable_Release(constants);
IDirect3DPixelShader9_Release(pshader);
diff --git a/dlls/d3dcompiler_43/tests/reflection.c b/dlls/d3dcompiler_43/tests/reflection.c
index 9d77d47938..5ca734e6bd 100644
--- a/dlls/d3dcompiler_43/tests/reflection.c
+++ b/dlls/d3dcompiler_43/tests/reflection.c
@@ -356,7 +356,7 @@ static void test_reflection_desc_vs(void)
ok(ret == 0, "GetMovcInstructionCount failed, got %u, expected %u\n", ret, 0);
/* GetIn/OutputParameterDesc */
- for (i = 0; i < sizeof(test_reflection_desc_vs_resultin)/sizeof(*test_reflection_desc_vs_resultin); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_reflection_desc_vs_resultin); ++i)
{
pdesc = &test_reflection_desc_vs_resultin[i];
@@ -381,7 +381,7 @@ static void test_reflection_desc_vs(void)
i, desc.Stream, pdesc->ReadWriteMask);
}
- for (i = 0; i < sizeof(test_reflection_desc_vs_resultout)/sizeof(*test_reflection_desc_vs_resultout); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_reflection_desc_vs_resultout); ++i)
{
pdesc = &test_reflection_desc_vs_resultout[i];
@@ -656,7 +656,7 @@ static void test_reflection_desc_ps(void)
ok(hr == E_INVALIDARG, "GetPatchConstantParameterDesc failed, got %x, expected %x\n", hr, E_INVALIDARG);
/* GetIn/OutputParameterDesc */
- for (i = 0; i < sizeof(test_reflection_desc_ps_resultin)/sizeof(*test_reflection_desc_ps_resultin); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_resultin); ++i)
{
pdesc = &test_reflection_desc_ps_resultin[i];
@@ -681,7 +681,7 @@ static void test_reflection_desc_ps(void)
i, desc.Stream, pdesc->ReadWriteMask);
}
- for (i = 0; i < sizeof(test_reflection_desc_ps_resultout)/sizeof(*test_reflection_desc_ps_resultout); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_resultout); ++i)
{
pdesc = &test_reflection_desc_ps_resultout[i];
@@ -899,7 +899,7 @@ static void test_reflection_desc_ps_output(void)
const D3D11_SIGNATURE_PARAMETER_DESC *pdesc;
unsigned int i;
- for (i = 0; i < sizeof(test_reflection_desc_ps_output_result)/sizeof(*test_reflection_desc_ps_output_result); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_reflection_desc_ps_output_result); ++i)
{
hr = D3DReflect(test_reflection_desc_ps_output_blob[i], test_reflection_desc_ps_output_blob[i][6], &IID_ID3D11ShaderReflection, (void **)&ref11);
ok(hr == S_OK, "(%u): D3DReflect failed %x\n", i, hr);
@@ -1036,7 +1036,7 @@ static void test_reflection_bound_resources(void)
ok(hr == E_INVALIDARG, "GetResourceBindingDescByName failed, got %x, expected %x\n", hr, E_INVALIDARG);
/* GetResourceBindingDesc */
- for (i = 0; i < sizeof(test_reflection_bound_resources_result)/sizeof(*test_reflection_bound_resources_result); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_reflection_bound_resources_result); ++i)
{
pdesc = &test_reflection_bound_resources_result[i];
@@ -1062,7 +1062,7 @@ static void test_reflection_bound_resources(void)
}
/* GetResourceBindingDescByName */
- for (i = 0; i < sizeof(test_reflection_bound_resources_result)/sizeof(*test_reflection_bound_resources_result); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_reflection_bound_resources_result); ++i)
{
pdesc = &test_reflection_bound_resources_result[i];
@@ -1393,7 +1393,7 @@ static void test_reflection_constant_buffer(void)
ok(hr == S_OK, "IsEqual failed, got %x, expected %x\n", hr, S_OK);
/* constant buffers */
- for (i = 0; i < sizeof(test_reflection_constant_buffer_cb_result)/sizeof(*test_reflection_constant_buffer_cb_result); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_reflection_constant_buffer_cb_result); ++i)
{
pcbdesc = &test_reflection_constant_buffer_cb_result[i];
@@ -1416,7 +1416,7 @@ static void test_reflection_constant_buffer(void)
}
/* variables */
- for (i = 0; i < sizeof(test_reflection_constant_buffer_variable_result)/sizeof(*test_reflection_constant_buffer_variable_result); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_reflection_constant_buffer_variable_result); ++i)
{
pvdesc = &test_reflection_constant_buffer_variable_result[i].desc;
--
2.14.4
June 7, 2018
[PATCH] advpack/tests: Use the available ARRAY_SIZE() macro
by Michael Stefaniuc
Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/advpack/tests/advpack.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/advpack/tests/advpack.c b/dlls/advpack/tests/advpack.c
index d5958769ab..8d7c5ebb48 100644
--- a/dlls/advpack/tests/advpack.c
+++ b/dlls/advpack/tests/advpack.c
@@ -134,8 +134,8 @@ static void delnode_test(void)
/* Native DelNode apparently does not support relative paths, so we use
absolute paths for testing */
- currDirLen = GetCurrentDirectoryA(sizeof(currDir) / sizeof(CHAR), currDir);
- assert(currDirLen > 0 && currDirLen < sizeof(currDir) / sizeof(CHAR));
+ currDirLen = GetCurrentDirectoryA(ARRAY_SIZE(currDir), currDir);
+ assert(currDirLen > 0 && currDirLen < ARRAY_SIZE(currDir));
if(currDir[currDirLen - 1] == '\\')
currDir[--currDirLen] = 0;
--
2.14.4
June 7, 2018
Re: [PATCH 1/5] wined3d: Declare the correct number and type of fragment shader color outputs.
by Matteo Bruni
2018-06-07 17:07 GMT+02:00 Henri Verbeet <hverbeet(a)gmail.com>:
> On 6 June 2018 at 00:32, Matteo Bruni <mbruni(a)codeweavers.com> wrote:
>> Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com>
>> ---
>> dlls/wined3d/glsl_shader.c | 116 ++++++++++++++++++++++++++++++++++++++++++---
>> 1 file changed, 109 insertions(+), 7 deletions(-)
>>
> This fails the tests here:
>
> ../../../../../src/wine-git/tools/runtest -q -P wine -T ../../.. -M
> d3d10core.dll -p d3d10core_test.exe.so device && touch device.ok
> device.c:11300: Test failed: Got 0xff0000ff, expected 0xff00ff00 at
> (0, 0), sub-resource 0.
> device.c:11307: Test failed: Got 0xff0000ff, expected 0xff00ff00 at
> (0, 0), sub-resource 0.
>
> ../../../../../src/wine-git/tools/runtest -q -P wine -T ../../.. -M
> d3d11.dll -p d3d11_test.exe.so d3d11 && touch d3d11.ok
> d3d11.c:14777: Test failed: Got 0xff0000ff, expected 0xff00ff00 at (0,
> 0, 0), sub-resource 0.
> d3d11.c:14784: Test failed: Got 0xff0000ff, expected 0xff00ff00 at (0,
> 0, 0), sub-resource 0.
> d3d11.c:20644: Tests skipped: Raw buffers are not supported.
> d3d11.c:20644: Tests skipped: Raw buffers are not supported.
:/
This time I know why I missed these (didn't notice them in the midst
of other test failures), still not great... I have a fix coming.
June 7, 2018
[PATCH 3/3] user32: Add RegisterTouchHitTestingWindow stub
by Fabian Maurer
Fixes bug 45303.
Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
dlls/user32/misc.c | 9 +++++++++
dlls/user32/user32.spec | 1 +
2 files changed, 10 insertions(+)
diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c
index 4cc54df412..b91aa3c7cc 100644
--- a/dlls/user32/misc.c
+++ b/dlls/user32/misc.c
@@ -862,6 +862,15 @@ BOOL WINAPI GetPointerDevices(UINT32 *device_count, POINTER_DEVICE_INFO *devices
return TRUE;
}
+/**********************************************************************
+ * RegisterTouchHitTestingWindow [USER32.@]
+ */
+BOOL WINAPI RegisterTouchHitTestingWindow(HWND hwnd, ULONG value)
+{
+ FIXME("(%p %d): stub\n", hwnd, value);
+ return TRUE;
+}
+
static const WCHAR imeW[] = {'I','M','E',0};
const struct builtin_class_descr IME_builtin_class =
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 7f652ee722..61e0e4e8cc 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -606,6 +606,7 @@
@ stdcall RegisterShellHookWindow (long)
@ stdcall RegisterSystemThread(long long)
@ stdcall RegisterTasklist (long)
+@ stdcall RegisterTouchHitTestingWindow(long long)
@ stdcall RegisterTouchWindow(long long)
# @ stub RegisterUserApiHook
@ stdcall RegisterWindowMessageA(str)
--
2.17.1
June 7, 2018