Browse Source

Unify handling of pointers to primitive types.

pull/1/head
triton 12 years ago
parent
commit
5037e8b6b0
  1. 19
      src/Generator/Generators/CSharp/CSharpMarshal.cs

19
src/Generator/Generators/CSharp/CSharpMarshal.cs

@ -270,18 +270,6 @@ namespace CppSharp.Generators.CSharp @@ -270,18 +270,6 @@ namespace CppSharp.Generators.CSharp
var pointee = pointer.Pointee;
var isVoidPtr = pointee.Desugar().IsPrimitiveType(PrimitiveType.Void);
var isUInt8Ptr = pointee.Desugar().IsPrimitiveType(PrimitiveType.UInt8);
if (isVoidPtr || isUInt8Ptr)
{
if (isUInt8Ptr)
Context.Return.Write("({0})", "uint8*");
Context.Return.Write("{0}.ToPointer()", Context.Parameter.Name);
return true;
}
if (pointee.IsPrimitiveType(PrimitiveType.Char) ||
pointee.IsPrimitiveType(PrimitiveType.WideChar))
{
@ -311,6 +299,13 @@ namespace CppSharp.Generators.CSharp @@ -311,6 +299,13 @@ namespace CppSharp.Generators.CSharp
return true;
}
PrimitiveType primitive;
if (pointee.IsPrimitiveType(out primitive))
{
Context.Return.Write("{0}.ToPointer()", Context.Parameter.Name);
return true;
}
return pointee.Visit(this, quals);
}

Loading…
Cancel
Save