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

Commit60bb68c

Browse files
committed
removed unused Utf8Marshaler
1 parentc3fc7f0 commit60bb68c

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

‎src/runtime/CustomMarshaler.cs

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -189,49 +189,4 @@ public static ICustomMarshaler GetInstance(string cookie)
189189
returnInstance;
190190
}
191191
}
192-
193-
194-
/// <summary>
195-
/// Custom Marshaler to deal with Managed String to Native
196-
/// conversion on UTF-8. Use on functions that expect UTF-8 encoded
197-
/// strings like `PyUnicode_FromStringAndSize`
198-
/// </summary>
199-
/// <remarks>
200-
/// If instead we used `MarshalAs(UnmanagedType.LPWStr)` the output to
201-
/// `foo` would be `f\x00o\x00o\x00`.
202-
/// </remarks>
203-
internalclassUtf8Marshaler:MarshalerBase
204-
{
205-
privatestaticreadonlyMarshalerBaseInstance=newUtf8Marshaler();
206-
privatestaticreadonlyEncodingPyEncoding=Encoding.UTF8;
207-
208-
publicoverrideIntPtrMarshalManagedToNative(objectmanagedObj)
209-
{
210-
vars=managedObjasstring;
211-
212-
if(s==null)
213-
{
214-
returnIntPtr.Zero;
215-
}
216-
217-
byte[]bStr=PyEncoding.GetBytes(s+"\0");
218-
IntPtrmem=Marshal.AllocHGlobal(bStr.Length);
219-
try
220-
{
221-
Marshal.Copy(bStr,0,mem,bStr.Length);
222-
}
223-
catch(Exception)
224-
{
225-
Marshal.FreeHGlobal(mem);
226-
throw;
227-
}
228-
229-
returnmem;
230-
}
231-
232-
publicstaticICustomMarshalerGetInstance(stringcookie)
233-
{
234-
returnInstance;
235-
}
236-
}
237192
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp