Eric Pouech : msvcrt: undname: correctly handle multi-dimensional arrays.
Module: wine Branch: master Commit: 2e1775620a0faaf50c5620d69555c0ad7cc9e51e URL: http://source.winehq.org/git/wine.git/?a=commit;h=2e1775620a0faaf50c5620d695... Author: Eric Pouech <eric.pouech(a)orange.fr> Date: Mon Apr 28 21:18:26 2008 +0200 msvcrt: undname: correctly handle multi-dimensional arrays. Based on a patch from Ulrich Küttler. --- dlls/msvcrt/tests/cpp.c | 4 ++++ dlls/msvcrt/undname.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 0 deletions(-) diff --git a/dlls/msvcrt/tests/cpp.c b/dlls/msvcrt/tests/cpp.c index 5daa4cc..2b815b7 100644 --- a/dlls/msvcrt/tests/cpp.c +++ b/dlls/msvcrt/tests/cpp.c @@ -985,6 +985,10 @@ static void test_demangle(void) {"?$AAA@?C@", "AAA<`template-parameter-2'>"}, {"?$AAA(a)PAUBBB@@", "AAA<struct BBB *>"}, {"??$ccccc(a)PAVaaa@@@bar(a)bb@foo@@DGPAV0(a)PAV0@PAVee@@IPAPAVaaa@@1(a)Z", "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa **,class ee *)"}, +{"?f(a)T@@QAEHQCY1BE(a)BO@D(a)Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"}, +{"?f(a)T@@QAEHQAY2BE(a)BO@CI(a)D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"}, +{"?f(a)T@@QAEHQAY1BE(a)BO@$$CBD(a)Z", "public: int __thiscall T::f(char const (* const)[20][30])"}, + }; int i, num_test = (sizeof(test)/sizeof(test[0])); char* name; diff --git a/dlls/msvcrt/undname.c b/dlls/msvcrt/undname.c index f115dca..9bc0970 100644 --- a/dlls/msvcrt/undname.c +++ b/dlls/msvcrt/undname.c @@ -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 :
participants (1)
-
Alexandre Julliard