mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
glib: Switch to generic collections in Marshaller and ValueArray
This commit is contained in:
parent
6e3e73e2ac
commit
df751f87ce
@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
namespace GLib {
|
namespace GLib {
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public class Marshaller {
|
public class Marshaller {
|
||||||
@ -202,7 +203,7 @@ namespace GLib {
|
|||||||
return new string [0];
|
return new string [0];
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
System.Collections.ArrayList result = new System.Collections.ArrayList ();
|
var result = new List<string> ();
|
||||||
IntPtr s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
|
IntPtr s = Marshal.ReadIntPtr (null_term_array, count++ * IntPtr.Size);
|
||||||
while (s != IntPtr.Zero) {
|
while (s != IntPtr.Zero) {
|
||||||
result.Add (Utf8PtrToString (s));
|
result.Add (Utf8PtrToString (s));
|
||||||
@ -212,7 +213,7 @@ namespace GLib {
|
|||||||
if (owned)
|
if (owned)
|
||||||
g_strfreev (null_term_array);
|
g_strfreev (null_term_array);
|
||||||
|
|
||||||
return (string[]) result.ToArray (typeof(string));
|
return result.ToArray ();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string[] PtrToStringArrayGFree (IntPtr string_array)
|
public static string[] PtrToStringArrayGFree (IntPtr string_array)
|
||||||
|
@ -23,13 +23,14 @@ namespace GLib {
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public class ValueArray : IDisposable, ICollection, ICloneable, IWrapper {
|
public class ValueArray : IDisposable, ICollection, ICloneable, IWrapper {
|
||||||
|
|
||||||
private IntPtr handle = IntPtr.Zero;
|
private IntPtr handle = IntPtr.Zero;
|
||||||
|
|
||||||
static private ArrayList PendingFrees = new ArrayList ();
|
static private IList<IntPtr> PendingFrees = new List<IntPtr> ();
|
||||||
static private bool idle_queued = false;
|
static private bool idle_queued = false;
|
||||||
|
|
||||||
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport ("libgobject-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
Loading…
Reference in New Issue
Block a user