Undname: Allow more then one coded character in demangle_datatype.

This commit is contained in:
Uwe Bonnes 2005-11-14 15:11:39 +00:00 committed by Alexandre Julliard
parent 3a547b08bb
commit 6cc66c9925
2 changed files with 42 additions and 18 deletions

View File

@ -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@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@ref2@dice@@","class dice::ref2::Vec4 const &",TRUE},
{ "?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)

View File

@ -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 parsed_symbol* sym, struct datatype_t* ct,
{
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 parsed_symbol* sym, struct datatype_t* ct,
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;