[seed] Added support for uint8 array as return type
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] Added support for uint8 array as return type
- Date: Fri, 13 Jul 2012 02:36:12 +0000 (UTC)
commit dd6811ccc95b456c5ff42e1ba8508386fdfdba91
Author: Eric Le Bihan <eric le bihan dev free fr>
Date: Thu Jul 12 18:35:14 2012 +0200
Added support for uint8 array as return type
libseed/seed-engine.c | 23 +++++++++++++++++------
libseed/seed-types.c | 2 +-
2 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 78f57e2..9f0ac39 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -475,6 +475,8 @@ seed_gobject_method_invoked (JSContextRef ctx,
GIDirection dir;
JSValueRef retval_ref;
GError *error = 0;
+ gint length_arg_pos = 0;
+ guint64 array_len = 0;
info = JSObjectGetPrivate (function);
@@ -753,11 +755,21 @@ seed_gobject_method_invoked (JSContextRef ctx,
}
+ length_arg_pos = g_type_info_get_array_length(type_info);
+ SEED_NOTE (INVOCATION, "length_arg_pos=%d\n", length_arg_pos);
+ if (length_arg_pos < 0)
+ {
+ array_len = 0;
+ }
+ else
+ {
+ array_len = (&out_values[ out_pos[length_arg_pos] ])->v_uint32;
+ }
+ SEED_NOTE (INVOCATION, "array_len=%d\n", array_len);
retval_ref =
- seed_value_from_gi_argument (ctx, &retval, type_info, exception);
-
+ seed_value_from_gi_argument_full (ctx, &retval, type_info, exception,
+ array_len, tag);
-
if (sunk)
g_object_unref (G_OBJECT (retval.v_pointer));
else
@@ -771,7 +783,6 @@ seed_gobject_method_invoked (JSContextRef ctx,
// finished with return.. now go thorugh the args and handle any out/inout etc..
-
in_args_pos = out_args_pos = 0;
for (i = 0; (i < n_args); i++)
{
@@ -802,8 +813,8 @@ seed_gobject_method_invoked (JSContextRef ctx,
// if the type_info is an array with a length position, we
// need to send that as well, so it can be used to build the seed value.
{
- gint length_arg_pos = g_type_info_get_array_length(type_info);
- guint64 array_len = 0;
+ length_arg_pos = g_type_info_get_array_length(type_info);
+ array_len = 0;
if (length_arg_pos > -1) {
GIArgInfo *array_arg_info;
GITypeInfo *array_type_info;
diff --git a/libseed/seed-types.c b/libseed/seed-types.c
index ce0f4f8..8f556e6 100644
--- a/libseed/seed-types.c
+++ b/libseed/seed-types.c
@@ -963,7 +963,7 @@ seed_value_from_gi_argument_full (JSContextRef ctx,
ret = seed_value_from_binary_string (ctx, arg->v_pointer, array_len, exception);
// always free arg... what about when we do not own it...?
- g_free(arg->v_pointer);
+ //g_free(arg->v_pointer);
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]