Michael Stefaniuc : msvcrt: Fix 20 tests from demangle_test()
on old Win versions.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Feb 20 05:40:32 CST 2006
Module: wine
Branch: refs/heads/master
Commit: 29fe8d02c7895a7d31b03a2032fe04d1d8a46fc2
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=29fe8d02c7895a7d31b03a2032fe04d1d8a46fc2
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Mon Feb 20 11:16:27 2006 +0100
msvcrt: Fix 20 tests from demangle_test() on old Win versions.
In test_demangle use a custom strcmp that treats multiple spaces as
single space. __unDName() from older msvcrt (including W2K it seems)
emit in some places 2 spaces instead of one. Fixes 20 failing tests on
those old Windows versions.
---
dlls/msvcrt/tests/cpp.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/dlls/msvcrt/tests/cpp.c b/dlls/msvcrt/tests/cpp.c
index a0e73ce..14eae6d 100644
--- a/dlls/msvcrt/tests/cpp.c
+++ b/dlls/msvcrt/tests/cpp.c
@@ -849,6 +849,26 @@ static void test_demangle_datatype(void)
}
}
+
+/* Compare two strings treating multiple spaces (' ', ascii 0x20) in s2
+ as single space. Needed for test_demangle as __unDName() returns sometimes
+ two spaces instead of one in some older native msvcrt dlls. */
+static int strcmp_space(const char *s1, const char *s2)
+{
+ const char* s2start = s2;
+ do {
+ while (*s1 == *s2 && *s1) {
+ s1++;
+ s2++;
+ }
+ if (*s2 == ' ' && s2 > s2start && *(s2 - 1) == ' ')
+ s2++;
+ else
+ break;
+ } while (*s1 && *s2);
+ return *s1 - *s2;
+}
+
static void test_demangle(void)
{
static struct {const char* in; const char* out;} test[] = {
@@ -950,7 +970,8 @@ static void test_demangle(void)
for (i = 0; i < num_test; i++)
{
name = p__unDName(0, test[i].in, 0, pmalloc, pfree, 0);
- ok(name != NULL && !strcmp(name, test[i].out), "Got name \"%s\" for %d\n", name, i);
+ ok(name != NULL && !strcmp_space(test[i].out, name),
+ "Got name \"%s\" for %d\n", name, i);
pfree(name);
}
}
More information about the wine-cvs
mailing list