[shotwell/shotwell-0.30] GPhoto2: Add one more proper array binding



commit e23fe2c9e27fc7f121ac10ac8004d87e0d94e8ba
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 bc2251c8..9bcb1513 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 e1c22467..2e119e89 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]