Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 30, 2019. It is now read-only.
/SharpDXPublic archive

Commitb448930

Browse files
xen2xoofx
authored andcommitted
[SharpGen] StringToHGlobalUni is not necessary since it is already the same layout as .NET strings, use "fixed" instead
1 parente4e820e commitb448930

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎Source/Tools/SharpGen/Templates/Method.tt‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,9 @@
225225
}
226226
}
227227
// Handle Input String
228-
} else if (param.IsString) {
229-
if (param.IsWideChar) {#>
230-
IntPtr <#= param.TempName #> = Utilities.StringToHGlobalUni(<#= param.Name #>);
231-
<#+} else {#>
228+
} else if (param.IsString && !param.IsWideChar) {#>
232229
IntPtr <#= param.TempName #> = Utilities.StringToHGlobalAnsi(<#= param.Name #>);
233-
<#+}
234-
} else if ( param.IsRefIn && param.IsValueType && param.IsOptionnal) {#>
230+
<#+} else if ( param.IsRefIn && param.IsValueType && param.IsOptionnal) {#>
235231
<#= param.PublicType.QualifiedName #> <#= param.TempName #>;
236232
if (<#= param.Name #>.HasValue)
237233
<#= param.TempName #> = <#= param.Name #>.Value;
@@ -272,7 +268,11 @@
272268
} else if (param.IsFixed && param.IsValueType && !param.HasNativeValueType && !param.IsUsedAsReturnType) {#>
273269
fixed (void* <#= param.TempName #> = &<#= param.Name #>)
274270
<#+PushIndent(" ");
275-
}
271+
// Handle Input String
272+
} else if (param.IsString && param.IsWideChar) {#>
273+
fixed (char* <#= param.TempName #> = <#= param.Name #>)
274+
<#+PushIndent(" ");
275+
}
276276
}
277277

278278

@@ -335,7 +335,7 @@
335335
<#= param.Name #> = <#= param.TempName #> != 0;
336336
<#+}
337337
// Handle Input String
338-
} else if (param.IsString) {#>
338+
} else if (param.IsString && !param.IsWideChar) {#>
339339
Marshal.FreeHGlobal(<#= param.TempName #> );
340340
<#+
341341
} else if (param.HasNativeValueType) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp