GVariant: fix normal-form checking for tuples
GVariant: fix normal-form checking for tuples

GVariant has the concept of fixed-sized types (ie: types for which all
values of the type will have the same size).  Examples are booleans,
integers, doubles, etc.  Tuples containing only these types are also
fixed size.

When GVariant is trying to deal with a fixed-sized value for which it
doesn't have a sufficient backing store (eg: the case where a
fixed-sized value was created with g_variant_new_data() with an
incorrect number of bytes) it denotes this by setting the size of the
value to the correct fixed size but using a NULL data pointer.

This is well-documented in several code comments and also in the public
API documentation for g_variant_get_data() which describes the situation
number which NULL could be returned.

The decision to deal with this case in this way was changed at the last
minute around the time that GVariant was merged -- originally we had an
elaborate setup involving allocating an internal buffer of sufficient
size to be shared between all invalid values.

Unfortunately, when making this change a small detail was missed.
gvs_tuple_get_child() (the function responsible for deserialising
tuples) was updated to properly check for this case (and it contains a
comment about why it must).  gvs_tuple_is_normal() (the function
responsible for verifying if a tuple is in normal form) was not.

We add the check now.

Note that this problem does not exist with any other container type
because tuples are the only container capable of being fixed-sized.  All
other container types (arrays, maybes, variants) can contain a variable
number of items or items of variable types (note: we consider dictionary
entries to be two-tuples).  The code for validating non-container values
also contains a check for the case of NULL data.

The problem also does not occur in the only other function dealing with
serialised tuples: gvs_tuple_n_children().  Whereas other container
types would have to inspect the serialised data to determine the number
of children, for tuples it can be determined directly from the type.

gale320/glib,MathieuDuponchelle/glib,Distrotech/glib,ieei/glib,endlessm/glib,endlessm/glib,cention-sany/glib,djdeath/glib,MathieuDuponchelle/glib,tchakabam/glib,gale320/glib,tamaskenez/glib,krichter722/glib,tamaskenez/glib,johne53/MB3Glib,cosimoc/glib,johne53/MB3Glib,cention-sany/glib,tamaskenez/glib,johne53/MB3Glib,MathieuDuponchelle/glib,ieei/glib,ieei/glib,endlessm/glib,tchakabam/glib,tchakabam/glib,djdeath/glib,mzabaluev/glib,cention-sany/glib,djdeath/glib,MathieuDuponchelle/glib,johne53/MB3Glib,cosimoc/glib,krichter722/glib,endlessm/glib,Distrotech/glib,johne53/MB3Glib,krichter722/glib,mzabaluev/glib,Distrotech/glib,krichter722/glib,ieei/glib,gale320/glib,cention-sany/glib,cosimoc/glib,lukasz-skalski/glib,mzabaluev/glib,cention-sany/glib,gale320/glib,krichter722/glib,lukasz-skalski/glib,tamaskenez/glib,Distrotech/glib,mzabaluev/glib,Distrotech/glib,djdeath/glib,tchakabam/glib,mzabaluev/glib,cosimoc/glib,MathieuDuponchelle/glib,endlessm/glib,lukasz-skalski/glib,lukasz-skalski/glib,tchakabam/glib,johne53/MB3Glib,ieei/glib,djdeath/glib,tamaskenez/glib,gale320/glib,cosimoc/glib,lukasz-skalski/glib