Added patch to handle begin == NULL in _vcomp_for_static_init.

This commit is contained in:
Sebastian Lackner 2017-02-01 14:58:18 +01:00
parent 25019ba42d
commit 52f7df8325
3 changed files with 118 additions and 0 deletions

View File

@ -367,6 +367,7 @@ patch_enable_all ()
enable_user32_lpCreateParams="$1"
enable_uxtheme_CloseThemeClass="$1"
enable_uxtheme_GTK_Theming="$1"
enable_vcomp__vcomp_for_static_init="$1"
enable_version_GetFileVersionInfoSizeExW="$1"
enable_version_VerFindFileA="$1"
enable_version_VerQueryValue="$1"
@ -1308,6 +1309,9 @@ patch_enable ()
uxtheme-GTK_Theming)
enable_uxtheme_GTK_Theming="$2"
;;
vcomp-_vcomp_for_static_init)
enable_vcomp__vcomp_for_static_init="$2"
;;
version-GetFileVersionInfoSizeExW)
enable_version_GetFileVersionInfoSizeExW="$2"
;;
@ -7604,6 +7608,18 @@ if test "$enable_uxtheme_GTK_Theming" -eq 1; then
) >> "$patchlist"
fi
# Patchset vcomp-_vcomp_for_static_init
# |
# | Modified files:
# | * dlls/vcomp/main.c, dlls/vcomp/tests/vcomp.c
# |
if test "$enable_vcomp__vcomp_for_static_init" -eq 1; then
patch_apply vcomp-_vcomp_for_static_init/0001-vcomp-Handle-begin-NULL-in-_vcomp_for_static_init.patch
(
printf '%s\n' '+ { "Sebastian Lackner", "vcomp: Handle begin == NULL in _vcomp_for_static_init.", 1 },';
) >> "$patchlist"
fi
# Patchset version-GetFileVersionInfoSizeExW
# |
# | Modified files:

View File

@ -0,0 +1,101 @@
From 4e4f93cf9aa5facc85ce9f51837e9d5ffb5540fa Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 1 Feb 2017 14:55:43 +0100
Subject: vcomp: Handle begin == NULL in _vcomp_for_static_init.
---
dlls/vcomp/main.c | 7 +++++++
dlls/vcomp/tests/vcomp.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index 34e327eedb7..5206e474b34 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -1171,10 +1171,17 @@ void CDECL _vcomp_for_static_init(int first, int last, int step, int chunksize,
struct vcomp_team_data *team_data = thread_data->team;
int num_threads = team_data ? team_data->num_threads : 1;
int thread_num = thread_data->thread_num;
+ int no_begin, no_lastchunk;
TRACE("(%d, %d, %d, %d, %p, %p, %p, %p, %p)\n",
first, last, step, chunksize, loops, begin, end, next, lastchunk);
+ if (!begin)
+ {
+ begin = &no_begin;
+ lastchunk = &no_lastchunk;
+ }
+
if (num_threads == 1 && chunksize != 1)
{
*loops = 1;
diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
index 96a3d9c20a8..a6912bbc0a2 100644
--- a/dlls/vcomp/tests/vcomp.c
+++ b/dlls/vcomp/tests/vcomp.c
@@ -1000,6 +1000,30 @@ static void CDECL for_static_cb(void)
p_vcomp_for_static_end();
p_vcomp_barrier();
+ loops = end = next = lastchunk = 0xdeadbeef;
+ p_vcomp_for_static_init(tests[i].first, tests[i].last, tests[i].step, tests[i].chunksize,
+ &loops, NULL, &end, &next, &lastchunk);
+
+ if (broken_flags & VCOMP_FOR_STATIC_BROKEN_LOOP)
+ {
+ ok(loops == 0 || loops == 1, "test %d, thread %d/%d: expected loops == 0 or 1, got %u\n",
+ i, thread_num, num_threads, loops);
+ }
+ else
+ {
+ ok(loops == my_loops, "test %d, thread %d/%d: expected loops == %u, got %u\n",
+ i, thread_num, num_threads, my_loops, loops);
+ ok(end == my_end, "test %d, thread %d/%d: expected end == %d, got %d\n",
+ i, thread_num, num_threads, my_end, end);
+ ok(next == my_next || broken(broken_flags & VCOMP_FOR_STATIC_BROKEN_NEXT),
+ "test %d, thread %d/%d: expected next == %d, got %d\n", i, thread_num, num_threads, my_next, next);
+ ok(lastchunk == 0xdeadbeef, "test %d, thread %d/%d: expected lastchunk == 0xdeadbeef, got %d\n",
+ i, thread_num, num_threads, lastchunk);
+ }
+
+ p_vcomp_for_static_end();
+ p_vcomp_barrier();
+
if (tests[i].first == tests[i].last) continue;
my_loops = my_begin = my_end = my_next = my_lastchunk = 0xdeadbeef;
@@ -1030,6 +1054,30 @@ static void CDECL for_static_cb(void)
p_vcomp_for_static_end();
p_vcomp_barrier();
+
+ loops = end = next = lastchunk = 0xdeadbeef;
+ p_vcomp_for_static_init(tests[i].last, tests[i].first, tests[i].step, tests[i].chunksize,
+ &loops, NULL, &end, &next, &lastchunk);
+
+ if (broken_flags & VCOMP_FOR_STATIC_BROKEN_LOOP)
+ {
+ ok(loops == 0 || loops == 1, "test %d, thread %d/%d: expected loops == 0 or 1, got %u\n",
+ i, thread_num, num_threads, loops);
+ }
+ else
+ {
+ ok(loops == my_loops, "test %d, thread %d/%d: expected loops == %u, got %u\n",
+ i, thread_num, num_threads, my_loops, loops);
+ ok(end == my_end, "test %d, thread %d/%d: expected end == %d, got %d\n",
+ i, thread_num, num_threads, my_end, end);
+ ok(next == my_next || broken(broken_flags & VCOMP_FOR_STATIC_BROKEN_NEXT),
+ "test %d, thread %d/%d: expected next == %d, got %d\n", i, thread_num, num_threads, my_next, next);
+ ok(lastchunk == 0xdeadbeef, "test %d, thread %d/%d: expected lastchunk == 0xdeadbeef, got %d\n",
+ i, thread_num, num_threads, lastchunk);
+ }
+
+ p_vcomp_for_static_end();
+ p_vcomp_barrier();
}
}
--
2.11.0

View File

@ -0,0 +1 @@
Fixes: Handle begin == NULL in _vcomp_for_static_init