From d5843a078d4c4103c3b5522df91052ecd3f3829a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 17 Sep 2009 09:13:52 +0200 Subject: [PATCH] Windows on x86-64 uses 32 bit longs... --- gstreamer-sharp/Makefile.am | 2 +- gstreamer-sharp/glib-sharp/Value.cs | 32 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/gstreamer-sharp/Makefile.am b/gstreamer-sharp/Makefile.am index b4e7dbb96e..b0e1dc6fe7 100644 --- a/gstreamer-sharp/Makefile.am +++ b/gstreamer-sharp/Makefile.am @@ -158,7 +158,7 @@ $(KEYFILE): $(top_srcdir)/gstreamer-sharp.snk cp $(top_srcdir)/gstreamer-sharp.snk . $(ASSEMBLY): $(build_sources) generated-stamp $(KEYFILE) $(plugin_csfiles) - $(CSC) -nowarn:0612 -debug -unsafe -out:$(ASSEMBLY) -target:library $(references) $(csc_build_sources) $(GENERATED_SOURCES) $(plugin_csfiles) -define:GTK_SHARP_2_6 -define:GTK_SHARP_2_8 -define:GTK_SHARP_2_10 -define:GTK_SHARP_2_12 -define:GTK_SHARP_2_14 + $(CSC) -nowarn:0612 -debug -unsafe -out:$(ASSEMBLY) -target:library $(references) $(csc_build_sources) $(GENERATED_SOURCES) $(plugin_csfiles) $(WIN64DEFINES) -define:GTK_SHARP_2_6 -define:GTK_SHARP_2_8 -define:GTK_SHARP_2_10 -define:GTK_SHARP_2_12 -define:GTK_SHARP_2_14 plugins-update: $(MAKE) -C coreplugins plugins-update diff --git a/gstreamer-sharp/glib-sharp/Value.cs b/gstreamer-sharp/glib-sharp/Value.cs index 8d248141bf..5431a8a62a 100755 --- a/gstreamer-sharp/glib-sharp/Value.cs +++ b/gstreamer-sharp/glib-sharp/Value.cs @@ -440,10 +440,17 @@ namespace Gst.GLib { return (long) this; else if (type == GType.UInt64.Val) return (ulong) this; +#if WIN64LONGS + else if (type == GType.Long.Val) + return g_value_get_long (ref this); + else if (type == GType.ULong.Val) + return g_value_get_ulong (ref this); +#else else if (type == GType.Long.Val) return g_value_get_long (ref this).ToInt64 (); else if (type == GType.ULong.Val) return g_value_get_ulong (ref this).ToUInt64 (); +#endif else if (GType.Is (type, GType.Enum) || GType.Is (type, GType.Flags)) return ToEnum (); @@ -487,10 +494,17 @@ namespace Gst.GLib { g_value_set_int64 (ref this, (long) value); else if (type == GType.UInt64.Val) g_value_set_uint64 (ref this, (ulong) value); +#if WIN64LONGS + else if (type == GType.Long.Val) + g_value_set_long (ref this, ((IConvertible)value).ToInt32 (null)); + else if (type == GType.ULong.Val) + g_value_set_ulong (ref this, ((IConvertible)value).ToUInt32 (null)); +#else else if (type == GType.Long.Val) g_value_set_long (ref this, new IntPtr (((IConvertible)value).ToInt64 (null))); else if (type == GType.ULong.Val) g_value_set_ulong (ref this, new UIntPtr (((IConvertible)value).ToUInt64 (null))); +#endif else if (GType.Is (type, GType.Enum)) g_value_set_enum (ref this, (int)value); else if (GType.Is (type, GType.Flags)) @@ -610,11 +624,20 @@ namespace Gst.GLib { [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void g_value_set_uint64 (ref Value val, ulong data); + /* Windows on x86-64 has 32 bit longs */ +#if WIN64LONGS + [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void g_value_set_long (ref Value val, int data); + + [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern void g_value_set_ulong (ref Value val, uint data); +#else [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void g_value_set_long (ref Value val, IntPtr data); [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void g_value_set_ulong (ref Value val, UIntPtr data); +#endif [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern void g_value_set_object (ref Value val, IntPtr data); @@ -663,11 +686,20 @@ namespace Gst.GLib { [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern ulong g_value_get_uint64 (ref Value val); + /* Windows on x86-64 has 32 bit longs */ +#if WIN64LONGS + [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern int g_value_get_long (ref Value val); + + [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] + static extern uint g_value_get_ulong (ref Value val); +#else [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr g_value_get_long (ref Value val); [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern UIntPtr g_value_get_ulong (ref Value val); +#endif [DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern IntPtr g_value_get_object (ref Value val);