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
1 changed files with 4 additions and 3 deletions
|
@ -532,8 +532,9 @@ namespace GLib {
|
|||
{
|
||||
UIntPtr native_length;
|
||||
IntPtr raw_ret = g_key_file_to_data (Handle, out native_length, IntPtr.Zero);
|
||||
byte[] ret = new byte [(int) native_length];
|
||||
Marshal.Copy (raw_ret, ret, 0, (int) native_length);
|
||||
int length = (int)native_length;
|
||||
byte[] ret = new byte [length];
|
||||
Marshal.Copy (raw_ret, ret, 0, length);
|
||||
Marshaller.Free (raw_ret);
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue