Undname: Allow more then one coded character in demangle_datatype
Uwe Bonnes
bon at elektron.ikp.physik.tu-darmstadt.de
Sun Nov 13 12:46:19 CST 2005
Changelog:
dlls/msvcrt/undname.c:
Allow more then one coded character in demangle_datatype
Extend undname test
Commented test still make wine msvcrt crash, while native does
something. More later.
--
Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/msvcrt/undname.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/undname.c,v
retrieving revision 1.3
diff -u -r1.3 undname.c
--- wine/dlls/msvcrt/undname.c 26 Oct 2005 10:09:05 -0000 1.3
+++ wine/dlls/msvcrt/undname.c 13 Nov 2005 18:35:05 -0000
@@ -23,6 +23,7 @@
#include "wine/port.h"
#include <assert.h>
+#include <stdio.h>
#include "msvcrt.h"
#include "wine/debug.h"
@@ -598,6 +599,7 @@
{
char dt;
BOOL add_pmt = TRUE;
+ int num_args=0;
assert(ct);
ct->left = ct->right = NULL;
@@ -713,24 +715,22 @@
ct->left = ptr;
sym->current += 2;
}
- else if ((sym->current[1] >= 'A' && sym->current[1] <= 'P') &&
- sym->current[2] == '@')
+ else if (sym->current[1] >= 'A' && sym->current[1] <= 'P')
{
- char* ptr;
- ptr = und_alloc(sym, 3);
- if (sym->current[1] <= 'J')
+ while (sym->current[1] >= 'A' && sym->current[1] <= 'P')
{
- ptr[0] = '0' + sym->current[1] - 'A';
- ptr[1] = 0;
+ num_args *= 16;
+ num_args += sym->current[1] - 'A';
+ sym->current += 1;
}
- else
+ if(sym->current[1] == '@')
{
- ptr[0] = '1';
- ptr[1] = sym->current[1] - 'K' + '0';
- ptr[2] = 0;
+ char *ptr;
+ ptr = und_alloc(sym, 17);
+ sprintf(ptr,"%d",num_args);
+ ct->left = ptr;
+ sym->current += 1;
}
- ct->left = ptr;
- sym->current += 3;
}
else goto done;
break;
Index: wine/dlls/msvcrt/tests/cpp.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/tests/cpp.c,v
retrieving revision 1.6
diff -u -r1.6 cpp.c
--- wine/dlls/msvcrt/tests/cpp.c 10 Nov 2005 12:14:58 -0000 1.6
+++ wine/dlls/msvcrt/tests/cpp.c 13 Nov 2005 18:35:07 -0000
@@ -818,13 +818,37 @@
ok (casted == NULL, "Cast succeeded\n");
}
+struct _demangle {
+ LPCSTR mangled;
+ LPCSTR result;
+ BOOL test_in_wine;
+};
+
static void test_demangle(void)
{
- char * name = NULL;
- static const char * mangled = ".ABVVec4 at ref2@dice@@";
- static const char * result = "class dice::ref2::Vec4 const &";
- name = p__unDName(0, mangled + 1, 0,pmalloc,pfree,0x2800);
- ok(name != NULL && !strcmp(name,result),"Got name %s\n", name);
+ char * name;
+ struct _demangle demangle[]={
+// { "BlaBla"," ?? ::Bla", FALSE},
+ { "ABVVec4 at ref2@dice@@","class dice::ref2::Vec4 const &",TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG at W4CDB_WYSIWYG_BITS_ENUM@@$0H@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,7>", TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG at W4CDB_WYSIWYG_BITS_ENUM@@$0HO@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,126>",TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG at W4CDB_WYSIWYG_BITS_ENUM@@$0HOA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,2016>",TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG at W4CDB_WYSIWYG_BITS_ENUM@@$0HOAA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,32256>",TRUE},
+ { "?AV?$CDB_GEN_BIG_ENUM_FLAG at W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG at W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", FALSE},
+// { "?AV?$CDB_GEN_BIG_ENUM_FLAG at W4CDB_WYSIWYG_BITS_ENUM@@$011@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG at W4CDB_WYSIWYG_BITS_ENUM@@$011@@@",FALSE},
+ };
+ int i, num_test = (sizeof(demangle)/sizeof(struct _demangle));
+
+ for (i=0; i < num_test; i++) {
+
+ name = NULL;
+ name = p__unDName(0, demangle[i].mangled, 0,pmalloc,pfree,0x2800);
+ if ( demangle[i].test_in_wine)
+ ok(name != NULL && !strcmp(name,demangle[i].result), "Got name \"%s\"\n", name);
+ else
+ todo_wine ok(name != NULL && !strcmp(name,demangle[i].result), "Got name %s\n", name);
+
+ }
}
START_TEST(cpp)
More information about the wine-patches
mailing list