From 1f6d968a1250a3171546e15c32cd1873d8f51363 Mon Sep 17 00:00:00 2001 From: Alexander Corrado Date: Sat, 23 Jul 2011 15:00:10 -0400 Subject: [PATCH] Fix stack overflow --- src/Mono.Cxxi/CppType.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mono.Cxxi/CppType.cs b/src/Mono.Cxxi/CppType.cs index 89a82c57..9e6514a0 100644 --- a/src/Mono.Cxxi/CppType.cs +++ b/src/Mono.Cxxi/CppType.cs @@ -114,6 +114,9 @@ namespace Mono.Cxxi { (t) => typeof (ushort).Equals (t)? new CppType (CppModifiers.Unsigned, CppModifiers.Short, CppTypes.Int) : CppTypes.Unknown, (t) => typeof (ulong).Equals (t)? new CppType (CppModifiers.Unsigned, CppModifiers.Long, CppTypes.Int) : CppTypes.Unknown, + (t) => typeof (IntPtr).Equals (t)? new CppType (CppTypes.Void, CppModifiers.Pointer) : CppTypes.Unknown, + (t) => typeof (UIntPtr).Equals(t)? new CppType (CppTypes.Void, CppModifiers.Pointer) : CppTypes.Unknown, + // strings mangle as "const char*" by default (t) => typeof (string).Equals (t)? new CppType (CppModifiers.Const, CppTypes.Char, CppModifiers.Pointer) : CppTypes.Unknown, // StringBuilder gets "char*" @@ -132,7 +135,7 @@ namespace Mono.Cxxi { // pointer types to C++ pointers // array types to C++ arrays (t) => { - var cppType = CppType.ForManagedType (t.GetElementType () ?? (t.IsGenericType? t.GetGenericTypeDefinition () : t)); + var cppType = CppType.ForManagedType (t.GetElementType () ?? (t.IsGenericType? t.GetGenericTypeDefinition () : null)); if (t.IsByRef) cppType.Modifiers.Add (CppModifiers.Reference); if (t.IsPointer) cppType.Modifiers.Add (CppModifiers.Pointer); if (t.IsArray) cppType.Modifiers.Add (CppModifiers.Array);