[gnome-builder] jsonrpc: allow extracting an iter for a vardict
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] jsonrpc: allow extracting an iter for a vardict
- Date: Thu, 30 Mar 2017 02:30:25 +0000 (UTC)
commit b33a6336e56540f9c47335e7b943747f4f2d79f5
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 29 20:28:53 2017 -0600
jsonrpc: allow extracting an iter for a vardict
contrib/jsonrpc-glib/jsonrpc-message.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/contrib/jsonrpc-glib/jsonrpc-message.c b/contrib/jsonrpc-glib/jsonrpc-message.c
index 7f37cd9..15d029b 100644
--- a/contrib/jsonrpc-glib/jsonrpc-message.c
+++ b/contrib/jsonrpc-glib/jsonrpc-message.c
@@ -289,6 +289,7 @@ jsonrpc_message_parse_object (GVariantDict *dict,
else if (valptr->magic.bytes[0] == '[' || IS_GET_ITER (valptr))
{
g_autoptr(GVariantIter) subiter = NULL;
+ g_autoptr(GVariant) subvalue = NULL;
if (g_variant_dict_lookup (dict, key, "av", &subiter))
{
@@ -300,6 +301,11 @@ jsonrpc_message_parse_object (GVariantDict *dict,
ret = jsonrpc_message_parse_array_va (subiter, param, args);
}
}
+ else if (NULL != (subvalue = g_variant_dict_lookup_value (dict, key, G_VARIANT_TYPE ("a{sv}"))))
+ {
+ if (IS_GET_ITER (valptr) && NULL != (subiter = g_variant_iter_new (subvalue)))
+ ret = !!(*((JsonrpcMessageGetIter *)valptr)->iterptr = g_steal_pointer (&subiter));
+ }
}
else if (IS_GET_VARIANT (valptr))
ret = !!(*((JsonrpcMessageGetVariant *)valptr)->variantptr = g_variant_dict_lookup_value (dict, key,
NULL));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]