Commit 8a113803 authored by Martin Finkel's avatar Martin Finkel

Fix build warning for deprecated SizeOf API

parent 66aadf5e
...@@ -485,6 +485,15 @@ namespace LibVLCSharp.Shared.Helpers ...@@ -485,6 +485,15 @@ namespace LibVLCSharp.Shared.Helpers
} }
} }
internal static int SizeOf<T>(T structure)
{
#if NETSTANDARD1_1 || NET40
return Marshal.SizeOf(typeof(T));
#else
return Marshal.SizeOf<T>(structure);
#endif
}
private static void Free(params IntPtr[] ptrs) private static void Free(params IntPtr[] ptrs)
{ {
foreach (var ptr in ptrs) foreach (var ptr in ptrs)
......
...@@ -535,7 +535,7 @@ namespace LibVLCSharp.Shared ...@@ -535,7 +535,7 @@ namespace LibVLCSharp.Shared
updateProgress(dlg, position, text); updateProgress(dlg, position, text);
}); });
_dialogCbsPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DialogCallbacks))); _dialogCbsPtr = Marshal.AllocHGlobal(MarshalUtils.SizeOf(dialogCbs));
Marshal.StructureToPtr(dialogCbs, _dialogCbsPtr, true); Marshal.StructureToPtr(dialogCbs, _dialogCbsPtr, true);
Native.LibVLCDialogSetCallbacks(NativeReference, _dialogCbsPtr, IntPtr.Zero); Native.LibVLCDialogSetCallbacks(NativeReference, _dialogCbsPtr, IntPtr.Zero);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment