diff --git a/Source/Libs/CairoSharp/Context.cs b/Source/Libs/CairoSharp/Context.cs index 09de92921..319b8e530 100644 --- a/Source/Libs/CairoSharp/Context.cs +++ b/Source/Libs/CairoSharp/Context.cs @@ -65,7 +65,7 @@ namespace Cairo { // except in the case of Win64 where sizeof(long) // is 32 bits // - int ptr_size = Marshal.SizeOf (typeof (IntPtr)); + int ptr_size = Marshal.SizeOf(); PlatformID platform = Environment.OSVersion.Platform; if (platform == PlatformID.Win32NT || diff --git a/Source/Libs/GLibSharp/HookList.cs b/Source/Libs/GLibSharp/HookList.cs index 34df11c1f..803d0d78e 100644 --- a/Source/Libs/GLibSharp/HookList.cs +++ b/Source/Libs/GLibSharp/HookList.cs @@ -15,7 +15,7 @@ namespace GLib { static public AbiStruct abi_info = new AbiStruct(new List { new GLib.AbiField("seq_id" , 0 - , (uint) Marshal.SizeOf(typeof(ulong)) // seq_id + , (uint) Marshal.SizeOf() // seq_id , null , "hook_size" , (long) Marshal.OffsetOf(typeof(GHookList_seq_idAlign), "seq_id") @@ -23,7 +23,7 @@ namespace GLib { ), new GLib.AbiField("hook_size" , -1 - , (uint) Marshal.SizeOf(typeof(uint)) // hook_size + , (uint) Marshal.SizeOf() // hook_size , "seq_id" , "is_setup" , 1 @@ -31,7 +31,7 @@ namespace GLib { ), new GLib.AbiField("is_setup" , -1 - , (uint) Marshal.SizeOf(typeof(bool)) // is_setup + , (uint) Marshal.SizeOf() // is_setup , "hook_size" , "hooks" , 1 @@ -39,7 +39,7 @@ namespace GLib { ), new GLib.AbiField("hooks" , -1 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // hooks + , (uint) Marshal.SizeOf() // hooks , "is_setup" , "dummy3" , (long) Marshal.OffsetOf(typeof(GHookList_hooksAlign), "hooks") @@ -47,7 +47,7 @@ namespace GLib { ), new GLib.AbiField("dummy3" , -1 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // dummy3 + , (uint) Marshal.SizeOf() // dummy3 , "hooks" , "finalize_hook" , (long) Marshal.OffsetOf(typeof(GHookList_dummy3Align), "dummy3") @@ -55,7 +55,7 @@ namespace GLib { ), new GLib.AbiField("finalize_hook" , -1 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // finalize_hook + , (uint) Marshal.SizeOf() // finalize_hook , "dummy3" , "dummy" , (long) Marshal.OffsetOf(typeof(GHookList_finalize_hookAlign), "finalize_hook") @@ -63,7 +63,7 @@ namespace GLib { ), new GLib.AbiField("dummy" , -1 - , (uint) Marshal.SizeOf(typeof(IntPtr)) * 2 // dummy + , (uint) Marshal.SizeOf() * 2 // dummy , "finalize_hook" , null , (long) Marshal.OffsetOf(typeof(GHookList_dummyAlign), "dummy") diff --git a/Source/Libs/GLibSharp/Marshaller.cs b/Source/Libs/GLibSharp/Marshaller.cs index def1d1f93..55683ffb2 100644 --- a/Source/Libs/GLibSharp/Marshaller.cs +++ b/Source/Libs/GLibSharp/Marshaller.cs @@ -364,7 +364,7 @@ namespace GLib { public static IntPtr StructArrayToNullTerminatedStructArrayIntPtr (T[] InputArray) { - int intPtrSize = Marshal.SizeOf (typeof (IntPtr)); + int intPtrSize = Marshal.SizeOf(); IntPtr mem = Marshal.AllocHGlobal ((InputArray.Length + 1) * intPtrSize); for (int i = 0; i < InputArray.Length; i++) { diff --git a/Source/Libs/GLibSharp/Object.cs b/Source/Libs/GLibSharp/Object.cs index 833b8e513..0062fd4db 100644 --- a/Source/Libs/GLibSharp/Object.cs +++ b/Source/Libs/GLibSharp/Object.cs @@ -939,7 +939,7 @@ namespace GLib { static public AbiStruct abi_info = new AbiStruct(new List { new GLib.AbiField("g_type_instance" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , null , "ref_count" , (long) Marshal.OffsetOf(typeof(GObject_g_type_instanceAlign), "g_type_instance") @@ -947,7 +947,7 @@ namespace GLib { ), new GLib.AbiField("ref_count" , -1 - , (uint) Marshal.SizeOf(typeof(uint)) // ref_count + , (uint) Marshal.SizeOf() // ref_count , "g_type_instance" , "qdata" , (long) Marshal.OffsetOf(typeof(GObject_ref_countAlign), "ref_count") @@ -955,7 +955,7 @@ namespace GLib { ), new GLib.AbiField("qdata" , -1 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // qdata + , (uint) Marshal.SizeOf() // qdata , "ref_count" , null , (long) Marshal.OffsetOf(typeof(GObject_qdataAlign), "qdata") @@ -968,146 +968,146 @@ namespace GLib { static public AbiStruct class_abi = new AbiStruct(new List { new GLib.AbiField("type_class" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , null , "construct_props" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("construct_props" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "type_class" , "constructor_cb" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("constructor_cb" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "construct_props" , "set_prop_cb" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("set_prop_cb" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "constructor_cb" , "get_prop_cb" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("get_prop_cb" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "set_prop_cb" , "dispose" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dispose" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "get_prop_cb" , "finalize" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("finalize" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "dispose" , "dispatch_properties_changed" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dispatch_properties_changed" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "finalize" , "notify" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("notify" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "dispatch_properties_changed" , "constructed" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("constructed" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "notify" , "dummy1" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dummy1" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "constructed" , "dummy2" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dummy2" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "dummy1" , "dummy3" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dummy3" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "dummy2" , "dummy4" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dummy3" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "dummy2" , "dummy4" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dummy4" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "dummy3" , "dummy5" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dummy5" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "dummy4" , "dummy6" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dummy6" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "dummy5" , "dummy7" - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), new GLib.AbiField("dummy7" , 0 - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , "dummy6" , null - , (uint) Marshal.SizeOf(typeof(IntPtr)) // g_type_instance + , (uint) Marshal.SizeOf() // g_type_instance , 0 ), } diff --git a/Source/Tools/GapiCodegen/ManualGen.cs b/Source/Tools/GapiCodegen/ManualGen.cs index 78a67b67f..9945f03d5 100644 --- a/Source/Tools/GapiCodegen/ManualGen.cs +++ b/Source/Tools/GapiCodegen/ManualGen.cs @@ -68,7 +68,7 @@ namespace GtkSharp.Generation { } public override string GenerateGetSizeOf () { - return "(uint) Marshal.SizeOf(typeof(" + abi_type + "))"; + return "(uint) Marshal.SizeOf<" + abi_type + ">()"; } } } diff --git a/Source/Tools/GapiCodegen/StructABIField.cs b/Source/Tools/GapiCodegen/StructABIField.cs index 90c3104ae..93413e2dd 100644 --- a/Source/Tools/GapiCodegen/StructABIField.cs +++ b/Source/Tools/GapiCodegen/StructABIField.cs @@ -104,7 +104,7 @@ namespace GtkSharp.Generation { // Do not generate structs if the type is a simple pointer. if (IsCPointer()) - min_align = "(uint) Marshal.SizeOf(typeof(IntPtr))"; + min_align = "(uint) Marshal.SizeOf()"; if (IsBitfield) min_align = "1"; diff --git a/Source/Tools/GapiCodegen/StructField.cs b/Source/Tools/GapiCodegen/StructField.cs index 9503f5ed4..f9e756c5a 100644 --- a/Source/Tools/GapiCodegen/StructField.cs +++ b/Source/Tools/GapiCodegen/StructField.cs @@ -144,7 +144,7 @@ namespace GtkSharp.Generation { if (_enum != null && !is_pointer) res = "(uint) Marshal.SizeOf(System.Enum.GetUnderlyingType(typeof(" + cstype + ")))"; else - res = "(uint) Marshal.SizeOf(typeof(" + cstype + "))"; + res = "(uint) Marshal.SizeOf<" + cstype + ">()"; if (IsFixedSizeArray()) res += " * " + ArrayLength; diff --git a/Source/Tools/GapiCodegen/SymbolTable.cs b/Source/Tools/GapiCodegen/SymbolTable.cs index 0e1cdc92d..ccb9a9eea 100644 --- a/Source/Tools/GapiCodegen/SymbolTable.cs +++ b/Source/Tools/GapiCodegen/SymbolTable.cs @@ -150,7 +150,7 @@ namespace GtkSharp.Generation { AddType (new MarshalGen ("GType", "GLib.GType", "IntPtr", "{0}.Val", "new GLib.GType({0})", "GLib.GType.None")); AddType (new ByRefGen ("GValue", "GLib.Value")); AddType (new SimpleGen ("GDestroyNotify", "GLib.DestroyNotify", "null", - "(uint) Marshal.SizeOf(typeof(IntPtr))")); + "(uint) Marshal.SizeOf()")); AddType (new SimpleGen ("GThread", "GLib.Thread", "null")); AddType (new ManualGen ("GBytes", "GLib.Bytes")); AddType (new SimpleGen ("GHookList", "GLib.HookList", "null",