f-spot r4125 - in trunk: . libgphoto2-sharp
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4125 - in trunk: . libgphoto2-sharp
- Date: Tue, 1 Jul 2008 10:52:19 +0000 (UTC)
Author: sdelcroix
Date: Tue Jul 1 10:52:19 2008
New Revision: 4125
URL: http://svn.gnome.org/viewvc/f-spot?rev=4125&view=rev
Log:
2008-07-01 Stephane Delcroix <stephane delcroix>
* libgphoto2-sharp/CameraFile.cs: pull GetDataAndSize from upstream.
Fixes bgo #505822. Thx to Tim Retout for his proposed patch.
Modified:
trunk/ChangeLog
trunk/libgphoto2-sharp/CameraFile.cs
Modified: trunk/libgphoto2-sharp/CameraFile.cs
==============================================================================
--- trunk/libgphoto2-sharp/CameraFile.cs (original)
+++ trunk/libgphoto2-sharp/CameraFile.cs Tue Jul 1 10:52:19 2008
@@ -214,21 +214,21 @@
}
[DllImport ("libgphoto2.so")]
- internal static extern ErrorCode gp_file_get_data_and_size (HandleRef file, out IntPtr data, out ulong size);
+ internal static extern ErrorCode gp_file_get_data_and_size (HandleRef file, out IntPtr data, out IntPtr size);
public byte[] GetDataAndSize ()
{
- ulong size;
+ IntPtr size;
byte[] data;
- unsafe
- {
- IntPtr data_addr = IntPtr.Zero;
- Error.CheckError (gp_file_get_data_and_size (this.Handle, out data_addr, out size));
- data = new byte[size];
- if (data_addr != IntPtr.Zero && size > 0)
- Marshal.Copy(data_addr, data, 0, (int)size);
- }
-
+ IntPtr data_addr;
+
+ Error.CheckError (gp_file_get_data_and_size (this.Handle, out data_addr, out size));
+
+ if(data_addr == IntPtr.Zero || size.ToInt32() == 0)
+ return new byte[0];
+
+ data = new byte[size.ToInt32()];
+ Marshal.Copy(data_addr, data, 0, (int)size.ToInt32());
return data;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]