[shotwell] GPhoto2: Add one more proper array binding
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] GPhoto2: Add one more proper array binding
- Date: Sun, 14 Mar 2021 11:52:46 +0000 (UTC)
commit 4979a2a89f92cf6fa031189a0c8e990167af6894
Author: Jens Georg <mail jensge org>
Date: Sun Mar 14 12:51:39 2021 +0100
GPhoto2: Add one more proper array binding
src/camera/GPhoto.vala | 8 ++------
vapi/libgphoto2.vapi | 3 ++-
2 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/camera/GPhoto.vala b/src/camera/GPhoto.vala
index df96bf56..702f3072 100644
--- a/src/camera/GPhoto.vala
+++ b/src/camera/GPhoto.vala
@@ -119,15 +119,11 @@ namespace GPhoto {
// if buffer can be loaded into memory, return a Bytes class with
// CameraFile being the owner of the data. This way, the CameraFile is freed
// when the Bytes are freed
- unowned uint8 *data;
- ulong data_len;
- var res = file.get_data_and_size(out data, out data_len);
+ unowned uint8[] buffer = null;
+ var res = file.get_data(out buffer);
if (res != Result.OK)
return null;
- unowned uint8[] buffer = (uint8[]) data;
- buffer.length = (int) data_len;
-
return Bytes.new_with_owner<GPhoto.CameraFile>(buffer, file);
}
diff --git a/vapi/libgphoto2.vapi b/vapi/libgphoto2.vapi
index aeab7255..f4fca0db 100644
--- a/vapi/libgphoto2.vapi
+++ b/vapi/libgphoto2.vapi
@@ -106,7 +106,8 @@ namespace GPhoto {
public static Result create(out CameraFile file);
[CCode (cname="gp_file_new_from_fd")]
public static Result create_from_fd(out CameraFile file, int fd);
- public Result get_data_and_size(out uint8 *data, out ulong data_len);
+ [CCode (cname="gp_file_get_data_and_size")]
+ public Result get_data([CCode (array_length_pos=1)]out unowned uint8[] data);
public Result save(string filename);
public Result slurp(uint8[] data, out size_t readlen);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]