Commit 2e177562 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

msvcrt: undname: correctly handle multi-dimensional arrays.

Based on a patch from Ulrich Küttler.
parent a940218c
......@@ -985,6 +985,10 @@ static void test_demangle(void)
{"?$AAA@?C@", "AAA<`template-parameter-2'>"},
{"?$AAA@PAUBBB@@", "AAA<struct BBB *>"},
{"??$ccccc@PAVaaa@@@bar@bb@foo@@DGPAV0@PAV0@PAVee@@IPAPAVaaa@@1@Z", "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa **,class ee *)"},
{"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"},
{"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"},
{"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"},
};
int i, num_test = (sizeof(test)/sizeof(test[0]));
char* name;
......
......@@ -24,6 +24,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "msvcrt.h"
#include "wine/debug.h"
......@@ -431,6 +432,31 @@ static BOOL get_modified_type(struct datatype_t *ct, struct parsed_symbol* sym,
unsigned mark = sym->stack.num;
struct datatype_t sub_ct;
/* multidimensional arrays */
if (*sym->current == 'Y')
{
const char* n1;
int num;
sym->current++;
if (!(n1 = get_number(sym))) return FALSE;
num = atoi(n1);
if (str_modif[0] == ' ' && !modifier)
str_modif++;
if (modifier)
{
str_modif = str_printf(sym, " (%s%s)", modifier, str_modif);
modifier = NULL;
}
else
str_modif = str_printf(sym, " (%s)", str_modif);
while (num--)
str_modif = str_printf(sym, "%s[%s]", str_modif, get_number(sym));
}
/* Recurse to get the referred-to type */
if (!demangle_datatype(sym, &sub_ct, pmt_ref, FALSE))
return FALSE;
......@@ -872,6 +898,17 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
ct->left = str_printf(sym, "`non-type-template-parameter%s'", ptr);
}
break;
case '$':
if (*sym->current == 'C')
{
const char* ptr;
sym->current++;
if (!get_modifier(*sym->current++, &ptr)) goto done;
if (!demangle_datatype(sym, ct, pmt_ref, in_args)) goto done;
ct->left = str_printf(sym, "%s %s", ct->left, ptr);
}
break;
}
break;
default :
......
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