GVariantTypeInfo tweaks

1) always emit ending type FIXED for fixed sized items

    The serialiser needs to know if it dealing with a fixed sized item
    in case the serialised data is corrupt and the item has the wrong
    size.

  2) add a macro that will be used by test cases to check that all
     memory has been freed.
This commit is contained in:
Ryan Lortie 2010-02-04 09:04:32 -05:00
parent cb7dfdc194
commit 6d6d7a8bb2

View File

@ -362,10 +362,10 @@ tuple_allocate_members (const GVariantType *type,
member->type_info = g_variant_type_info_get (item_type);
item_type = g_variant_type_next (item_type);
if (item_type == NULL)
member->ending_type = G_VARIANT_MEMBER_ENDING_LAST;
else if (member->type_info->fixed_size)
if (member->type_info->fixed_size)
member->ending_type = G_VARIANT_MEMBER_ENDING_FIXED;
else if (item_type == NULL)
member->ending_type = G_VARIANT_MEMBER_ENDING_LAST;
else
member->ending_type = G_VARIANT_MEMBER_ENDING_OFFSET;
}
@ -848,3 +848,7 @@ g_variant_type_info_unref (GVariantTypeInfo *info)
}
}
}
/* used from the test cases */
#define assert_no_type_infos() \
g_assert_cmpint (g_hash_table_size (g_variant_type_info_table), ==, 0)