[PATCH 2/3] [Msvcrt]: undname: correctly handle multi-dimensional arrays
Eric Pouech
eric.pouech at orange.fr
Mon Apr 28 14:18:26 CDT 2008
Based on a patch from Ulrich Küttler
A+
---
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 at PAUBBB@@", "AAA<struct BBB *>"},
{"??$ccccc at PAVaaa@@@bar at bb@foo@@DGPAV0 at PAV0@PAVee@@IPAPAVaaa@@1 at Z", "private: static class bar * __stdcall foo::bb::bar::ccccc<class aaa *>(class bar *,class ee *,unsigned int,class aaa **,class ee *)"},
+{"?f at T@@QAEHQCY1BE at BO@D at Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"},
+{"?f at T@@QAEHQAY2BE at BO@CI at D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"},
+{"?f at T@@QAEHQAY1BE at BO@$$CBD at 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 :
More information about the wine-patches
mailing list