mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-07 07:23:18 +02:00
glib: Avoid doing the same cast twice in KeyFile.ToData
The cast from UIntPtr to int can fail at runtime, but if your config file is more than 2^31 bytes, you probably have bigger problems...
This commit is contained in:
parent
f1005da47c
commit
ee06530b52
@ -531,9 +531,10 @@ namespace GLib {
|
|||||||
public byte[] ToData ()
|
public byte[] ToData ()
|
||||||
{
|
{
|
||||||
UIntPtr native_length;
|
UIntPtr native_length;
|
||||||
IntPtr raw_ret = g_key_file_to_data(Handle, out native_length, IntPtr.Zero);
|
IntPtr raw_ret = g_key_file_to_data (Handle, out native_length, IntPtr.Zero);
|
||||||
byte[] ret = new byte [(int) native_length];
|
int length = (int)native_length;
|
||||||
Marshal.Copy (raw_ret, ret, 0, (int) native_length);
|
byte[] ret = new byte [length];
|
||||||
|
Marshal.Copy (raw_ret, ret, 0, length);
|
||||||
Marshaller.Free (raw_ret);
|
Marshaller.Free (raw_ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user