From 5e3b7204089a68aeb1032eac6fe26897c4fc3ec0 Mon Sep 17 00:00:00 2001 From: Bertrand Lorentz Date: Sun, 21 Apr 2013 16:50:37 +0200 Subject: [PATCH] gdk: Remove invalid method and P/Invoke in TextProperty The native functions gdk_free_text_list and gdk_text_property_to_utf8_list are gone, and we now need to use StrFreeV to free the native string list. --- gdk/TextProperty.cs | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/gdk/TextProperty.cs b/gdk/TextProperty.cs index db244255b..578502bfb 100644 --- a/gdk/TextProperty.cs +++ b/gdk/TextProperty.cs @@ -26,29 +26,6 @@ namespace Gdk { public class TextProperty { - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern void gdk_free_text_list(IntPtr ptr); - - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] - static extern int gdk_text_property_to_utf8_list(IntPtr encoding, int format, byte[] text, int length, out IntPtr list); - - public static string[] ToStringList (Gdk.Atom encoding, int format, byte[] text, int length) - { - IntPtr list_ptr; - int count = gdk_text_property_to_utf8_list(encoding.Handle, format, text, length, out list_ptr); - - if (count == 0) - return new string [0]; - - string[] result = new string [count]; - for (int i = 0; i < count; i++) { - IntPtr ptr = Marshal.ReadIntPtr (list_ptr, i * IntPtr.Size); - result [i] = GLib.Marshaller.Utf8PtrToString (ptr); - } - gdk_free_text_list (list_ptr); - return result; - } - [DllImport ("libgdk-win32-3.0-0.dll", CallingConvention = CallingConvention.Cdecl)] static extern int gdk_text_property_to_utf8_list_for_display(IntPtr display, IntPtr encoding, int format, byte[] text, int length, out IntPtr list); @@ -65,7 +42,7 @@ namespace Gdk { IntPtr ptr = Marshal.ReadIntPtr (list_ptr, i * IntPtr.Size); result [i] = GLib.Marshaller.Utf8PtrToString (ptr); } - gdk_free_text_list (list_ptr); + GLib.Marshaller.StrFreeV (list_ptr); return result; } }