mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-05-11 22:12:12 +00:00
2004-05-18 Zoltan Varga <vargaz@freemail.hu>
* glib/time_t_CustomMarshaler.cs: Fix custom marshalling after runtime changes. svn path=/trunk/gtk-sharp/; revision=27621
This commit is contained in:
parent
43a82f1204
commit
fed2de1fe7
|
@ -1,3 +1,8 @@
|
||||||
|
2004-05-18 Zoltan Varga <vargaz@freemail.hu>
|
||||||
|
|
||||||
|
* glib/time_t_CustomMarshaler.cs: Fix custom marshalling after runtime
|
||||||
|
changes.
|
||||||
|
|
||||||
2004-05-18 Vladimir Vukicevic <vladimir@pobox.com
|
2004-05-18 Vladimir Vukicevic <vladimir@pobox.com
|
||||||
|
|
||||||
* gnome/Print.custom: Cast .Pixels usage to a (byte *)
|
* gnome/Print.custom: Cast .Pixels usage to a (byte *)
|
||||||
|
|
|
@ -32,23 +32,21 @@ namespace GLib {
|
||||||
public IntPtr MarshalManagedToNative (object obj)
|
public IntPtr MarshalManagedToNative (object obj)
|
||||||
{
|
{
|
||||||
DateTime dt = (DateTime) obj;
|
DateTime dt = (DateTime) obj;
|
||||||
int size = Marshal.SizeOf (typeof (int)) + GetNativeDataSize ();
|
int size = GetNativeDataSize ();
|
||||||
IntPtr ptr = Marshal.AllocCoTaskMem (size);
|
IntPtr ptr = Marshal.AllocCoTaskMem (size);
|
||||||
IntPtr time_t_ptr = new IntPtr (ptr.ToInt32 () + Marshal.SizeOf (typeof(int)));
|
|
||||||
int secs = ((int)dt.Subtract (local_epoch).TotalSeconds) + utc_offset;
|
int secs = ((int)dt.Subtract (local_epoch).TotalSeconds) + utc_offset;
|
||||||
if (GetNativeDataSize () == 4)
|
if (GetNativeDataSize () == 4)
|
||||||
Marshal.WriteInt32 (time_t_ptr, secs);
|
Marshal.WriteInt32 (ptr, secs);
|
||||||
else if (GetNativeDataSize () == 8)
|
else if (GetNativeDataSize () == 8)
|
||||||
Marshal.WriteInt64 (time_t_ptr, secs);
|
Marshal.WriteInt64 (ptr, secs);
|
||||||
else
|
else
|
||||||
throw new Exception ("Unexpected native size for time_t.");
|
throw new Exception ("Unexpected native size for time_t.");
|
||||||
return time_t_ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CleanUpNativeData (IntPtr data)
|
public void CleanUpNativeData (IntPtr data)
|
||||||
{
|
{
|
||||||
IntPtr ptr = new IntPtr (data.ToInt32 () - Marshal.SizeOf (typeof (int)));
|
Marshal.FreeCoTaskMem (data);
|
||||||
Marshal.FreeCoTaskMem (ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public object MarshalNativeToManaged (IntPtr data)
|
public object MarshalNativeToManaged (IntPtr data)
|
||||||
|
|
Loading…
Reference in a new issue