Skip to content

Commit

Permalink
Remove unnecessary specifier.
Browse files Browse the repository at this point in the history
The unsafe specifier in C# binding is unnecessary.
  • Loading branch information
zpgit committed Oct 8, 2021
1 parent c9fd78c commit e31890d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions Source/buildbindingcsharp.go
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
}

w.Writeln(" [StructLayout(LayoutKind.Explicit, Size=%d)]", fieldOffset)
w.Writeln(" public unsafe struct Internal%s", structinfo.Name)
w.Writeln(" public struct Internal%s", structinfo.Name)
w.Writeln(" {")
w.Writelns(" ", memberLines)
w.Writeln(" }")
Expand Down Expand Up @@ -821,7 +821,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
parameters = "IntPtr Handle, " + parameters
}

w.Writeln(" public unsafe extern static Int32 %s_%s (%s);", class.ClassName, method.MethodName, parameters)
w.Writeln(" public extern static Int32 %s_%s (%s);", class.ClassName, method.MethodName, parameters)
w.Writeln("")

}
Expand All @@ -844,7 +844,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
for i := 0; i < len(component.Structs); i++ {
structinfo := component.Structs[i]

w.Writeln(" public unsafe static s%s convertInternalToStruct_%s (Internal%s int%s)", structinfo.Name, structinfo.Name, structinfo.Name, structinfo.Name)
w.Writeln(" public static s%s convertInternalToStruct_%s (Internal%s int%s)", structinfo.Name, structinfo.Name, structinfo.Name, structinfo.Name)
w.Writeln(" {")
w.Writeln(" s%s %s;", structinfo.Name, structinfo.Name)

Expand Down Expand Up @@ -891,7 +891,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
w.Writeln(" }")
w.Writeln("")

w.Writeln(" public unsafe static Internal%s convertStructToInternal_%s (s%s %s)", structinfo.Name, structinfo.Name, structinfo.Name, structinfo.Name)
w.Writeln(" public static Internal%s convertStructToInternal_%s (s%s %s)", structinfo.Name, structinfo.Name, structinfo.Name, structinfo.Name)
w.Writeln(" {")
w.Writeln(" Internal%s int%s;", structinfo.Name, structinfo.Name)

Expand Down Expand Up @@ -1202,12 +1202,6 @@ func buildCSharpExampleProject(componentdefinition ComponentDefinition, w Langua
w.Writeln(" <ApplicationIcon />")
w.Writeln(" <Platforms>x64</Platforms>")
w.Writeln(" </PropertyGroup>")
w.Writeln(" <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">")
w.Writeln(" <AllowUnsafeBlocks>true</AllowUnsafeBlocks>")
w.Writeln(" </PropertyGroup>")
w.Writeln(" <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">")
w.Writeln(" <AllowUnsafeBlocks>true</AllowUnsafeBlocks>")
w.Writeln(" </PropertyGroup>")
w.Writeln(" <ItemGroup>")
w.Writeln(" <Compile Include=\"..\\..\\Bindings\\CSharp\\%s.cs\" Link=\"%s.cs\" />", NameSpace, NameSpace)
w.Writeln(" </ItemGroup>")
Expand Down

0 comments on commit e31890d

Please sign in to comment.