[PATCH] msvcrt/cpp: Make the strcmp for __unDName more lazy
Detlef Riekenberg
wine.dev at web.de
Sun Aug 5 15:14:08 CDT 2012
This fixes failures on old msvcrt on NT 4
--
By by ... Detlef
---
dlls/msvcrt/tests/cpp.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/msvcrt/tests/cpp.c b/dlls/msvcrt/tests/cpp.c
index bb6ba16..e64d95b 100644
--- a/dlls/msvcrt/tests/cpp.c
+++ b/dlls/msvcrt/tests/cpp.c
@@ -874,9 +874,10 @@ 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)
+ as single space or skip a space between two greater ('>') chars in s2.
+ Needed for test_demangle as __unDName() returns sometimes different results
+ in some older native msvcrt dlls. */
+static int lazy_strcmp(const char *s1, const char *s2)
{
const char* s2start = s2;
do {
@@ -886,6 +887,8 @@ static int strcmp_space(const char *s1, const char *s2)
}
if (*s2 == ' ' && s2 > s2start && *(s2 - 1) == ' ')
s2++;
+ else if (*s2 == ' ' && s2 > s2start && *(s2 - 1) == '>' && *(s2 + 1) == '>' && *s1 == '>')
+ s2++;
else
break;
} while (*s1 && *s2);
@@ -1069,11 +1072,11 @@ static void test_demangle(void)
name = p__unDName(0, test[i].in, 0, pmalloc, pfree, test[i].flags);
ok(name != NULL, "%u: unDName failed\n", i);
if (!name) continue;
- ok( !strcmp_space(test[i].out, name) ||
- broken(test[i].broken && !strcmp_space(test[i].broken, name)),
+ ok( !lazy_strcmp(test[i].out, name) ||
+ broken(test[i].broken && !lazy_strcmp(test[i].broken, name)),
"%u: Got name \"%s\"\n", i, name );
- ok( !strcmp_space(test[i].out, name) ||
- broken(test[i].broken && !strcmp_space(test[i].broken, name)),
+ ok( !lazy_strcmp(test[i].out, name) ||
+ broken(test[i].broken && !lazy_strcmp(test[i].broken, name)),
"%u: Expected \"%s\"\n", i, test[i].out );
pfree(name);
}
--
1.7.5.4
More information about the wine-patches
mailing list