| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0cfc67a commit ffe6448
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ namespace Python.Runtime | |||
| 9 | 9 | /// Abstract class defining boiler plate methods that | |
| 10 | 10 | /// Custom Marshalers will use. | |
| 11 | 11 | /// </summary> | |
| 12 | - public abstract class MarshalerBase : ICustomMarshaler | ||
| 12 | + internal abstract class MarshalerBase : ICustomMarshaler | ||
| 13 | 13 | { | |
| 14 | 14 | public object MarshalNativeToManaged(IntPtr pNativeData) | |
| 15 | 15 | { | |
@@ -39,9 +39,9 @@ public int GetNativeDataSize() | |||
| 39 | 39 | /// Custom Marshaler to deal with Managed String to Native | |
| 40 | 40 | /// conversion differences on UCS2/UCS4. | |
| 41 | 41 | /// </summary> | |
| 42 | - public class StrMarshaler : MarshalerBase | ||
| 42 | + internal class UcsMarshaler : MarshalerBase | ||
| 43 | 43 | { | |
| 44 | - private static readonly MarshalerBase Instance = new StrMarshaler(); | ||
| 44 | + private static readonly MarshalerBase Instance = new UcsMarshaler(); | ||
| 45 | 45 | private static readonly Encoding PyEncoding = Runtime.PyEncoding; | |
| 46 | 46 | ||
| 47 | 47 | public override IntPtr MarshalManagedToNative(object managedObj) | |
@@ -106,7 +106,7 @@ public static int GetUnicodeByteLength(IntPtr p) | |||
| 106 | 106 | /// Custom Marshaler to deal with Managed String Arrays to Native | |
| 107 | 107 | /// conversion differences on UCS2/UCS4. | |
| 108 | 108 | /// </summary> | |
| 109 | - public class StrArrayMarshaler : MarshalerBase | ||
| 109 | + internal class StrArrayMarshaler : MarshalerBase | ||
| 110 | 110 | { | |
| 111 | 111 | private static readonly MarshalerBase Instance = new StrArrayMarshaler(); | |
| 112 | 112 | private static readonly Encoding PyEncoding = Runtime.PyEncoding; | |
@@ -161,7 +161,7 @@ public static ICustomMarshaler GetInstance(string cookie) | |||
| 161 | 161 | /// If instead we used `MarshalAs(UnmanagedType.LPWStr)` the output to | |
| 162 | 162 | /// `foo` would be `f\x00o\x00o\x00`. | |
| 163 | 163 | /// </remarks> | |
| 164 | - public class Utf8Marshaler : MarshalerBase | ||
| 164 | + internal class Utf8Marshaler : MarshalerBase | ||
| 165 | 165 | { | |
| 166 | 166 | private static readonly MarshalerBase Instance = new Utf8Marshaler(); | |
| 167 | 167 | private static readonly Encoding PyEncoding = Encoding.UTF8; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,7 +59,7 @@ public static string ProgramName | |||
| 59 | 59 | { | |
| 60 | 60 | IntPtr p = Runtime.Py_GetProgramName(); | |
| 61 | 61 | string result = Runtime.IsPython3 | |
| 62 | - ? StrMarshaler.PtrToStringUni(p) | ||
| 62 | + ? UcsMarshaler.PtrToStringUni(p) | ||
| 63 | 63 | : Marshal.PtrToStringAnsi(p); | |
| 64 | 64 | ||
| 65 | 65 | return result ?? ""; | |
@@ -73,7 +73,7 @@ public static string PythonHome | |||
| 73 | 73 | { | |
| 74 | 74 | IntPtr p = Runtime.Py_GetPythonHome(); | |
| 75 | 75 | string result = Runtime.IsPython3 | |
| 76 | - ? StrMarshaler.PtrToStringUni(p) | ||
| 76 | + ? UcsMarshaler.PtrToStringUni(p) | ||
| 77 | 77 | : Marshal.PtrToStringAnsi(p); | |
| 78 | 78 | ||
| 79 | 79 | return result ?? ""; | |
@@ -87,7 +87,7 @@ public static string PythonPath | |||
| 87 | 87 | { | |
| 88 | 88 | IntPtr p = Runtime.Py_GetPath(); | |
| 89 | 89 | string result = Runtime.IsPython3 | |
| 90 | - ? StrMarshaler.PtrToStringUni(p) | ||
| 90 | + ? UcsMarshaler.PtrToStringUni(p) | ||
| 91 | 91 | : Marshal.PtrToStringAnsi(p); | |
| 92 | 92 | ||
| 93 | 93 | return result ?? ""; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1239,7 +1239,7 @@ internal static bool PyUnicode_Check(IntPtr ob) | |||
| 1239 | 1239 | [DllImport(PythonDll)] | |
| 1240 | 1240 | internal static extern IntPtr PyUnicode_FromKindAndData( | |
| 1241 | 1241 | int kind, | |
| 1242 | - [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StrMarshaler))] string s, | ||
| 1242 | + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UcsMarshaler))] string s, | ||
| 1243 | 1243 | int size | |
| 1244 | 1244 | ); | |
| 1245 | 1245 | ||
@@ -1265,7 +1265,7 @@ internal static IntPtr PyUnicode_FromUnicode(string s, int size) | |||
| 1265 | 1265 | ||
| 1266 | 1266 | [DllImport(PythonDll, EntryPoint = PyUnicodeEntryPoint + "FromUnicode")] | |
| 1267 | 1267 | internal static extern IntPtr PyUnicode_FromUnicode( | |
| 1268 | - [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(StrMarshaler))] string s, | ||
| 1268 | + [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(UcsMarshaler))] string s, | ||
| 1269 | 1269 | int size | |
| 1270 | 1270 | ); | |
| 1271 | 1271 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments