From f4c7bdad4177849be16fc9e6e737370a1db453c1 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Wed, 30 Nov 2022 00:46:31 +0000 Subject: [PATCH] Mark GetStringLength static --- VpSharp/src/Internal/Utf8StringToManaged.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/VpSharp/src/Internal/Utf8StringToManaged.cs b/VpSharp/src/Internal/Utf8StringToManaged.cs index e6ec09b..811edb4 100644 --- a/VpSharp/src/Internal/Utf8StringToManaged.cs +++ b/VpSharp/src/Internal/Utf8StringToManaged.cs @@ -12,6 +12,16 @@ internal sealed class Utf8StringToManaged : ICustomMarshaler return s_instance ??= new Utf8StringToManaged(); } + private static int GetStringLength(IntPtr ptr) + { + int offset; + for (offset = 0; Marshal.ReadByte(ptr, offset) != 0; offset++) + { + } + + return offset; + } + public void CleanUpNativeData(IntPtr pNativeData) { // Do nothing. For some reason CleanUpNativeData is called for pointers that are not even created by the marshaler. @@ -33,16 +43,6 @@ internal sealed class Utf8StringToManaged : ICustomMarshaler throw new NotImplementedException(); } - private int GetStringLength(IntPtr ptr) - { - int offset; - for (offset = 0; Marshal.ReadByte(ptr, offset) != 0; offset++) - { - } - - return offset; - } - public object MarshalNativeToManaged(IntPtr pNativeData) { if (pNativeData == IntPtr.Zero)