get_data


Description:

public void* get_data ()

Returns a pointer to the serialised form of a Variant instance.

The returned data may not be in fully-normalised form if read from an untrusted source. The returned data must not be freed; it remains valid for as long as this exists.

If this is a fixed-sized value that was deserialised from a corrupted serialised container then null may be returned. In this case, the proper thing to do is typically to use the appropriate number of nul bytes in place of this. If this is not fixed-sized then null is never returned.

In the case that this is already in serialised form, this function is O(1). If the value is not already in serialised form, serialisation occurs implicitly and is approximately O(n) in the size of the result.

To deserialise the data returned by this function, in addition to the serialised data, you must know the type of the Variant, and (if the machine might be different) the endianness of the machine that stored it. As a result, file formats or network messages that incorporate serialised Variant s must include this information either implicitly (for instance "the file always contains a g_variant_type_variant and it is always in little-endian order") or explicitly (by storing the type and/or endianness in addition to the serialised data).

Parameters:

this

a Variant instance

Returns:

the serialised form of this, or null