Skip to content

Commit 031f1e5

Browse files
committed
fixup! Make string marshaling either lax or strict
1 parent f340a32 commit 031f1e5

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

LibGit2Sharp/Core/EncodingMarshaler.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static void Cleanup(IntPtr pNativeData)
8888
Marshal.FreeHGlobal(pNativeData);
8989
}
9090

91-
public static unsafe String FromNative(Encoding encoding, IntPtr pNativeData)
91+
public static unsafe string FromNative(Encoding encoding, IntPtr pNativeData)
9292
{
9393
if (pNativeData == IntPtr.Zero)
9494
{
@@ -112,7 +112,7 @@ public static unsafe String FromNative(Encoding encoding, IntPtr pNativeData)
112112
return new String((sbyte*)pNativeData.ToPointer(), 0, (int)(walk - start), encoding);
113113
}
114114

115-
public static unsafe String FromNative(Encoding encoding, IntPtr pNativeData, int length)
115+
public static unsafe string FromNative(Encoding encoding, IntPtr pNativeData, int length)
116116
{
117117
if (pNativeData == IntPtr.Zero)
118118
{
@@ -127,7 +127,7 @@ public static unsafe String FromNative(Encoding encoding, IntPtr pNativeData, in
127127
return new String((sbyte*)pNativeData.ToPointer(), 0, length, encoding);
128128
}
129129

130-
public static String FromBuffer(Encoding encoding, byte[] buffer)
130+
public static string FromBuffer(Encoding encoding, byte[] buffer)
131131
{
132132
if (buffer == null)
133133
{

LibGit2Sharp/Core/FilePathMarshaler.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ internal class LaxFilePathMarshaler : LaxUtf8Marshaler
9797
{
9898
private static readonly LaxFilePathMarshaler staticInstance = new LaxFilePathMarshaler();
9999

100+
public new static ICustomMarshaler GetInstance(String cookie)
101+
{
102+
return staticInstance;
103+
}
104+
100105
#region ICustomMarshaler
101106

102107
public override Object MarshalNativeToManaged(IntPtr pNativeData)
@@ -106,11 +111,6 @@ public override Object MarshalNativeToManaged(IntPtr pNativeData)
106111

107112
#endregion
108113

109-
public new static ICustomMarshaler GetInstance(String cookie)
110-
{
111-
return staticInstance;
112-
}
113-
114114
public new static FilePath FromNative(IntPtr pNativeData)
115115
{
116116
return LaxUtf8Marshaler.FromNative(pNativeData);

0 commit comments

Comments
 (0)