From 478d47566181f0d50e72a86bf157bedac1e27b67 Mon Sep 17 00:00:00 2001 From: Dimitar Dobrev Date: Wed, 19 Feb 2014 17:09:56 +0200 Subject: [PATCH] Wrapped pointers to primitives as such. Signed-off-by: Dimitar Dobrev --- src/Generator/Generators/CLI/CLIMarshal.cs | 6 +++--- src/Generator/Generators/CLI/CLITypePrinter.cs | 2 +- src/Generator/Generators/CSharp/CSharpTypePrinter.cs | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Generator/Generators/CLI/CLIMarshal.cs b/src/Generator/Generators/CLI/CLIMarshal.cs index 24a4cda2..2fc0acd1 100644 --- a/src/Generator/Generators/CLI/CLIMarshal.cs +++ b/src/Generator/Generators/CLI/CLIMarshal.cs @@ -76,7 +76,7 @@ namespace CppSharp.Generators.CLI if (pointee.IsPrimitiveType(PrimitiveType.Void)) { - Context.Return.Write("IntPtr({0})", Context.ReturnVarName); + Context.Return.Write(Context.ReturnVarName); return true; } @@ -89,7 +89,7 @@ namespace CppSharp.Generators.CLI if (pointee.IsPrimitiveType(out primitive)) { - Context.Return.Write("IntPtr({0})", Context.ReturnVarName); + Context.Return.Write(Context.ReturnVarName); return true; } @@ -431,7 +431,7 @@ namespace CppSharp.Generators.CLI var cppTypeName = pointer.Visit(cppTypePrinter, quals); Context.Return.Write("({0})", cppTypeName); - Context.Return.Write("{0}.ToPointer()", Context.Parameter.Name); + Context.Return.Write(Context.Parameter.Name); return true; } diff --git a/src/Generator/Generators/CLI/CLITypePrinter.cs b/src/Generator/Generators/CLI/CLITypePrinter.cs index a1d8b7e1..5b6815b1 100644 --- a/src/Generator/Generators/CLI/CLITypePrinter.cs +++ b/src/Generator/Generators/CLI/CLITypePrinter.cs @@ -148,7 +148,7 @@ namespace CppSharp.Generators.CLI if (param != null && (param.IsOut || param.IsInOut)) return VisitPrimitiveType(primitive); - return "System::IntPtr"; + return VisitPrimitiveType(primitive, quals) + "*"; } return pointee.Visit(this, quals); diff --git a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs index e9e1d4fd..9770efb1 100644 --- a/src/Generator/Generators/CSharp/CSharpTypePrinter.cs +++ b/src/Generator/Generators/CSharp/CSharpTypePrinter.cs @@ -203,9 +203,6 @@ namespace CppSharp.Generators.CSharp if (ContextKind == CSharpTypePrinterContextKind.GenericDelegate) return "global::System.IntPtr"; - if (primitive == PrimitiveType.Void) - return "global::System.IntPtr"; - return VisitPrimitiveType(primitive, quals) + "*"; }