mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
2007-11-08 Mike Kestner <mkestner@novell.com>
* glib/Marshaller.cs: new null-terminated string[] marshaler from Mono.Unix with adaptations by Michael Hutchinson. svn path=/trunk/gtk-sharp/; revision=89218
This commit is contained in:
parent
5882ecf29a
commit
de78d57176
@ -1,3 +1,8 @@
|
|||||||
|
2007-11-08 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
|
* glib/Marshaller.cs: new null-terminated string[] marshaler from
|
||||||
|
Mono.Unix with adaptations by Michael Hutchinson.
|
||||||
|
|
||||||
2007-11-02 Mike Kestner <mkestner@novell.com>
|
2007-11-02 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
* glib/SList.cs:
|
* glib/SList.cs:
|
||||||
|
@ -133,6 +133,24 @@ namespace GLib {
|
|||||||
return ret.Replace ("%", "%%");
|
return ret.Replace ("%", "%%");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string[] PtrToStringArrayGFree (IntPtr string_array)
|
||||||
|
{
|
||||||
|
if (string_array == IntPtr.Zero)
|
||||||
|
return new string [0];
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
while (Marshal.ReadIntPtr (string_array, count*IntPtr.Size) != IntPtr.Zero)
|
||||||
|
++count;
|
||||||
|
|
||||||
|
string[] members = new string[count];
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
IntPtr s = Marshal.ReadIntPtr (string_array, i * IntPtr.Size);
|
||||||
|
members[i] = GLib.Marshaller.PtrToStringGFree (s);
|
||||||
|
}
|
||||||
|
GLib.Marshaller.Free (string_array);
|
||||||
|
return members;
|
||||||
|
}
|
||||||
|
|
||||||
// Argv marshalling -- unpleasantly complex, but
|
// Argv marshalling -- unpleasantly complex, but
|
||||||
// don't know of a better way to do it.
|
// don't know of a better way to do it.
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user