Module: wine Branch: master Commit: 2e1775620a0faaf50c5620d69555c0ad7cc9e51e URL: http://source.winehq.org/git/wine.git/?a=commit;h=2e1775620a0faaf50c5620d695...
Author: Eric Pouech eric.pouech@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@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; 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 :