GVariant: avoid byteswapping in some cases
authorRyan Lortie <desrt@desrt.ca>
Mon, 4 Oct 2010 02:39:47 +0000 (22:39 -0400)
committerRyan Lortie <desrt@desrt.ca>
Mon, 4 Oct 2010 02:55:39 +0000 (22:55 -0400)
commit2ce2d587edbeb98b355c4038c218d75a8c8f9c99
tree344fe79685ceb0c2f3358c69395a2a2d2ffcadf7
parent63adeda0861a26b38ec0adc76255666554c18951
GVariant: avoid byteswapping in some cases

Make g_variant_byteswap() merely return a new reference on the given
value in the event that we know that byteswapping will have no effect
(ie: types which have no alignment requirement).

This fixes a somewhat complicated interaction between GVariant,
GSettings and GVDB on big endian machines:  GSettings assumes that it
can unref values returned from GVDB without losing access to the
underlying data.  This only works if the underlying data is in the
mapped file -- not a freshly-allocated buffer that GVariant byteswapped
into.
glib/gvariant.c