Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
[SharpGen] StringToHGlobalUni is not necessary since it is already th…
Browse files Browse the repository at this point in the history
…e same layout as .NET strings, use "fixed" instead
  • Loading branch information
xen2 authored and xoofx committed Mar 23, 2016
1 parent e4e820e commit b448930
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Source/Tools/SharpGen/Templates/Method.tt
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,9 @@
}
}
// Handle Input String
} else if (param.IsString) {
if (param.IsWideChar) {#>
IntPtr <#= param.TempName #> = Utilities.StringToHGlobalUni(<#= param.Name #>);
<#+ } else {#>
} else if (param.IsString && !param.IsWideChar) {#>
IntPtr <#= param.TempName #> = Utilities.StringToHGlobalAnsi(<#= param.Name #>);
<#+ }
} else if ( param.IsRefIn && param.IsValueType && param.IsOptionnal) {#>
<#+ } else if ( param.IsRefIn && param.IsValueType && param.IsOptionnal) {#>
<#= param.PublicType.QualifiedName #> <#= param.TempName #>;
if (<#= param.Name #>.HasValue)
<#= param.TempName #> = <#= param.Name #>.Value;
Expand Down Expand Up @@ -272,7 +268,11 @@
} else if (param.IsFixed && param.IsValueType && !param.HasNativeValueType && !param.IsUsedAsReturnType) {#>
fixed (void* <#= param.TempName #> = &<#= param.Name #>)
<#+ PushIndent(" ");
}
// Handle Input String
} else if (param.IsString && param.IsWideChar) {#>
fixed (char* <#= param.TempName #> = <#= param.Name #>)
<#+ PushIndent(" ");
}
}


Expand Down Expand Up @@ -335,7 +335,7 @@
<#= param.Name #> = <#= param.TempName #> != 0;
<#+ }
// Handle Input String
} else if (param.IsString) {#>
} else if (param.IsString && !param.IsWideChar) {#>
Marshal.FreeHGlobal(<#= param.TempName #> );
<#+
} else if (param.HasNativeValueType) {
Expand Down

0 comments on commit b448930

Please sign in to comment.