* [PATCH] Fix dict_append_array to accept types other than string
@ 2010-09-10 11:50 Luiz Augusto von Dentz
2010-09-10 11:58 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2010-09-10 11:50 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
---
src/dbus-common.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/dbus-common.c b/src/dbus-common.c
index 0484450..5e4813c 100644
--- a/src/dbus-common.c
+++ b/src/dbus-common.c
@@ -210,8 +210,6 @@ static void append_array_variant(DBusMessageIter *iter, int type, void *val,
DBusMessageIter variant, array;
char type_sig[2] = { type, '\0' };
char array_sig[3] = { DBUS_TYPE_ARRAY, type, '\0' };
- const char ***str_array = val;
- int i;
dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
array_sig, &variant);
@@ -219,9 +217,17 @@ static void append_array_variant(DBusMessageIter *iter, int type, void *val,
dbus_message_iter_open_container(&variant, DBUS_TYPE_ARRAY,
type_sig, &array);
- for (i = 0; i < n_elements; i++)
- dbus_message_iter_append_basic(&array, type,
- &((*str_array)[i]));
+ if (dbus_type_is_fixed(type) == TRUE) {
+ dbus_message_iter_append_fixed_array(&array, type, val,
+ n_elements);
+ } else if (type == DBUS_TYPE_STRING || type == DBUS_TYPE_OBJECT_PATH) {
+ const char ***str_array = (const char ***) val;
+ int i;
+
+ for (i = 0; i < n_elements; i++)
+ dbus_message_iter_append_basic(&array, type,
+ &((*str_array)[i]));
+ }
dbus_message_iter_close_container(&variant, &array);
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix dict_append_array to accept types other than string
2010-09-10 11:50 [PATCH] Fix dict_append_array to accept types other than string Luiz Augusto von Dentz
@ 2010-09-10 11:58 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2010-09-10 11:58 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Fri, Sep 10, 2010, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
>
> ---
> src/dbus-common.c | 16 +++++++++++-----
> 1 files changed, 11 insertions(+), 5 deletions(-)
The patch is now upstream, with the following minor change that I did
for you:
> + const char ***str_array = (const char ***) val;
Since val is void * there's no need to do the type cast (the original
code didn't do it either).
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-10 11:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-10 11:50 [PATCH] Fix dict_append_array to accept types other than string Luiz Augusto von Dentz
2010-09-10 11:58 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).