[seed] Proper deal with array returns when they are strings
- From: Danilo Cesar Lemes de Paula <danilocesar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] Proper deal with array returns when they are strings
- Date: Tue, 14 Jun 2016 20:30:05 +0000 (UTC)
commit 5fe14cc348c51d0b4bee4e1e8be110fb6b8a97a1
Author: Danilo Cesar Lemes de Paula <danilo cesar collabora co uk>
Date: Mon Jun 13 11:25:48 2016 -0300
Proper deal with array returns when they are strings
libseed/seed-types.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index 649927c..0bc2d39 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -1005,6 +1005,24 @@ seed_value_from_gi_argument_full(JSContextRef ctx,
g_base_info_unref((GIBaseInfo*) array_type_info);
return ret_ptr_array;
+ } else if (array_type == GI_ARRAY_TYPE_C) {
+
+ if (g_type_info_is_zero_terminated(type_info)) {
+ GITypeInfo* param_info;
+ param_info = g_type_info_get_param_type(type_info, 0);
+ g_assert(param_info != NULL);
+
+ // TODO: this is pretty simple and probably incomplete.
+ // GJS makes possible the return of an array, supporting
+ // all types. We're only supporting strings ATM.
+ ret
+ = seed_value_from_string(ctx, arg->v_pointer, exception);
+
+ g_base_info_unref((GIBaseInfo*) param_info);
+ g_base_info_unref((GIBaseInfo*) array_type_info);
+
+ return ret;
+ }
}
// technically gir has arrays of bytes, eg.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]