- GVariant *item;
- item = parse_value_from_blob (buf,
- element_type,
- TRUE,
- indent + 2,
- NULL);
- g_assert (item == NULL);
+ gconstpointer array_data;
+
+ if (array_len % fixed_size != 0)
+ {
+ g_set_error (&local_error,
+ G_IO_ERROR,
+ G_IO_ERROR_INVALID_ARGUMENT,
+ _("Encountered array of type 'a%c', expected to have a length a multiple "
+ "of %u bytes, but found to be %u bytes in length"),
+ g_variant_type_peek_string (element_type)[0], fixed_size, array_len);
+ goto fail;
+ }
+
+ ensure_input_padding (buf, fixed_size);
+ array_data = read_bytes (buf, array_len, &local_error);
+ if (array_data == NULL)
+ goto fail;
+
+ ret = g_variant_new_fixed_array (element_type, array_data, array_len / fixed_size, fixed_size);
+
+ if (g_memory_buffer_is_byteswapped (buf))
+ {
+ GVariant *tmp = g_variant_ref_sink (ret);
+ ret = g_variant_byteswap (tmp);
+ g_variant_unref (tmp);
+ }