wine/dlls/msvcrt tests/cpp.c undname.c

Alexandre Julliard julliard at wine.codeweavers.com
Mon Nov 14 09:11:39 CST 2005


ChangeSet ID:	21262
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/11/14 09:11:39

Modified files:
	dlls/msvcrt/tests: cpp.c 
	dlls/msvcrt    : undname.c 

Log message:
	Uwe Bonnes <bon at elektron.ikp.physik.tu-darmstadt.de>
	Undname: Allow more then one coded character in demangle_datatype.

Patch: http://cvs.winehq.org/patch.py?id=21262

Old revision  New revision  Changes     Path
 1.6           1.7           +29 -5      wine/dlls/msvcrt/tests/cpp.c
 1.3           1.4           +13 -13     wine/dlls/msvcrt/undname.c

Index: wine/dlls/msvcrt/tests/cpp.c
diff -u -p wine/dlls/msvcrt/tests/cpp.c:1.6 wine/dlls/msvcrt/tests/cpp.c:1.7
--- wine/dlls/msvcrt/tests/cpp.c:1.6	14 Nov 2005 15:11:39 -0000
+++ wine/dlls/msvcrt/tests/cpp.c	14 Nov 2005 15:11:39 -0000
@@ -818,13 +818,37 @@ static void test_rtti(void)
   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)
Index: wine/dlls/msvcrt/undname.c
diff -u -p wine/dlls/msvcrt/undname.c:1.3 wine/dlls/msvcrt/undname.c:1.4
--- wine/dlls/msvcrt/undname.c:1.3	14 Nov 2005 15:11:39 -0000
+++ wine/dlls/msvcrt/undname.c	14 Nov 2005 15:11:39 -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 @@ static BOOL demangle_datatype(struct par
 {
     char                dt;
     BOOL                add_pmt = TRUE;
+    int                 num_args=0;
 
     assert(ct);
     ct->left = ct->right = NULL;
@@ -713,24 +715,22 @@ static BOOL demangle_datatype(struct par
             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;



More information about the wine-cvs mailing list