From c148dfd50aef1b3f8142238a0bf88f20e95700a9 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Mon, 14 May 2012 21:02:51 -0400 Subject: [PATCH] uobject: Add support for decoding boolean properties. Boolean properties have an encoded length of zero, but we were failing spuriously due to an excessively broad error check. Other than that, we have already done all the necessary decoding for boolean properties, so just wire up the appropriate GObject calls to make it happen. --- src/uobject/uobject.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/uobject/uobject.c b/src/uobject/uobject.c index 1a3d740..fa93ec0 100644 --- a/src/uobject/uobject.c +++ b/src/uobject/uobject.c @@ -174,7 +174,7 @@ decode_prop_header(struct upkg *upkg, struct prop_head *head, } rc = decode_tag_size(&head->size, tag_size, buf+len, n-len); - if (head->size == 0) + if (rc == 0 && head->size == 0) return 0; len += rc; @@ -239,6 +239,11 @@ static unsigned long deserialize_property(UObject *uo, struct prop_head *head) g_value_set_ulong(&val, unpack_32_le(priv->buf+len)); g_object_set_property(G_OBJECT(uo), head->prop_name, &val); break; + case PROPERTY_BOOLEAN: + g_value_init(&val, G_TYPE_BOOLEAN); + g_value_set_boolean(&val, head->tag_msb); + g_object_set_property(G_OBJECT(uo), head->prop_name, &val); + break; case PROPERTY_OBJECT: rc = decode_object_property(uo, &val, len); if (rc != 0) -- 2.43.2