mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 07:56:17 +01:00
GVariant: create child instance from its own data
also: white-space fix in the serialiser
This commit is contained in:
parent
7fb9d536c0
commit
b899bfc741
@ -800,17 +800,21 @@ g_variant_get_child_value (GVariant *value,
|
||||
};
|
||||
GVariantSerialised s_child;
|
||||
|
||||
/* get the serialiser to extract the serialised data for the child
|
||||
* from the serialised data for the container
|
||||
*/
|
||||
s_child = g_variant_serialised_get_child (serialised, index_);
|
||||
|
||||
/* create a new serialised instance out of it */
|
||||
child = g_slice_new (GVariant);
|
||||
child->type_info = s_child.type_info;
|
||||
child->state = (value->state & STATE_TRUSTED) |
|
||||
STATE_SERIALISED;
|
||||
child->size = serialised.size;
|
||||
child->size = s_child.size;
|
||||
child->ref_count = 1;
|
||||
child->contents.serialised.buffer =
|
||||
g_buffer_ref (value->contents.serialised.buffer);
|
||||
child->contents.serialised.data = serialised.data;
|
||||
child->contents.serialised.data = s_child.data;
|
||||
}
|
||||
else
|
||||
child = g_variant_ref (value->contents.tree.children[index_]);
|
||||
|
@ -1114,7 +1114,6 @@ gvs_variant_get_child (GVariantSerialised value,
|
||||
/* NOTE: not O(1) and impossible for it to be... */
|
||||
if (value.size)
|
||||
{
|
||||
|
||||
/* find '\0' character */
|
||||
for (child.size = value.size - 1; child.size; child.size--)
|
||||
if (value.data[child.size] == '\0')
|
||||
|
Loading…
Reference in New Issue
Block a user