Skip to content

Commit 7434189

Browse files
zpgitmartinweismann
authored andcommitted
Remove unnecessary specifier.
The unsafe specifier in C# binding is unnecessary.
1 parent 70934cc commit 7434189

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

Source/buildbindingcsharp.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
800800
}
801801

802802
w.Writeln(" [StructLayout(LayoutKind.Explicit, Size=%d)]", fieldOffset)
803-
w.Writeln(" public unsafe struct Internal%s", structinfo.Name)
803+
w.Writeln(" public struct Internal%s", structinfo.Name)
804804
w.Writeln(" {")
805805
w.Writelns(" ", memberLines)
806806
w.Writeln(" }")
@@ -831,7 +831,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
831831
parameters = "IntPtr Handle, " + parameters
832832
}
833833

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

837837
}
@@ -854,7 +854,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
854854
for i := 0; i < len(component.Structs); i++ {
855855
structinfo := component.Structs[i]
856856

857-
w.Writeln(" public unsafe static s%s convertInternalToStruct_%s (Internal%s int%s)", structinfo.Name, structinfo.Name, structinfo.Name, structinfo.Name)
857+
w.Writeln(" public static s%s convertInternalToStruct_%s (Internal%s int%s)", structinfo.Name, structinfo.Name, structinfo.Name, structinfo.Name)
858858
w.Writeln(" {")
859859
w.Writeln(" s%s %s;", structinfo.Name, structinfo.Name)
860860

@@ -901,7 +901,7 @@ func buildBindingCSharpImplementation(component ComponentDefinition, w LanguageW
901901
w.Writeln(" }")
902902
w.Writeln("")
903903

904-
w.Writeln(" public unsafe static Internal%s convertStructToInternal_%s (s%s %s)", structinfo.Name, structinfo.Name, structinfo.Name, structinfo.Name)
904+
w.Writeln(" public static Internal%s convertStructToInternal_%s (s%s %s)", structinfo.Name, structinfo.Name, structinfo.Name, structinfo.Name)
905905
w.Writeln(" {")
906906
w.Writeln(" Internal%s int%s;", structinfo.Name, structinfo.Name)
907907

@@ -1258,12 +1258,6 @@ func buildCSharpExampleProject(componentdefinition ComponentDefinition, w Langua
12581258
w.Writeln(" <ApplicationIcon />")
12591259
w.Writeln(" <Platforms>x64</Platforms>")
12601260
w.Writeln(" </PropertyGroup>")
1261-
w.Writeln(" <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">")
1262-
w.Writeln(" <AllowUnsafeBlocks>true</AllowUnsafeBlocks>")
1263-
w.Writeln(" </PropertyGroup>")
1264-
w.Writeln(" <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">")
1265-
w.Writeln(" <AllowUnsafeBlocks>true</AllowUnsafeBlocks>")
1266-
w.Writeln(" </PropertyGroup>")
12671261
w.Writeln(" <ItemGroup>")
12681262
w.Writeln(" <Compile Include=\"..\\..\\Bindings\\CSharp\\%s.cs\" Link=\"%s.cs\" />", NameSpace, NameSpace)
12691263
w.Writeln(" </ItemGroup>")

0 commit comments

Comments
 (0)