Commit 6cc66c99 authored by Uwe Bonnes's avatar Uwe Bonnes Committed by Alexandre Julliard

Undname: Allow more then one coded character in demangle_datatype.

parent 3a547b08
...@@ -818,13 +818,37 @@ static void test_rtti(void) ...@@ -818,13 +818,37 @@ static void test_rtti(void)
ok (casted == NULL, "Cast succeeded\n"); ok (casted == NULL, "Cast succeeded\n");
} }
struct _demangle {
LPCSTR mangled;
LPCSTR result;
BOOL test_in_wine;
};
static void test_demangle(void) static void test_demangle(void)
{ {
char * name = NULL; char * name;
static const char * mangled = ".ABVVec4@ref2@dice@@"; struct _demangle demangle[]={
static const char * result = "class dice::ref2::Vec4 const &"; /* { "BlaBla"," ?? ::Bla", FALSE}, */
name = p__unDName(0, mangled + 1, 0,pmalloc,pfree,0x2800); { "ABVVec4@ref2@dice@@","class dice::ref2::Vec4 const &",TRUE},
ok(name != NULL && !strcmp(name,result),"Got name %s\n", name); { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0H@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,7>", TRUE},
{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HO@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,126>",TRUE},
{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,2016>",TRUE},
{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$0HOAA@@@", "class CDB_GEN_BIG_ENUM_FLAG<enum CDB_WYSIWYG_BITS_ENUM,32256>",TRUE},
{ "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$01@@@", FALSE},
/* { "?AV?$CDB_GEN_BIG_ENUM_FLAG@W4CDB_WYSIWYG_BITS_ENUM@@$011@@@", "?AV?$CDB_GEN_BIG_ENUM_FLAG@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) START_TEST(cpp)
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "wine/port.h" #include "wine/port.h"
#include <assert.h> #include <assert.h>
#include <stdio.h>
#include "msvcrt.h" #include "msvcrt.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -598,6 +599,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, ...@@ -598,6 +599,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
{ {
char dt; char dt;
BOOL add_pmt = TRUE; BOOL add_pmt = TRUE;
int num_args=0;
assert(ct); assert(ct);
ct->left = ct->right = NULL; ct->left = ct->right = NULL;
...@@ -713,24 +715,22 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct, ...@@ -713,24 +715,22 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
ct->left = ptr; ct->left = ptr;
sym->current += 2; sym->current += 2;
} }
else if ((sym->current[1] >= 'A' && sym->current[1] <= 'P') && else if (sym->current[1] >= 'A' && sym->current[1] <= 'P')
sym->current[2] == '@')
{ {
char* ptr; while (sym->current[1] >= 'A' && sym->current[1] <= 'P')
ptr = und_alloc(sym, 3);
if (sym->current[1] <= 'J')
{ {
ptr[0] = '0' + sym->current[1] - 'A'; num_args *= 16;
ptr[1] = 0; num_args += sym->current[1] - 'A';
sym->current += 1;
} }
else if(sym->current[1] == '@')
{ {
ptr[0] = '1'; char *ptr;
ptr[1] = sym->current[1] - 'K' + '0'; ptr = und_alloc(sym, 17);
ptr[2] = 0; sprintf(ptr,"%d",num_args);
ct->left = ptr;
sym->current += 1;
} }
ct->left = ptr;
sym->current += 3;
} }
else goto done; else goto done;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment