[perl-Glib-Object-Introspection] Support fixed size arrays as return values and out arguments
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [perl-Glib-Object-Introspection] Support fixed size arrays as return values and out arguments
- Date: Sun, 27 Feb 2011 11:04:32 +0000 (UTC)
commit 3873073d2d08db6f92103eaff572464074fe2c68
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Sun Feb 27 11:02:34 2011 +0000
Support fixed size arrays as return values and out arguments
GObjectIntrospection.xs | 7 ++++---
t/arrays.t | 4 +++-
2 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/GObjectIntrospection.xs b/GObjectIntrospection.xs
index 4bb685c..020dd7e 100644
--- a/GObjectIntrospection.xs
+++ b/GObjectIntrospection.xs
@@ -604,9 +604,10 @@ array_to_sv (GITypeInfo* info,
if (is_zero_terminated) {
length = g_strv_length (pointer);
} else {
- ccroak ("FIXME: non-zero-terminated arrays "
- "are not supported yet");
- return &PL_sv_undef;
+ length = g_type_info_get_array_fixed_size (info);
+ if (length < 0) {
+ ccroak ("FIXME: dynamic length arrays are not supported yet");
+ }
}
av = newAV ();
diff --git a/t/arrays.t b/t/arrays.t
index e5b7061..ebaeaa5 100644
--- a/t/arrays.t
+++ b/t/arrays.t
@@ -6,7 +6,7 @@ use strict;
use warnings;
use utf8;
-plan tests => 18;
+plan tests => 20;
my $str_array = [ '1', '2', '3' ];
ok (test_strv_in ($str_array));
@@ -19,6 +19,8 @@ is (test_array_gint32_in (3, $int_array), 6);
is (test_array_gint64_in (3, $int_array), 6);
is (test_array_gtype_in (2, [ 'Glib::Object', 'Glib::Int64' ]), "[GObject,gint64,]");
is (test_array_fixed_size_int_in ([ 1, 2, 3, 4, 5 ]), 15);
+is_deeply (test_array_fixed_size_int_out (), [ 0, 1, 2, 3, 4 ]);
+is_deeply (test_array_fixed_size_int_return (), [ 0, 1, 2, 3, 4 ]);
# TODO:
#void regress_test_array_int_out (int *n_ints, int **ints);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]